diff options
Diffstat (limited to 'bpmn/MSOCommonBPMN/src/main')
292 files changed, 31670 insertions, 44730 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/AaiUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy index 5a4b25dca9..0bd54ffe64 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/AaiUtil.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy @@ -1,667 +1,643 @@ -/*-
- * ============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.common.scripts
-import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor;
-import org.openecomp.mso.rest.APIResponse;
-import org.openecomp.mso.rest.RESTClient
-import org.openecomp.mso.rest.RESTConfig
-
-class AaiUtil {
-
- public MsoUtils utils = new MsoUtils()
- public static final String AAI_NAMESPACE_STRING_KEY = 'URN_mso_workflow_global_default_aai_namespace'
- public static final String DEFAULT_VERSION_KEY = 'URN_mso_workflow_global_default_aai_version'
-
- private String aaiNamespace = null;
-
- private AbstractServiceTaskProcessor taskProcessor
-
- public AaiUtil(AbstractServiceTaskProcessor taskProcessor) {
- this.taskProcessor = taskProcessor
- }
-
- public String getNetworkGenericVnfEndpoint(DelegateExecution execution) {
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- String endpoint = execution.getVariable("URN_aai_endpoint")
- def uri = getNetworkGenericVnfUri(execution)
- taskProcessor.logDebug('AaiUtil.getNetworkGenericVnfEndpoint() - AAI endpoint: ' + endpoint + uri, isDebugLogEnabled)
- return endpoint + uri
- }
-
- public String getNetworkGenericVnfUri(DelegateExecution execution) {
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- def uri = getUri(execution, 'generic_vnf')
- taskProcessor.logDebug('AaiUtil.getNetworkGenericVnfUri() - AAI URI: ' + uri, isDebugLogEnabled)
- return uri
- }
-
- public String getNetworkVpnBindingUri(DelegateExecution execution) {
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- def uri = getUri(execution, 'vpn_binding')
- taskProcessor.logDebug('AaiUtil.getNetworkVpnBindingUri() - AAI URI: ' + uri, isDebugLogEnabled)
- return uri
- }
-
- public String getNetworkPolicyUri(DelegateExecution execution) {
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- def uri = getUri(execution, 'network_policy')
- taskProcessor.logDebug('AaiUtil.getNetworkPolicyUri() - AAI URI: ' + uri, isDebugLogEnabled)
- return uri
- }
-
- public String getNetworkTableReferencesUri(DelegateExecution execution) {
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- def uri = getUri(execution, 'route_table_reference')
- taskProcessor.logDebug('AaiUtil.getNetworkTableReferencesUri() - AAI URI: ' + uri, isDebugLogEnabled)
- return uri
- }
-
- public String getNetworkVceUri(DelegateExecution execution) {
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- def uri = getUri(execution, 'vce')
- taskProcessor.logDebug('AaiUtil.getNetworkVceUri() - AAI URI: ' + uri, isDebugLogEnabled)
- return uri
- }
-
- public String getNetworkL3NetworkUri(DelegateExecution execution) {
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- def uri = getUri(execution, 'l3_network')
- taskProcessor.logDebug('AaiUtil.getNetworkL3NetworkUri() - AAI URI: ' + uri, isDebugLogEnabled)
- return uri
- }
-
- public String getBusinessCustomerUri(DelegateExecution execution) {
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- def uri = getUri(execution, 'customer')
- taskProcessor.logDebug('AaiUtil.getBusinessCustomerUri() - AAI URI: ' + uri, isDebugLogEnabled)
- return uri
- }
-
- //public String getBusinessCustomerUriv7(DelegateExecution execution) {
- // def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- // //def uri = getUri(execution, BUSINESS_CUSTOMERV7)
- // def uri = getUri(execution, 'Customer')
- // taskProcessor.logDebug('AaiUtil.getBusinessCustomerUriv7() - AAI URI: ' + uri, isDebugLogEnabled)
- // return uri
- //}
-
- public String getCloudInfrastructureCloudRegionEndpoint(DelegateExecution execution) {
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- String endpoint = execution.getVariable("URN_aai_endpoint")
- def uri = getCloudInfrastructureCloudRegionUri(execution)
- taskProcessor.logDebug('AaiUtil.getCloudInfrastructureCloudRegionEndpoint() - AAI endpoint: ' + endpoint + uri, isDebugLogEnabled)
- return endpoint + uri
- }
-
- public String getCloudInfrastructureCloudRegionUri(DelegateExecution execution) {
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- def uri = getUri(execution, 'cloud_region')
- taskProcessor.logDebug('AaiUtil.getCloudInfrastructureCloudRegionUri() - AAI URI: ' + uri, isDebugLogEnabled)
- return uri
- }
-
- public String getCloudInfrastructureTenantUri(DelegateExecution execution) {
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- def uri = getUri(execution, 'tenant')
- taskProcessor.logDebug('AaiUtil.getCloudInfrastructureTenantUri() - AAI URI: ' + uri, isDebugLogEnabled)
- return uri
- }
-
- public String getSearchNodesQueryUri(DelegateExecution execution) {
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- def uri = getUri(execution, 'nodes_query')
- taskProcessor.logDebug('AaiUtil.getSearchNodesQueryUri() - AAI URI: ' + uri, isDebugLogEnabled)
- return uri
- }
-
- public String getSearchNodesQueryEndpoint(DelegateExecution execution) {
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- String endpoint = execution.getVariable("URN_aai_endpoint")
- def uri = getSearchNodesQueryUri(execution)
- taskProcessor.logDebug('AaiUtil.getSearchNodesQueryEndpoint() - AAI endpoint: ' + endpoint + uri, isDebugLogEnabled)
- return endpoint + uri
- }
-
- public String getSearchGenericQueryUri(DelegateExecution execution) {
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- def uri = getUri(execution, 'generic_query')
- taskProcessor.logDebug('AaiUtil.getSearchGenericQueryUri() - AAI URI: ' + uri, isDebugLogEnabled)
- return uri
- }
-
- public String getVersion(DelegateExecution execution, resourceName, processKey) {
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
-
- resourceName = resourceName.replaceAll('-', '_')
-
- def versionWithResourceKey = "URN_mso_workflow_default_aai_${resourceName}_version"
- def versionWithProcessKey = "URN_mso_workflow_custom_${processKey}_aai_version"
-
- def version = execution.getVariable(versionWithProcessKey)
- if (version) {
- taskProcessor.logDebug("AaiUtil.getVersion() - using flow specific ${versionWithProcessKey}=${version}", isDebugLogEnabled)
- return version
- }
-
- version = execution.getVariable(versionWithResourceKey)
- if (version) {
- taskProcessor.logDebug("AaiUtil.getVersion() - using resource specific ${versionWithResourceKey}=${version}", isDebugLogEnabled)
- return version
- }
-
- version = execution.getVariable(DEFAULT_VERSION_KEY)
- if (version) {
- taskProcessor.logDebug("AaiUtil.getVersion() - using default version ${DEFAULT_VERSION_KEY}=${version}", isDebugLogEnabled)
- return version
- }
-
- (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, "Internal Error: One of the following should be defined in MSO URN properties file: ${versionWithResourceKey}, ${versionWithProcessKey}, ${DEFAULT_VERSION_KEY}")
- }
-
- public String getUri(DelegateExecution execution, resourceName) {
-
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- def processKey = taskProcessor.getMainProcessKey(execution)
- resourceName = resourceName.replaceAll('-', '_')
-
- //set namespace
- setNamespace(execution)
-
- // Check for flow+resource specific first
- def key = "URN_mso_workflow_${processKey}_aai_${resourceName}_uri"
- def uri = execution.getVariable(key)
- if(uri) {
- taskProcessor.logDebug("AaiUtil.getUri() - using flow+resource specific key: ${key}=${uri}", isDebugLogEnabled)
- return uri
- }
-
- // Check for versioned key
- def version = getVersion(execution, resourceName, processKey)
- key = "URN_mso_workflow_default_aai_v${version}_${resourceName}_uri"
- uri = execution.getVariable(key)
-
- if(uri) {
- taskProcessor.logDebug("AaiUtil.getUri() - using versioned URI key: ${key}=${uri}", isDebugLogEnabled)
- return uri
- }
-
- (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, 'Internal Error: AAI URI entry for ' + key + ' not defined in the MSO URN properties file')
- }
-
- public String setNamespace(DelegateExecution execution) {
- def key = AAI_NAMESPACE_STRING_KEY
- aaiNamespace = execution.getVariable(key)
- if (aaiNamespace == null ) {
- (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, 'Internal Error: AAI URI entry for ' + key + ' not defined in the MSO URN properties file')
- }
- }
-
- /**
- * This method can be used for getting the building namespace out of uri.
- * NOTE: A getUri() method needs to be invoked first.
- * Alternative method is the getNamespaceFromUri(DelegateExecution execution, String uri)
- * return namespace (plus version from uri)
- *
- * @param url
- *
- * @return namespace
- */
-
- public String getNamespaceFromUri(String uri) {
- if (aaiNamespace == null) {
- throw new Exception('Internal Error: AAI Namespace has not been set yet. A getUri() method needs to be invoked first.')
- }
- String namespace = aaiNamespace
- if(uri!=null){
- String version = getVersionFromUri(uri)
- return namespace + "v"+version
- }else{
- return namespace
- }
- }
-
- /**
- * This method can be used for building namespace with aai version out of uri.
- * NOTE: 2 arguments: DelegateExecution execution & String uri
- * @param execution
- * @param url
- *
- * @return namespace
- */
- public String getNamespaceFromUri(DelegateExecution execution, String uri) {
- String namespace = execution.getVariable(AAI_NAMESPACE_STRING_KEY)
- if (namespace == null ) {
- (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, 'Internal Error: AAI URI entry for ' + AAI_NAMESPACE_STRING_KEY + ' not defined in the MSO URN properties file')
- }
- if(uri!=null){
- String version = getVersionFromUri(uri)
- return namespace + "v"+version
- }else{
- return namespace
- }
- }
-
- /**
- * This is used to extract the version from uri.
- *
- * @param uri
- *
- * @return version
- */
- private String getVersionFromUri(String uri) {
- def version = ""
- def savedVersion = ""
- for (int x=2; x<6; x++) {
- version = uri.substring(uri.indexOf("v")+1, uri.indexOf("v")+x)
- if (!Character.isDigit(version.charAt(version.size()-1))) {
- break
- }
- savedVersion = version
- }
- return savedVersion
- }
-
-
- /**
- * This reusable method can be used for making AAI Get Calls. The url should
- * be passed as a parameter along with the execution. The method will
- * return an APIResponse.
- *
- * @param execution
- * @param url
- *
- * @return APIResponse
- *
- */
- public APIResponse executeAAIGetCall(DelegateExecution execution, String url){
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- taskProcessor.logDebug(" ======== STARTED Execute AAI Get Process ======== ", isDebugEnabled)
- APIResponse apiResponse = null
- try{
- String uuid = utils.getRequestID()
- taskProcessor.logDebug( "Generated uuid is: " + uuid, isDebugEnabled)
- taskProcessor.logDebug( "URL to be used is: " + url, isDebugEnabled)
-
- String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey"))
-
- RESTConfig config = new RESTConfig(url);
- RESTClient client = new RESTClient(config).addHeader("X-FromAppId", "MSO").addHeader("X-TransactionId", uuid).addHeader("Accept","application/xml");
-
- if (basicAuthCred != null && !"".equals(basicAuthCred)) {
- client.addAuthorizationHeader(basicAuthCred)
- }
- apiResponse = client.get()
-
- taskProcessor.logDebug( "======== COMPLETED Execute AAI Get Process ======== ", isDebugEnabled)
- }catch(Exception e){
- taskProcessor.logDebug("Exception occured while executing AAI Get Call. Exception is: \n" + e, isDebugEnabled)
- (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, e.getMessage())
- }
- return apiResponse
- }
-
-
- /**
- * This reusable method can be used for making AAI httpPut Calls. The url should
- * be passed as a parameter along with the execution and payload. The method will
- * return an APIResponse.
- *
- * @param execution
- * @param url
- * @param payload
- *
- * @return APIResponse
- *
- */
- public APIResponse executeAAIPutCall(DelegateExecution execution, String url, String payload){
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- taskProcessor.logDebug( " ======== Started Execute AAI Put Process ======== ", isDebugEnabled)
- APIResponse apiResponse = null
- try{
- String uuid = utils.getRequestID()
- taskProcessor.logDebug( "Generated uuid is: " + uuid, isDebugEnabled)
- taskProcessor.logDebug( "URL to be used is: " + url, isDebugEnabled)
-
- String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey"))
-
- RESTConfig config = new RESTConfig(url);
- RESTClient client = new RESTClient(config).addHeader("X-FromAppId", "MSO").addHeader("X-TransactionId", uuid).addHeader("Content-Type", "application/xml").addHeader("Accept","application/xml");
- if (basicAuthCred != null && !"".equals(basicAuthCred)) {
- client.addAuthorizationHeader(basicAuthCred)
- }
- apiResponse = client.httpPut(payload)
-
- taskProcessor.logDebug( "======== Completed Execute AAI Put Process ======== ", isDebugEnabled)
- }catch(Exception e){
- taskProcessor.utils.log("ERROR", "Exception occured while executing AAI Put Call. Exception is: \n" + e, isDebugEnabled)
- (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, e.getMessage())
- }
- return apiResponse
- }
-
- /**
- * This reusable method can be used for making AAI httpPatch Calls. The url should
- * be passed as a parameter along with the execution and payload. The method will
- * return an APIResponse.
- *
- * @param execution
- * @param url
- * @param payload
- *
- * @return APIResponse
- *
- */
- public APIResponse executeAAIPatchCall(DelegateExecution execution, String url, String payload){
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- taskProcessor.logDebug( " ======== Started Execute AAI Patch Process ======== ", isDebugEnabled)
- APIResponse apiResponse = null
- try{
- String uuid = utils.getRequestID()
- taskProcessor.logDebug( "Generated uuid is: " + uuid, isDebugEnabled)
-
- taskProcessor.logDebug( "URL to be used is: " + url, isDebugEnabled)
-
- String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey"))
-
- RESTConfig config = new RESTConfig(url);
- RESTClient client = new RESTClient(config).addHeader("X-FromAppId", "MSO").addHeader("X-TransactionId", uuid).addHeader("Content-Type", "application/merge-patch+json").addHeader("Accept","application/json");
- if (basicAuthCred != null && !"".equals(basicAuthCred)) {
- client.addAuthorizationHeader(basicAuthCred)
- }
- apiResponse = client.httpPatch(payload)
-
- taskProcessor.logDebug( "======== Completed Execute AAI Patch Process ======== ", isDebugEnabled)
- }catch(Exception e){
- taskProcessor.utils.log("ERROR", "Exception occured while executing AAI Patch Call. Exception is: \n" + e, isDebugEnabled)
- (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, e.getMessage())
- }
- return apiResponse
- }
-
-
- /**
- * This reusable method can be used for making AAI Delete Calls. The url should
- * be passed as a parameter along with the execution. The method will
- * return an APIResponse.
- *
- * @param execution
- * @param url
- *
- * @return APIResponse
- *
- */
- public APIResponse executeAAIDeleteCall(DelegateExecution execution, String url){
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- taskProcessor.logDebug( " ======== Started Execute AAI Delete Process ======== ", isDebugEnabled)
- APIResponse apiResponse = null
- try{
- String uuid = utils.getRequestID()
- taskProcessor.logDebug( "Generated uuid is: " + uuid, isDebugEnabled)
- taskProcessor.logDebug( "URL to be used is: " + url, isDebugEnabled)
-
- String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey"))
-
- RESTConfig config = new RESTConfig(url);
- RESTClient client = new RESTClient(config).addHeader("X-FromAppId", "MSO").addHeader("X-TransactionId", uuid).addHeader("Accept","application/xml");
- if (basicAuthCred != null && !"".equals(basicAuthCred)) {
- client.addAuthorizationHeader(basicAuthCred)
- }
- apiResponse = client.delete()
-
- taskProcessor.logDebug( "======== Completed Execute AAI Delete Process ======== ", isDebugEnabled)
- }catch(Exception e){
- taskProcessor.utils.log("ERROR", "Exception occured while executing AAI Delete Call. Exception is: \n" + e, isDebugEnabled)
- (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, e.getMessage())
- }
- return apiResponse
- }
-
- /**
- * This reusable method can be used for making AAI Delete Calls. The url should
- * be passed as a parameter along with the execution. The method will
- * return an APIResponse.
- *
- * @param execution
- * @param url
- * @param payload
- *
- * @return APIResponse
- *
- */
- public APIResponse executeAAIDeleteCall(DelegateExecution execution, String url, String payload, String authHeader){
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- taskProcessor.logDebug( " ======== Started Execute AAI Delete Process ======== ", isDebugEnabled)
- APIResponse apiResponse = null
- try{
- String uuid = utils.getRequestID()
- taskProcessor.logDebug( "Generated uuid is: " + uuid, isDebugEnabled)
-
- taskProcessor.logDebug( "URL to be used is: " + url, isDebugEnabled)
-
- String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey"))
- RESTConfig config = new RESTConfig(url);
- RESTClient client = new RESTClient(config).addHeader("X-FromAppId", "MSO").addHeader("X-TransactionId", uuid).addHeader("Accept","application/xml").addAuthorizationHeader(authHeader);
- if (basicAuthCred != null && !"".equals(basicAuthCred)) {
- client.addAuthorizationHeader(basicAuthCred)
- }
- apiResponse = client.httpDelete(payload)
-
- taskProcessor.logDebug( "======== Completed Execute AAI Delete Process ======== ", isDebugEnabled)
- }catch(Exception e){
- taskProcessor.utils.log("ERROR", "Exception occured while executing AAI Delete Call. Exception is: \n" + e, isDebugEnabled)
- (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, e.getMessage())
- }
- return apiResponse
- }
-
- /**
- * This reusable method can be used for making AAI Post Calls. The url
- * and payload should be passed as a parameters along with the execution.
- * The method will return an APIResponse.
- *
- * @param execution
- * @param url
- * @param payload
- *
- * @return APIResponse
- *
- */
- public APIResponse executeAAIPostCall(DelegateExecution execution, String url, String payload){
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- taskProcessor.logDebug( " ======== Started Execute AAI Post Process ======== ", isDebugEnabled)
- APIResponse apiResponse = null
- try{
- String uuid = utils.getRequestID()
- taskProcessor.logDebug( "Generated uuid is: " + uuid, isDebugEnabled)
- taskProcessor.logDebug( "URL to be used is: " + url, isDebugEnabled)
-
- String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey"))
- RESTConfig config = new RESTConfig(url);
- RESTClient client = new RESTClient(config).addHeader("X-FromAppId", "MSO").addHeader("X-TransactionId", uuid).addHeader("Accept","application/xml");
-
- if (basicAuthCred != null && !"".equals(basicAuthCred)) {
- client.addAuthorizationHeader(basicAuthCred)
- }
- apiResponse = client.httpPost(payload)
-
- taskProcessor.logDebug( "======== Completed Execute AAI Post Process ======== ", isDebugEnabled)
- }catch(Exception e){
- taskProcessor.utils.log("ERROR", "Exception occured while executing AAI Post Call. Exception is: \n" + e, isDebugEnabled)
- (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, e.getMessage())
- }
- return apiResponse
- }
-
- /**
- * This reusable method can be used for making AAI Post Calls. The url
- * and payload should be passed as a parameters along with the execution.
- * The method will return an APIResponse.
- *
- * @param execution
- * @param url
- * @param payload
- * @param authenticationHeader - addAuthenticationHeader value
- * @param headerName - name of header you want to add, i.e. addHeader(headerName, headerValue)
- * @param headerValue - the header's value, i.e. addHeader(headerName, headerValue)
- *
- * @return APIResponse
- *
- */
- public APIResponse executeAAIPostCall(DelegateExecution execution, String url, String payload, String authenticationHeaderValue, String headerName, String headerValue){
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- taskProcessor.logDebug( " ======== Started Execute AAI Post Process ======== ", isDebugEnabled)
- APIResponse apiResponse = null
- try{
- taskProcessor.logDebug( "URL to be used is: " + url, isDebugEnabled)
-
- String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey"))
-
- RESTConfig config = new RESTConfig(url);
- RESTClient client = new RESTClient(config).addAuthorizationHeader(authenticationHeaderValue).addHeader(headerName, headerValue)
- if (basicAuthCred != null && !"".equals(basicAuthCred)) {
- client.addAuthorizationHeader(basicAuthCred)
- }
- apiResponse = client.httpPost(payload)
-
- taskProcessor.logDebug( "======== Completed Execute AAI Post Process ======== ", isDebugEnabled)
- }catch(Exception e){
- taskProcessor.utils.log("ERROR", "Exception occured while executing AAI Post Call. Exception is: \n" + e, isDebugEnabled)
- (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, e.getMessage())
- }
- return apiResponse
- }
-
-
- /* Utility to get the Cloud Region from AAI
- * Returns String cloud region id, (ie, cloud-region-id)
- * @param execution
- * @param url - url for AAI get cloud region
- * @param backend - "PO" - real region, or "SDNC" - v2.5 (fake region).
- */
-
- public String getAAICloudReqion(DelegateExecution execution, String url, String backend, inputCloudRegion){
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- String regionId = ""
- try{
- APIResponse apiResponse = executeAAIGetCall(execution, url)
- String returnCode = apiResponse.getStatusCode()
- String aaiResponseAsString = apiResponse.getResponseBodyAsString()
- taskProcessor.utils.log("DEBUG", "Call AAI Cloud Region Return code: " + returnCode, isDebugEnabled)
- execution.setVariable(execution.getVariable("prefix")+"queryCloudRegionReturnCode", returnCode)
-
- if(returnCode == "200"){
- taskProcessor.utils.log("DEBUG", "Call AAI Cloud Region is Successful.", isDebugEnabled)
-
- String regionVersion = taskProcessor.utils.getNodeText1(aaiResponseAsString, "cloud-region-version")
- taskProcessor.utils.log("DEBUG", "Cloud Region Version from AAI for " + backend + " is: " + regionVersion, isDebugEnabled)
- if (backend == "PO") {
- regionId = taskProcessor.utils.getNodeText1(aaiResponseAsString, "cloud-region-id")
- } else { // backend not "PO"
- if (regionVersion == "2.5" ) {
- regionId = "AAIAIC25"
- } else {
- regionId = taskProcessor.utils.getNodeText1(aaiResponseAsString, "cloud-region-id")
- }
- }
- if(regionId == null){
- throw new BpmnError("MSOWorkflowException")
- }
- taskProcessor.utils.log("DEBUG", "Cloud Region Id from AAI " + backend + " is: " + regionId, isDebugEnabled)
- }else if (returnCode == "404"){ // not 200
- if (backend == "PO") {
- regionId = inputCloudRegion
- }else{ // backend not "PO"
- regionId = "AAIAIC25"
- }
- taskProcessor.utils.log("DEBUG", "Cloud Region value for code='404' of " + backend + " is: " + regionId, isDebugEnabled)
- }else{
- taskProcessor.utils.log("ERROR", "Call AAI Cloud Region is NOT Successful.", isDebugEnabled)
- throw new BpmnError("MSOWorkflowException")
- }
- }catch(Exception e) {
- taskProcessor.utils.log("ERROR", "Exception occured while getting the Cloud Reqion. Exception is: \n" + e, isDebugEnabled)
- (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, e.getMessage())
- }
- return regionId
- }
-
- /* returns xml Node with service-type of searchValue */
- def searchServiceType(xmlInput, searchValue){
- def fxml= new XmlSlurper().parseText(xmlInput)
- def ret = fxml.'**'.find {it.'service-type' == searchValue}
- return ret
- }
-
- /* returns xml Node with service-instance-id of searchValue */
- def searchServiceInstanceId(xmlInput, searchValue){
- def ret = xmlInput.'**'.find {it.'service-instance-id' == searchValue}
- return ret
- }
-
- /**
- * Get the lowest unused VF Module index from AAI response for a given module type. The criteria for
- * determining module type is specified by "key" parameter (for example, "persona-model-id"),
- * the value for filtering is specified in "value" parameter
- *
- * @param execution
- * @param aaiVnfResponse
- * @param key
- * @param value
- *
- * @return moduleIndex
- *
- */
- public int getLowestUnusedVfModuleIndexFromAAIVnfResponse(DelegateExecution execution, String aaiVnfResponse, String key, String value) {
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- if (aaiVnfResponse != null) {
- String vfModulesText = taskProcessor.utils.getNodeXml(aaiVnfResponse, "vf-modules")
- if (vfModulesText == null || vfModulesText.isEmpty()) {
- taskProcessor.utils.log("DEBUG", "There are no VF modules in this VNF yet", isDebugEnabled)
- return 0
- }
- else {
- def xmlVfModules= new XmlSlurper().parseText(vfModulesText)
- def vfModules = xmlVfModules.'**'.findAll {it.name() == "vf-module"}
- int vfModulesSize = 0
- if (vfModules != null) {
- vfModulesSize = vfModules.size()
- }
- String matchingVfModules = "<vfModules>"
- for (i in 0..vfModulesSize-1) {
- def vfModuleXml = groovy.xml.XmlUtil.serialize(vfModules[i])
- def keyFromAAI = taskProcessor.utils.getNodeText(vfModuleXml, key)
- if (keyFromAAI != null && keyFromAAI.equals(value)) {
- matchingVfModules = matchingVfModules + taskProcessor.utils.removeXmlPreamble(vfModuleXml)
- }
- }
- matchingVfModules = matchingVfModules + "</vfModules>"
- taskProcessor.utils.log("DEBUG", "Matching VF Modules: " + matchingVfModules, isDebugEnabled)
- String lowestUnusedIndex = taskProcessor.utils.getLowestUnusedIndex(matchingVfModules)
- return Integer.parseInt(lowestUnusedIndex)
- }
- }
- else {
- return 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.onap.so.bpmn.common.scripts +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.core.UrnPropertiesReader; +import org.onap.so.rest.APIResponse; +import org.onap.so.rest.RESTClient +import org.onap.so.rest.RESTConfig +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + + + +class AaiUtil { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, AaiUtil.class); + + + public MsoUtils utils = new MsoUtils() + public static final String AAI_NAMESPACE_STRING_KEY = 'mso.workflow.global.default.aai.namespace' + public static final String DEFAULT_VERSION_KEY = 'mso.workflow.global.default.aai.version' + + private String aaiNamespace = null; + + private AbstractServiceTaskProcessor taskProcessor + + public AaiUtil(AbstractServiceTaskProcessor taskProcessor) { + this.taskProcessor = taskProcessor + } + + public String getNetworkGenericVnfEndpoint(DelegateExecution execution) { + String endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + def uri = getNetworkGenericVnfUri(execution) + msoLogger.debug('AaiUtil.getNetworkGenericVnfEndpoint() - AAI endpoint: ' + endpoint + uri) + return endpoint + uri + } + + public String getNetworkGenericVnfUri(DelegateExecution execution) { + def uri = getUri(execution, 'generic-vnf') + msoLogger.debug('AaiUtil.getNetworkGenericVnfUri() - AAI URI: ' + uri) + return uri + } + + public String getNetworkVpnBindingUri(DelegateExecution execution) { + def uri = getUri(execution, 'vpn-binding') + msoLogger.debug('AaiUtil.getNetworkVpnBindingUri() - AAI URI: ' + uri) + return uri + } + + public String getNetworkPolicyUri(DelegateExecution execution) { + def uri = getUri(execution, 'network-policy') + msoLogger.debug('AaiUtil.getNetworkPolicyUri() - AAI URI: ' + uri) + return uri + } + + public String getNetworkTableReferencesUri(DelegateExecution execution) { + def uri = getUri(execution, 'route-table-reference') + msoLogger.debug('AaiUtil.getNetworkTableReferencesUri() - AAI URI: ' + uri) + return uri + } + + public String getNetworkVceUri(DelegateExecution execution) { + def uri = getUri(execution, 'vce') + msoLogger.debug('AaiUtil.getNetworkVceUri() - AAI URI: ' + uri) + return uri + } + + public String getNetworkL3NetworkUri(DelegateExecution execution) { + def uri = getUri(execution, 'l3-network') + msoLogger.debug('AaiUtil.getNetworkL3NetworkUri() - AAI URI: ' + uri) + return uri + } + + public String getBusinessCustomerUri(DelegateExecution execution) { + def uri = getUri(execution, 'customer') + msoLogger.debug('AaiUtil.getBusinessCustomerUri() - AAI URI: ' + uri) + return uri + } + + //public String getBusinessCustomerUriv7(DelegateExecution execution) { + // // //def uri = getUri(execution, BUSINESS_CUSTOMERV7) + // def uri = getUri(execution, 'Customer') + // msoLogger.debug('AaiUtil.getBusinessCustomerUriv7() - AAI URI: ' + uri) + // return uri + //} + + public String getCloudInfrastructureCloudRegionEndpoint(DelegateExecution execution) { + String endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + def uri = getCloudInfrastructureCloudRegionUri(execution) + msoLogger.debug('AaiUtil.getCloudInfrastructureCloudRegionEndpoint() - AAI endpoint: ' + endpoint + uri) + return endpoint + uri + } + + public String getCloudInfrastructureCloudRegionUri(DelegateExecution execution) { + def uri = getUri(execution, 'cloud-region') + msoLogger.debug('AaiUtil.getCloudInfrastructureCloudRegionUri() - AAI URI: ' + uri) + return uri + } + + public String getCloudInfrastructureTenantUri(DelegateExecution execution) { + def uri = getUri(execution, 'tenant') + msoLogger.debug('AaiUtil.getCloudInfrastructureTenantUri() - AAI URI: ' + uri) + return uri + } + + public String getSearchNodesQueryUri(DelegateExecution execution) { + def uri = getUri(execution, 'nodes-query') + msoLogger.debug('AaiUtil.getSearchNodesQueryUri() - AAI URI: ' + uri) + return uri + } + + public String getSearchNodesQueryEndpoint(DelegateExecution execution) { + String endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + def uri = getSearchNodesQueryUri(execution) + msoLogger.debug('AaiUtil.getSearchNodesQueryEndpoint() - AAI endpoint: ' + endpoint + uri) + return endpoint + uri + } + + public String getSearchGenericQueryUri(DelegateExecution execution) { + def uri = getUri(execution, 'generic-query') + msoLogger.debug('AaiUtil.getSearchGenericQueryUri() - AAI URI: ' + uri) + return uri + } + + public String getVersion(DelegateExecution execution, resourceName, processKey) { + def versionWithResourceKey = "mso.workflow.default.aai.${resourceName}.version" + def versionWithProcessKey = "mso.workflow.custom.${processKey}.aai.version" + + def version = UrnPropertiesReader.getVariable(versionWithProcessKey, execution) + if (version) { + msoLogger.debug("AaiUtil.getVersion() - using flow specific ${versionWithProcessKey}=${version}") + return version + } + + version = UrnPropertiesReader.getVariable(versionWithResourceKey, execution) + if (version) { + msoLogger.debug("AaiUtil.getVersion() - using resource specific ${versionWithResourceKey}=${version}") + return version + } + + version = UrnPropertiesReader.getVariable(DEFAULT_VERSION_KEY, execution) + if (version) { + msoLogger.debug("AaiUtil.getVersion() - using default version ${DEFAULT_VERSION_KEY}=${version}") + return version + } + + (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, "Internal Error: One of the following should be defined in MSO URN properties file: ${versionWithResourceKey}, ${versionWithProcessKey}, ${DEFAULT_VERSION_KEY}") + } + + public String getUri(DelegateExecution execution, resourceName) { + + def processKey = taskProcessor.getMainProcessKey(execution) + + //set namespace + setNamespace(execution) + + // Check for flow+resource specific first + def key = "mso.workflow.${processKey}.aai.${resourceName}.uri" + def uri = UrnPropertiesReader.getVariable(key, execution) + if(uri) { + msoLogger.debug("AaiUtil.getUri() - using flow+resource specific key: ${key}=${uri}") + return uri + } + + // Check for versioned key + def version = getVersion(execution, resourceName, processKey) + key = "mso.workflow.default.aai.v${version}.${resourceName}.uri" + uri = UrnPropertiesReader.getVariable(key, execution) + + if(uri) { + msoLogger.debug("AaiUtil.getUri() - using versioned URI key: ${key}=${uri}") + return uri + } + + (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, 'Internal Error: AAI URI entry for ' + key + ' not defined in the MSO URN properties file') + } + + public String setNamespace(DelegateExecution execution) { + def key = AAI_NAMESPACE_STRING_KEY + aaiNamespace = UrnPropertiesReader.getVariable(key, execution) + if (aaiNamespace == null ) { + (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, 'Internal Error: AAI URI entry for ' + key + ' not defined in the MSO URN properties file') + } + } + + /** + * This method can be used for getting the building namespace out of uri. + * NOTE: A getUri() method needs to be invoked first. + * Alternative method is the getNamespaceFromUri(DelegateExecution execution, String uri) + * return namespace (plus version from uri) + * + * @param url + * + * @return namespace + */ + + public String getNamespaceFromUri(String uri) { + if (aaiNamespace == null) { + throw new Exception('Internal Error: AAI Namespace has not been set yet. A getUri() method needs to be invoked first.') + } + String namespace = aaiNamespace + if(uri!=null){ + String version = getVersionFromUri(uri) + return namespace + "v"+version + }else{ + return namespace + } + } + + /** + * This method can be used for building namespace with aai version out of uri. + * NOTE: 2 arguments: DelegateExecution execution & String uri + * @param execution + * @param url + * + * @return namespace + */ + public String getNamespaceFromUri(DelegateExecution execution, String uri) { + String namespace = UrnPropertiesReader.getVariable(AAI_NAMESPACE_STRING_KEY, execution) + if (namespace == null ) { + (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, 'Internal Error: AAI URI entry for ' + AAI_NAMESPACE_STRING_KEY + ' not defined in the MSO URN properties file') + } + if(uri!=null){ + String version = getVersionFromUri(uri) + return namespace + "v"+version + }else{ + return namespace + } + } + + /** + * This is used to extract the version from uri. + * + * @param uri + * + * @return version + */ + private String getVersionFromUri(String uri) { + def version = "" + def savedVersion = "" + for (int x=2; x<6; x++) { + version = uri.substring(uri.indexOf("v")+1, uri.indexOf("v")+x) + if (!Character.isDigit(version.charAt(version.size()-1))) { + break + } + savedVersion = version + } + return savedVersion + } + + + /** + * This reusable method can be used for making AAI Get Calls. The url should + * be passed as a parameter along with the execution. The method will + * return an APIResponse. + * + * @param execution + * @param url + * + * @return APIResponse + * + */ + public APIResponse executeAAIGetCall(DelegateExecution execution, String url){ + msoLogger.trace("STARTED Execute AAI Get Process ") + APIResponse apiResponse = null + try{ + String uuid = utils.getRequestID() + msoLogger.debug("Generated uuid is: " + uuid) + msoLogger.debug("URL to be used is: " + url) + + String basicAuthCred = utils.getBasicAuth(UrnPropertiesReader.getVariable("aai.auth", execution),UrnPropertiesReader.getVariable("mso.msoKey", execution)) + + RESTConfig config = new RESTConfig(url); + RESTClient client = new RESTClient(config).addHeader("X-FromAppId", "MSO").addHeader("X-TransactionId", uuid).addHeader("Accept","application/xml"); + + if (basicAuthCred != null && !"".equals(basicAuthCred)) { + client.addAuthorizationHeader(basicAuthCred) + } + apiResponse = client.get() + + msoLogger.trace("COMPLETED Execute AAI Get Process ") + }catch(Exception e){ + msoLogger.debug("Exception occured while executing AAI Get Call. Exception is: \n" + e) + (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, e.getMessage()) + } + return apiResponse + } + + + /** + * This reusable method can be used for making AAI httpPut Calls. The url should + * be passed as a parameter along with the execution and payload. The method will + * return an APIResponse. + * + * @param execution + * @param url + * @param payload + * + * @return APIResponse + * + */ + public APIResponse executeAAIPutCall(DelegateExecution execution, String url, String payload){ + msoLogger.trace("Started Execute AAI Put Process ") + APIResponse apiResponse = null + try{ + String uuid = utils.getRequestID() + msoLogger.debug("Generated uuid is: " + uuid) + msoLogger.debug("URL to be used is: " + url) + + String basicAuthCred = utils.getBasicAuth(UrnPropertiesReader.getVariable("aai.auth", execution),UrnPropertiesReader.getVariable("mso.msoKey", execution)) + + RESTConfig config = new RESTConfig(url); + RESTClient client = new RESTClient(config).addHeader("X-FromAppId", "MSO").addHeader("X-TransactionId", uuid).addHeader("Content-Type", "application/xml").addHeader("Accept","application/xml"); + if (basicAuthCred != null && !"".equals(basicAuthCred)) { + client.addAuthorizationHeader(basicAuthCred) + } + apiResponse = client.httpPut(payload) + + msoLogger.trace("Completed Execute AAI Put Process ") + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception occured while executing AAI Put Call.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e); + (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, e.getMessage()) + } + return apiResponse + } + + /** + * This reusable method can be used for making AAI httpPatch Calls. The url should + * be passed as a parameter along with the execution and payload. The method will + * return an APIResponse. + * + * @param execution + * @param url + * @param payload + * + * @return APIResponse + * + */ + public APIResponse executeAAIPatchCall(DelegateExecution execution, String url, String payload){ + msoLogger.trace("Started Execute AAI Patch Process ") + APIResponse apiResponse = null + try{ + String uuid = utils.getRequestID() + msoLogger.debug("Generated uuid is: " + uuid) + + msoLogger.debug("URL to be used is: " + url) + + String basicAuthCred = utils.getBasicAuth(UrnPropertiesReader.getVariable("aai.auth", execution),UrnPropertiesReader.getVariable("mso.msoKey", execution)) + + RESTConfig config = new RESTConfig(url); + RESTClient client = new RESTClient(config).addHeader("X-FromAppId", "MSO").addHeader("X-TransactionId", uuid).addHeader("Content-Type", "application/merge-patch+json").addHeader("Accept","application/json"); + if (basicAuthCred != null && !"".equals(basicAuthCred)) { + client.addAuthorizationHeader(basicAuthCred) + } + apiResponse = client.httpPatch(payload) + + msoLogger.trace("Completed Execute AAI Patch Process ") + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception occured while executing AAI Patch Call.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e); + (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, e.getMessage()) + } + return apiResponse + } + + + /** + * This reusable method can be used for making AAI Delete Calls. The url should + * be passed as a parameter along with the execution. The method will + * return an APIResponse. + * + * @param execution + * @param url + * + * @return APIResponse + * + */ + public APIResponse executeAAIDeleteCall(DelegateExecution execution, String url){ + msoLogger.trace("Started Execute AAI Delete Process ") + APIResponse apiResponse = null + try{ + String uuid = utils.getRequestID() + msoLogger.debug("Generated uuid is: " + uuid) + msoLogger.debug("URL to be used is: " + url) + + String basicAuthCred = utils.getBasicAuth(UrnPropertiesReader.getVariable("aai.auth", execution),UrnPropertiesReader.getVariable("mso.msoKey", execution)) + + RESTConfig config = new RESTConfig(url); + RESTClient client = new RESTClient(config).addHeader("X-FromAppId", "MSO").addHeader("X-TransactionId", uuid).addHeader("Accept","application/xml"); + if (basicAuthCred != null && !"".equals(basicAuthCred)) { + client.addAuthorizationHeader(basicAuthCred) + } + apiResponse = client.delete() + + msoLogger.trace("Completed Execute AAI Delete Process ") + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception occured while executing AAI Delete Call.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e); + (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, e.getMessage()) + } + return apiResponse + } + + /** + * This reusable method can be used for making AAI Delete Calls. The url should + * be passed as a parameter along with the execution. The method will + * return an APIResponse. + * + * @param execution + * @param url + * @param payload + * + * @return APIResponse + * + */ + public APIResponse executeAAIDeleteCall(DelegateExecution execution, String url, String payload, String authHeader){ + msoLogger.trace("Started Execute AAI Delete Process ") + APIResponse apiResponse = null + try{ + String uuid = utils.getRequestID() + msoLogger.debug("Generated uuid is: " + uuid) + + msoLogger.debug("URL to be used is: " + url) + + String basicAuthCred = utils.getBasicAuth(UrnPropertiesReader.getVariable("aai.auth", execution),UrnPropertiesReader.getVariable("mso.msoKey", execution)) + RESTConfig config = new RESTConfig(url); + RESTClient client = new RESTClient(config).addHeader("X-FromAppId", "MSO").addHeader("X-TransactionId", uuid).addHeader("Accept","application/xml").addAuthorizationHeader(authHeader); + if (basicAuthCred != null && !"".equals(basicAuthCred)) { + client.addAuthorizationHeader(basicAuthCred) + } + apiResponse = client.httpDelete(payload) + + msoLogger.trace("Completed Execute AAI Delete Process ") + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception occured while executing AAI Delete Call.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e); + (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, e.getMessage()) + } + return apiResponse + } + + /** + * This reusable method can be used for making AAI Post Calls. The url + * and payload should be passed as a parameters along with the execution. + * The method will return an APIResponse. + * + * @param execution + * @param url + * @param payload + * + * @return APIResponse + * + */ + public APIResponse executeAAIPostCall(DelegateExecution execution, String url, String payload){ + msoLogger.trace("Started Execute AAI Post Process ") + APIResponse apiResponse = null + try{ + String uuid = utils.getRequestID() + msoLogger.debug("Generated uuid is: " + uuid) + msoLogger.debug("URL to be used is: " + url) + + String basicAuthCred = utils.getBasicAuth(UrnPropertiesReader.getVariable("aai.auth", execution),UrnPropertiesReader.getVariable("mso.msoKey", execution)) + RESTConfig config = new RESTConfig(url); + RESTClient client = new RESTClient(config).addHeader("X-FromAppId", "MSO").addHeader("X-TransactionId", uuid).addHeader("Accept","application/xml"); + + if (basicAuthCred != null && !"".equals(basicAuthCred)) { + client.addAuthorizationHeader(basicAuthCred) + } + apiResponse = client.httpPost(payload) + + msoLogger.trace("Completed Execute AAI Post Process ") + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception occured while executing AAI Post Call.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e); + (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, e.getMessage()) + } + return apiResponse + } + + /** + * This reusable method can be used for making AAI Post Calls. The url + * and payload should be passed as a parameters along with the execution. + * The method will return an APIResponse. + * + * @param execution + * @param url + * @param payload + * @param authenticationHeader - addAuthenticationHeader value + * @param headerName - name of header you want to add, i.e. addHeader(headerName, headerValue) + * @param headerValue - the header's value, i.e. addHeader(headerName, headerValue) + * + * @return APIResponse + * + */ + public APIResponse executeAAIPostCall(DelegateExecution execution, String url, String payload, String authenticationHeaderValue, String headerName, String headerValue){ + msoLogger.trace("Started Execute AAI Post Process ") + APIResponse apiResponse = null + try{ + msoLogger.debug("URL to be used is: " + url) + + String basicAuthCred = utils.getBasicAuth(UrnPropertiesReader.getVariable("aai.auth", execution),UrnPropertiesReader.getVariable("mso.msoKey", execution)) + + RESTConfig config = new RESTConfig(url); + RESTClient client = new RESTClient(config).addAuthorizationHeader(authenticationHeaderValue).addHeader(headerName, headerValue) + if (basicAuthCred != null && !"".equals(basicAuthCred)) { + client.addAuthorizationHeader(basicAuthCred) + } + apiResponse = client.httpPost(payload) + + msoLogger.trace("Completed Execute AAI Post Process ") + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception occured while executing AAI Post Call.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e); + (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, e.getMessage()) + } + return apiResponse + } + + + /* Utility to get the Cloud Region from AAI + * Returns String cloud region id, (ie, cloud-region-id) + * @param execution + * @param url - url for AAI get cloud region + * @param backend - "PO" - real region, or "SDNC" - v2.5 (fake region). + */ + + public String getAAICloudReqion(DelegateExecution execution, String url, String backend, inputCloudRegion){ + String regionId = "" + try{ + APIResponse apiResponse = executeAAIGetCall(execution, url) + String returnCode = apiResponse.getStatusCode() + String aaiResponseAsString = apiResponse.getResponseBodyAsString() + msoLogger.debug("Call AAI Cloud Region Return code: " + returnCode) + execution.setVariable(execution.getVariable("prefix")+"queryCloudRegionReturnCode", returnCode) + + if(returnCode == "200"){ + msoLogger.debug("Call AAI Cloud Region is Successful.") + + String regionVersion = taskProcessor.utils.getNodeText(aaiResponseAsString, "cloud-region-version") + msoLogger.debug("Cloud Region Version from AAI for " + backend + " is: " + regionVersion) + if (backend == "PO") { + regionId = taskProcessor.utils.getNodeText(aaiResponseAsString, "cloud-region-id") + } else { // backend not "PO" + if (regionVersion == "2.5" ) { + regionId = "AAIAIC25" + } else { + regionId = taskProcessor.utils.getNodeText(aaiResponseAsString, "cloud-region-id") + } + } + if(regionId == null){ + throw new BpmnError("MSOWorkflowException") + } + msoLogger.debug("Cloud Region Id from AAI " + backend + " is: " + regionId) + }else if (returnCode == "404"){ // not 200 + if (backend == "PO") { + regionId = inputCloudRegion + }else{ // backend not "PO" + regionId = "AAIAIC25" + } + msoLogger.debug("Cloud Region value for code='404' of " + backend + " is: " + regionId) + }else{ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Call AAI Cloud Region is NOT Successful.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + throw new BpmnError("MSOWorkflowException") + } + }catch(Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception occured while getting the Cloud Reqion.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.getMessage()); + (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, e.getMessage()) + } + return regionId + } + + /* returns xml Node with service-type of searchValue */ + def searchServiceType(xmlInput, searchValue){ + def fxml= new XmlSlurper().parseText(xmlInput) + def ret = fxml.'**'.find {it.'service-type' == searchValue} + return ret + } + + /* returns xml Node with service-instance-id of searchValue */ + def searchServiceInstanceId(xmlInput, searchValue){ + def ret = xmlInput.'**'.find {it.'service-instance-id' == searchValue} + return ret + } + + /** + * Get the lowest unused VF Module index from AAI response for a given module type. The criteria for + * determining module type is specified by "key" parameter (for example, "persona-model-id"), + * the value for filtering is specified in "value" parameter + * + * @param execution + * @param aaiVnfResponse + * @param key + * @param value + * + * @return moduleIndex + * + */ + public int getLowestUnusedVfModuleIndexFromAAIVnfResponse(DelegateExecution execution, String aaiVnfResponse, String key, String value) { + if (aaiVnfResponse != null) { + String vfModulesText = taskProcessor.utils.getNodeXml(aaiVnfResponse, "vf-modules") + if (vfModulesText == null || vfModulesText.isEmpty()) { + msoLogger.debug("There are no VF modules in this VNF yet") + return 0 + } + else { + def xmlVfModules= new XmlSlurper().parseText(vfModulesText) + def vfModules = xmlVfModules.'**'.findAll {it.name() == "vf-module"} + int vfModulesSize = 0 + if (vfModules != null) { + vfModulesSize = vfModules.size() + } + String matchingVfModules = "<vfModules>" + for (i in 0..vfModulesSize-1) { + def vfModuleXml = groovy.xml.XmlUtil.serialize(vfModules[i]) + def keyFromAAI = taskProcessor.utils.getNodeText(vfModuleXml, key) + if (keyFromAAI != null && keyFromAAI.equals(value)) { + matchingVfModules = matchingVfModules + taskProcessor.utils.removeXmlPreamble(vfModuleXml) + } + } + matchingVfModules = matchingVfModules + "</vfModules>" + msoLogger.debug("Matching VF Modules: " + matchingVfModules) + String lowestUnusedIndex = taskProcessor.utils.getLowestUnusedIndex(matchingVfModules) + return Integer.parseInt(lowestUnusedIndex) + } + } + else { + return 0 + } + } }
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy index d3f3696fcf..1e2a703e70 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy @@ -1,787 +1,768 @@ -/*-
- * ============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.common.scripts;
-
-import groovy.json.JsonSlurper
-
-import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.camunda.bpm.engine.variable.VariableMap
-import org.camunda.bpm.engine.variable.Variables
-import org.camunda.bpm.engine.variable.Variables.SerializationDataFormats
-import org.camunda.bpm.engine.variable.impl.value.ObjectValueImpl
-import org.openecomp.mso.bpmn.common.workflow.service.WorkflowCallbackResponse
-import org.openecomp.mso.bpmn.common.workflow.service.WorkflowContextHolder
-import org.openecomp.mso.bpmn.core.WorkflowException
-import org.springframework.web.util.UriUtils
-
-public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcessor {
- public MsoUtils utils = new MsoUtils()
-
-
- /**
- * Logs a message at the ERROR level.
- * @param message the message
- */
- public void logError(String message) {
- log('ERROR', message, null, "true")
- }
-
- /**
- * Logs a message at the ERROR level.
- * @param message the message
- * @param cause the cause (stracktrace will be included in the output)
- */
- public void logError(String message, Throwable cause) {
- log('ERROR', message, cause, "true")
- }
-
- /**
- * Logs a message at the WARN level.
- * @param message the message
- */
- public void logWarn(String message) {
- log('WARN', message, null, "true")
- }
-
- /**
- * Logs a message at the WARN level.
- * @param message the message
- * @param cause the cause (stracktrace will be included in the output)
- */
- public void logWarn(String message, Throwable cause) {
- log('WARN', message, cause, "true")
- }
-
- /**
- * Logs a message at the DEBUG level.
- * @param message the message
- * @param isDebugLogEnabled a flag indicating if DEBUG level is enabled
- */
- public void logDebug(String message, String isDebugLogEnabled) {
- log('DEBUG', message, null, isDebugLogEnabled)
- }
-
- /**
- * Logs a message at the DEBUG level.
- * @param message the message
- * @param cause the cause (stracktrace will be included in the output)
- * @param isDebugLogEnabled a flag indicating if DEBUG level is enabled
- */
- public void logDebug(String message, Throwable cause, String isDebugLogEnabled) {
- log('DEBUG', message, cause, isDebugLogEnabled)
- }
-
- /**
- * Logs a message at the specified level.
- * @param level the level (DEBUG, INFO, WARN, ERROR)
- * @param message the message
- * @param isLevelEnabled a flag indicating if the level is enabled
- * (used only at the DEBUG level)
- */
- public void log(String level, String message, String isLevelEnabled) {
- log(level, message, null, isLevelEnabled)
- }
-
- /**
- * Logs a message at the specified level.
- * @param level the level (DEBUG, INFO, WARN, ERROR)
- * @param message the message
- * @param cause the cause (stracktrace will be included in the output)
- * @param isLevelEnabled a flag indicating if the level is enabled
- * (used only at the DEBUG level)
- */
- public void log(String level, String message, Throwable cause, String isLevelEnabled) {
- if (cause == null) {
- utils.log(level, message, isLevelEnabled);
- } else {
- StringWriter stringWriter = new StringWriter();
- PrintWriter printWriter = new PrintWriter(stringWriter);
- printWriter.println(message);
- cause.printStackTrace(printWriter);
- utils.log(level, stringWriter.toString(), isLevelEnabled);
- printWriter.close();
- }
- }
-
- /**
- * Logs a WorkflowException at the ERROR level with the specified message.
- * @param execution the execution
- */
- public void logWorkflowException(DelegateExecution execution, String message) {
- def workflowException = execution.getVariable("WorkflowException")
-
- if (workflowException == null) {
- logError(message);
- } else {
- logError(message + ": " + workflowException)
- }
- }
-
- /**
- * Saves the WorkflowException in the execution to the specified variable,
- * clearing the WorkflowException variable so the workflow can continue
- * processing (perhaps catching another WorkflowException).
- * @param execution the execution
- * @return the name of the destination variable
- */
- public saveWorkflowException(DelegateExecution execution, String variable) {
- if (variable == null) {
- throw new NullPointerException();
- }
-
- execution.setVariable(variable, execution.getVariable("WorkflowException"))
- execution.setVariable("WorkflowException", null)
- }
-
-
- /**
- * Validates that the request exists and that the mso-request-id variable is set.
- * Additional required variables may be checked by specifying their names.
- * NOTE: services requiring mso-service-instance-id must specify it explicitly!
- * If a problem is found, buildAndThrowWorkflowException builds a WorkflowException
- * and throws an MSOWorkflowException. This method also sets up the log context for
- * the workflow.
- *
- * @param execution the execution
- * @return the validated request
- */
- public String validateRequest(DelegateExecution execution, String... requiredVariables) {
- ExceptionUtil exceptionUtil = new ExceptionUtil()
- def method = getClass().getSimpleName() + '.validateRequest(' +
- 'execution=' + execution.getId() +
- ', requredVariables=' + requiredVariables +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- String processKey = getProcessKey(execution)
- def prefix = execution.getVariable("prefix")
-
- if (prefix == null) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey + " prefix is null")
- }
-
- try {
- def request = execution.getVariable(prefix + 'Request')
-
- if (request == null) {
- request = execution.getVariable(processKey + 'Request')
-
- if (request == null) {
- request = execution.getVariable('bpmnRequest')
- }
-
- setVariable(execution, processKey + 'Request', null)
- setVariable(execution, 'bpmnRequest', null)
- setVariable(execution, prefix + 'Request', request)
- }
-
- if (request == null) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey + " request is null")
- }
-
- // All requests must have a request ID.
- // Some requests (e.g. SDN-MOBILITY) do not have a service instance ID.
-
- String requestId = null
- String serviceInstanceId = null
-
- List<String> allRequiredVariables = new ArrayList<String>()
- allRequiredVariables.add("mso-request-id")
-
- if (requiredVariables != null) {
- for (String variable : requiredVariables) {
- if (!allRequiredVariables.contains(variable)) {
- allRequiredVariables.add(variable)
- }
- }
- }
-
- for (String variable : allRequiredVariables) {
- def value = execution.getVariable(variable)
- if (value == null || ((value instanceof CharSequence) && value.length() == 0)) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey +
- " request was received with no '" + variable + "' variable")
- }
-
- if ("mso-request-id".equals(variable)) {
- requestId = (String) value
- } else if ("mso-service-instance-id".equals(variable)) {
- serviceInstanceId = (String) value
- }
- }
-
- if (serviceInstanceId == null) {
- serviceInstanceId = (String) execution.getVariable("mso-service-instance-id")
- }
-
- utils.logContext(requestId, serviceInstanceId)
- logDebug('Incoming message: ' + System.lineSeparator() + request, isDebugLogEnabled)
- logDebug('Exited ' + method, isDebugLogEnabled)
- return request
- } catch (BpmnError e) {
- throw e
- } catch (Exception e) {
- logError('Caught exception in ' + method, e)
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Invalid Message")
- }
- }
-
- /**
- * gets vars stored in a JSON object in prefix+Request and returns as a LazyMap
- * setting log context here too
- * @param execution the execution
- * @return the inputVars
- */
- public Map validateJSONReq(DelegateExecution execution) {
- def method = getClass().getSimpleName() + '.validateJSONReq(' +
- 'execution=' + execution.getId() +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- String processKey = getProcessKey(execution);
- def prefix = execution.getVariable("prefix")
-
- def requestId =getVariable(execution, "mso-request-id")
- def serviceInstanceId = getVariable(execution, "mso-service-instance-id")
- if(requestId!=null && serviceInstanceId!=null){
- utils.logContext(requestId, serviceInstanceId)
- }
-
-
- def request = getVariable(execution, prefix + 'Request')
-
- if (request == null) {
- request = getVariable(execution, processKey + 'Request')
-
- if (request == null) {
- request = getVariable(execution, 'bpmnRequest')
- }
- execution.setVariable(prefix + 'Request', request)
- }
-
- def jsonSlurper = new JsonSlurper()
- def parsed = jsonSlurper.parseText(request)
-
-
- logDebug('Incoming message: ' + System.lineSeparator() + request, isDebugLogEnabled)
- logDebug('Exited ' + method, isDebugLogEnabled)
- return parsed
-
- }
-
- /**
- * Sends a response to the workflow service that invoked the process. This method
- * may only be used by top-level processes that were directly invoked by the
- * asynchronous workflow service.
- * @param execution the execution
- * @param responseCode the response code
- * @param content the message content
- * @throws IllegalArgumentException if the response code is invalid
- * by HTTP standards
- * @throws UnsupportedOperationException if not invoked by an asynchronous,
- * top-level process
- * @throws IllegalStateException if a response has already been sent
- */
- protected void sendWorkflowResponse(DelegateExecution execution, Object responseCode, String response) {
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- try {
- String processKey = getProcessKey(execution);
-
- // isAsyncProcess is injected by the workflow service that started the flow
- if (!String.valueOf(execution.getVariable("isAsyncProcess")).equals("true")) {
- throw new UnsupportedOperationException(processKey + ": " +
- "sendWorkflowResponse is valid only in asynchronous workflows");
- }
-
- if (String.valueOf(execution.getVariable(processKey + "WorkflowResponseSent")).equals("true")) {
- logDebug("Sync response has already been sent for " + processKey, isDebugLogEnabled)
- }else{
-
- logDebug("Building " + processKey + " response ", isDebugLogEnabled)
-
- int intResponseCode;
-
- try {
- intResponseCode = Integer.parseInt(String.valueOf(responseCode));
-
- if (intResponseCode < 100 || intResponseCode > 599) {
- throw new NumberFormatException(String.valueOf(responseCode));
- }
- } catch (NumberFormatException e) {
- throw new IllegalArgumentException("Process " + processKey
- + " provided an invalid HTTP response code: " + responseCode);
- }
-
- // Only 2XX responses are considered "Success"
- String status = (intResponseCode >= 200 && intResponseCode <= 299) ?
- "Success" : "Fail";
-
- // TODO: Should deprecate use of processKey+Response variable for the response. Will use "WorkflowResponse" instead
- execution.setVariable(processKey + "ResponseCode", String.valueOf(intResponseCode))
- execution.setVariable(processKey + "Response", response);
- execution.setVariable(processKey + "Status", status);
- execution.setVariable("WorkflowResponse", response)
-
- logDebug("Sending response for " + processKey
- + " ResponseCode=" + intResponseCode
- + " Status=" + status
- + " Response=\n" + response,
- isDebugLogEnabled)
-
- // TODO: ensure that this flow was invoked asynchronously?
-
- WorkflowCallbackResponse callbackResponse = new WorkflowCallbackResponse()
- callbackResponse.setStatusCode(intResponseCode)
- callbackResponse.setMessage(status)
- callbackResponse.setResponse(response)
-
- // TODO: send this data with HTTP POST
-
- WorkflowContextHolder.getInstance().processCallback(
- processKey,
- execution.getProcessInstanceId(),
- execution.getVariable("mso-request-id"),
- callbackResponse)
-
- execution.setVariable(processKey + "WorkflowResponseSent", "true");
- }
-
- } catch (Exception ex) {
- logError("Unable to send workflow response to client ....", ex)
- }
- }
-
- /**
- * Returns true if a workflow response has already been sent.
- * @param execution the execution
- */
- protected boolean isWorkflowResponseSent(DelegateExecution execution) {
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- String processKey = getProcessKey(execution);
- return String.valueOf(execution.getVariable(processKey + "WorkflowResponseSent")).equals("true");
- }
-
- /**
- * Returns the process definition key (i.e. the process name) of the
- * current process.
- *
- * @param execution the execution
- */
- public String getProcessKey(DelegateExecution execution) {
- def testKey = execution.getVariable("testProcessKey")
- if(testKey!=null){
- return testKey
- }
- return execution.getProcessEngineServices().getRepositoryService()
- .getProcessDefinition(execution.getProcessDefinitionId()).getKey()
- }
-
- /**
- * Returns the process definition key (i.e. the process name) of the
- * top-level process.
- * @param execution the execution
- */
- public String getMainProcessKey(DelegateExecution execution) {
- DelegateExecution exec = execution
-
- while (true) {
- DelegateExecution parent = exec.getSuperExecution()
-
- if (parent == null) {
- parent = exec.getParent()
-
- if (parent == null) {
- break
- }
- }
-
- exec = parent
- }
-
- return execution.getProcessEngineServices().getRepositoryService()
- .getProcessDefinition(exec.getProcessDefinitionId()).getKey()
- }
-
- /**
- * Gets the node for the named element from the given xml. If the element
- * does not exist in the xml or is empty, a WorkflowException is created
- * (and as a result, a MSOWorkflowException event is thrown).
- *
- * @param execution The flow's execution.
- * @param xml Xml to search.
- * @param elementName Name of element to search for.
- * @return The element node, if found in the xml.
- */
- protected String getRequiredNodeXml(DelegateExecution execution, String xml, String elementName) {
- ExceptionUtil exceptionUtil = new ExceptionUtil()
- def element = utils.getNodeXml(xml, elementName, false)
- if (element.trim().isEmpty()) {
- def msg = 'Required element \'' + elementName + '\' is missing or empty'
- logError(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
- } else {
- return element
- }
- }
-
- /**
- * Gets the value of the named element from the given xml. If the element
- * does not exist in the xml or is empty, a WorkflowException is created
- * (and as a result, a MSOWorkflowException event is thrown).
- *
- * @param execution The flow's execution.
- * @param xml Xml to search.
- * @param elementName Name of element to whose value to get.
- * @return The non-empty value of the element, if found in the xml.
- */
- protected String getRequiredNodeText(DelegateExecution execution, String xml, String elementName) {
- ExceptionUtil exceptionUtil = new ExceptionUtil()
- def elementText = utils.getNodeText1(xml, elementName)
- if ((elementText == null) || (elementText.isEmpty())) {
- def msg = 'Required element \'' + elementName + '\' is missing or empty'
- logError(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
- } else {
- return elementText
- }
- }
-
- /**
- * Get the text for the specified element from the specified xml. If
- * the element does not exist, return the specified default value.
- *
- * @param xml Xml from which to get the element's text
- * @param elementName Name of element whose text to get
- * @param defaultValue the default value
- * @return the element's text or the default value if the element does not
- * exist in the given xml
- */
- protected String getNodeText(String xml, String elementName, String defaultValue) {
- def nodeText = utils.getNodeText1(xml, elementName)
- return (nodeText == null) ? defaultValue : nodeText
- }
-
- /**
- * Get the text for the specified element from the specified xml. If
- * the element does not exist, return an empty string.
- *
- * @param xml Xml from which to get the element's text.
- * @param elementName Name of element whose text to get.
- * @return the element's text or an empty string if the element does not
- * exist in the given xml.
- */
- protected String getNodeTextForce(String xml, String elementName) {
- return getNodeText(xml, elementName, '');
- }
-
- /**
- *Store the variable as typed with java serialization type
- *@param execution
- *@param name
- *@param value
- */
- public void setVariable(DelegateExecution execution, String name, Object value) {
- VariableMap variables = Variables.createVariables()
- variables.putValueTyped('payload', Variables.objectValue(value)
- .serializationDataFormat(SerializationDataFormats.JAVA) // tells the engine to use java serialization for persisting the value
- .create())
- execution.setVariable(name,variables)
- }
-
- //TODO not sure how this will look in Cockpit
-
- /**
- * Returns the variable map
- *@param execution
- *@param name
- *@return
- **/
- public String getVariable(DelegateExecution execution, String name) {
- def myObj = execution.getVariable(name)
- if(myObj instanceof VariableMap){
- VariableMap serializedObjectMap = (VariableMap) myObj
- ObjectValueImpl payloadObj = serializedObjectMap.getValueTyped('payload')
- return payloadObj.getValue()
- }else{
- return myObj
- }
- }
-
-
- /**
- * Returns true if a value equals one of the provided set. Equality is
- * determined by using the equals method if the value object and the
- * object in the provided set have the same class. Otherwise, the objects
- * are converted to strings and then compared. Nulls are permitted for
- * the value as well as in the provided set
- * Example:
- * <pre>
- * def statusCode = getStatusCode()
- * isOneOf(statusCode, 200, 201, 204)
- * </pre>
- * @param value the value to test
- * @param these a set of permissable values
- * @return true if the value is in the provided set
- */
- public boolean isOneOf(Object value, Object... these) {
- for (Object thisOne : these) {
- if (thisOne == null) {
- if (value == null) {
- return true
- }
- } else {
- if (value != null) {
- if (value.getClass() == thisOne.getClass()) {
- if (value.equals(thisOne)) {
- return true
- }
- } else {
- if (String.valueOf(value).equals(String.valueOf(thisOne))) {
- return true
- }
- }
- }
- }
- }
- return false
- }
-
- /**
- * Sets flows success indicator variable.
- *
- */
- public void setSuccessIndicator(DelegateExecution execution, boolean isSuccess) {
- String prefix = execution.getVariable('prefix')
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
-
- logDebug('Entered SetSuccessIndicator Method', isDebugLogEnabled)
- execution.setVariable(prefix+'SuccessIndicator', isSuccess)
- logDebug('Outgoing SuccessIndicator is: ' + execution.getVariable(prefix+'SuccessIndicator') + '', isDebugLogEnabled)
- }
-
- /**
- * Sends a Error Sync Response
- *
- */
- public void sendSyncError(DelegateExecution execution) {
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- String requestId = execution.getVariable("mso-request-id")
- logDebug('sendSyncError, requestId: ' + requestId, isDebugEnabled)
- WorkflowException workflowExceptionObj = execution.getVariable("WorkflowException")
- if (workflowExceptionObj != null) {
- String errorMessage = workflowExceptionObj.getErrorMessage()
- def errorCode = workflowExceptionObj.getErrorCode()
- logDebug('sendSyncError, requestId: ' + requestId + ' | errorMessage: ' + errorMessage + ' | errorCode: ' + errorCode, isDebugEnabled)
- sendWorkflowResponse(execution, errorCode, errorMessage)
- }
- }
-
- /**
- * Executes a named groovy script method in the current object
- */
- public void executeMethod(String methodName, Object... args) {
-
- if (args != null && args.size() > 0) {
-
- // First argument of method to call is always the execution object
- DelegateExecution execution = (DelegateExecution) args[0]
-
- def classAndMethod = getClass().getSimpleName() + '.' + methodName + '(execution=' + execution.getId() + ')'
- def isDebugEnabled = execution.getVariable('isDebugLogEnabled')
-
- logDebug('Entered ' + classAndMethod, isDebugEnabled)
- logDebug('Received parameters: ' + args, isDebugEnabled)
-
- try{
- def methodToCall = this.metaClass.getMetaMethod(methodName, args)
- logDebug('Method to call: ' + methodToCall, isDebugEnabled)
- methodToCall?.invoke(this, args)
- }
- catch(BpmnError bpmnError) {
- logDebug('Rethrowing BpmnError ' + bpmnError.getMessage(), isDebugEnabled)
- throw bpmnError
- }
- catch(Exception e) {
- e.printStackTrace()
- logDebug('Unexpected error encountered - ' + e.getMessage(), isDebugEnabled)
- (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, e.getMessage())
- }
- finally {
- logDebug('Exited ' + classAndMethod, isDebugEnabled)
- }
- }
- }
-
- /**
- *This method determines and adds the appropriate ending to come
- *after a number (-st, -nd, -rd, or -th)
- *
- *@param int n
- *
- *@return String ending - number with suffix
- */
- public static String labelMaker(Object n) {
- Integer num
- if(n instanceof String){
- num = Integer.parseInt(n)
- }else{
- num = n
- }
-
- String ending = ""; //the end to be added to the number
- if(num != null){
- if ((num % 10 == 1) && (num != 11)) {
- ending = num + "st";
- } else if ((num % 10 == 2) && (num != 12)) {
- ending = num + "nd";
- } else if ((num % 10 == 3) && (num != 13)) {
- ending = num + "rd";
- } else {
- ending = num + "th";
- }
- }
- return ending
- }
-
- /**
- *
- *This method gets and decodes SDNC Response's "RequestData".
- *
- *@param response - the sdnc response
- *
- *@return data - the response "RequestData" decoded
- *
- */
- public String getRequestDataDecoded(String response){
- String data = utils.getNodeText1(response, "RequestData")
- if(data != null){
- data = data.replaceAll("<", "<")
- data = data.replaceAll(">", ">")
- }
-
- return data
- }
-
-
- /**
- * Constructs a workflow message callback URL for the specified message type and correlator.
- * This type of callback URL is used when a workflow wants an MSO adapter (like the SDNC
- * adapter) to call it back. In other words, this is for callbacks internal to the MSO
- * complex. Use <code>createWorkflowMessageAdapterCallbackURL</code> if the callback
- * will come from outside the MSO complex.
- * @param messageType the message type (e.g. SDNCAResponse or VNFAResponse)
- * @param correlator the correlator value (e.g. a request ID)
- */
- public String createCallbackURL(DelegateExecution execution, String messageType, String correlator) {
- String endpoint = (String) execution.getVariable('URN_mso_workflow_message_endpoint')
-
- if (endpoint == null || endpoint.isEmpty()) {
- ExceptionUtil exceptionUtil = new ExceptionUtil()
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000,
- 'mso:workflow:message:endpoint URN mapping is not set')
- }
-
- while (endpoint.endsWith('/')) {
- endpoint = endpoint.substring(0, endpoint.length()-1)
- }
-
- return endpoint +
- '/' + UriUtils.encodePathSegment(messageType, 'UTF-8') +
- '/' + UriUtils.encodePathSegment(correlator, 'UTF-8')
- }
-
- /**
- *
- * Constructs a workflow message callback URL for the specified message type and correlator.
- * This type of callback URL is used when a workflow wants a system outside the MSO complex
- * to call it back through the Workflow Message Adapter.
- * @param messageType the message type (e.g. SNIROResponse)
- * @param correlator the correlator value (e.g. a request ID)
- */
- public String createWorkflowMessageAdapterCallbackURL(DelegateExecution execution, String messageType, String correlator) {
- String endpoint = (String) execution.getVariable('URN_mso_adapters_workflow_message_endpoint')
-
- if (endpoint == null || endpoint.isEmpty()) {
- ExceptionUtil exceptionUtil = new ExceptionUtil()
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000,
- 'mso:adapters:workflow:message:endpoint URN mapping is not set')
- }
-
- while (endpoint.endsWith('/')) {
- endpoint = endpoint.substring(0, endpoint.length()-1)
- }
-
- return endpoint +
- '/' + UriUtils.encodePathSegment(messageType, 'UTF-8') +
- '/' + UriUtils.encodePathSegment(correlator, 'UTF-8')
- }
-
- public void setRollbackEnabled(DelegateExecution execution, isDebugLogEnabled) {
-
- // Rollback settings
- def prefix = execution.getVariable('prefix')
- def disableRollback = execution.getVariable("disableRollback")
- def defaultRollback = execution.getVariable("URN_mso_rollback").toBoolean()
-
- logDebug('disableRollback: ' + disableRollback, isDebugLogEnabled)
- logDebug('defaultRollback: ' + defaultRollback, isDebugLogEnabled)
-
- def rollbackEnabled
-
- if(disableRollback == null || disableRollback == '' ) {
- // get from default urn settings for mso_rollback
- disableRollback = !defaultRollback
- rollbackEnabled = defaultRollback
- logDebug('disableRollback is null or empty!', isDebugLogEnabled)
- }
- else {
- if(disableRollback == true) {
- rollbackEnabled = false
- }
- else if(disableRollback == false){
- rollbackEnabled = true
- }
- else {
- rollbackEnabled = defaultRollback
- }
- }
-
- execution.setVariable(prefix+"backoutOnFailure", rollbackEnabled)
- logDebug('rollbackEnabled (aka backoutOnFailure): ' + rollbackEnabled, isDebugLogEnabled)
- }
-
- public void setBasicDBAuthHeader(DelegateExecution execution, isDebugLogEnabled) {
- try {
- String basicAuthValueDB = execution.getVariable("URN_mso_adapters_db_auth")
- utils.log("DEBUG", " Obtained BasicAuth userid password for Catalog DB adapter: " + basicAuthValueDB, isDebugLogEnabled)
-
- def encodedString = utils.getBasicAuth(basicAuthValueDB, execution.getVariable("URN_mso_msoKey"))
- execution.setVariable("BasicAuthHeaderValueDB",encodedString)
- } catch (IOException ex) {
- String dataErrorMessage = " Unable to encode Catalog DB user/password string - " + ex.getMessage()
- utils.log("DEBUG", dataErrorMessage, isDebugLogEnabled)
- (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 2500, dataErrorMessage)
- }
- }
+/*- + * ============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.common.scripts; + +import groovy.json.JsonSlurper + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.camunda.bpm.engine.variable.VariableMap +import org.camunda.bpm.engine.variable.Variables +import org.camunda.bpm.engine.variable.Variables.SerializationDataFormats +import org.camunda.bpm.engine.variable.impl.value.ObjectValueImpl +import org.onap.so.bpmn.common.workflow.context.WorkflowCallbackResponse +import org.onap.so.bpmn.common.workflow.context.WorkflowContextHolder +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.springframework.web.util.UriUtils + +public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcessor { + public MsoUtils utils = new MsoUtils() + + + /** + * Logs a message at the ERROR level. + * @param message the message + */ + public void logError(String message) { + log('ERROR', message, null, "true") + } + + /** + * Logs a message at the ERROR level. + * @param message the message + * @param cause the cause (stracktrace will be included in the output) + */ + public void logError(String message, Throwable cause) { + log('ERROR', message, cause, "true") + } + + /** + * Logs a message at the WARN level. + * @param message the message + */ + public void logWarn(String message) { + log('WARN', message, null, "true") + } + + /** + * Logs a message at the WARN level. + * @param message the message + * @param cause the cause (stracktrace will be included in the output) + */ + public void logWarn(String message, Throwable cause) { + log('WARN', message, cause, "true") + } + + /** + * Logs a message at the DEBUG level. + * @param message the message + * @param isDebugLogEnabled a flag indicating if DEBUG level is enabled + */ + public void logDebug(String message, String isDebugLogEnabled) { + log('DEBUG', message, null, isDebugLogEnabled) + } + + /** + * Logs a message at the DEBUG level. + * @param message the message + * @param cause the cause (stracktrace will be included in the output) + * @param isDebugLogEnabled a flag indicating if DEBUG level is enabled + */ + public void logDebug(String message, Throwable cause, String isDebugLogEnabled) { + log('DEBUG', message, cause, isDebugLogEnabled) + } + + /** + * Logs a message at the specified level. + * @param level the level (DEBUG, INFO, WARN, ERROR) + * @param message the message + * @param isLevelEnabled a flag indicating if the level is enabled + * (used only at the DEBUG level) + */ + public void log(String level, String message, String isLevelEnabled) { + log(level, message, null, isLevelEnabled) + } + + /** + * Logs a message at the specified level. + * @param level the level (DEBUG, INFO, WARN, ERROR) + * @param message the message + * @param cause the cause (stracktrace will be included in the output) + * @param isLevelEnabled a flag indicating if the level is enabled + * (used only at the DEBUG level) + */ + public void log(String level, String message, Throwable cause, String isLevelEnabled) { + if (cause == null) { + utils.log(level, message, isLevelEnabled); + } else { + StringWriter stringWriter = new StringWriter(); + PrintWriter printWriter = new PrintWriter(stringWriter); + printWriter.println(message); + cause.printStackTrace(printWriter); + utils.log(level, stringWriter.toString(), isLevelEnabled); + printWriter.close(); + } + } + + /** + * Logs a WorkflowException at the ERROR level with the specified message. + * @param execution the execution + */ + public void logWorkflowException(DelegateExecution execution, String message) { + def workflowException = execution.getVariable("WorkflowException") + + if (workflowException == null) { + logError(message); + } else { + logError(message + ": " + workflowException) + } + } + + /** + * Saves the WorkflowException in the execution to the specified variable, + * clearing the WorkflowException variable so the workflow can continue + * processing (perhaps catching another WorkflowException). + * @param execution the execution + * @return the name of the destination variable + */ + public saveWorkflowException(DelegateExecution execution, String variable) { + if (variable == null) { + throw new NullPointerException(); + } + + execution.setVariable(variable, execution.getVariable("WorkflowException")) + execution.setVariable("WorkflowException", null) + } + + + /** + * Validates that the request exists and that the mso-request-id variable is set. + * Additional required variables may be checked by specifying their names. + * NOTE: services requiring mso-service-instance-id must specify it explicitly! + * If a problem is found, buildAndThrowWorkflowException builds a WorkflowException + * and throws an MSOWorkflowException. This method also sets up the log context for + * the workflow. + * + * @param execution the execution + * @return the validated request + */ + public String validateRequest(DelegateExecution execution, String... requiredVariables) { + ExceptionUtil exceptionUtil = new ExceptionUtil() + def method = getClass().getSimpleName() + '.validateRequest(' + + 'execution=' + execution.getId() + + ', requredVariables=' + requiredVariables + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + logDebug('Entered ' + method, isDebugLogEnabled) + + String processKey = getProcessKey(execution) + def prefix = execution.getVariable("prefix") + + if (prefix == null) { + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey + " prefix is null") + } + + try { + def request = execution.getVariable(prefix + 'Request') + + if (request == null) { + request = execution.getVariable(processKey + 'Request') + + if (request == null) { + request = execution.getVariable('bpmnRequest') + } + + setVariable(execution, processKey + 'Request', null) + setVariable(execution, 'bpmnRequest', null) + setVariable(execution, prefix + 'Request', request) + } + + if (request == null) { + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey + " request is null") + } + + // All requests must have a request ID. + // Some requests (e.g. SDN-MOBILITY) do not have a service instance ID. + + String requestId = null + String serviceInstanceId = null + + List<String> allRequiredVariables = new ArrayList<String>() + allRequiredVariables.add("mso-request-id") + + if (requiredVariables != null) { + for (String variable : requiredVariables) { + if (!allRequiredVariables.contains(variable)) { + allRequiredVariables.add(variable) + } + } + } + + for (String variable : allRequiredVariables) { + def value = execution.getVariable(variable) + if (value == null || ((value instanceof CharSequence) && value.length() == 0)) { + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey + + " request was received with no '" + variable + "' variable") + } + + if ("mso-request-id".equals(variable)) { + requestId = (String) value + } else if ("mso-service-instance-id".equals(variable)) { + serviceInstanceId = (String) value + } + } + + if (serviceInstanceId == null) { + serviceInstanceId = (String) execution.getVariable("mso-service-instance-id") + } + + utils.logContext(requestId, serviceInstanceId) + logDebug('Incoming message: ' + System.lineSeparator() + request, isDebugLogEnabled) + logDebug('Exited ' + method, isDebugLogEnabled) + return request + } catch (BpmnError e) { + throw e + } catch (Exception e) { + logError('Caught exception in ' + method, e) + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Invalid Message") + } + } + + /** + * gets vars stored in a JSON object in prefix+Request and returns as a LazyMap + * setting log context here too + * @param execution the execution + * @return the inputVars + */ + public Map validateJSONReq(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.validateJSONReq(' + + 'execution=' + execution.getId() + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + logDebug('Entered ' + method, isDebugLogEnabled) + + String processKey = getProcessKey(execution); + def prefix = execution.getVariable("prefix") + + def requestId =getVariable(execution, "mso-request-id") + def serviceInstanceId = getVariable(execution, "mso-service-instance-id") + if(requestId!=null && serviceInstanceId!=null){ + utils.logContext(requestId, serviceInstanceId) + } + + + def request = getVariable(execution, prefix + 'Request') + + if (request == null) { + request = getVariable(execution, processKey + 'Request') + + if (request == null) { + request = getVariable(execution, 'bpmnRequest') + } + execution.setVariable(prefix + 'Request', request) + } + + def jsonSlurper = new JsonSlurper() + def parsed = jsonSlurper.parseText(request) + + + logDebug('Incoming message: ' + System.lineSeparator() + request, isDebugLogEnabled) + logDebug('Exited ' + method, isDebugLogEnabled) + return parsed + + } + + /** + * Sends a response to the workflow service that invoked the process. This method + * may only be used by top-level processes that were directly invoked by the + * asynchronous workflow service. + * @param execution the execution + * @param responseCode the response code + * @param content the message content + * @throws IllegalArgumentException if the response code is invalid + * by HTTP standards + * @throws UnsupportedOperationException if not invoked by an asynchronous, + * top-level process + * @throws IllegalStateException if a response has already been sent + */ + protected void sendWorkflowResponse(DelegateExecution execution, Object responseCode, String response) { + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + try { + String processKey = getProcessKey(execution); + + // isAsyncProcess is injected by the workflow service that started the flow + if (!String.valueOf(execution.getVariable("isAsyncProcess")).equals("true")) { + throw new UnsupportedOperationException(processKey + ": " + + "sendWorkflowResponse is valid only in asynchronous workflows"); + } + + if (String.valueOf(execution.getVariable(processKey + "WorkflowResponseSent")).equals("true")) { + logDebug("Sync response has already been sent for " + processKey, isDebugLogEnabled) + }else{ + + logDebug("Building " + processKey + " response ", isDebugLogEnabled) + + int intResponseCode; + + try { + intResponseCode = Integer.parseInt(String.valueOf(responseCode)); + + if (intResponseCode < 100 || intResponseCode > 599) { + throw new NumberFormatException(String.valueOf(responseCode)); + } + } catch (NumberFormatException e) { + throw new IllegalArgumentException("Process " + processKey + + " provided an invalid HTTP response code: " + responseCode); + } + + // Only 2XX responses are considered "Success" + String status = (intResponseCode >= 200 && intResponseCode <= 299) ? + "Success" : "Fail"; + + // TODO: Should deprecate use of processKey+Response variable for the response. Will use "WorkflowResponse" instead + execution.setVariable(processKey + "ResponseCode", String.valueOf(intResponseCode)) + execution.setVariable(processKey + "Response", response); + execution.setVariable(processKey + "Status", status); + execution.setVariable("WorkflowResponse", response) + + logDebug("Sending response for " + processKey + + " ResponseCode=" + intResponseCode + + " Status=" + status + + " Response=\n" + response, + isDebugLogEnabled) + + // TODO: ensure that this flow was invoked asynchronously? + + WorkflowCallbackResponse callbackResponse = new WorkflowCallbackResponse() + callbackResponse.setStatusCode(intResponseCode) + callbackResponse.setMessage(status) + callbackResponse.setResponse(response) + + // TODO: send this data with HTTP POST + + WorkflowContextHolder.getInstance().processCallback( + processKey, + execution.getProcessInstanceId(), + execution.getVariable("mso-request-id"), + callbackResponse) + + execution.setVariable(processKey + "WorkflowResponseSent", "true"); + } + + } catch (Exception ex) { + logError("Unable to send workflow response to client ....", ex) + } + } + + /** + * Returns true if a workflow response has already been sent. + * @param execution the execution + */ + protected boolean isWorkflowResponseSent(DelegateExecution execution) { + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + String processKey = getProcessKey(execution); + return String.valueOf(execution.getVariable(processKey + "WorkflowResponseSent")).equals("true"); + } + + /** + * Returns the process definition key (i.e. the process name) of the + * current process. + * + * @param execution the execution + */ + public String getProcessKey(DelegateExecution execution) { + def testKey = execution.getVariable("testProcessKey") + if(testKey!=null){ + return testKey + } + return execution.getProcessEngineServices().getRepositoryService() + .getProcessDefinition(execution.getProcessDefinitionId()).getKey() + } + + /** + * Returns the process definition key (i.e. the process name) of the + * top-level process. + * @param execution the execution + */ + public String getMainProcessKey(DelegateExecution execution) { + DelegateExecution exec = execution + + while (true) { + DelegateExecution parent = exec.getSuperExecution() + + if (parent == null) { + parent = exec.getParent() + + if (parent == null) { + break + } + } + + exec = parent + } + + return execution.getProcessEngineServices().getRepositoryService() + .getProcessDefinition(exec.getProcessDefinitionId()).getKey() + } + + /** + * Gets the node for the named element from the given xml. If the element + * does not exist in the xml or is empty, a WorkflowException is created + * (and as a result, a MSOWorkflowException event is thrown). + * + * @param execution The flow's execution. + * @param xml Xml to search. + * @param elementName Name of element to search for. + * @return The element node, if found in the xml. + */ + protected String getRequiredNodeXml(DelegateExecution execution, String xml, String elementName) { + ExceptionUtil exceptionUtil = new ExceptionUtil() + def element = utils.getNodeXml(xml, elementName, false) + if (element.trim().isEmpty()) { + def msg = 'Required element \'' + elementName + '\' is missing or empty' + logError(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } else { + return element + } + } + + /** + * Gets the value of the named element from the given xml. If the element + * does not exist in the xml or is empty, a WorkflowException is created + * (and as a result, a MSOWorkflowException event is thrown). + * + * @param execution The flow's execution. + * @param xml Xml to search. + * @param elementName Name of element to whose value to get. + * @return The non-empty value of the element, if found in the xml. + */ + protected String getRequiredNodeText(DelegateExecution execution, String xml, String elementName) { + ExceptionUtil exceptionUtil = new ExceptionUtil() + def elementText = utils.getNodeText(xml, elementName) + if ((elementText == null) || (elementText.isEmpty())) { + def msg = 'Required element \'' + elementName + '\' is missing or empty' + logError(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } else { + return elementText + } + } + + /** + * Get the text for the specified element from the specified xml. If + * the element does not exist, return the specified default value. + * + * @param xml Xml from which to get the element's text + * @param elementName Name of element whose text to get + * @param defaultValue the default value + * @return the element's text or the default value if the element does not + * exist in the given xml + */ + protected String getNodeText(String xml, String elementName, String defaultValue) { + def nodeText = utils.getNodeText(xml, elementName) + return (nodeText == null) ? defaultValue : nodeText + } + + /** + * Get the text for the specified element from the specified xml. If + * the element does not exist, return an empty string. + * + * @param xml Xml from which to get the element's text. + * @param elementName Name of element whose text to get. + * @return the element's text or an empty string if the element does not + * exist in the given xml. + */ + protected String getNodeTextForce(String xml, String elementName) { + return getNodeText(xml, elementName, ''); + } + + /** + *Store the variable as typed with java serialization type + *@param execution + *@param name + *@param value + */ + public void setVariable(DelegateExecution execution, String name, Object value) { + VariableMap variables = Variables.createVariables() + variables.putValueTyped('payload', Variables.objectValue(value) + .serializationDataFormat(SerializationDataFormats.JAVA) // tells the engine to use java serialization for persisting the value + .create()) + execution.setVariable(name,variables) + } + + //TODO not sure how this will look in Cockpit + + /** + * Returns the variable map + *@param execution + *@param name + *@return + **/ + public String getVariable(DelegateExecution execution, String name) { + def myObj = execution.getVariable(name) + if(myObj instanceof VariableMap){ + VariableMap serializedObjectMap = (VariableMap) myObj + ObjectValueImpl payloadObj = serializedObjectMap.getValueTyped('payload') + return payloadObj.getValue() + }else{ + return myObj + } + } + + + /** + * Returns true if a value equals one of the provided set. Equality is + * determined by using the equals method if the value object and the + * object in the provided set have the same class. Otherwise, the objects + * are converted to strings and then compared. Nulls are permitted for + * the value as well as in the provided set + * Example: + * <pre> + * def statusCode = getStatusCode() + * isOneOf(statusCode, 200, 201, 204) + * </pre> + * @param value the value to test + * @param these a set of permissable values + * @return true if the value is in the provided set + */ + public boolean isOneOf(Object value, Object... these) { + for (Object thisOne : these) { + if (thisOne == null) { + if (value == null) { + return true + } + } else { + if (value != null) { + if (value.getClass() == thisOne.getClass()) { + if (value.equals(thisOne)) { + return true + } + } else { + if (String.valueOf(value).equals(String.valueOf(thisOne))) { + return true + } + } + } + } + } + return false + } + + /** + * Sets flows success indicator variable. + * + */ + public void setSuccessIndicator(DelegateExecution execution, boolean isSuccess) { + String prefix = execution.getVariable('prefix') + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + + logDebug('Entered SetSuccessIndicator Method', isDebugLogEnabled) + execution.setVariable(prefix+'SuccessIndicator', isSuccess) + logDebug('Outgoing SuccessIndicator is: ' + execution.getVariable(prefix+'SuccessIndicator') + '', isDebugLogEnabled) + } + + /** + * Sends a Error Sync Response + * + */ + public void sendSyncError(DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + String requestId = execution.getVariable("mso-request-id") + logDebug('sendSyncError, requestId: ' + requestId, isDebugEnabled) + WorkflowException workflowExceptionObj = execution.getVariable("WorkflowException") + if (workflowExceptionObj != null) { + String errorMessage = workflowExceptionObj.getErrorMessage() + def errorCode = workflowExceptionObj.getErrorCode() + logDebug('sendSyncError, requestId: ' + requestId + ' | errorMessage: ' + errorMessage + ' | errorCode: ' + errorCode, isDebugEnabled) + sendWorkflowResponse(execution, errorCode, errorMessage) + } + } + + /** + * Executes a named groovy script method in the current object + */ + public void executeMethod(String methodName, Object... args) { + + if (args != null && args.size() > 0) { + + // First argument of method to call is always the execution object + DelegateExecution execution = (DelegateExecution) args[0] + + def classAndMethod = getClass().getSimpleName() + '.' + methodName + '(execution=' + execution.getId() + ')' + def isDebugEnabled = execution.getVariable('isDebugLogEnabled') + + logDebug('Entered ' + classAndMethod, isDebugEnabled) + logDebug('Received parameters: ' + args, isDebugEnabled) + + try{ + def methodToCall = this.metaClass.getMetaMethod(methodName, args) + logDebug('Method to call: ' + methodToCall, isDebugEnabled) + methodToCall?.invoke(this, args) + } + catch(BpmnError bpmnError) { + logDebug('Rethrowing BpmnError ' + bpmnError.getMessage(), isDebugEnabled) + throw bpmnError + } + catch(Exception e) { + e.printStackTrace() + logDebug('Unexpected error encountered - ' + e.getMessage(), isDebugEnabled) + (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, e.getMessage()) + } + finally { + logDebug('Exited ' + classAndMethod, isDebugEnabled) + } + } + } + + /** + *This method determines and adds the appropriate ending to come + *after a number (-st, -nd, -rd, or -th) + * + *@param int n + * + *@return String ending - number with suffix + */ + public static String labelMaker(Object n) { + Integer num + if(n instanceof String){ + num = Integer.parseInt(n) + }else{ + num = n + } + + String ending = ""; //the end to be added to the number + if(num != null){ + if ((num % 10 == 1) && (num != 11)) { + ending = num + "st"; + } else if ((num % 10 == 2) && (num != 12)) { + ending = num + "nd"; + } else if ((num % 10 == 3) && (num != 13)) { + ending = num + "rd"; + } else { + ending = num + "th"; + } + } + return ending + } + + /** + * Constructs a workflow message callback URL for the specified message type and correlator. + * This type of callback URL is used when a workflow wants an MSO adapter (like the SDNC + * adapter) to call it back. In other words, this is for callbacks internal to the MSO + * complex. Use <code>createWorkflowMessageAdapterCallbackURL</code> if the callback + * will come from outside the MSO complex. + * @param messageType the message type (e.g. SDNCAResponse or VNFAResponse) + * @param correlator the correlator value (e.g. a request ID) + */ + public String createCallbackURL(DelegateExecution execution, String messageType, String correlator) { + String endpoint = UrnPropertiesReader.getVariable("mso.workflow.message.endpoint", execution) + + if (endpoint == null || endpoint.isEmpty()) { + ExceptionUtil exceptionUtil = new ExceptionUtil() + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, + 'mso:workflow:message:endpoint URN mapping is not set') + } + + while (endpoint.endsWith('/')) { + endpoint = endpoint.substring(0, endpoint.length()-1) + } + + return endpoint + + '/' + UriUtils.encodePathSegment(messageType, 'UTF-8') + + '/' + UriUtils.encodePathSegment(correlator, 'UTF-8') + } + + /** + * + * Constructs a workflow message callback URL for the specified message type and correlator. + * This type of callback URL is used when a workflow wants a system outside the MSO complex + * to call it back through the Workflow Message Adapter. + * @param messageType the message type (e.g. SNIROResponse) + * @param correlator the correlator value (e.g. a request ID) + */ + public String createWorkflowMessageAdapterCallbackURL(DelegateExecution execution, String messageType, String correlator) { + String endpoint = UrnPropertiesReader.getVariable("mso.adapters.workflow.message.endpoint", execution) + + if (endpoint == null || endpoint.isEmpty()) { + ExceptionUtil exceptionUtil = new ExceptionUtil() + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, + 'mso:adapters:workflow:message:endpoint URN mapping is not set') + } + + while (endpoint.endsWith('/')) { + endpoint = endpoint.substring(0, endpoint.length()-1) + } + + return endpoint + + '/' + UriUtils.encodePathSegment(messageType, 'UTF-8') + + '/' + UriUtils.encodePathSegment(correlator, 'UTF-8') + } + + public void setRollbackEnabled(DelegateExecution execution, isDebugLogEnabled) { + + // Rollback settings + def prefix = execution.getVariable('prefix') + def disableRollback = execution.getVariable("disableRollback") + def defaultRollback = UrnPropertiesReader.getVariable("mso.rollback", execution).toBoolean() + + logDebug('disableRollback: ' + disableRollback, isDebugLogEnabled) + logDebug('defaultRollback: ' + defaultRollback, isDebugLogEnabled) + + def rollbackEnabled + + if(disableRollback == null || disableRollback == '' ) { + // get from default urn settings for mso_rollback + disableRollback = !defaultRollback + rollbackEnabled = defaultRollback + logDebug('disableRollback is null or empty!', isDebugLogEnabled) + } + else { + if(disableRollback == true) { + rollbackEnabled = false + } + else if(disableRollback == false){ + rollbackEnabled = true + } + else { + rollbackEnabled = defaultRollback + } + } + + execution.setVariable(prefix+"backoutOnFailure", rollbackEnabled) + logDebug('rollbackEnabled (aka backoutOnFailure): ' + rollbackEnabled, isDebugLogEnabled) + } + + public void setBasicDBAuthHeader(DelegateExecution execution, isDebugLogEnabled) { + try { + String basicAuthValueDB = UrnPropertiesReader.getVariable("mso.adapters.db.auth", execution) + utils.log("DEBUG", " Obtained BasicAuth userid password for Catalog DB adapter: " + basicAuthValueDB, isDebugLogEnabled) + + def encodedString = utils.getBasicAuth(basicAuthValueDB, UrnPropertiesReader.getVariable("mso.msoKey", execution)) + execution.setVariable("BasicAuthHeaderValueDB",encodedString) + } catch (IOException ex) { + String dataErrorMessage = " Unable to encode Catalog DB user/password string - " + ex.getMessage() + utils.log("DEBUG", dataErrorMessage, isDebugLogEnabled) + (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + } + } }
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/AllottedResourceUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtils.groovy index fc099caa5f..b054c0f934 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/AllottedResourceUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtils.groovy @@ -1,333 +1,343 @@ -package org.openecomp.mso.bpmn.common.scripts
-
-import org.apache.commons.lang3.StringEscapeUtils;
-import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.delegate.DelegateExecution;
-import org.openecomp.mso.bpmn.core.WorkflowException
-import org.openecomp.mso.rest.APIResponse;
-
-
-import org.apache.commons.lang3.*
-import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.delegate.DelegateExecution;
-
-import groovy.util.XmlParser
-import groovy.util.Node
-import static org.apache.commons.lang3.StringUtils.*;
-
-class AllottedResourceUtils {
-
- private AbstractServiceTaskProcessor taskProcessor
- ExceptionUtil exceptionUtil = new ExceptionUtil()
- MsoUtils utils;
-
- public AllottedResourceUtils(AbstractServiceTaskProcessor taskProcessor) {
- this.taskProcessor = taskProcessor
- this.utils = taskProcessor.utils
- }
-
- /*Used on Create - called from DoCreate
- * Using Consuming ServiceInstanceId get related Allotted Resources Orchestration status from AAI
- * 1) get related AR links for CSI 2) get AR from AR links
- * return: null -> AR Not found
- * return: " " -> AR found with empty orchStatus
- * return: orchStatus - > AR found with this orchStatus
- * setsVariable aaiARGetResponse
- */
- public String getAROrchStatus (DelegateExecution execution) {
-
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- utils.log("DEBUG"," ***** getAROrchStatus *****", isDebugEnabled)
- String msg = ""
- String serviceInstanceId = execution.getVariable("serviceInstanceId")
- String arType = execution.getVariable("allottedResourceType")
- String arRole = execution.getVariable("allottedResourceRole")
- String siXml = execution.getVariable("CSI_service")
- String ar = null
- String orchStatus = null
- XmlParser xmlParser = new XmlParser()
- utils.log("DEBUG","getAROrchStatus siXml:" + siXml, isDebugEnabled)
- try {
- if (!isBlank(siXml)) {
- def groovy.util.Node siNode = xmlParser.parseText(siXml)
- def groovy.util.Node relationshipList = utils.getChildNode(siNode, 'relationship-list')
- if (relationshipList != null) {
- def groovy.util.NodeList relationships = utils.getIdenticalChildren(relationshipList, 'relationship')
- for (groovy.util.Node relationship in relationships) {
- def groovy.util.Node relatedTo = utils.getChildNode(relationship, 'related-to')
- if ((relatedTo != null) && (relatedTo.text().equals('allotted-resource'))) {
- utils.log("DEBUG","getARORchStatus AR found", isDebugEnabled)
- def groovy.util.Node relatedLink = utils.getChildNode(relationship, 'related-link')
- if (relatedLink != null){
- ar = getARbyLink(execution, relatedLink.text(), arRole)
- if (!isBlank(ar))
- {
- orchStatus = execution.getVariable("aaiAROrchStatus")
- break
- }
- }
- }
- }
- }
- }
- }catch(Exception e){
- utils.log("DEBUG", " Error encountered in getAROrchStatus" + e.getMessage(), isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error in getAROrchStatus" + e.getMessage())
- }
- utils.log("DEBUG"," *****Exit getAROrchStatus **** OrchStatus:" + orchStatus, isDebugEnabled)
- return orchStatus
- }
-
- // get Allotted Resource by AllottedResourceId
- // used on Delete - called from doDeleteAR
- // setsVariable aaiARGetResponse
- public String getARbyId (DelegateExecution execution, String allottedResourceId) {
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- utils.log("DEBUG", " ***** getARbyId ***** ", isDebugEnabled)
- String arLink = getARLinkbyId(execution, allottedResourceId)
- String ar = null
- if (!isBlank(arLink))
- {
- ar = getARbyLink(execution, arLink, "")
- }
- utils.log("DEBUG", " ***** Exit GetARbyId ***** AR:" + ar, isDebugEnabled)
- return ar;
- }
-
- public String getPSIFmARLink(DelegateExecution execution, String arLink)
- {
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- // Path: /aai/{version}/business/customers/customer/{cust}/service-subscriptions/service-subscription/{subs}/service-instances/service-instance/{psiid}/allotted-resources/allotted-resource/{arid}
- utils.log("DEBUG", " ***** getPSIFmARLink ***** path:" + arLink, isDebugEnabled)
- String[] split = arLink.split("/service-instance/")
- String[] splitB = split[1].split("/allotted-resources/")
- String siId = splitB[0]
- utils.log("DEBUG", " ***** Exit getARLinkbyId ***** parentServiceInstanceId:" + siId , isDebugEnabled)
- return siId
- }
-
- // get Allotted Resource Link by AllottedResourceId using Nodes Query
- // used on Delete - called from getARbyId
- public String getARLinkbyId (DelegateExecution execution, String allottedResourceId) {
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- utils.log("DEBUG", " ***** getARLinkbyId ***** ", isDebugEnabled)
- String arLink = null
- try {
- AaiUtil aaiUriUtil = new AaiUtil(taskProcessor)
- String aaiNQUri = aaiUriUtil.getSearchNodesQueryEndpoint(execution)
- String aaiEndpoint = execution.getVariable("URN_aai_endpoint")
- String aaiUrl = "${aaiNQUri}?search-node-type=allotted-resource&filter=id:EQUALS:${allottedResourceId}"
-
- utils.log("DEBUG", "getARLinkbyId url: \n" + aaiUrl, isDebugEnabled)
-
- APIResponse response = aaiUriUtil.executeAAIGetCall(execution, aaiUrl)
- int responseCode = response.getStatusCode()
- utils.log("DEBUG", " GET AR response code is: " + responseCode, isDebugEnabled)
-
- String aaiResponse = response.getResponseBodyAsString()
- aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse)
- utils.log("DEBUG", "GET AR:" + aaiResponse, isDebugEnabled)
- if(responseCode == 200 || responseCode == 202){
- utils.log("DEBUG", "GET AR Received a Good Response Code", isDebugEnabled)
- if(utils.nodeExists(aaiResponse, "result-data")){
- utils.log("DEBUG", "Query for AllottedResource Url Response Does Contain Data" , isDebugEnabled)
- arLink = utils.getNodeText1(aaiResponse, "resource-link")
- }else{
- utils.log("DEBUG", "GET AR Response Does NOT Contain Data" , isDebugEnabled)
- }
- }else if(responseCode == 404){
- utils.log("DEBUG", "GET AR received a Not Found (404) Response", isDebugEnabled)
- }
- else{
- utils.log("DEBUG", " GET AR received a Bad Response: \n" + aaiResponse, isDebugEnabled)
- buildAAIErrorResponse(execution, aaiResponse, "Error retrieving AR from AAI")
- }
- }catch(Exception e){
- utils.log("DEBUG", " Error encountered within GetAaiAR" + e.getMessage(), isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error in GetARbyId" + e.getMessage())
- }
- utils.log("DEBUG", " ***** Exit GetARLinkbyId ***** Link:" + arLink, isDebugEnabled)
- return arLink
- }
-
- // get Allotted resource using Link
- // used on Create called from getARORchStatus
- // used on Delete called from getARbyId
- // setsVariable aaiARPath - used for Patch in create
- public String getARbyLink (DelegateExecution execution, String link, String role) {
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- utils.log("DEBUG", " ***** getARbyLink ***** ", isDebugEnabled)
- String ar = null
- String arUrl = null
- try {
- AaiUtil aaiUriUtil = new AaiUtil(taskProcessor)
- String aai_endpoint = execution.getVariable("URN_aai_endpoint")
- String arEndpoint = ""
-
- if(!isBlank(link)) {
- utils.log("DEBUG", "Incoming AR Resource Link is: " + link, isDebugEnabled)
- String[] split = link.split("/aai/")
- arEndpoint = "/aai/" + split[1]
- }
-
- arUrl = "${aai_endpoint}" + arEndpoint
-
- utils.log("DEBUG", "GET AR Aai Path is: \n" + arUrl, isDebugEnabled)
-
- APIResponse response = aaiUriUtil.executeAAIGetCall(execution, arUrl)
- int responseCode = response.getStatusCode()
- utils.log("DEBUG", " GET AR response code is: " + responseCode, isDebugEnabled)
-
- String aaiResponse = response.getResponseBodyAsString()
- aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse)
- utils.log("DEBUG", "GET AR:" + aaiResponse, isDebugEnabled)
- if(responseCode == 200 || responseCode == 202){
- utils.log("DEBUG", "GET AR Received a Good Response Code", isDebugEnabled)
- if(utils.nodeExists(aaiResponse, "allotted-resource")){
- if (!isBlank(role))
- {
- if (utils.nodeExists(aaiResponse, "role") && role.equals(utils.getNodeText1(aaiResponse, "role"))) {
- ar = aaiResponse
- }else{
- utils.log("DEBUG", "AAI AR does not match input role:" + role, isDebugEnabled)
- }
- }
- else
- {
- ar = aaiResponse
- }
- }
- else
- {
- utils.log("DEBUG", "GET AR Does NOT Contain Data" , isDebugEnabled)
- }
- }else if(responseCode == 404){
- utils.log("DEBUG", "GET AR received a Not Found (404) Response", isDebugEnabled)
- }
- else{
- utils.log("DEBUG", " GET AR received a Bad Response: \n" + aaiResponse, isDebugEnabled)
- buildAAIErrorResponse(execution, aaiResponse, "Error retrieving AR from AAI")
- }
- }catch(Exception e){
- utils.log("DEBUG", " Error encountered within GetAaiAR" + e.getMessage(), isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error in GetAaiAR" + e.getMessage())
- }
- if (!isBlank(ar))
- {
- execution.setVariable("aaiARGetResponse", ar)
- execution.setVariable("aaiARPath", arUrl)
-
- String resourceVersion = null
- if (utils.nodeExists(ar, "resource-version")) {
- resourceVersion = utils.getNodeText1(ar, "resource-version")
- execution.setVariable("aaiARResourceVersion", resourceVersion)
- }
-
- String orchStatus = null
- if (utils.nodeExists(ar, "orchestration-status")) {
- orchStatus= utils.getNodeText1(ar, "orchestration-status")
- }
- else
- {
- orchStatus = " "
- }
- execution.setVariable("aaiAROrchStatus", orchStatus)
- }
- utils.log("DEBUG", " ***** Exit GetARbyLink ***** AR:" + ar, isDebugEnabled)
- return ar
- }
-
- public void updateAROrchStatus(DelegateExecution execution, String status, String aaiARPath){
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- utils.log("DEBUG", " *** updaAROrchStatus *** ", isDebugEnabled)
- try{
-
- String updateReq = """
- {
- "orchestration-status": "${status}"
- }
- """
-
- utils.log("DEBUG", 'AAI AR URI: ' + aaiARPath, isDebugEnabled)
-
- AaiUtil aaiUriUtil = new AaiUtil(taskProcessor)
- APIResponse apiResponse = aaiUriUtil.executeAAIPatchCall(execution, aaiARPath, updateReq)
- def aaiResponse = StringEscapeUtils.unescapeXml(apiResponse.getResponseBodyAsString())
- def responseCode = apiResponse.getStatusCode()
-
- utils.logAudit("AAI Response Code: " + responseCode)
- utils.logAudit("AAI Response: " + aaiResponse)
- if(responseCode == 200){
- utils.log("DEBUG", "UpdateAR Good REST Response is: " + "\n" + aaiResponse, isDebugEnabled)
- }else{
- utils.log("DEBUG", "UpdateAROrchStatus Bad REST Response!", isDebugEnabled)
- buildAAIErrorResponse(execution, aaiResponse, "Error updating AR OrchStatus in AAI")
- }
-
- }catch(BpmnError b){
- utils.log("DEBUG", "Rethrowing MSOWorkflowException ", isDebugEnabled)
- throw b
- }catch(Exception e){
- utils.log("ERROR", "Exception in updateAR. Exception is:\n" + e.getMessage(), isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, 'Internal Error in updateAROrchStatus.' + e.getMessage())
- }
- utils.log("DEBUG", " *** Exit updateAROrchStatus *** ", isDebugEnabled)
- }
-
- //Sets Variable "wasDeleted"
- public void deleteAR(DelegateExecution execution, String aaiARPath){
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- utils.log("DEBUG", " *** deleteAR *** aaiARPath:" + aaiARPath, isDebugEnabled)
- try {
- AaiUtil aaiUriUtil = new AaiUtil(taskProcessor)
- APIResponse response = aaiUriUtil.executeAAIDeleteCall(execution, aaiARPath)
- int responseCode = response.getStatusCode()
- execution.setVariable("deleteARResponseCode", responseCode)
-
- utils.log("DEBUG", " Delete AR response code:" + responseCode, isDebugEnabled)
-
- String aaiResponse = response.getResponseBodyAsString()
- aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse)
- execution.setVariable("aaiARDeleteResponse", aaiResponse)
-
- utils.log("DEBUG", "Delete AR Response:" + aaiResponse)
- //Process Response
- if(responseCode == 204){
- utils.log("DEBUG", " Delete AR Received a Good Response", isDebugEnabled)
- execution.setVariable("wasDeleted", "true")
- }else if(responseCode == 404){
- utils.log("DEBUG", " Delete AR Received a Not Found (404) Response", isDebugEnabled)
- }else if(responseCode == 412){
- utils.log("DEBUG", "Delete AR Received a Resource Version Mismatch Error: \n" + aaiResponse, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 412, "DeleteAR Received a resource-version Mismatch Error Response from AAI")
- }else{
- utils.log("DEBUG", "Delete AR Received a BAD REST Response: \n" + aaiResponse, isDebugEnabled)
- buildAAIErrorResponse(execution, aaiResponse, "Error deleting AR in AAI")
- exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode)
- }
- }catch(BpmnError b){
- utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled)
- throw b
- }catch(Exception e){
- utils.log("DEBUG", " Error encountered in deleteAR!" + e, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During Delete AR")
- }
- utils.log("DEBUG", " *** Exit deleteAR *** ", isDebugEnabled)
- }
-
- public void buildAAIErrorResponse(DelegateExecution execution, String response, String errorMessage){
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- utils.log("DEBUG", " *** BuildAAIErrorResponse*** ", isDebugEnabled)
-
- if((response != null) && (response.contains("Fault") || response.contains("RESTFault"))){
- WorkflowException workflowException = exceptionUtil.MapAAIExceptionToWorkflowException(response, execution)
- execution.setVariable("WorkflowException", workflowException)
- }else{
- exceptionUtil.buildWorkflowException(execution, 500, errorMessage)
- }
-
- utils.log("DEBUG", " *** Exit BuildAAIErrorResponse Process*** ", isDebugEnabled)
- throw new BpmnError("MSOWorkflowException")
- }
-
-}
\ No newline at end of file +/*- + * ============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.common.scripts + +import static org.apache.commons.lang3.StringUtils.*; + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger +import org.onap.so.rest.APIResponse; + + + +class AllottedResourceUtils { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, AllottedResourceUtils.class); + + + private AbstractServiceTaskProcessor taskProcessor + ExceptionUtil exceptionUtil = new ExceptionUtil() + MsoUtils utils; + + public AllottedResourceUtils(AbstractServiceTaskProcessor taskProcessor) { + this.taskProcessor = taskProcessor + this.utils = taskProcessor.utils + } + + /*Used on Create - called from DoCreate + * Using Consuming ServiceInstanceId get related Allotted Resources Orchestration status from AAI + * 1) get related AR links for CSI 2) get AR from AR links + * return: null -> AR Not found + * return: " " -> AR found with empty orchStatus + * return: orchStatus - > AR found with this orchStatus + * setsVariable aaiARGetResponse + */ + public String getAROrchStatus (DelegateExecution execution) { + + msoLogger.trace("getAROrchStatus ") + String msg = "" + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String arType = execution.getVariable("allottedResourceType") + String arRole = execution.getVariable("allottedResourceRole") + String siXml = execution.getVariable("CSI_service") + String ar = null + String orchStatus = null + XmlParser xmlParser = new XmlParser() + msoLogger.debug("getAROrchStatus siXml:" + siXml) + try { + if (!isBlank(siXml)) { + def groovy.util.Node siNode = xmlParser.parseText(siXml) + def groovy.util.Node relationshipList = utils.getChildNode(siNode, 'relationship-list') + if (relationshipList != null) { + def groovy.util.NodeList relationships = utils.getIdenticalChildren(relationshipList, 'relationship') + for (groovy.util.Node relationship in relationships) { + def groovy.util.Node relatedTo = utils.getChildNode(relationship, 'related-to') + if ((relatedTo != null) && (relatedTo.text().equals('allotted-resource'))) { + msoLogger.debug("getARORchStatus AR found") + def groovy.util.Node relatedLink = utils.getChildNode(relationship, 'related-link') + if (relatedLink != null){ + ar = getARbyLink(execution, relatedLink.text(), arRole) + if (!isBlank(ar)) + { + orchStatus = execution.getVariable("aaiAROrchStatus") + break + } + } + } + } + } + } + }catch(Exception e){ + msoLogger.debug(" Error encountered in getAROrchStatus" + e.getMessage()) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error in getAROrchStatus" + e.getMessage()) + } + msoLogger.trace(" Exit getAROrchStatus - OrchStatus:" + orchStatus) + return orchStatus + } + + // get Allotted Resource by AllottedResourceId + // used on Delete - called from doDeleteAR + // setsVariable aaiARGetResponse + public String getARbyId (DelegateExecution execution, String allottedResourceId) { + msoLogger.trace("getARbyId ") + String arLink = getARLinkbyId(execution, allottedResourceId) + String ar = null + if (!isBlank(arLink)) + { + ar = getARbyLink(execution, arLink, "") + } + msoLogger.trace(" Exit GetARbyId - AR:" + ar) + return ar; + } + + public String getPSIFmARLink(DelegateExecution execution, String arLink) + { + // Path: /aai/{version}/business/customers/customer/{cust}/service-subscriptions/service-subscription/{subs}/service-instances/service-instance/{psiid}/allotted-resources/allotted-resource/{arid} + msoLogger.trace(" getPSIFmARLink - path:" + arLink) + String[] split = arLink.split("/service-instance/") + String[] splitB = split[1].split("/allotted-resources/") + String siId = splitB[0] + msoLogger.trace(" Exit getARLinkbyId - parentServiceInstanceId:" + siId ) + return siId + } + + // get Allotted Resource Link by AllottedResourceId using Nodes Query + // used on Delete - called from getARbyId + public String getARLinkbyId (DelegateExecution execution, String allottedResourceId) { + msoLogger.trace("getARLinkbyId ") + String arLink = null + try { + AaiUtil aaiUriUtil = new AaiUtil(taskProcessor) + String aaiNQUri = aaiUriUtil.getSearchNodesQueryEndpoint(execution) + String aaiEndpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + String aaiUrl = "${aaiNQUri}?search-node-type=allotted-resource&filter=id:EQUALS:${allottedResourceId}" + + msoLogger.debug("getARLinkbyId url: \n" + aaiUrl) + + APIResponse response = aaiUriUtil.executeAAIGetCall(execution, aaiUrl) + int responseCode = response.getStatusCode() + msoLogger.debug(" GET AR response code is: " + responseCode) + + String aaiResponse = response.getResponseBodyAsString() + msoLogger.debug("GET AR:" + aaiResponse) + if(responseCode == 200 || responseCode == 202){ + msoLogger.debug("GET AR Received a Good Response Code") + if(utils.nodeExists(aaiResponse, "result-data")){ + msoLogger.debug("Query for AllottedResource Url Response Does Contain Data" ) + arLink = utils.getNodeText(aaiResponse, "resource-link") + }else{ + msoLogger.debug("GET AR Response Does NOT Contain Data" ) + } + }else if(responseCode == 404){ + msoLogger.debug("GET AR received a Not Found (404) Response") + } + else{ + msoLogger.debug(" GET AR received a Bad Response: \n" + aaiResponse) + buildAAIErrorResponse(execution, aaiResponse, "Error retrieving AR from AAI") + } + }catch(Exception e){ + msoLogger.debug(" Error encountered within GetAaiAR" + e.getMessage()) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error in GetARbyId" + e.getMessage()) + } + msoLogger.trace(" Exit GetARLinkbyId - Link:" + arLink) + return arLink + } + + // get Allotted resource using Link + // used on Create called from getARORchStatus + // used on Delete called from getARbyId + // setsVariable aaiARPath - used for Patch in create + public String getARbyLink (DelegateExecution execution, String link, String role) { + msoLogger.trace("getARbyLink ") + String ar = null + String arUrl = null + try { + AaiUtil aaiUriUtil = new AaiUtil(taskProcessor) + String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + String arEndpoint = "" + + if(!isBlank(link)) { + msoLogger.debug("Incoming AR Resource Link is: " + link) + String[] split = link.split("/aai/") + arEndpoint = "/aai/" + split[1] + } + + arUrl = "${aai_endpoint}" + arEndpoint + + msoLogger.debug("GET AR Aai Path is: \n" + arUrl) + + APIResponse response = aaiUriUtil.executeAAIGetCall(execution, arUrl) + int responseCode = response.getStatusCode() + msoLogger.debug(" GET AR response code is: " + responseCode) + + String aaiResponse = response.getResponseBodyAsString() + msoLogger.debug("GET AR:" + aaiResponse) + if(responseCode == 200 || responseCode == 202){ + msoLogger.debug("GET AR Received a Good Response Code") + if(utils.nodeExists(aaiResponse, "allotted-resource")){ + if (!isBlank(role)) + { + if (utils.nodeExists(aaiResponse, "role") && role.equals(utils.getNodeText(aaiResponse, "role"))) { + ar = aaiResponse + }else{ + msoLogger.debug("AAI AR does not match input role:" + role) + } + } + else + { + ar = aaiResponse + } + } + else + { + msoLogger.debug("GET AR Does NOT Contain Data" ) + } + }else if(responseCode == 404){ + msoLogger.debug("GET AR received a Not Found (404) Response") + } + else{ + msoLogger.debug(" GET AR received a Bad Response: \n" + aaiResponse) + buildAAIErrorResponse(execution, aaiResponse, "Error retrieving AR from AAI") + } + }catch(Exception e){ + msoLogger.debug(" Error encountered within GetAaiAR" + e.getMessage()) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error in GetAaiAR" + e.getMessage()) + } + if (!isBlank(ar)) + { + execution.setVariable("aaiARGetResponse", ar) + execution.setVariable("aaiARPath", arUrl) + + String resourceVersion = null + if (utils.nodeExists(ar, "resource-version")) { + resourceVersion = utils.getNodeText(ar, "resource-version") + execution.setVariable("aaiARResourceVersion", resourceVersion) + } + + String orchStatus = null + if (utils.nodeExists(ar, "orchestration-status")) { + orchStatus= utils.getNodeText(ar, "orchestration-status") + } + else + { + orchStatus = " " + } + execution.setVariable("aaiAROrchStatus", orchStatus) + } + msoLogger.trace(" Exit GetARbyLink - AR:" + ar) + return ar + } + + public void updateAROrchStatus(DelegateExecution execution, String status, String aaiARPath){ + msoLogger.trace("updaAROrchStatus ") + try{ + + String updateReq = """ + { + "orchestration-status": "${status}" + } + """ + + msoLogger.debug('AAI AR URI: ' + aaiARPath) + + AaiUtil aaiUriUtil = new AaiUtil(taskProcessor) + APIResponse apiResponse = aaiUriUtil.executeAAIPatchCall(execution, aaiARPath, updateReq) + def aaiResponse = apiResponse.getResponseBodyAsString() + def responseCode = apiResponse.getStatusCode() + + msoLogger.debug("AAI Response Code: " + responseCode) + msoLogger.debug("AAI Response: " + aaiResponse) + if(responseCode == 200){ + msoLogger.debug("UpdateAR Good REST Response is: " + "\n" + aaiResponse) + }else{ + msoLogger.debug("UpdateAROrchStatus Bad REST Response!") + buildAAIErrorResponse(execution, aaiResponse, "Error updating AR OrchStatus in AAI") + } + + }catch(BpmnError b){ + msoLogger.debug("Rethrowing MSOWorkflowException ") + throw b + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in updateAR.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.getMessage()); + exceptionUtil.buildAndThrowWorkflowException(execution, 500, 'Internal Error in updateAROrchStatus.' + e.getMessage()) + } + msoLogger.trace("Exit updateAROrchStatus ") + } + + //Sets Variable "wasDeleted" + public void deleteAR(DelegateExecution execution, String aaiARPath){ + msoLogger.trace(" deleteAR - aaiARPath:" + aaiARPath) + try { + AaiUtil aaiUriUtil = new AaiUtil(taskProcessor) + APIResponse response = aaiUriUtil.executeAAIDeleteCall(execution, aaiARPath) + int responseCode = response.getStatusCode() + execution.setVariable("deleteARResponseCode", responseCode) + + msoLogger.debug(" Delete AR response code:" + responseCode) + + String aaiResponse = response.getResponseBodyAsString() + execution.setVariable("aaiARDeleteResponse", aaiResponse) + + msoLogger.debug("Delete AR Response:" + aaiResponse) + + //Process Response + if(responseCode == 204){ + msoLogger.debug(" Delete AR Received a Good Response") + execution.setVariable("wasDeleted", "true") + }else if(responseCode == 404){ + msoLogger.debug(" Delete AR Received a Not Found (404) Response") + }else if(responseCode == 412){ + msoLogger.debug("Delete AR Received a Resource Version Mismatch Error: \n" + aaiResponse) + exceptionUtil.buildAndThrowWorkflowException(execution, 412, "DeleteAR Received a resource-version Mismatch Error Response from AAI") + }else{ + msoLogger.debug("Delete AR Received a BAD REST Response: \n" + aaiResponse) + buildAAIErrorResponse(execution, aaiResponse, "Error deleting AR in AAI") + exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) + } + }catch(BpmnError b){ + msoLogger.debug("Rethrowing MSOWorkflowException") + throw b + }catch(Exception e){ + msoLogger.debug(" Error encountered in deleteAR!" + e) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During Delete AR") + } + msoLogger.trace("Exit deleteAR ") + } + + public void buildAAIErrorResponse(DelegateExecution execution, String response, String errorMessage){ + msoLogger.trace("BuildAAIErrorResponse") + + if((response != null) && (response.contains("Fault") || response.contains("RESTFault"))){ + WorkflowException workflowException = exceptionUtil.MapAAIExceptionToWorkflowException(response, execution) + execution.setVariable("WorkflowException", workflowException) + }else{ + exceptionUtil.buildWorkflowException(execution, 500, errorMessage) + } + + msoLogger.trace("Exit BuildAAIErrorResponse Process") + throw new BpmnError("MSOWorkflowException") + } + +} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/AppCClient.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AppCClient.groovy index 535b65e187..bb1de36eac 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/AppCClient.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AppCClient.groovy @@ -1,20 +1,42 @@ -package org.openecomp.mso.bpmn.common.scripts +/*- + * ============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.common.scripts + +import org.onap.so.bpmn.core.UrnPropertiesReader import java.util.HashMap; import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.hibernate.event.internal.AbstractLockUpgradeEventListener -import org.openecomp.mso.bpmn.core.HealthCheckHandler -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.client.appc.ApplicationControllerOrchestrator -import org.openecomp.mso.client.appc.ApplicationControllerOrchestratorException +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.client.appc.ApplicationControllerOrchestrator +import org.onap.so.client.appc.ApplicationControllerOrchestratorException import org.onap.appc.client.lcm.model.Action import org.onap.appc.client.lcm.model.Status -import org.openecomp.mso.bpmn.appc.payload.PayloadClient -import org.openecomp.mso.bpmn.common.adapter.vnf.CreateVnfNotification.Outputs -import org.openecomp.mso.client.appc.ApplicationControllerAction; +import org.onap.so.bpmn.appc.payload.PayloadClient +import org.onap.so.client.appc.ApplicationControllerAction; import groovy.transform.TypeChecked; import java.util.UUID; +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger /** * This groovy class supports the <class>AppCClient.bpmn</class> process. @@ -27,37 +49,32 @@ import java.util.UUID; * @param - vnfId * @param - action * @param - payload - * @param - vnfName - * @param - controllerType - * + * * Outputs: * @param - errorcode * @param - errorText * @param - responsePayload * @param - healthCheckIndex * @param - workstep - * @param - rollbackVnfStop - * @param - rollbackVnfLock - * @param - rollbackQuiesceTraffic */ public class AppCClient extends AbstractServiceTaskProcessor{ - + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, AppCClient.class); + ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtils = new JsonUtils() def prefix = "UPDVnfI_" - public void preProcessRequest(DelegateExecution execution){ + public void preProcessRequest(DelegateExecution execution){ } public void runAppcCommand(DelegateExecution execution) { - String isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - utils.log("DEBUG", "***** Start runCommand *****", isDebugLogEnabled) + msoLogger.trace("Start runCommand ") def method = getClass().getSimpleName() + '.runAppcCommand(' + 'execution=' + execution.getId() + ')' - logDebug('Entered ' + method, isDebugLogEnabled) + msoLogger.trace('Entered ' + method) execution.setVariable("rollbackVnfStop", false) execution.setVariable("rollbackVnfLock", false) execution.setVariable("rollbackQuiesceTraffic", false) @@ -73,19 +90,21 @@ public class AppCClient extends AbstractServiceTaskProcessor{ String aicIdentity = execution.getVariable('aicIdentity') String vnfHostIpAddress = execution.getVariable('vnfHostIpAddress') String vmIdList = execution.getVariable("vmIdList") + String vserverIdList = execution.getVariable("vserverIdList") String identityUrl = execution.getVariable("identityUrl") - String controllerType = execution.getVariable("controllerType") + String controllerType = execution.getVariable("controllerType") String vfModuleId = execution.getVariable("vfModuleId") - HashMap<String, String> payloadInfo = new HashMap<String, String>(); + HashMap<String, String> payloadInfo = new HashMap<String, String>(); payloadInfo.put("vnfName", vnfName) payloadInfo.put("aicIdentity", aicIdentity) payloadInfo.put("vnfHostIpAddress", vnfHostIpAddress) payloadInfo.put("vmIdList", vmIdList) + payloadInfo.put("vserverIdList", vserverIdList) payloadInfo.put("identityUrl", identityUrl) payloadInfo.put("vfModuleId",vfModuleId) Optional<String> payload - logDebug("Running APP-C action: " + action.toString(), isDebugLogEnabled) - utils.log("DEBUG", "VNFID: " + vnfId, isDebugLogEnabled) + msoLogger.debug("Running APP-C action: " + action.toString()) + msoLogger.debug("VNFID: " + vnfId) execution.setVariable('msoRequestId', msoRequestId) execution.setVariable("failedActivity", "APP-C") execution.setVariable('workStep', action.toString()) @@ -99,17 +118,17 @@ public class AppCClient extends AbstractServiceTaskProcessor{ execution.setVariable('healthCheckIndex', healthCheckIndex + 1) } ApplicationControllerAction client = new ApplicationControllerAction() - utils.log("DEBUG", "Created Application Controller Action Object", isDebugLogEnabled) + msoLogger.debug("Created Application Controller Action Object") //PayloadInfo contains extra information that adds on to payload before making request to appc client.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType) - utils.log("DEBUG", "ran through the main method for Application Contoller", isDebugLogEnabled) + msoLogger.debug("ran through the main method for Application Contoller") appcCode = client.getErrorCode() appcMessage = client.getErrorMessage() } catch (BpmnError e) { - logError('Caught exception in ' + method, e) + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); appcMessage = e.getMessage() - } + } execution.setVariable("errorCode", appcCode) if (appcCode == '0' && action != null) { if (action.equals(Action.Lock)) { @@ -133,8 +152,8 @@ public class AppCClient extends AbstractServiceTaskProcessor{ } execution.setVariable("errorText", appcMessage) execution.setVariable("responsePayload", responsePayload) - utils.log("DEBUG", "Error Message: " + appcMessage, isDebugLogEnabled) - utils.log("DEBUG","ERROR CODE: " + execution.getVariable("errorCode"), isDebugLogEnabled) - utils.log("DEBUG", "***** End of runCommand *****", isDebugLogEnabled) - } -}
\ No newline at end of file + msoLogger.debug("Error Message: " + appcMessage) + msoLogger.debug("ERROR CODE: " + execution.getVariable("errorCode")) + msoLogger.trace("End of runCommand ") + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CatalogDbUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy index 7fcf310210..9ce29dedb8 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CatalogDbUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy @@ -1,1251 +1,1311 @@ -/*-
- * ============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.common.scripts
-
-import org.json.JSONObject;
-import org.json.JSONArray;
-import org.json.XML;
-import org.springframework.web.util.UriUtils;
-
-import org.openecomp.mso.bpmn.core.json.JsonUtils
-
-
-import groovy.json.JsonBuilder
-import groovy.json.JsonSlurper
-import groovy.util.slurpersupport.GPathResult
-import groovy.xml.QName;
-
-import org.camunda.bpm.engine.delegate.DelegateExecution
-
-import org.openecomp.mso.logger.MsoLogger;
-import org.openecomp.mso.rest.APIResponse;
-import org.openecomp.mso.rest.RESTClient
-import org.openecomp.mso.rest.RESTConfig
-
-
-/***
- * Utilities for accessing Catalog DB Adapter to retrieve Networks, VNF/VFModules, AllottedResources and complete ServiceResources information
- *
- */
-
-class CatalogDbUtils {
-
- MsoUtils utils = new MsoUtils()
- JsonUtils jsonUtils = new JsonUtils()
- MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
- static private String defaultDbAdapterVersion = "v2"
-
- public JSONArray getAllNetworksByServiceModelUuid(DelegateExecution execution, String serviceModelUuid) {
- JSONArray networksList = null
- String endPoint = "/serviceNetworks?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8")
- try {
- String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
-
- if (catalogDbResponse != null) {
- networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", "v1")
- }
-
- }
- catch (Exception e) {
- utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
- }
-
- return networksList
- }
-
- public JSONArray getAllNetworksByServiceModelUuid(DelegateExecution execution, String serviceModelUuid, String catalogUtilsVersion) {
- JSONArray networksList = null
- String endPoint = "/serviceNetworks?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8")
- try {
- String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
-
- if (catalogDbResponse != null) {
- if (!catalogUtilsVersion.equals("v1")) {
- JSONObject responseJson = new JSONObject(catalogDbResponse)
- networksList = responseJson.getJSONArray("serviceNetworks")
- }
- else {
- networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", catalogUtilsVersion)
- }
- }
-
- }
- catch (Exception e) {
- utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
- }
-
- return networksList
- }
-
- public JSONArray getAllNetworksByServiceModelInvariantUuid(DelegateExecution execution, String serviceModelInvariantUuid) {
- JSONArray networksList = null
- String endPoint = "/serviceNetworks?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8")
- try {
- String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
-
- if (catalogDbResponse != null) {
- networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", "v1")
- }
-
- }
- catch (Exception e) {
- utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
- }
-
- return networksList
- }
-
- public JSONArray getAllNetworksByServiceModelInvariantUuid(DelegateExecution execution, String serviceModelInvariantUuid, String catalogUtilsVersion) {
- JSONArray networksList = null
- String endPoint = "/serviceNetworks?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8")
- try {
- String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
-
- if (catalogDbResponse != null) {
- if (!catalogUtilsVersion.equals("v1")) {
- JSONObject responseJson = new JSONObject(catalogDbResponse)
- networksList = responseJson.getJSONArray("serviceNetworks")
- }
- else {
- networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", catalogUtilsVersion)
- }
- }
-
- }
- catch (Exception e) {
- utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
- }
-
- return networksList
- }
-
- public JSONArray getAllNetworksByServiceModelInvariantUuidAndServiceModelVersion(DelegateExecution execution, String serviceModelInvariantUuid, String serviceModelVersion) {
- JSONArray networksList = null
- String endPoint = "/serviceNetworks?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8")
- try {
- String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
-
- if (catalogDbResponse != null) {
- networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", "v1")
- }
-
- }
- catch (Exception e) {
- utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
- }
-
- return networksList
- }
-
- public JSONArray getAllNetworksByServiceModelInvariantUuidAndServiceModelVersion(DelegateExecution execution, String serviceModelInvariantUuid, String serviceModelVersion, String catalogUtilsVersion) {
- JSONArray networksList = null
- String endPoint = "/serviceNetworks?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8")
- try {
- String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
-
- if (catalogDbResponse != null) {
- if (!catalogUtilsVersion.equals("v1")) {
- JSONObject responseJson = new JSONObject(catalogDbResponse)
- networksList = responseJson.getJSONArray("serviceNetworks")
- }
- else {
- networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", catalogUtilsVersion)
- }
- }
-
- }
- catch (Exception e) {
- utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
- }
-
- return networksList
- }
-
- public JSONArray getAllNetworksByNetworkModelCustomizationUuid(DelegateExecution execution, String networkModelCustomizationUuid) {
- JSONArray networksList = null
- String endPoint = "/serviceNetworks?networkModelCustomizationUuid=" + UriUtils.encode(networkModelCustomizationUuid, "UTF-8")
- try {
- String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
-
- if (catalogDbResponse != null) {
- networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", "v1")
- }
-
- }
- catch (Exception e) {
- utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
- }
-
- return networksList
- }
-
- public JSONArray getAllNetworksByNetworkModelCustomizationUuid(DelegateExecution execution, String networkModelCustomizationUuid, String catalogUtilsVersion) {
- JSONArray networksList = null
- String endPoint = "/serviceNetworks?networkModelCustomizationUuid=" + UriUtils.encode(networkModelCustomizationUuid, "UTF-8")
- try {
- String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
-
- if (catalogDbResponse != null) {
- if (!catalogUtilsVersion.equals("v1")) {
- JSONObject responseJson = new JSONObject(catalogDbResponse)
- networksList = responseJson.getJSONArray("serviceNetworks")
- }
- else {
- networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", catalogUtilsVersion)
- }
- }
-
- }
- catch (Exception e) {
- utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
- }
-
- return networksList
- }
-
- public JSONArray getAllNetworksByNetworkType(DelegateExecution execution, String networkType) {
- JSONArray networksList = null
- String endPoint = "/serviceNetworks?networkType=" + UriUtils.encode(networkType, "UTF-8")
- try {
- String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
-
- if (catalogDbResponse != null) {
- networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", "v1")
- }
-
- }
- catch (Exception e) {
- utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
- }
-
- return networksList
- }
-
- public JSONArray getAllNetworksByNetworkType(DelegateExecution execution, String networkType, String catalogUtilsVersion) {
- JSONArray networksList = null
- String endPoint = "/serviceNetworks?networkType=" + UriUtils.encode(networkType, "UTF-8")
- try {
- String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
-
- if (catalogDbResponse != null) {
- if (!catalogUtilsVersion.equals("v1")) {
- JSONObject responseJson = new JSONObject(catalogDbResponse)
- networksList = responseJson.getJSONArray("serviceNetworks")
- }
- else {
- networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", catalogUtilsVersion)
- }
- }
-
- }
- catch (Exception e) {
- utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
- }
-
- return networksList
- }
-
-
- public JSONArray getAllVnfsByServiceModelUuid(DelegateExecution execution, String serviceModelUuid) {
- JSONArray vnfsList = null
- String endPoint = "/serviceVnfs?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8")
- try {
- msoLogger.debug("ENDPOINT: " + endPoint)
- String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
-
- if (catalogDbResponse != null) {
- vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", "v1")
- }
-
- }
- catch (Exception e) {
- utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
- }
-
- return vnfsList
- }
-
- public JSONArray getAllVnfsByServiceModelUuid(DelegateExecution execution, String serviceModelUuid, String catalogUtilsVersion) {
- JSONArray vnfsList = null
- String endPoint = "/serviceVnfs?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8")
- try {
- msoLogger.debug("ENDPOINT: " + endPoint)
- String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
-
- if (catalogDbResponse != null) {
- if (!catalogUtilsVersion.equals("v1")) {
- JSONObject responseJson = new JSONObject(catalogDbResponse)
- vnfsList = responseJson.getJSONArray("serviceVnfs")
- }
- else {
- vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", catalogUtilsVersion)
- }
- }
-
- }
- catch (Exception e) {
- utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
- }
-
- return vnfsList
- }
-
- public JSONArray getAllVnfsByServiceModelInvariantUuid(DelegateExecution execution, String serviceModelInvariantUuid) {
- JSONArray vnfsList = null
- String endPoint ="/serviceVnfs?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8")
- try {
- msoLogger.debug("ENDPOINT: " + endPoint)
- String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
-
- if (catalogDbResponse != null) {
- vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", "v1")
- }
-
- }
- catch (Exception e) {
- utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
- }
-
- return vnfsList
- }
-
- public JSONArray getAllVnfsByServiceModelInvariantUuid(DelegateExecution execution, String serviceModelInvariantUuid, String catalogUtilsVersion) {
- JSONArray vnfsList = null
- String endPoint = "/serviceVnfs?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8")
- try {
- msoLogger.debug("ENDPOINT: " + endPoint)
- String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
-
- if (catalogDbResponse != null) {
- if (!catalogUtilsVersion.equals("v1")) {
- JSONObject responseJson = new JSONObject(catalogDbResponse)
- vnfsList = responseJson.getJSONArray("serviceVnfs")
- }
- else {
- vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", catalogUtilsVersion)
- }
- }
-
- }
- catch (Exception e) {
- utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
- }
-
- return vnfsList
- }
-
- public JSONArray getAllVnfsByServiceModelInvariantUuidAndServiceModelVersion(DelegateExecution execution, String serviceModelInvariantUuid, String serviceModelVersion) {
- JSONArray vnfsList = null
- String endPoint = "/serviceVnfs?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8")
- try {
- msoLogger.debug("ENDPOINT: " + endPoint)
- String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
-
- if (catalogDbResponse != null) {
- vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", "v1")
- }
-
- }
- catch (Exception e) {
- utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
- }
-
- return vnfsList
- }
-
- public JSONArray getAllVnfsByServiceModelInvariantUuidAndServiceModelVersion(DelegateExecution execution, String serviceModelInvariantUuid, String serviceModelVersion, String catalogUtilsVersion) {
- JSONArray vnfsList = null
- String endPoint = "/serviceVnfs?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8")
- try {
- msoLogger.debug("ENDPOINT: " + endPoint)
- String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
-
- if (catalogDbResponse != null) {
- if (!catalogUtilsVersion.equals("v1")) {
- JSONObject responseJson = new JSONObject(catalogDbResponse)
- vnfsList = responseJson.getJSONArray("serviceVnfs")
- }
- else {
- vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", catalogUtilsVersion)
- }
- }
-
- }
- catch (Exception e) {
- utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
- }
-
- return vnfsList
- }
-
- public JSONArray getAllVnfsByVnfModelCustomizationUuid(DelegateExecution execution, String vnfModelCustomizationUuid) {
- JSONArray vnfsList = null
- String endPoint = "/serviceVnfs?vnfModelCustomizationUuid=" + UriUtils.encode(vnfModelCustomizationUuid, "UTF-8")
- try {
- msoLogger.debug("ENDPOINT: " + endPoint)
- String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
-
- if (catalogDbResponse != null) {
- vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", "v1")
- }
-
- }
- catch (Exception e) {
- utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
- }
-
- return vnfsList
- }
-
- /**
- * This method gets a all vnfs for a particular
- * service from the catalog database using the
- * service model's model name.
- *
- * @param catalogDbEndpoint
- * @param serviceModelModelName
- * @return vnfsList *
- *
- */
- public JSONArray getAllVnfsByServiceModelModelName(DelegateExecution execution, String serviceModelModelName) {
- JSONArray vnfsList = null
- String endPoint = "/serviceVnfs?serviceModelName=" + UriUtils.encode(serviceModelModelName, "UTF-8")
- try {
- msoLogger.debug("ENDPOINT: " + endPoint)
- String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
-
- if (catalogDbResponse != null) {
- vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", defaultDbAdapterVersion)
- }
- }catch (Exception e) {
- utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
- }
- return vnfsList
- }
-
- public JSONArray getAllVnfsByVnfModelCustomizationUuid(DelegateExecution execution, String vnfModelCustomizationUuid, String catalogUtilsVersion) {
- JSONArray vnfsList = null
- String endPoint = "/serviceVnfs?vnfModelCustomizationUuid=" + UriUtils.encode(vnfModelCustomizationUuid, "UTF-8")
- try {
- msoLogger.debug("ENDPOINT: " + endPoint)
- String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
-
- if (catalogDbResponse != null) {
- if (!catalogUtilsVersion.equals("v1")) {
- JSONObject responseJson = new JSONObject(catalogDbResponse)
- vnfsList = responseJson.getJSONArray("serviceVnfs")
- }
- else {
- vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", catalogUtilsVersion)
- }
- }
-
- }
- catch (Exception e) {
- utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
- }
-
- return vnfsList
- }
-
- /**
- * This method gets a single vf module from
- * the catalog database using the vf module's
- * model name. It returns that vf module as
- * a JSONObject
- *
- * @param catalogDbEndpoint
- * @param vfModuleModelName
- * @return vfModule
- */
- public JSONObject getVfModuleByVfModuleModelName(DelegateExecution execution, String vfModuleModelName) {
- JSONObject vfModule = null
- String endPoint = "/vfModules?vfModuleModelName=" + UriUtils.encode(vfModuleModelName, "UTF-8")
- try{
- msoLogger.debug("Get VfModule By VfModule ModelName Endpoint is: " + endPoint)
- String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
-
- if (catalogDbResponse != null) {
- vfModule = parseVfModuleJson(catalogDbResponse, "vfModules", "v1")
- }
- }
- catch(Exception e){
- utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
- }
-
- return vfModule
- }
-
- /**
- * This method gets a single vf module from
- * the catalog database using the vf module's
- * model name. It returns that vf module as
- * a JSONObject
- *
- * @param catalogDbEndpoint
- * @param vfModuleModelName
- * @param catalogUtilsVersion
- * @return vfModules
- */
- public JSONObject getVfModuleByVfModuleModelName(DelegateExecution execution, String vfModuleModelName, String catalogUtilsVersion) {
- JSONObject vfModule = null
- String endPoint = "/vfModules?vfModuleModelName=" + UriUtils.encode(vfModuleModelName, "UTF-8")
- try{
- msoLogger.debug("Get VfModule By VfModule ModelName Endpoint is: " + endPoint)
- String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
-
- if (catalogDbResponse != null) {
- vfModule = parseVfModuleJson(catalogDbResponse, "vfModules", "v1")
- }
- }
- catch(Exception e){
- utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
- }
-
- return vfModule
- }
-
-
- public JSONArray getAllottedResourcesByServiceModelUuid(DelegateExecution execution, String serviceModelUuid) {
- JSONArray vnfsList = null
- String endPoint = "/ServiceAllottedResources?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8")
- try {
- String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
-
- if (catalogDbResponse != null) {
- vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources", "v1")
- }
-
- }
- catch (Exception e) {
- utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
- }
-
- return vnfsList
- }
-
- public JSONArray getAllottedResourcesByServiceModelUuid(DelegateExecution execution, String serviceModelUuid, String catalogUtilsVersion) {
- JSONArray vnfsList = null
- String endPoint = "/ServiceAllottedResources?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8")
- try {
- String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
-
- if (catalogDbResponse != null) {
- if (!catalogUtilsVersion.equals("v1")) {
- JSONObject responseJson = new JSONObject(catalogDbResponse)
- vnfsList = responseJson.getJSONArray("serviceAllottedResources")
- }
- else {
- vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources", catalogUtilsVersion)
- }
- }
-
- }
- catch (Exception e) {
- utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
- }
-
- return vnfsList
- }
-
- public JSONArray getAllottedResourcesByServiceModelInvariantUuid(DelegateExecution execution, String serviceModelInvariantUuid) {
- JSONArray vnfsList = null
- String endPoint = "/serviceAllottedResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8")
- try {
- String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
-
- if (catalogDbResponse != null) {
- vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources", "v1")
- }
-
- }
- catch (Exception e) {
- utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
- }
-
- return vnfsList
- }
-
- public JSONArray getAllottedResourcesByServiceModelInvariantUuid(DelegateExecution execution, String serviceModelInvariantUuid, String catalogUtilsVersion) {
- JSONArray vnfsList = null
- String endPoint = "/serviceAllottedResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8")
- try {
- String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
-
- if (catalogDbResponse != null) {
- if (!catalogUtilsVersion.equals("v1")) {
- JSONObject responseJson = new JSONObject(catalogDbResponse)
- vnfsList = responseJson.getJSONArray()
- }
- else {
- vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources", catalogUtilsVersion)
- }
- }
-
- }
- catch (Exception e) {
- utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
- utils.log("ERROR", "Exception in Querying Catalog DB: " + e.getStackTrace())
- }
-
- return vnfsList
- }
-
- public JSONArray getAllottedResourcesByServiceModelInvariantUuidAndServiceModelVersion(DelegateExecution execution, String serviceModelInvariantUuid, String serviceModelVersion) {
- JSONArray vnfsList = null
- String endPoint = "/serviceAllottedResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8")
- try {
- String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
-
- if (catalogDbResponse != null) {
- vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources", "v1")
- }
-
- }
- catch (Exception e) {
- utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
- }
-
- return vnfsList
- }
-
- public JSONArray getAllottedResourcesByServiceModelInvariantUuidAndServiceModelVersion(DelegateExecution execution, String serviceModelInvariantUuid, String serviceModelVersion, String catalogUtilsVersion) {
- JSONArray vnfsList = null
- String endPoint = "/serviceAllottedResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8")
- try {
- String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
-
- if (catalogDbResponse != null) {
- if (!catalogUtilsVersion.equals("v1")) {
- JSONObject responseJson = new JSONObject(catalogDbResponse)
- vnfsList = responseJson.getJSONArray("serviceAllottedResources")
- }
- else {
- vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources", catalogUtilsVersion)
- }
- }
-
- }
- catch (Exception e) {
- utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
- }
-
- return vnfsList
- }
-
-
- public JSONArray getAllottedResourcesByArModelCustomizationUuid(DelegateExecution execution, String arModelCustomizationUuid) {
- JSONArray vnfsList = null
- String endPoint = "/serviceAllottedResources?serviceModelCustomizationUuid=" + UriUtils.encode(arModelCustomizationUuid, "UTF-8")
- try {
- String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
-
- if (catalogDbResponse != null) {
- vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources", "v1")
- }
-
- }
- catch (Exception e) {
- utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
- }
-
- return vnfsList
- }
-
- public JSONArray getAllottedResourcesByArModelCustomizationUuid(DelegateExecution execution, String arModelCustomizationUuid, String catalogUtilsVersion) {
- JSONArray vnfsList = null
- String endPoint = "/serviceAllottedResources?serviceModelCustomizationUuid=" + UriUtils.encode(arModelCustomizationUuid, "UTF-8")
- try {
- String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
-
- if (catalogDbResponse != null) {
- if (!catalogUtilsVersion.equals("v1")) {
- JSONObject responseJson = new JSONObject(catalogDbResponse)
- vnfsList = responseJson.getJSONArray("serviceAllottedResources")
- }
- else {
- vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources", catalogUtilsVersion)
- }
- }
-
- }
- catch (Exception e) {
- utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
- }
-
- return vnfsList
- }
-
- public JSONObject getServiceResourcesByServiceModelUuid(DelegateExecution execution, String serviceModelUuid) {
- JSONObject resources = null
- String endPoint = "/serviceResources?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8")
- try {
- String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
-
- if (catalogDbResponse != null) {
-
- resources = parseServiceResourcesJson(catalogDbResponse, "v1")
- }
-
- }
- catch (Exception e) {
- utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
- }
-
- return resources
- }
-
- public JSONObject getServiceResourcesByServiceModelUuid(DelegateExecution execution, String serviceModelUuid, String catalogUtilsVersion) {
- JSONObject resources = null
- String endPoint = "/serviceResources?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8")
- try {
- String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
-
- if (catalogDbResponse != null) {
- if (!catalogUtilsVersion.equals("v1")) {
- resources = new JSONObject(catalogDbResponse)
- }
- else {
- resources = parseServiceResourcesJson(catalogDbResponse, catalogUtilsVersion)
- }
- }
- }
- catch (Exception e) {
- utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
- }
-
- return resources
- }
-
- public JSONObject getServiceResourcesByServiceModelInvariantUuid(DelegateExecution execution, String serviceModelInvariantUuid) {
- JSONObject resources = null
- String endPoint = "/serviceResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8")
- try {
- String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
-
- if (catalogDbResponse != null) {
-
- resources = parseServiceResourcesJson(catalogDbResponse, "v1")
- }
-
- }
- catch (Exception e) {
- utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
- }
-
- return resources
- }
-
- public String getServiceResourcesByServiceModelInvariantUuidString(DelegateExecution execution, String serviceModelInvariantUuid) {
- String resources = null
- String endPoint = "/serviceResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8")
- try {
- String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
-
- if (catalogDbResponse != null) {
-
- resources = catalogDbResponse
- }
-
- }
- catch (Exception e) {
- utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
- }
-
- return resources
- }
-
- public JSONObject getServiceResourcesByServiceModelInvariantUuid(DelegateExecution execution, String serviceModelInvariantUuid, String catalogUtilsVersion) {
- JSONObject resources = null
- String endPoint = "/serviceResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8")
- try {
- String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
-
- if (catalogDbResponse != null) {
- if (!catalogUtilsVersion.equals("v1")) {
- resources = new JSONObject(catalogDbResponse)
- }
- else {
- resources = parseServiceResourcesJson(catalogDbResponse, catalogUtilsVersion)
- }
- }
-
- }
- catch (Exception e) {
- utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
- }
-
- return resources
- }
-
-
- public JSONObject getServiceResourcesByServiceModelInvariantUuidAndServiceModelVersion(DelegateExecution execution, String serviceModelInvariantUuid, String serviceModelVersion) {
- JSONObject resources = null
- String endPoint = "/serviceResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8")
- try {
- String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
-
- if (catalogDbResponse != null) {
- //TODO this is wrong
- resources = parseServiceResourcesJson(catalogDbResponse)
- }
-
- }
- catch (Exception e) {
- utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
- }
-
- return resources
- }
-
- public JSONObject getServiceResourcesByServiceModelInvariantUuidAndServiceModelVersion(DelegateExecution execution, String serviceModelInvariantUuid, String serviceModelVersion, String catalogUtilsVersion) {
- JSONObject resources = null
- String endPoint = "/serviceResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8")
- try {
- String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
-
- if (catalogDbResponse != null) {
- if (!catalogUtilsVersion.equals("v1")) {
- resources = new JSONObject(catalogDbResponse)
- }
- else {
- resources = parseServiceResourcesJson(catalogDbResponse, catalogUtilsVersion)
- }
- }
-
- }
- catch (Exception e) {
- utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
- }
-
- return resources
- }
-
-
-
- private JSONArray parseNetworksJson (String catalogDbResponse, String arrayName, String catalogUtilsVersion) {
- JSONArray modelInfos = null
-
- msoLogger.debug("parseNetworksJson - catalogUtilsVersion is " + catalogUtilsVersion)
- try {
- // Create array of jsons
-
- JSONObject responseJson = new JSONObject(catalogDbResponse)
- JSONArray networks = responseJson.getJSONArray(arrayName)
- modelInfos = new JSONArray()
-
- for (int i = 0; i < networks.length(); i++) {
-
- JSONObject network = networks.getJSONObject(i)
- JSONObject modelJson = new JSONObject()
- JSONObject modelInfo = buildModelInfo("network", network, catalogUtilsVersion)
- modelJson.put("modelInfo", modelInfo)
- String networkType = jsonUtils.getJsonValueForKey(network, "networkType")
- modelJson.put("networkType", networkType)
-
- switch (catalogUtilsVersion) {
- case "v1":
- break
- default:
- String toscaNodeType = jsonUtils.getJsonValueForKey(network, "toscaNodeType")
- modelJson.put("toscaNodeType", toscaNodeType)
- String networkTechnology = jsonUtils.getJsonValueForKey(network, "networkTechnology")
- modelJson.put("networkTechnology", networkTechnology)
- String networkRole = jsonUtils.getJsonValueForKey(network, "networkRole")
- modelJson.put("networkRole", networkRole)
- String networkScope = jsonUtils.getJsonValueForKey(network, "networkScope")
- modelJson.put("networkScope", networkScope)
- break
- }
- modelInfos.put(modelJson)
- }
-
- String modelInfosString = modelInfos.toString()
- msoLogger.debug("Returning networks JSON: " + modelInfosString)
-
- } catch (Exception e) {
- utils.log("ERROR", "Exception in parsing Catalog DB Response: " + e.message)
- }
-
- return modelInfos
- }
-
- private JSONArray parseVnfsJson (String catalogDbResponse, String arrayName, String catalogUtilsVersion) {
- JSONArray modelInfos = null
-
- msoLogger.debug("parseVnfsJson - catalogUtilsVersion is " + catalogUtilsVersion)
-
- try {
- // Create array of jsons
-
- JSONObject responseJson = new JSONObject(catalogDbResponse)
- JSONArray vnfs = responseJson.getJSONArray(arrayName)
- modelInfos = new JSONArray()
-
- for (int i = 0; i < vnfs.length(); i++) {
- JSONObject vnf = vnfs.getJSONObject(i)
-
- msoLogger.debug(vnf.toString(2))
- JSONObject modelInfo = buildModelInfo("vnf", vnf, catalogUtilsVersion)
- JSONObject modelJson = new JSONObject()
- modelJson.put("modelInfo", modelInfo)
- switch(catalogUtilsVersion) {
- case "v1":
- break
- default:
- String toscaNodeType = jsonUtils.getJsonValueForKey(vnf, "toscaNodeType")
- modelJson.put("toscaNodeType", toscaNodeType)
- String nfType = jsonUtils.getJsonValueForKey(vnf, "nfType")
- modelJson.put("nfType", nfType)
- String nfRole = jsonUtils.getJsonValueForKey(vnf, "nfRole")
- modelJson.put("nfRole", nfRole)
- String nfCode = jsonUtils.getJsonValueForKey(vnf, "nfCode")
- modelJson.put("nfNamingCode", nfCode)
- String nfFunction = jsonUtils.getJsonValueForKey(vnf, "nfFunction")
- modelJson.put("nfFunction", nfFunction)
- String multiStageDesign = jsonUtils.getJsonValueForKey(vnf, "multiStageDesign")
- modelJson.put("multiStageDesign", multiStageDesign)
- break
- }
-
- JSONArray vfModules = null
- try {
- vfModules = vnf.getJSONArray("vfModules")
- } catch (Exception e)
- {
- msoLogger.debug("Cannot find VF MODULE ARRAY: " + i + ", exception is " + e.message)
- }
-
- if (vfModules != null) {
- JSONArray vfModuleInfo = new JSONArray()
- for (int j = 0; j < vfModules.length(); j++) {
- JSONObject vfModule = vfModules.getJSONObject(j)
- JSONObject vfModuleModelInfo = buildModelInfo("vfModule", vfModule, catalogUtilsVersion)
- JSONObject vfModuleModelJson = new JSONObject()
- vfModuleModelJson.put("modelInfo", vfModuleModelInfo)
- String vfModuleType = jsonUtils.getJsonValueForKey(vfModule, "type")
- vfModuleModelJson.put("vfModuleType", vfModuleType)
- switch(catalogUtilsVersion) {
- case "v1":
- //TODO this does not work, isBase is not a integer.
- Integer isBase = jsonUtils.getJsonIntValueForKey(vfModule, "isBase")
- if (isBase.intValue() == 1) {
- vfModuleModelJson.put("isBase", "true")
- }
- else {
- vfModuleModelJson.put("isBase", "false")
- }
- break
- default:
- boolean isBase = jsonUtils.getJsonBooleanValueForKey(vfModule, "isBase")
- vfModuleModelJson.put("isBase", isBase)
- break
- }
- String vfModuleLabel = jsonUtils.getJsonValueForKey(vfModule, "label")
- vfModuleModelJson.put("vfModuleLabel", vfModuleLabel)
- Integer initialCount = jsonUtils.getJsonIntValueForKey(vfModule, "initialCount")
- vfModuleModelJson.put("initialCount", initialCount.intValue())
- vfModuleInfo.put(vfModuleModelJson)
- }
- modelJson.put("vfModules", vfModuleInfo)
- }
- modelInfos.put(modelJson)
- }
-
- String modelInfosString = modelInfos.toString()
- msoLogger.debug("Returning vnfs JSON: " + modelInfosString)
-
- } catch (Exception e) {
- utils.log("ERROR", "Exception in parsing Catalog DB Response: " + e.message)
- }
-
- return modelInfos
- }
-
- /**
- * This method parses a Vf Module from the
- * Vf Modules array
- *
- * @param catalogDbResponse
- * @param arrayName
- * @param catalogUtilsVersion
- * @return vfModulelJson
- */
- private JSONObject parseVfModuleJson (String catalogDbResponse, String arrayName, String catalogUtilsVersion) {
- JSONObject vfModulelJson = new JSONObject()
- msoLogger.debug("Started Parse Vf Module Json")
- try {
- JSONObject responseJson = new JSONObject(catalogDbResponse)
- JSONArray vfModules = responseJson.getJSONArray(arrayName)
- if(vfModules != null){
- JSONObject vfModuleInfo = new JSONObject()
- for (int i = 0; i < vfModules.length(); i++) {
- JSONObject vfModule = vfModules.getJSONObject(i)
- JSONObject vfModuleModelInfo = buildModelInfo("vfModule", vfModule, catalogUtilsVersion)
- vfModulelJson.put("modelInfo", vfModuleModelInfo)
- String vfModuleType = jsonUtils.getJsonValueForKey(vfModule, "type")
- vfModulelJson.put("vfModuleType", vfModuleType)
- switch(catalogUtilsVersion) {
- case "v1":
- Integer isBase = jsonUtils.getJsonIntValueForKey(vfModule, "isBase")
- if (isBase.intValue() == 1) {
- vfModulelJson.put("isBase", "true")
- }
- else {
- vfModulelJson.put("isBase", "false")
- }
- break
- default:
- boolean isBase = jsonUtils.getJsonBooleanValueForKey(vfModule, "isBase")
- vfModulelJson.put("isBase", isBase)
- break
- }
- String vfModuleLabel = jsonUtils.getJsonValueForKey(vfModule, "label")
- vfModulelJson.put("vfModuleLabel", vfModuleLabel)
- Integer initialCount = jsonUtils.getJsonIntValueForKey(vfModule, "initialCount")
- vfModulelJson.put("initialCount", initialCount.intValue())
- }
- }
- msoLogger.debug("Completed Parsing Vf Module: " + vfModulelJson.toString())
- }catch (Exception e){
- utils.log("DEBUG", "Exception while parsing Vf Modules from Catalog DB Response: " + e.message)
- }
-
- return vfModulelJson
- }
-
- private JSONArray parseAllottedResourcesJson (String catalogDbResponse, String arrayName, String catalogUtilsVersion) {
- JSONArray modelInfos = null
-
- msoLogger.debug("parseAllottedResourcesJson - catalogUtilsVersion is " + catalogUtilsVersion)
-
- try {
- // Create array of jsons
-
- JSONObject responseJson = new JSONObject(catalogDbResponse)
- JSONArray allottedResources = responseJson.getJSONArray(arrayName)
- modelInfos = new JSONArray()
-
- for (int i = 0; i < allottedResources.length(); i++) {
- JSONObject allottedResource = allottedResources.getJSONObject(i)
- JSONObject modelInfo = buildModelInfo("allottedResource", allottedResource, catalogUtilsVersion)
- JSONObject modelJson = new JSONObject()
- modelJson.put("modelInfo", modelInfo)
- switch(catalogUtilsVersion) {
- case "v1":
- break
- default:
- String toscaNodeType = jsonUtils.getJsonValueForKey(allottedResource, "toscaNodeType")
- modelJson.put("toscaNodeType", toscaNodeType)
- String nfType = jsonUtils.getJsonValueForKey(allottedResource, "nfType")
- modelJson.put("nfType", nfType)
- String nfRole = jsonUtils.getJsonValueForKey(allottedResource, "nfRole")
- modelJson.put("nfRole", nfRole)
- String nfCode = jsonUtils.getJsonValueForKey(allottedResource, "nfCode")
- modelJson.put("nfNamingCode", nfCode)
- String nfFunction = jsonUtils.getJsonValueForKey(allottedResource, "nfFunction")
- modelJson.put("nfFunction", nfFunction)
- String providingServiceModelName = jsonUtils.getJsonValueForKey(allottedResource, "providingServiceModelName")
- modelJson.put("providingServiceModelName", providingServiceModelName)
- String providingServiceModelUuid = jsonUtils.getJsonValueForKey(allottedResource, "providingServiceModelUuid")
- modelJson.put("providingServiceModelUuid", providingServiceModelUuid)
- break
- }
-
-
- modelInfos.put(modelJson)
- }
-
- String modelInfosString = modelInfos.toString()
- msoLogger.debug("Returning allottedResources JSON: " + modelInfosString)
-
- } catch (Exception e) {
- utils.log("ERROR", "Exception in parsing Catalog DB Response: " + e.message)
- }
-
- return modelInfos
- }
-
- //TODO this is wrong
- private JSONObject parseServiceResourcesJson (String catalogDbResponse) {
- JSONObject serviceResources = new JSONObject()
- String catalogUtilsVersion = "v1"
-
- try {
- // Create array of jsons
-
- JSONObject responseJson = new JSONObject(catalogDbResponse)
- JSONObject serviceResourcesRoot = responseJson.getJSONObject("serviceResources")
- JSONArray vnfsArray = parseVnfsJson(serviceResourcesRoot.toString(), "vnfResources", catalogUtilsVersion)
- serviceResources.put("vnfs", vnfsArray)
- JSONArray networksArray = parseNetworksJson(serviceResourcesRoot.toString(), "networkResourceCustomization", catalogUtilsVersion)
- serviceResources.put("networks", networksArray)
- JSONArray allottedResourcesArray = parseAllottedResourcesJson(serviceResourcesRoot.toString(), "allottedResourceCustomization", catalogUtilsVersion)
- serviceResources.put("allottedResources", allottedResourcesArray)
-
- String serviceResourcesString = serviceResources.toString()
- msoLogger.debug("Returning serviceResources JSON: " + serviceResourcesString)
-
- } catch (Exception e) {
- utils.log("ERROR", "Exception in parsing Catalog DB Response: " + e.message)
- }
-
- return serviceResources
- }
-
- private JSONObject parseServiceResourcesJson (String catalogDbResponse, String catalogUtilsVersion) {
- JSONObject serviceResources = new JSONObject()
- JSONObject serviceResourcesObject = new JSONObject()
- String serviceResourcesString = ""
-
- try {
- // Create array of jsons
-
- JSONObject responseJson = new JSONObject(catalogDbResponse)
- JSONObject serviceResourcesRoot = responseJson.getJSONObject("serviceResources")
- JSONObject modelInfo = buildModelInfo("", serviceResourcesRoot, catalogUtilsVersion)
- serviceResources.put("modelInfo", modelInfo)
- JSONArray vnfsArray = parseVnfsJson(serviceResourcesRoot.toString(), "serviceVnfs", catalogUtilsVersion)
- serviceResources.put("serviceVnfs", vnfsArray)
- JSONArray networksArray = parseNetworksJson(serviceResourcesRoot.toString(), "serviceNetworks", catalogUtilsVersion)
- serviceResources.put("serviceNetworks", networksArray)
- JSONArray allottedResourcesArray = parseAllottedResourcesJson(serviceResourcesRoot.toString(), "serviceAllottedResources", catalogUtilsVersion)
- serviceResources.put("serviceAllottedResources", allottedResourcesArray)
- serviceResourcesObject.put("serviceResources", serviceResources)
-
- serviceResourcesString = serviceResourcesObject.toString()
- msoLogger.debug("Returning serviceResources JSON: " + serviceResourcesString)
-
- } catch (Exception e) {
- utils.log("ERROR", "Exception in parsing Catalog DB Response: " + e.message)
- }
-
- return serviceResourcesObject
- }
-
- private JSONObject buildModelInfo(String modelType, JSONObject modelFromDb, String catalogUtilsVersion) {
- JSONObject modelInfo = null
- try {
- modelInfo = new JSONObject()
- modelInfo.put("modelType", modelType)
- String modelInvariantId = jsonUtils.getJsonValueForKey(modelFromDb, "modelInvariantUuid")
- modelInfo.put("modelInvariantId", modelInvariantId)
- if(modelType.equalsIgnoreCase("allottedResource") || modelType.equalsIgnoreCase("vnf")){
- String modelInstanceName = jsonUtils.getJsonValueForKey(modelFromDb, "modelInstanceName")
- modelInfo.put("modelInstanceName", modelInstanceName)
- }
- if ((!"vfModule".equals(modelType) && !"vnf".equals(modelType)) || !catalogUtilsVersion.equals("v1")) {
- String modelVersionId = jsonUtils.getJsonValueForKey(modelFromDb, "modelUuid")
- modelInfo.put("modelVersionId", modelVersionId)
- }
- else {
- String modelVersionId = jsonUtils.getJsonValueForKey(modelFromDb, "asdcUuid")
- modelInfo.put("modelVersionId", modelVersionId)
- }
- String modelName = jsonUtils.getJsonValueForKey(modelFromDb, "modelName")
- modelInfo.put("modelName", modelName)
- String modelVersion = jsonUtils.getJsonValueForKey(modelFromDb, "modelVersion")
- modelInfo.put("modelVersion", modelVersion)
- if (!"vfModule".equals(modelType)) {
- String modelCustomizationName = jsonUtils.getJsonValueForKey(modelFromDb, "modelCustomizationName")
- modelInfo.put("modelCustomizationName", modelCustomizationName)
- }
- String modelCustomizationId = jsonUtils.getJsonValueForKey(modelFromDb, "modelCustomizationUuid")
- switch (catalogUtilsVersion) {
- case "v1":
- modelInfo.put("modelCustomizationId", modelCustomizationId)
- break
- default:
- modelInfo.put("modelCustomizationUuid", modelCustomizationId)
- break
- }
- JSONObject modelJson = new JSONObject()
- modelJson.put("modelInfo", modelInfo)
- }
- catch (Exception e) {
- utils.log("ERROR", "Exception while parsing model information: " + e.message)
- }
- return modelInfo
- }
-
- private String getResponseFromCatalogDb (DelegateExecution execution, String endPoint) {
- try {
- String catalogDbEndpoint = execution.getVariable("URN_mso_catalog_db_endpoint")
- String queryEndpoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + endPoint
- RESTConfig config = new RESTConfig(queryEndpoint);
- def responseData = ''
- def bpmnRequestId = UUID.randomUUID().toString()
- RESTClient client = new RESTClient(config).
- addHeader('X-TransactionId', bpmnRequestId).
- addHeader('X-FromAppId', 'BPMN').
- addHeader('Content-Type', 'application/json').
- addHeader('Accept','application/json');
-
- String basicAuthCred = execution.getVariable("BasicAuthHeaderValueDB")
- if (basicAuthCred != null && !"".equals(basicAuthCred)) {
- client.addAuthorizationHeader(basicAuthCred)
- }
- msoLogger.debug('sending GET to Catalog DB endpoint: ' + endPoint)
- APIResponse response = client.httpGet()
-
- responseData = response.getResponseBodyAsString()
- if (responseData != null) {
- msoLogger.debug("Received data from Catalog DB: " + responseData)
- }
-
- msoLogger.debug('Response code:' + response.getStatusCode())
- msoLogger.debug('Response:' + System.lineSeparator() + responseData)
- if (response.getStatusCode() == 200) {
- // parse response as needed
- return responseData
- }
- else {
- return null
- }
- }
- catch (Exception e) {
- msoLogger.debug("ERROR WHILE QUERYING CATALOG DB: " + e.message)
- return null
- }
-
- }
-
- /**
- * get resource recipe by resource model uuid and action
- */
- public JSONObject getResourceRecipe(DelegateExecution execution, String resourceModelUuid, String action) {
- String endPoint = "/resourceRecipe?resourceModelUuid=" + UriUtils.encode(resourceModelUuid, "UTF-8")+ "&action=" + UriUtils.encode(action, "UTF-8")
- JSONObject responseJson = null
- try {
- msoLogger.debug("ENDPOINT: " + endPoint)
- String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
-
- if (catalogDbResponse != null) {
- responseJson = new JSONObject(catalogDbResponse)
- }
- }
- catch (Exception e) {
- utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
- }
-
- return responseJson
- }
-}
+/*- + * ============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.common.scripts + +import org.json.JSONObject; +import org.json.JSONArray; +import org.json.XML +import org.onap.so.bpmn.core.UrnPropertiesReader; +import org.springframework.web.util.UriUtils; + +import org.onap.so.bpmn.core.json.JsonUtils + + +import groovy.json.JsonBuilder +import groovy.json.JsonSlurper +import groovy.util.slurpersupport.GPathResult +import groovy.xml.QName; + +import org.camunda.bpm.engine.delegate.DelegateExecution + +import org.onap.so.logger.MsoLogger; +import org.onap.so.rest.APIResponse; +import org.onap.so.rest.RESTClient +import org.onap.so.rest.RESTConfig +import org.onap.so.logger.MessageEnum + + + +/*** + * Utilities for accessing Catalog DB Adapter to retrieve Networks, VNF/VFModules, AllottedResources and complete ServiceResources information + * + */ + +class CatalogDbUtils { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CatalogDbUtils.class); + + + MsoUtils utils = new MsoUtils() + JsonUtils jsonUtils = new JsonUtils() + static private String defaultDbAdapterVersion = "v2" + + public JSONArray getAllNetworksByServiceModelUuid(DelegateExecution execution, String serviceModelUuid) { + JSONArray networksList = null + String endPoint = "/serviceNetworks?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8") + try { + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", "v1") + } + + } + catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + throw e + } + + return networksList + } + + public JSONArray getAllNetworksByServiceModelUuid(DelegateExecution execution, String serviceModelUuid, String catalogUtilsVersion) { + JSONArray networksList = null + String endPoint = "/serviceNetworks?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8") + try { + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + if (!catalogUtilsVersion.equals("v1")) { + JSONObject responseJson = new JSONObject(catalogDbResponse) + networksList = responseJson.getJSONArray("serviceNetworks") + } + else { + networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", catalogUtilsVersion) + } + } + + } + catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + throw e + } + + return networksList + } + + public JSONArray getAllNetworksByServiceModelInvariantUuid(DelegateExecution execution, String serviceModelInvariantUuid) { + JSONArray networksList = null + String endPoint = "/serviceNetworks?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + try { + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", "v1") + } + + } + catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + throw e + } + + return networksList + } + + public JSONArray getAllNetworksByServiceModelInvariantUuid(DelegateExecution execution, String serviceModelInvariantUuid, String catalogUtilsVersion) { + JSONArray networksList = null + String endPoint = "/serviceNetworks?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + try { + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + if (!catalogUtilsVersion.equals("v1")) { + JSONObject responseJson = new JSONObject(catalogDbResponse) + networksList = responseJson.getJSONArray("serviceNetworks") + } + else { + networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", catalogUtilsVersion) + } + } + + } + catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + throw e + } + + return networksList + } + + public JSONArray getAllNetworksByServiceModelInvariantUuidAndServiceModelVersion(DelegateExecution execution, String serviceModelInvariantUuid, String serviceModelVersion) { + JSONArray networksList = null + String endPoint = "/serviceNetworks?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8") + try { + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", "v1") + } + + } + catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + throw e + } + + return networksList + } + + public JSONArray getAllNetworksByServiceModelInvariantUuidAndServiceModelVersion(DelegateExecution execution, String serviceModelInvariantUuid, String serviceModelVersion, String catalogUtilsVersion) { + JSONArray networksList = null + String endPoint = "/serviceNetworks?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8") + try { + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + if (!catalogUtilsVersion.equals("v1")) { + JSONObject responseJson = new JSONObject(catalogDbResponse) + networksList = responseJson.getJSONArray("serviceNetworks") + } + else { + networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", catalogUtilsVersion) + } + } + + } + catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + throw e + } + + return networksList + } + + public JSONArray getAllNetworksByNetworkModelCustomizationUuid(DelegateExecution execution, String networkModelCustomizationUuid) { + JSONArray networksList = null + String endPoint = "/serviceNetworks?networkModelCustomizationUuid=" + UriUtils.encode(networkModelCustomizationUuid, "UTF-8") + try { + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", "v1") + } + + } + catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + throw e + } + + return networksList + } + + public JSONArray getAllNetworksByNetworkModelCustomizationUuid(DelegateExecution execution, String networkModelCustomizationUuid, String catalogUtilsVersion) { + JSONArray networksList = null + String endPoint = "/serviceNetworks?networkModelCustomizationUuid=" + UriUtils.encode(networkModelCustomizationUuid, "UTF-8") + try { + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + if (!catalogUtilsVersion.equals("v1")) { + JSONObject responseJson = new JSONObject(catalogDbResponse) + networksList = responseJson.getJSONArray("serviceNetworks") + } + else { + networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", catalogUtilsVersion) + } + } + + } + catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + throw e + } + + return networksList + } + + public JSONArray getAllNetworksByNetworkType(DelegateExecution execution, String networkType) { + JSONArray networksList = null + String endPoint = "/serviceNetworks?networkType=" + UriUtils.encode(networkType, "UTF-8") + try { + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", "v1") + } + + } + catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + throw e + } + + return networksList + } + + public JSONArray getAllNetworksByNetworkType(DelegateExecution execution, String networkType, String catalogUtilsVersion) { + JSONArray networksList = null + String endPoint = "/serviceNetworks?networkType=" + UriUtils.encode(networkType, "UTF-8") + try { + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + if (!catalogUtilsVersion.equals("v1")) { + JSONObject responseJson = new JSONObject(catalogDbResponse) + networksList = responseJson.getJSONArray("serviceNetworks") + } + else { + networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", catalogUtilsVersion) + } + } + + } + catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + throw e + } + + return networksList + } + + + public JSONArray getAllVnfsByServiceModelUuid(DelegateExecution execution, String serviceModelUuid) { + JSONArray vnfsList = null + String endPoint = "/serviceVnfs?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8") + try { + msoLogger.debug("ENDPOINT: " + endPoint) + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", "v1") + } + + } + catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + throw e + } + + return vnfsList + } + + public JSONArray getAllVnfsByServiceModelUuid(DelegateExecution execution, String serviceModelUuid, String catalogUtilsVersion) { + JSONArray vnfsList = null + String endPoint = "/serviceVnfs?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8") + try { + msoLogger.debug("ENDPOINT: " + endPoint) + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + if (!catalogUtilsVersion.equals("v1")) { + JSONObject responseJson = new JSONObject(catalogDbResponse) + vnfsList = responseJson.getJSONArray("serviceVnfs") + } + else { + vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", catalogUtilsVersion) + } + } + + } + catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + throw e + } + + return vnfsList + } + + public JSONArray getAllVnfsByServiceModelInvariantUuid(DelegateExecution execution, String serviceModelInvariantUuid) { + JSONArray vnfsList = null + String endPoint ="/serviceVnfs?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + try { + msoLogger.debug("ENDPOINT: " + endPoint) + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", "v1") + } + + } + catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + throw e + } + + return vnfsList + } + + public JSONArray getAllVnfsByServiceModelInvariantUuid(DelegateExecution execution, String serviceModelInvariantUuid, String catalogUtilsVersion) { + JSONArray vnfsList = null + String endPoint = "/serviceVnfs?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + try { + msoLogger.debug("ENDPOINT: " + endPoint) + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + if (!catalogUtilsVersion.equals("v1")) { + JSONObject responseJson = new JSONObject(catalogDbResponse) + vnfsList = responseJson.getJSONArray("serviceVnfs") + } + else { + vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", catalogUtilsVersion) + } + } + + } + catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + throw e + } + + return vnfsList + } + + public JSONArray getAllVnfsByServiceModelInvariantUuidAndServiceModelVersion(DelegateExecution execution, String serviceModelInvariantUuid, String serviceModelVersion) { + JSONArray vnfsList = null + String endPoint = "/serviceVnfs?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8") + try { + msoLogger.debug("ENDPOINT: " + endPoint) + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", "v1") + } + + } + catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + throw e + } + + return vnfsList + } + + public JSONArray getAllVnfsByServiceModelInvariantUuidAndServiceModelVersion(DelegateExecution execution, String serviceModelInvariantUuid, String serviceModelVersion, String catalogUtilsVersion) { + JSONArray vnfsList = null + String endPoint = "/serviceVnfs?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8") + try { + msoLogger.debug("ENDPOINT: " + endPoint) + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + if (!catalogUtilsVersion.equals("v1")) { + JSONObject responseJson = new JSONObject(catalogDbResponse) + vnfsList = responseJson.getJSONArray("serviceVnfs") + } + else { + vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", catalogUtilsVersion) + } + } + + } + catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + throw e + } + + return vnfsList + } + + public JSONArray getAllVnfsByVnfModelCustomizationUuid(DelegateExecution execution, String vnfModelCustomizationUuid) { + JSONArray vnfsList = null + String endPoint = "/serviceVnfs?vnfModelCustomizationUuid=" + UriUtils.encode(vnfModelCustomizationUuid, "UTF-8") + try { + msoLogger.debug("ENDPOINT: " + endPoint) + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", "v1") + } + + } + catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + throw e + } + + return vnfsList + } + + /** + * This method gets a all vnfs for a particular + * service from the catalog database using the + * service model's model name. + * + * @param catalogDbEndpoint + * @param serviceModelModelName + * @return vnfsList * + * + */ + public JSONArray getAllVnfsByServiceModelModelName(DelegateExecution execution, String serviceModelModelName) { + JSONArray vnfsList = null + String endPoint = "/serviceVnfs?serviceModelName=" + UriUtils.encode(serviceModelModelName, "UTF-8") + try { + msoLogger.debug("ENDPOINT: " + endPoint) + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", defaultDbAdapterVersion) + } + }catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + throw e + } + return vnfsList + } + + public JSONArray getAllVnfsByVnfModelCustomizationUuid(DelegateExecution execution, String vnfModelCustomizationUuid, String catalogUtilsVersion) { + JSONArray vnfsList = null + String endPoint = "/serviceVnfs?vnfModelCustomizationUuid=" + UriUtils.encode(vnfModelCustomizationUuid, "UTF-8") + try { + msoLogger.debug("ENDPOINT: " + endPoint) + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + if (!catalogUtilsVersion.equals("v1")) { + JSONObject responseJson = new JSONObject(catalogDbResponse) + vnfsList = responseJson.getJSONArray("serviceVnfs") + } + else { + vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", catalogUtilsVersion) + } + } + + } + catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + throw e + } + + return vnfsList + } + + /** + * This method gets a single vf module from + * the catalog database using the vf module's + * model name. It returns that vf module as + * a JSONObject + * + * @param catalogDbEndpoint + * @param vfModuleModelName + * @return vfModule + */ + public JSONObject getVfModuleByVfModuleModelName(DelegateExecution execution, String vfModuleModelName) { + JSONObject vfModule = null + String endPoint = "/vfModules?vfModuleModelName=" + UriUtils.encode(vfModuleModelName, "UTF-8") + try{ + msoLogger.debug("Get VfModule By VfModule ModelName Endpoint is: " + endPoint) + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + vfModule = parseVfModuleJson(catalogDbResponse, "vfModules", "v1") + } + } + catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + throw e + } + + return vfModule + } + + /** + * This method gets a single vf module from + * the catalog database using the vf module's + * model name. It returns that vf module as + * a JSONObject + * + * @param catalogDbEndpoint + * @param vfModuleModelName + * @param catalogUtilsVersion + * @return vfModules + */ + public JSONObject getVfModuleByVfModuleModelName(DelegateExecution execution, String vfModuleModelName, String catalogUtilsVersion) { + JSONObject vfModule = null + String endPoint = "/vfModules?vfModuleModelName=" + UriUtils.encode(vfModuleModelName, "UTF-8") + try{ + msoLogger.debug("Get VfModule By VfModule ModelName Endpoint is: " + endPoint) + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + vfModule = parseVfModuleJson(catalogDbResponse, "vfModules", "v1") + } + } + catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + throw e + } + + return vfModule + } + + + public JSONArray getAllottedResourcesByServiceModelUuid(DelegateExecution execution, String serviceModelUuid) { + JSONArray vnfsList = null + String endPoint = "/ServiceAllottedResources?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8") + try { + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources", "v1") + } + + } + catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + throw e + } + + return vnfsList + } + + public JSONArray getAllottedResourcesByServiceModelUuid(DelegateExecution execution, String serviceModelUuid, String catalogUtilsVersion) { + JSONArray vnfsList = null + String endPoint = "/ServiceAllottedResources?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8") + try { + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + if (!catalogUtilsVersion.equals("v1")) { + JSONObject responseJson = new JSONObject(catalogDbResponse) + vnfsList = responseJson.getJSONArray("serviceAllottedResources") + } + else { + vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources", catalogUtilsVersion) + } + } + + } + catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + throw e + } + + return vnfsList + } + + public JSONArray getAllottedResourcesByServiceModelInvariantUuid(DelegateExecution execution, String serviceModelInvariantUuid) { + JSONArray vnfsList = null + String endPoint = "/serviceAllottedResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + try { + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources", "v1") + } + + } + catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + throw e + } + + return vnfsList + } + + public JSONArray getAllottedResourcesByServiceModelInvariantUuid(DelegateExecution execution, String serviceModelInvariantUuid, String catalogUtilsVersion) { + JSONArray vnfsList = null + String endPoint = "/serviceAllottedResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + try { + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + if (!catalogUtilsVersion.equals("v1")) { + JSONObject responseJson = new JSONObject(catalogDbResponse) + vnfsList = responseJson.getJSONArray() + } + else { + vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources", catalogUtilsVersion) + } + } + + } + catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.getStackTrace()); + throw e + } + + return vnfsList + } + + public JSONArray getAllottedResourcesByServiceModelInvariantUuidAndServiceModelVersion(DelegateExecution execution, String serviceModelInvariantUuid, String serviceModelVersion) { + JSONArray vnfsList = null + String endPoint = "/serviceAllottedResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8") + try { + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources", "v1") + } + + } + catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + throw e + } + + return vnfsList + } + + public JSONArray getAllottedResourcesByServiceModelInvariantUuidAndServiceModelVersion(DelegateExecution execution, String serviceModelInvariantUuid, String serviceModelVersion, String catalogUtilsVersion) { + JSONArray vnfsList = null + String endPoint = "/serviceAllottedResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8") + try { + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + if (!catalogUtilsVersion.equals("v1")) { + JSONObject responseJson = new JSONObject(catalogDbResponse) + vnfsList = responseJson.getJSONArray("serviceAllottedResources") + } + else { + vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources", catalogUtilsVersion) + } + } + + } + catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + throw e + } + + return vnfsList + } + + + public JSONArray getAllottedResourcesByArModelCustomizationUuid(DelegateExecution execution, String arModelCustomizationUuid) { + JSONArray vnfsList = null + String endPoint = "/serviceAllottedResources?serviceModelCustomizationUuid=" + UriUtils.encode(arModelCustomizationUuid, "UTF-8") + try { + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources", "v1") + } + + } + catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + throw e + } + + return vnfsList + } + + public JSONArray getAllottedResourcesByArModelCustomizationUuid(DelegateExecution execution, String arModelCustomizationUuid, String catalogUtilsVersion) { + JSONArray vnfsList = null + String endPoint = "/serviceAllottedResources?serviceModelCustomizationUuid=" + UriUtils.encode(arModelCustomizationUuid, "UTF-8") + try { + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + if (!catalogUtilsVersion.equals("v1")) { + JSONObject responseJson = new JSONObject(catalogDbResponse) + vnfsList = responseJson.getJSONArray("serviceAllottedResources") + } + else { + vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources", catalogUtilsVersion) + } + } + + } + catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + throw e + } + + return vnfsList + } + + public JSONObject getServiceResourcesByServiceModelUuid(DelegateExecution execution, String serviceModelUuid) { + JSONObject resources = null + String endPoint = "/serviceResources?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8") + try { + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + + resources = parseServiceResourcesJson(catalogDbResponse, "v1") + } + + } + catch (Exception e) { + utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message) + throw e + } + + return resources + } + + public JSONObject getServiceResourcesByServiceModelUuid(DelegateExecution execution, String serviceModelUuid, String catalogUtilsVersion) { + JSONObject resources = null + String endPoint = "/serviceResources?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8") + try { + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + if (!catalogUtilsVersion.equals("v1")) { + resources = new JSONObject(catalogDbResponse) + } + else { + resources = parseServiceResourcesJson(catalogDbResponse, catalogUtilsVersion) + } + } + } + catch (Exception e) { + utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message) + throw e + } + + return resources + } + + public JSONObject getServiceResourcesByServiceModelInvariantUuid(DelegateExecution execution, String serviceModelInvariantUuid) { + JSONObject resources = null + String endPoint = "/serviceResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + try { + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + + resources = parseServiceResourcesJson(catalogDbResponse, "v1") + } + + } + catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + throw e + } + + return resources + } + + public String getServiceResourcesByServiceModelInvariantUuidString(DelegateExecution execution, String serviceModelInvariantUuid) { + String resources = null + String endPoint = "/serviceResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + try { + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + + resources = catalogDbResponse + } + + } + catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + throw e + } + + return resources + } + + public JSONObject getServiceResourcesByServiceModelInvariantUuid(DelegateExecution execution, String serviceModelInvariantUuid, String catalogUtilsVersion) { + JSONObject resources = null + String endPoint = "/serviceResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + try { + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + if (!catalogUtilsVersion.equals("v1")) { + resources = new JSONObject(catalogDbResponse) + } + else { + resources = parseServiceResourcesJson(catalogDbResponse, catalogUtilsVersion) + } + } + + } + catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + throw e + } + + return resources + } + + + public JSONObject getServiceResourcesByServiceModelInvariantUuidAndServiceModelVersion(DelegateExecution execution, String serviceModelInvariantUuid, String serviceModelVersion) { + JSONObject resources = null + String endPoint = "/serviceResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8") + try { + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + //TODO this is wrong + resources = parseServiceResourcesJson(catalogDbResponse) + } + + } + catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + throw e + } + + return resources + } + + public JSONObject getServiceResourcesByServiceModelInvariantUuidAndServiceModelVersion(DelegateExecution execution, String serviceModelInvariantUuid, String serviceModelVersion, String catalogUtilsVersion) { + JSONObject resources = null + String endPoint = "/serviceResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8") + try { + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + if (!catalogUtilsVersion.equals("v1")) { + resources = new JSONObject(catalogDbResponse) + } + else { + resources = parseServiceResourcesJson(catalogDbResponse, catalogUtilsVersion) + } + } + + } + catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + throw e + } + + return resources + } + + + + private JSONArray parseNetworksJson (String catalogDbResponse, String arrayName, String catalogUtilsVersion) { + JSONArray modelInfos = null + + msoLogger.debug("parseNetworksJson - catalogUtilsVersion is " + catalogUtilsVersion) + try { + // Create array of jsons + + JSONObject responseJson = new JSONObject(catalogDbResponse) + JSONArray networks = responseJson.getJSONArray(arrayName) + modelInfos = new JSONArray() + + for (int i = 0; i < networks.length(); i++) { + + JSONObject network = networks.getJSONObject(i) + JSONObject modelJson = new JSONObject() + JSONObject modelInfo = buildModelInfo("network", network, catalogUtilsVersion) + modelJson.put("modelInfo", modelInfo) + String networkType = jsonUtils.getJsonValueForKey(network, "networkType") + modelJson.put("networkType", networkType) + + switch (catalogUtilsVersion) { + case "v1": + break + default: + String toscaNodeType = jsonUtils.getJsonValueForKey(network, "toscaNodeType") + modelJson.put("toscaNodeType", toscaNodeType) + String networkTechnology = jsonUtils.getJsonValueForKey(network, "networkTechnology") + modelJson.put("networkTechnology", networkTechnology) + String networkRole = jsonUtils.getJsonValueForKey(network, "networkRole") + modelJson.put("networkRole", networkRole) + String networkScope = jsonUtils.getJsonValueForKey(network, "networkScope") + modelJson.put("networkScope", networkScope) + break + } + modelInfos.put(modelJson) + } + + String modelInfosString = modelInfos.toString() + msoLogger.debug("Returning networks JSON: " + modelInfosString) + + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in parsing Catalog DB Response", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + } + + return modelInfos + } + + private JSONArray parseVnfsJson (String catalogDbResponse, String arrayName, String catalogUtilsVersion) { + JSONArray modelInfos = null + + msoLogger.debug("parseVnfsJson - catalogUtilsVersion is " + catalogUtilsVersion) + + try { + // Create array of jsons + + JSONObject responseJson = new JSONObject(catalogDbResponse) + JSONArray vnfs = responseJson.getJSONArray(arrayName) + modelInfos = new JSONArray() + + for (int i = 0; i < vnfs.length(); i++) { + JSONObject vnf = vnfs.getJSONObject(i) + + msoLogger.debug(vnf.toString(2)) + JSONObject modelInfo = buildModelInfo("vnf", vnf, catalogUtilsVersion) + JSONObject modelJson = new JSONObject() + modelJson.put("modelInfo", modelInfo) + switch(catalogUtilsVersion) { + case "v1": + break + default: + String toscaNodeType = jsonUtils.getJsonValueForKey(vnf, "toscaNodeType") + modelJson.put("toscaNodeType", toscaNodeType) + String nfType = jsonUtils.getJsonValueForKey(vnf, "nfType") + modelJson.put("nfType", nfType) + String nfRole = jsonUtils.getJsonValueForKey(vnf, "nfRole") + modelJson.put("nfRole", nfRole) + String nfCode = jsonUtils.getJsonValueForKey(vnf, "nfCode") + modelJson.put("nfNamingCode", nfCode) + String nfFunction = jsonUtils.getJsonValueForKey(vnf, "nfFunction") + modelJson.put("nfFunction", nfFunction) + String multiStageDesign = jsonUtils.getJsonValueForKey(vnf, "multiStageDesign") + modelJson.put("multiStageDesign", multiStageDesign) + break + } + + JSONArray vfModules = null + try { + vfModules = vnf.getJSONArray("vfModules") + } catch (Exception e) + { + msoLogger.debug("Cannot find VF MODULE ARRAY: " + i + ", exception is " + e.message) + } + + if (vfModules != null) { + JSONArray vfModuleInfo = new JSONArray() + for (int j = 0; j < vfModules.length(); j++) { + JSONObject vfModule = vfModules.getJSONObject(j) + JSONObject vfModuleModelInfo = buildModelInfo("vfModule", vfModule, catalogUtilsVersion) + JSONObject vfModuleModelJson = new JSONObject() + vfModuleModelJson.put("modelInfo", vfModuleModelInfo) + String vfModuleType = jsonUtils.getJsonValueForKey(vfModule, "type") + vfModuleModelJson.put("vfModuleType", vfModuleType) + switch(catalogUtilsVersion) { + case "v1": + //TODO this does not work, isBase is not a integer. + Integer isBase = jsonUtils.getJsonIntValueForKey(vfModule, "isBase") + if (isBase.intValue() == 1) { + vfModuleModelJson.put("isBase", "true") + } + else { + vfModuleModelJson.put("isBase", "false") + } + break + default: + boolean isBase = jsonUtils.getJsonBooleanValueForKey(vfModule, "isBase") + vfModuleModelJson.put("isBase", isBase) + break + } + String vfModuleLabel = jsonUtils.getJsonValueForKey(vfModule, "label") + vfModuleModelJson.put("vfModuleLabel", vfModuleLabel) + Integer initialCount = jsonUtils.getJsonIntValueForKey(vfModule, "initialCount") + vfModuleModelJson.put("initialCount", initialCount.intValue()) + vfModuleInfo.put(vfModuleModelJson) + } + modelJson.put("vfModules", vfModuleInfo) + } + modelInfos.put(modelJson) + } + + String modelInfosString = modelInfos.toString() + msoLogger.debug("Returning vnfs JSON: " + modelInfosString) + + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in parsing Catalog DB Response", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + } + + return modelInfos + } + + /** + * This method parses a Vf Module from the + * Vf Modules array + * + * @param catalogDbResponse + * @param arrayName + * @param catalogUtilsVersion + * @return vfModulelJson + */ + private JSONObject parseVfModuleJson (String catalogDbResponse, String arrayName, String catalogUtilsVersion) { + JSONObject vfModulelJson = new JSONObject() + msoLogger.debug("Started Parse Vf Module Json") + try { + JSONObject responseJson = new JSONObject(catalogDbResponse) + JSONArray vfModules = responseJson.getJSONArray(arrayName) + if(vfModules != null){ + JSONObject vfModuleInfo = new JSONObject() + for (int i = 0; i < vfModules.length(); i++) { + JSONObject vfModule = vfModules.getJSONObject(i) + JSONObject vfModuleModelInfo = buildModelInfo("vfModule", vfModule, catalogUtilsVersion) + vfModulelJson.put("modelInfo", vfModuleModelInfo) + String vfModuleType = jsonUtils.getJsonValueForKey(vfModule, "type") + vfModulelJson.put("vfModuleType", vfModuleType) + switch(catalogUtilsVersion) { + case "v1": + Integer isBase = jsonUtils.getJsonIntValueForKey(vfModule, "isBase") + if (isBase.intValue() == 1) { + vfModulelJson.put("isBase", "true") + } + else { + vfModulelJson.put("isBase", "false") + } + break + default: + boolean isBase = jsonUtils.getJsonBooleanValueForKey(vfModule, "isBase") + vfModulelJson.put("isBase", isBase) + break + } + String vfModuleLabel = jsonUtils.getJsonValueForKey(vfModule, "label") + vfModulelJson.put("vfModuleLabel", vfModuleLabel) + Integer initialCount = jsonUtils.getJsonIntValueForKey(vfModule, "initialCount") + vfModulelJson.put("initialCount", initialCount.intValue()) + } + } + msoLogger.debug("Completed Parsing Vf Module: " + vfModulelJson.toString()) + }catch (Exception e){ + msoLogger.debug("Exception while parsing Vf Modules from Catalog DB Response: " + e.message) + } + + return vfModulelJson + } + + private JSONArray parseAllottedResourcesJson (String catalogDbResponse, String arrayName, String catalogUtilsVersion) { + JSONArray modelInfos = null + + msoLogger.debug("parseAllottedResourcesJson - catalogUtilsVersion is " + catalogUtilsVersion) + + try { + // Create array of jsons + + JSONObject responseJson = new JSONObject(catalogDbResponse) + JSONArray allottedResources = responseJson.getJSONArray(arrayName) + modelInfos = new JSONArray() + + for (int i = 0; i < allottedResources.length(); i++) { + JSONObject allottedResource = allottedResources.getJSONObject(i) + JSONObject modelInfo = buildModelInfo("allottedResource", allottedResource, catalogUtilsVersion) + JSONObject modelJson = new JSONObject() + modelJson.put("modelInfo", modelInfo) + switch(catalogUtilsVersion) { + case "v1": + break + default: + String toscaNodeType = jsonUtils.getJsonValueForKey(allottedResource, "toscaNodeType") + modelJson.put("toscaNodeType", toscaNodeType) + String nfType = jsonUtils.getJsonValueForKey(allottedResource, "nfType") + modelJson.put("nfType", nfType) + String nfRole = jsonUtils.getJsonValueForKey(allottedResource, "nfRole") + modelJson.put("nfRole", nfRole) + String nfCode = jsonUtils.getJsonValueForKey(allottedResource, "nfCode") + modelJson.put("nfNamingCode", nfCode) + String nfFunction = jsonUtils.getJsonValueForKey(allottedResource, "nfFunction") + modelJson.put("nfFunction", nfFunction) + String providingServiceModelName = jsonUtils.getJsonValueForKey(allottedResource, "providingServiceModelName") + modelJson.put("providingServiceModelName", providingServiceModelName) + String providingServiceModelUuid = jsonUtils.getJsonValueForKey(allottedResource, "providingServiceModelUuid") + modelJson.put("providingServiceModelUuid", providingServiceModelUuid) + break + } + + + modelInfos.put(modelJson) + } + + String modelInfosString = modelInfos.toString() + msoLogger.debug("Returning allottedResources JSON: " + modelInfosString) + + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in parsing Catalog DB Response", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + } + + return modelInfos + } + + //TODO this is wrong + private JSONObject parseServiceResourcesJson (String catalogDbResponse) { + JSONObject serviceResources = new JSONObject() + String catalogUtilsVersion = "v1" + + try { + // Create array of jsons + + JSONObject responseJson = new JSONObject(catalogDbResponse) + JSONObject serviceResourcesRoot = responseJson.getJSONObject("serviceResources") + JSONArray vnfsArray = parseVnfsJson(serviceResourcesRoot.toString(), "vnfResources", catalogUtilsVersion) + serviceResources.put("vnfs", vnfsArray) + JSONArray networksArray = parseNetworksJson(serviceResourcesRoot.toString(), "networkResourceCustomization", catalogUtilsVersion) + serviceResources.put("networks", networksArray) + JSONArray allottedResourcesArray = parseAllottedResourcesJson(serviceResourcesRoot.toString(), "allottedResourceCustomization", catalogUtilsVersion) + serviceResources.put("allottedResources", allottedResourcesArray) + + String serviceResourcesString = serviceResources.toString() + msoLogger.debug("Returning serviceResources JSON: " + serviceResourcesString) + + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in parsing Catalog DB Response", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + } + + return serviceResources + } + + private JSONObject parseServiceResourcesJson (String catalogDbResponse, String catalogUtilsVersion) { + JSONObject serviceResources = new JSONObject() + JSONObject serviceResourcesObject = new JSONObject() + String serviceResourcesString = "" + + try { + // Create array of jsons + + JSONObject responseJson = new JSONObject(catalogDbResponse) + JSONObject serviceResourcesRoot = responseJson.getJSONObject("serviceResources") + JSONObject modelInfo = buildModelInfo("", serviceResourcesRoot, catalogUtilsVersion) + serviceResources.put("modelInfo", modelInfo) + JSONArray vnfsArray = parseVnfsJson(serviceResourcesRoot.toString(), "serviceVnfs", catalogUtilsVersion) + serviceResources.put("serviceVnfs", vnfsArray) + JSONArray networksArray = parseNetworksJson(serviceResourcesRoot.toString(), "serviceNetworks", catalogUtilsVersion) + serviceResources.put("serviceNetworks", networksArray) + JSONArray allottedResourcesArray = parseAllottedResourcesJson(serviceResourcesRoot.toString(), "serviceAllottedResources", catalogUtilsVersion) + serviceResources.put("serviceAllottedResources", allottedResourcesArray) + serviceResourcesObject.put("serviceResources", serviceResources) + + serviceResourcesString = serviceResourcesObject.toString() + msoLogger.debug("Returning serviceResources JSON: " + serviceResourcesString) + + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in parsing Catalog DB Response", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + } + + return serviceResourcesObject + } + + private JSONObject buildModelInfo(String modelType, JSONObject modelFromDb, String catalogUtilsVersion) { + JSONObject modelInfo = null + try { + modelInfo = new JSONObject() + modelInfo.put("modelType", modelType) + String modelInvariantId = jsonUtils.getJsonValueForKey(modelFromDb, "modelInvariantUuid") + modelInfo.put("modelInvariantId", modelInvariantId) + if(modelType.equalsIgnoreCase("allottedResource") || modelType.equalsIgnoreCase("vnf")){ + String modelInstanceName = jsonUtils.getJsonValueForKey(modelFromDb, "modelInstanceName") + modelInfo.put("modelInstanceName", modelInstanceName) + } + if ((!"vfModule".equals(modelType) && !"vnf".equals(modelType)) || !catalogUtilsVersion.equals("v1")) { + String modelVersionId = jsonUtils.getJsonValueForKey(modelFromDb, "modelUuid") + modelInfo.put("modelVersionId", modelVersionId) + } + else { + String modelVersionId = jsonUtils.getJsonValueForKey(modelFromDb, "asdcUuid") + modelInfo.put("modelVersionId", modelVersionId) + } + String modelName = jsonUtils.getJsonValueForKey(modelFromDb, "modelName") + modelInfo.put("modelName", modelName) + String modelVersion = jsonUtils.getJsonValueForKey(modelFromDb, "modelVersion") + modelInfo.put("modelVersion", modelVersion) + if (!"vfModule".equals(modelType)) { + String modelCustomizationName = jsonUtils.getJsonValueForKey(modelFromDb, "modelCustomizationName") + modelInfo.put("modelCustomizationName", modelCustomizationName) + } + String modelCustomizationId = jsonUtils.getJsonValueForKey(modelFromDb, "modelCustomizationUuid") + switch (catalogUtilsVersion) { + case "v1": + modelInfo.put("modelCustomizationId", modelCustomizationId) + break + default: + modelInfo.put("modelCustomizationUuid", modelCustomizationId) + break + } + JSONObject modelJson = new JSONObject() + modelJson.put("modelInfo", modelInfo) + } + catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception while parsing model information", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message); + } + return modelInfo + } + + private String getResponseFromCatalogDb (DelegateExecution execution, String endPoint) { + try { + + String catalogDbEndpoint = UrnPropertiesReader.getVariable("mso.catalog.db.endpoint",execution) + String queryEndpoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + endPoint + RESTConfig config = new RESTConfig(queryEndpoint); + def responseData = '' + def bpmnRequestId = UUID.randomUUID().toString() + RESTClient client = new RESTClient(config). + addHeader('X-TransactionId', bpmnRequestId). + addHeader('X-FromAppId', 'BPMN'). + addHeader('Content-Type', 'application/json'). + addHeader('Accept','application/json'); + + String basicAuthCred = execution.getVariable("BasicAuthHeaderValueDB") + if (basicAuthCred != null && !"".equals(basicAuthCred)) { + client.addAuthorizationHeader(basicAuthCred) + }else { + client.addAuthorizationHeader(getBasicDBAuthHeader(execution)) + } + msoLogger.debug('sending GET to Catalog DB endpoint: ' + endPoint) + APIResponse response = client.httpGet() + + responseData = response.getResponseBodyAsString() + if (responseData != null) { + msoLogger.debug("Received data from Catalog DB: " + responseData) + } + + msoLogger.debug('Response code:' + response.getStatusCode()) + msoLogger.debug('Response:' + System.lineSeparator() + responseData) + if (response.getStatusCode() == 200) { + // parse response as needed + return responseData + } + else { + return null + } + } + catch (Exception e) { + msoLogger.debug("ERROR WHILE QUERYING CATALOG DB: " + e.message) + throw e + } + + } + + /** + * get resource recipe by resource model uuid and action + */ + public JSONObject getResourceRecipe(DelegateExecution execution, String resourceModelUuid, String action) { + String endPoint = "/resourceRecipe?resourceModelUuid=" + UriUtils.encode(resourceModelUuid, "UTF-8")+ "&action=" + UriUtils.encode(action, "UTF-8") + JSONObject responseJson = null + try { + msoLogger.debug("ENDPOINT: " + endPoint) + String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint) + + if (catalogDbResponse != null) { + responseJson = new JSONObject(catalogDbResponse) + } + } + catch (Exception e) { + utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message) + throw e + } + + return responseJson + } + + private String getBasicDBAuthHeader(DelegateExecution execution) { + + String encodedString = null + try { + String basicAuthValueDB = UrnPropertiesReader.getVariable("mso.adapters.db.auth", execution) + utils.log("DEBUG", " Obtained BasicAuth userid password for Catalog DB adapter: " + basicAuthValueDB) + + encodedString = utils.getBasicAuth(basicAuthValueDB, UrnPropertiesReader.getVariable("mso.msoKey", execution)) + execution.setVariable("BasicAuthHeaderValueDB",encodedString) + } catch (IOException ex) { + String dataErrorMessage = " Unable to encode Catalog DB user/password string - " + ex.getMessage() + utils.log("ERROR", dataErrorMessage) + } + return encodedString + } + +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CompleteMsoProcess.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcess.groovy index 57a04e5439..9c4c73fb7d 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CompleteMsoProcess.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcess.groovy @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,24 +18,25 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.common.scripts +package org.onap.so.bpmn.common.scripts import org.apache.commons.lang3.* import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution
- +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger public class CompleteMsoProcess extends AbstractServiceTaskProcessor { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CompleteMsoProcess.class); String Prefix="CMSO_" ExceptionUtil exceptionUtil = new ExceptionUtil() // Complete MSO Request processing - public initializeProcessVariables(DelegateExecution execution){
+ public initializeProcessVariables(DelegateExecution execution){ def method = getClass().getSimpleName() + '.initializeProcessVariables(' +'execution=' + execution.getId() +')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) + msoLogger.trace('Entered ' + method) try { /* Initialize all the process request variables in this block */ @@ -70,30 +71,29 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor { } catch (BpmnError e) { throw e; } catch (Exception e) { - logError('Caught exception in ' + method, e) + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method) } } - public void preProcessRequest (DelegateExecution execution) {
+ public void preProcessRequest (DelegateExecution execution) { initializeProcessVariables(execution) def method = getClass().getSimpleName() + '.preProcessRequest(' +'execution=' + execution.getId() +')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') -// utils.log("DEBUG", "*** Started CompleteMsoProcess preProcessRequest Method ***", isDebugLogEnabled); - logDebug('Entered ' + method, isDebugLogEnabled) - - setBasicDBAuthHeader(execution, isDebugLogEnabled) + // msoLogger.trace("Started CompleteMsoProcess preProcessRequest Method "); + msoLogger.trace('Entered ' + method) + + setBasicDBAuthHeader(execution, execution.getVariable('isDebugLogEnabled')) try { def xml = execution.getVariable("CompleteMsoProcessRequest") - utils.logAudit("CompleteMsoProcess Request: " + xml) - utils.log("DEBUG", "Incoming Request is: "+ xml, isDebugLogEnabled) + msoLogger.debug("CompleteMsoProcess Request: " + xml) + msoLogger.debug("Incoming Request is: "+ xml) //mso-bpel-name from the incoming request - def msoBpelName = utils.getNodeText1(xml,"mso-bpel-name") + def msoBpelName = utils.getNodeText(xml,"mso-bpel-name") execution.setVariable("CMSO_mso-bpel-name",msoBpelName) //Check the incoming request type @@ -103,7 +103,7 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor { } //Check for rehome indicator - def rehomeIndicator = utils.getNodeText1(xml,"rehomeDone") + def rehomeIndicator = utils.getNodeText(xml,"rehomeDone") execution.setVariable("rehomeDone", rehomeIndicator) //Check notification-url for the incoming request type @@ -143,18 +143,18 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor { execution.setVariable("CMSO_source",utils.getNodeText(xml,"source")) } - utils.log("DEBUG", "CMSO_notification-url-Ok --> " + execution.getVariable("CMSO_notification-url-Ok"), isDebugLogEnabled) - utils.log("DEBUG", "CMSO_request_id-Ok --> " + execution.getVariable("CMSO_request_id-Ok"), isDebugLogEnabled) + msoLogger.trace("--> " + execution.getVariable("")) + msoLogger.trace("--> " + execution.getVariable("")) // set the DHV/Service Instantiation values if specified in the request - execution.setVariable("CMSO_is_srv_inst_req", String.valueOf("true".equals(utils.getNodeText1(xml, "is-srv-inst-req")))) - utils.log("DEBUG", "CMSO_is_srv_inst_req --> " + execution.getVariable("CMSO_is_srv_inst_req"), isDebugLogEnabled) - execution.setVariable("CMSO_is_json_content", String.valueOf("JSON".equals(utils.getNodeText1(xml, "resp-content-type")))) - utils.log("DEBUG", "CMSO_is_json_content --> " + execution.getVariable("CMSO_is_json_content"), isDebugLogEnabled) - execution.setVariable("CMSO_service_inst_id", utils.getNodeText1(xml, "service-instance-id")) - utils.log("DEBUG", "CMSO_service_inst_id --> " + execution.getVariable("CMSO_service_inst_id"), isDebugLogEnabled) - execution.setVariable("CMSO_start_time", utils.getNodeText1(xml, "start-time")) - utils.log("DEBUG", "CMSO_start_time --> " + execution.getVariable("CMSO_start_time"), isDebugLogEnabled) + execution.setVariable("CMSO_is_srv_inst_req", String.valueOf("true".equals(utils.getNodeText(xml, "is-srv-inst-req")))) + msoLogger.trace("--> " + execution.getVariable("")) + execution.setVariable("CMSO_is_json_content", String.valueOf("JSON".equals(utils.getNodeText(xml, "resp-content-type")))) + msoLogger.trace("--> " + execution.getVariable("")) + execution.setVariable("CMSO_service_inst_id", utils.getNodeText(xml, "service-instance-id")) + msoLogger.trace("--> " + execution.getVariable("")) + execution.setVariable("CMSO_start_time", utils.getNodeText(xml, "start-time")) + msoLogger.trace("--> " + execution.getVariable("")) // this variable is used by the camunda flow to set the Content-Type for the async response if (execution.getVariable("CMSO_is_srv_inst_req").equals("true") && execution.getVariable("CMSO_is_json_content").equals("true")) { @@ -163,22 +163,21 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor { execution.setVariable("CMSO_content_type", "text/xml") } - logDebug('Exited ' + method, isDebugLogEnabled) + msoLogger.trace('Exited ' + method) } catch (BpmnError e) { throw e; } catch (Exception e) { - utils.log("DEBUG", "Exception Occured During PreProcessRequest: " + e, isDebugLogEnabled); + msoLogger.debug("Exception Occured During PreProcessRequest: " + e); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in " + method) } -// utils.log("DEBUG", "*** Completed CompleteMsoProcess preProcessRequest Method ***", isDebugLogEnabled); +// msoLogger.trace("Completed CompleteMsoProcess preProcessRequest Method "); } - public void setUpdateDBstatustoSuccessPayload (DelegateExecution execution){
+ public void setUpdateDBstatustoSuccessPayload (DelegateExecution execution){ def method = getClass().getSimpleName() + '.setUpdateDBstatustoSuccessPayload(' +'execution=' + execution.getId() +')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) + msoLogger.trace('Entered ' + method) try { @@ -187,7 +186,7 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor { //Get statusMessage if exists def statusMessage if(utils.nodeExists(xml, "status-message")){ - statusMessage = utils.getNodeText1(xml, "status-message") + statusMessage = utils.getNodeText(xml, "status-message") }else{ statusMessage = "Resource Completed Successfully" } @@ -210,16 +209,16 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor { idXml = "" } idXml = utils.removeXmlPreamble(idXml) - utils.log("DEBUG", "Incoming Instance Id Xml: " + idXml, isDebugLogEnabled) + msoLogger.debug("Incoming Instance Id Xml: " + idXml) String payload = """ - <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.openecomp.mso/requestsdb"> + <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.onap.so/requestsdb"> <soapenv:Header/> <soapenv:Body> <req:updateInfraRequest> - <requestId>${execution.getVariable("CMSO_request_id")}</requestId> - <lastModifiedBy>${execution.getVariable("CMSO_mso-bpel-name")}</lastModifiedBy> - <statusMessage>${statusMessage}</statusMessage> + <requestId>${MsoUtils.xmlEscape(execution.getVariable("CMSO_request_id"))}</requestId> + <lastModifiedBy>${MsoUtils.xmlEscape(execution.getVariable("CMSO_mso-bpel-name"))}</lastModifiedBy> + <statusMessage>${MsoUtils.xmlEscape(statusMessage)}</statusMessage> <requestStatus>COMPLETE</requestStatus> <progress>100</progress> ${idXml} @@ -228,27 +227,26 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor { </soapenv:Envelope>""" execution.setVariable("CMSO_setUpdateDBstatustoSuccessPayload", payload) - utils.log("DEBUG", "Outgoing Update Mso Request Payload is: " + payload, isDebugLogEnabled) - utils.logAudit("setUpdateDBstatustoSuccessPayload: " + payload) + msoLogger.debug("Outgoing Update Mso Request Payload is: " + payload) + msoLogger.debug("setUpdateDBstatustoSuccessPayload: " + payload) } catch (BpmnError e) { throw e; } catch (Exception e) { - logError('Caught exception in ' + method, e) + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method) } - logDebug('Exited ' + method, isDebugLogEnabled) + msoLogger.trace('Exited ' + method) } - public void buildDataError (DelegateExecution execution, String message) {
+ public void buildDataError (DelegateExecution execution, String message) { def method = getClass().getSimpleName() + '.buildDataError(' +'execution=' + execution.getId() +')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) + msoLogger.trace('Entered ' + method) try { def msoCompletionResponse = """ - <sdncadapterworkflow:MsoCompletionResponse xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1"> + <sdncadapterworkflow:MsoCompletionResponse xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> <sdncadapterworkflow:out>BPEL ${execution.getVariable("CMSO_mso-bpel-name")} FAILED</sdncadapterworkflow:out> </sdncadapterworkflow:MsoCompletionResponse> """.trim() @@ -256,28 +254,27 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor { // Format Response def xmlMsoCompletionResponse = utils.formatXml(msoCompletionResponse) String buildMsoCompletionResponseAsString = xmlMsoCompletionResponse.drop(38).trim() - utils.logAudit("CompleteMsoProcess Response: " + buildMsoCompletionResponseAsString) + msoLogger.debug("CompleteMsoProcess Response: " + buildMsoCompletionResponseAsString) execution.setVariable("CompleteMsoProcessResponse", buildMsoCompletionResponseAsString) - utils.log("DEBUG", "@@ CompleteMsoProcess Response @@ " + "\n" + execution.getVariable("CompletionHandlerResponse"), isDebugLogEnabled) + msoLogger.debug("@@ CompleteMsoProcess Response @@ " + "\n" + execution.getVariable("CompletionHandlerResponse")) exceptionUtil.buildAndThrowWorkflowException(execution, 500, message) } catch (BpmnError e) { - utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugLogEnabled) + msoLogger.debug("Rethrowing MSOWorkflowException") throw e; } catch (Exception e) { - logError('Caught exception in ' + method, e) + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method) } } - public void postProcessResponse (DelegateExecution execution) {
+ public void postProcessResponse (DelegateExecution execution) { def method = getClass().getSimpleName() + '.postProcessResponse(' +'execution=' + execution.getId() +')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - // utils.log("DEBUG", "*** Started CompleteMsoProcess PostProcessRequest Method ***", isDebugLogEnabled); + msoLogger.trace('Entered ' + method) + // msoLogger.trace("Started CompleteMsoProcess PostProcessRequest Method "); try { def msoCompletionResponse = """ @@ -291,22 +288,22 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor { String buildMsoCompletionResponseAsString = xmlMsoCompletionResponse.drop(38).trim() // TODO: Should deprecate use of processKey+Response variable for the response. Will use "WorkflowResponse" instead execution.setVariable("WorkflowResponse", buildMsoCompletionResponseAsString) - utils.logAudit("CompleteMsoProcess Response: " + buildMsoCompletionResponseAsString) + msoLogger.debug("CompleteMsoProcess Response: " + buildMsoCompletionResponseAsString) execution.setVariable("CompleteMsoProcessResponse", buildMsoCompletionResponseAsString) execution.setVariable("CMSO_ResponseCode", "200") setSuccessIndicator(execution, true) - utils.log("DEBUG", "@@ CompleteMsoProcess Response @@ " + "\n" + execution.getVariable("CompleteMsoProcessResponse"), isDebugLogEnabled) + msoLogger.debug("@@ CompleteMsoProcess Response @@ " + "\n" + execution.getVariable("CompleteMsoProcessResponse")) - logDebug('Exited ' + method, isDebugLogEnabled) + msoLogger.trace('Exited ' + method) } catch (BpmnError e) { throw e; } catch (Exception e) { - logError('Caught exception in ' + method, e) + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method) } - // utils.log("DEBUG", "*** Completed CompleteMsoProcess PostProcessRequest Method ***", isDebugLogEnabled); + // msoLogger.trace("Completed CompleteMsoProcess PostProcessRequest Method "); } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ConfirmVolumeGroupName.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy index 615e25de71..8b786bc152 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ConfirmVolumeGroupName.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy @@ -1,159 +1,152 @@ -/*-
- * ============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.common.scripts
-import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.openecomp.mso.rest.APIResponse
-
-
-public class ConfirmVolumeGroupName extends AbstractServiceTaskProcessor{
-
- def Prefix="CVGN_"
- ExceptionUtil exceptionUtil = new ExceptionUtil()
-
- public void initProcessVariables(DelegateExecution execution) {
- execution.setVariable("prefix",Prefix)
- execution.setVariable("CVGN_volumeGroupId",null)
- execution.setVariable("CVGN_volumeGroupName",null)
- execution.setVariable("CVGN_aicCloudRegion", null)
- execution.setVariable("CVGN_volumeGroupGetEndpoint",null)
-
- // ConfirmVolumeGroupName workflow response variable placeholders
- execution.setVariable("CVGN_volumeGroupNameMatches", false)
- execution.setVariable("CVGN_queryVolumeGroupResponseCode",null)
- execution.setVariable("CVGN_queryVolumeGroupResponse","")
- execution.setVariable("CVGN_ResponseCode",null)
-// execution.setVariable("CVGN_ErrorResponse","")
- execution.setVariable("RollbackData", null)
- }
-
- // store the incoming data in the flow DelegateExecution
- public void preProcessRequest(DelegateExecution execution) {
- def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled")
- def volumeGroupId = execution.getVariable("ConfirmVolumeGroupName_volumeGroupId")
- def volumeGroupName= execution.getVariable("ConfirmVolumeGroupName_volumeGroupName")
- def aicCloudRegion = execution.getVariable("ConfirmVolumeGroupName_aicCloudRegion")
-
- initProcessVariables(execution)
- execution.setVariable("CVGN_volumeGroupId", volumeGroupId)
- execution.setVariable("CVGN_volumeGroupName", volumeGroupName)
- execution.setVariable("CVGN_aicCloudRegion", aicCloudRegion)
-
- AaiUtil aaiUriUtil = new AaiUtil(this)
- def aai_uri = aaiUriUtil.getCloudInfrastructureCloudRegionUri(execution)
- logDebug('AAI URI is: ' + aai_uri, isDebugLogEnabled)
- utils.logAudit("AAI URI: " + aai_uri)
- execution.setVariable("CVGN_volumeGroupGetEndpoint","${aai_uri}/${aicCloudRegion}/volume-groups/volume-group/" +
- volumeGroupId)
- }
-
- // send a GET request to AA&I to retrieve the Volume information based on volume-group-id
- // expect a 200 response with the information in the response body or a 404 if the volume group id does not exist
- public void queryAAIForVolumeGroupId(DelegateExecution execution) {
- def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled")
- def endPoint = execution.getVariable("URN_aai_endpoint") + execution.getVariable("CVGN_volumeGroupGetEndpoint")
-
- try {
- logDebug("invoking GET call to AAI endpoint :"+System.lineSeparator()+endPoint,isDebugLogEnabled)
- utils.log("DEBUG","queryAAIForVolumeGroupId() endpoint-" + endPoint, isDebugLogEnabled)
- utils.logAudit("ConfirmVolumeGroup sending GET call to AAI Endpoint: " + endPoint)
-
- AaiUtil aaiUtil = new AaiUtil(this)
- APIResponse response = aaiUtil.executeAAIGetCall(execution, endPoint)
- def responseData = response.getResponseBodyAsString()
- def responseStatusCode = response.getStatusCode()
- execution.setVariable("CVGN_queryVolumeGroupResponseCode", responseStatusCode)
- execution.setVariable("CVGN_queryVolumeGroupResponse", responseData)
-
- utils.logAudit("Response code:" + responseStatusCode)
- utils.logAudit("Response:" + responseData)
- logDebug("Response code:" + responseStatusCode, isDebugLogEnabled)
- logDebug("Response:" + System.lineSeparator()+responseData,isDebugLogEnabled)
- } catch (Exception ex) {
- // ex.printStackTrace()
- logDebug("Exception occurred while executing AAI GET:" + ex.getMessage(),isDebugLogEnabled)
- execution.setVariable("CVGN_queryVolumeGroupResponseCode", 500)
- execution.setVariable("CVGN_queryVolumeGroupResponse", "AAI GET Failed:" + ex.getMessage())
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, "AAI GET Failed")
- }
- }
-
- // process the result from queryAAIVolumeGroupId()
-
- public void checkAAIQueryResult(DelegateExecution execution) {
- def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled")
- def result = execution.getVariable("CVGN_queryVolumeGroupResponse")
-
- if (execution.getVariable("CVGN_queryVolumeGroupResponseCode") == 404) {
- logDebug('volumeGroupId does not exist in AAI', isDebugLogEnabled)
- }
- else if (execution.getVariable("CVGN_queryVolumeGroupResponseCode") == 200) {
- logDebug("volumeGroupId exists in AAI", isDebugLogEnabled)
- }
- def xml = execution.getVariable("CVGN_queryVolumeGroupResponse")
- def actualVolumeGroupName = ""
- if (utils.nodeExists(xml, "volume-group-name")) {
- actualVolumeGroupName = utils.getNodeText(xml, "volume-group-name")
- }
- execution.setVariable("CVGN_volumeGroupNameMatches", false)
- def volumeGroupName = execution.getVariable("CVGN_volumeGroupName")
-
- if (volumeGroupName.equals(actualVolumeGroupName)) {
- logDebug('Volume Group Name Matches AAI records', isDebugLogEnabled)
- execution.setVariable("CVGN_volumeGroupNameMatches", true)
- }
- }
-
-
- // generates a WorkflowException if the A&AI query returns a response code other than 200/404
- public void handleAAIQueryFailure(DelegateExecution execution) {
- def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled")
-
- logError("Error occurred attempting to query AAI, Response Code " +
- execution.getVariable("CVGN_queryVolumeGroupResponseCode") + ", Error Response " +
- execution.getVariable("CVGN_queryVolumeGroupResponse"))
- //String processKey = getProcessKey(execution);
- //WorkflowException exception = new WorkflowException(processKey, 5000,
- //execution.getVariable("CVGN_queryVolumeGroupResponse"))
- //execution.setVariable("WorkflowException", exception)
- }
-
- // generates a WorkflowException if the volume group name does not match AAI record for this volume group
- public void handleVolumeGroupNameNoMatch(DelegateExecution execution) {
- def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled")
-
- def errorNotAssociated = "Error occurred - volume group id " + execution.getVariable("CVGN_volumeGroupId") +
- " is not associated with " + execution.getVariable("CVGN_volumeGroupName")
- logError(errorNotAssociated)
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, errorNotAssociated)
- //String processKey = getProcessKey(execution);
- //WorkflowException exception = new WorkflowException(processKey, 1002,
- // errorNotAssociated)
- //execution.setVariable("WorkflowException", exception)
- }
-
- // sends a successful WorkflowResponse
- public void reportSuccess(DelegateExecution execution) {
- def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled")
- logDebug("Sending 200 back to the caller", isDebugLogEnabled)
- def responseXML = ""
- execution.setVariable("WorkflowResponse", responseXML)
- }
+/*- + * ============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.common.scripts +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.rest.APIResponse +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + +public class ConfirmVolumeGroupName extends AbstractServiceTaskProcessor{ + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ConfirmVolumeGroupName.class); + + def Prefix="CVGN_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + + public void initProcessVariables(DelegateExecution execution) { + execution.setVariable("prefix",Prefix) + execution.setVariable("CVGN_volumeGroupId",null) + execution.setVariable("CVGN_volumeGroupName",null) + execution.setVariable("CVGN_aicCloudRegion", null) + execution.setVariable("CVGN_volumeGroupGetEndpoint",null) + + // ConfirmVolumeGroupName workflow response variable placeholders + execution.setVariable("CVGN_volumeGroupNameMatches", false) + execution.setVariable("CVGN_queryVolumeGroupResponseCode",null) + execution.setVariable("CVGN_queryVolumeGroupResponse","") + execution.setVariable("CVGN_ResponseCode",null) +// execution.setVariable("CVGN_ErrorResponse","") + execution.setVariable("RollbackData", null) + } + + // store the incoming data in the flow DelegateExecution + public void preProcessRequest(DelegateExecution execution) { + def volumeGroupId = execution.getVariable("ConfirmVolumeGroupName_volumeGroupId") + def volumeGroupName= execution.getVariable("ConfirmVolumeGroupName_volumeGroupName") + def aicCloudRegion = execution.getVariable("ConfirmVolumeGroupName_aicCloudRegion") + + initProcessVariables(execution) + execution.setVariable("CVGN_volumeGroupId", volumeGroupId) + execution.setVariable("CVGN_volumeGroupName", volumeGroupName) + execution.setVariable("CVGN_aicCloudRegion", aicCloudRegion) + + AaiUtil aaiUriUtil = new AaiUtil(this) + def aai_uri = aaiUriUtil.getCloudInfrastructureCloudRegionUri(execution) + msoLogger.debug('AAI URI is: ' + aai_uri) + msoLogger.debug("AAI URI: " + aai_uri) + execution.setVariable("CVGN_volumeGroupGetEndpoint","${aai_uri}/${aicCloudRegion}/volume-groups/volume-group/" + + volumeGroupId) + } + + // send a GET request to AA&I to retrieve the Volume information based on volume-group-id + // expect a 200 response with the information in the response body or a 404 if the volume group id does not exist + public void queryAAIForVolumeGroupId(DelegateExecution execution) { + def endPoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + execution.getVariable("CVGN_volumeGroupGetEndpoint") + + try { + msoLogger.debug("invoking GET call to AAI endpoint :"+System.lineSeparator()+endPoint) + msoLogger.debug("queryAAIForVolumeGroupId() endpoint-" + endPoint) + msoLogger.debug("ConfirmVolumeGroup sending GET call to AAI Endpoint: " + endPoint) + + AaiUtil aaiUtil = new AaiUtil(this) + APIResponse response = aaiUtil.executeAAIGetCall(execution, endPoint) + def responseData = response.getResponseBodyAsString() + def responseStatusCode = response.getStatusCode() + execution.setVariable("CVGN_queryVolumeGroupResponseCode", responseStatusCode) + execution.setVariable("CVGN_queryVolumeGroupResponse", responseData) + + msoLogger.debug("Response code:" + responseStatusCode) + msoLogger.debug("Response:" + responseData) + msoLogger.debug("Response code:" + responseStatusCode) + msoLogger.debug("Response:" + System.lineSeparator()+responseData) + } catch (Exception ex) { + // ex.printStackTrace() + msoLogger.debug("Exception occurred while executing AAI GET:" + ex.getMessage()) + execution.setVariable("CVGN_queryVolumeGroupResponseCode", 500) + execution.setVariable("CVGN_queryVolumeGroupResponse", "AAI GET Failed:" + ex.getMessage()) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "AAI GET Failed") + } + } + + // process the result from queryAAIVolumeGroupId() + + public void checkAAIQueryResult(DelegateExecution execution) { + def result = execution.getVariable("CVGN_queryVolumeGroupResponse") + + if (execution.getVariable("CVGN_queryVolumeGroupResponseCode") == 404) { + msoLogger.debug('volumeGroupId does not exist in AAI') + } + else if (execution.getVariable("CVGN_queryVolumeGroupResponseCode") == 200) { + msoLogger.debug("volumeGroupId exists in AAI") + } + def xml = execution.getVariable("CVGN_queryVolumeGroupResponse") + def actualVolumeGroupName = "" + if (utils.nodeExists(xml, "volume-group-name")) { + actualVolumeGroupName = utils.getNodeText(xml, "volume-group-name") + } + execution.setVariable("CVGN_volumeGroupNameMatches", false) + def volumeGroupName = execution.getVariable("CVGN_volumeGroupName") + + if (volumeGroupName.equals(actualVolumeGroupName)) { + msoLogger.debug('Volume Group Name Matches AAI records') + execution.setVariable("CVGN_volumeGroupNameMatches", true) + } + } + + + // generates a WorkflowException if the A&AI query returns a response code other than 200/404 + public void handleAAIQueryFailure(DelegateExecution execution) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Error occurred attempting to query AAI, Response Code " + execution.getVariable("CVGN_queryVolumeGroupResponseCode"), "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "ErrorResponse is:\n" + execution.getVariable("CVGN_queryVolumeGroupResponse")); + //String processKey = getProcessKey(execution); + //WorkflowException exception = new WorkflowException(processKey, 5000, + //execution.getVariable("CVGN_queryVolumeGroupResponse")) + //execution.setVariable("WorkflowException", exception) + } + + // generates a WorkflowException if the volume group name does not match AAI record for this volume group + public void handleVolumeGroupNameNoMatch(DelegateExecution execution) { + def errorNotAssociated = "Error occurred - volume group id " + execution.getVariable("CVGN_volumeGroupId") + + " is not associated with " + execution.getVariable("CVGN_volumeGroupName") + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, errorNotAssociated, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, errorNotAssociated) + //String processKey = getProcessKey(execution); + //WorkflowException exception = new WorkflowException(processKey, 1002, + // errorNotAssociated) + //execution.setVariable("WorkflowException", exception) + } + + // sends a successful WorkflowResponse + public void reportSuccess(DelegateExecution execution) { + msoLogger.debug("Sending 200 back to the caller") + def responseXML = "" + execution.setVariable("WorkflowResponse", responseXML) + } }
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy index ecb18043a7..c0ed81c553 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy @@ -1,193 +1,193 @@ -/*-
- * ============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.common.scripts
-
-import javax.xml.parsers.DocumentBuilder
-import javax.xml.parsers.DocumentBuilderFactory
-
-import org.apache.commons.lang3.*
-import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.openecomp.mso.bpmn.core.WorkflowException
-import org.openecomp.mso.rest.APIResponse
-import org.w3c.dom.Document
-import org.w3c.dom.Element
-import org.w3c.dom.Node
-import org.w3c.dom.NodeList
-import org.xml.sax.InputSource
-
-
-/**
- * Vnf Module Subflow for confirming the volume group belongs
- * to the tenant
- *
- * @param tenantId
- * @param volumeGroupId
- *
- */
-class ConfirmVolumeGroupTenant extends AbstractServiceTaskProcessor{
-
- String Prefix="CVGT_"
- ExceptionUtil exceptionUtil = new ExceptionUtil()
-
- public void preProcessRequest(DelegateExecution execution){
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- execution.setVariable("prefix", Prefix)
- utils.log("DEBUG", " ======== STARTED Confirm Volume Group Tenant Subflow ======== ", isDebugEnabled)
- String processKey = getProcessKey(execution);
- try{
- utils.log("DEBUG", " === Started QueryAAIForVolumeGroup Process === ", isDebugEnabled)
-
- String volumeGroupId = execution.getVariable("volumeGroupId")
- String incomingGroupName = execution.getVariable("volumeGroupName")
- String incomingTenantId = execution.getVariable("tenantId")
- def aicCloudRegion = execution.getVariable("aicCloudRegion")
- String aai = execution.getVariable("URN_aai_endpoint")
-
- AaiUtil aaiUriUtil = new AaiUtil(this)
- def aai_uri = aaiUriUtil.getCloudInfrastructureCloudRegionUri(execution)
- logDebug('AAI URI is: ' + aai_uri, isDebugEnabled)
-
- String path = aai + "${aai_uri}/${aicCloudRegion}/volume-groups/volume-group/" + volumeGroupId
-
- APIResponse queryAAIForVolumeGroupResponse = aaiUriUtil.executeAAIGetCall(execution, path)
-
- def responseCode = queryAAIForVolumeGroupResponse.getStatusCode()
- execution.setVariable("queryVolumeGroupResponseCode", responseCode)
- String response = queryAAIForVolumeGroupResponse.getResponseBodyAsString()
- response = StringEscapeUtils.unescapeXml(response)
-
- utils.logAudit("ConfirmVolumeGroup Response: " + response)
- utils.logAudit("ConfirmVolumeGroup Response Code: " + responseCode)
-
- if(responseCode == 200 && response != null){
- execution.setVariable("queryAAIVolumeGroupResponse", response)
- utils.log("DEBUG", "QueryAAIForVolumeGroup Received a Good REST Response is: \n" + response, isDebugEnabled)
-
- String volumeGroupTenantId = ""
- InputSource source = new InputSource(new StringReader(response));
- DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
- docFactory.setNamespaceAware(true)
- DocumentBuilder docBuilder = docFactory.newDocumentBuilder()
- Document createVCERequestXml = docBuilder.parse(source)
- NodeList nodeList = createVCERequestXml.getElementsByTagNameNS("*", "relationship")
- for (int x = 0; x < nodeList.getLength(); x++) {
- Node node = nodeList.item(x)
- if (node.getNodeType() == Node.ELEMENT_NODE) {
- Element eElement = (Element) node
- String e = eElement.getElementsByTagNameNS("*", "related-to").item(0).getTextContent()
- if(e.equals("tenant")){
- NodeList relationDataList = eElement.getElementsByTagNameNS("*", "relationship-data")
- for (int d = 0; d < relationDataList.getLength(); d++) {
- Node dataNode = relationDataList.item(d)
- if (dataNode.getNodeType() == Node.ELEMENT_NODE) {
- Element dElement = (Element) dataNode
- String key = dElement.getElementsByTagNameNS("*", "relationship-key").item(0).getTextContent()
- if(key.equals("tenant.tenant-id")){
- volumeGroupTenantId = dElement.getElementsByTagNameNS("*", "relationship-value").item(0).getTextContent()
- }
- }
- }
- }
- }
- }
-
- //Determine if Tenant Ids match
- if(incomingTenantId.equals(volumeGroupTenantId)){
- utils.log("DEBUG", "Tenant Ids Match", isDebugEnabled)
- execution.setVariable("tenantIdsMatch", true)
- }else{
- utils.log("DEBUG", "Tenant Ids DO NOT Match", isDebugEnabled)
- execution.setVariable("tenantIdsMatch", false)
- }
-
- //Determine if Volume Group Names match
- String volumeGroupName = utils.getNodeText1(response, "volume-group-name")
- if(incomingGroupName == null || incomingGroupName.length() < 1){
- utils.log("DEBUG", "Incoming Volume Group Name is NOT Provided.", isDebugEnabled)
- execution.setVariable("groupNamesMatch", true)
- }else{
- utils.log("DEBUG", "Incoming Volume Group Name is: " + incomingGroupName, isDebugEnabled)
- if(volumeGroupName.equals(incomingGroupName)){
- utils.log("DEBUG", "Volume Group Names Match.", isDebugEnabled)
- execution.setVariable("groupNamesMatch", true)
- }else{
- utils.log("DEBUG", "Volume Group Names DO NOT Match.", isDebugEnabled)
- execution.setVariable("groupNamesMatch", false)
- }
- }
- }else{
- utils.log("DEBUG", "QueryAAIForVolumeGroup Bad REST Response!", isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 1, "Error Searching AAI for Volume Group. Received a Bad Response.")
- }
-
- }catch(BpmnError b){
- throw b
- }catch(Exception e){
- utils.log("ERROR", "Exception Occured Processing queryAAIForVolumeGroup. Exception is:\n" + e, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured in preProcessRequest.")
- }
- utils.log("DEBUG", "=== COMPLETED queryAAIForVolumeGroup Process === ", isDebugEnabled)
- }
-
- public void assignVolumeHeatId(DelegateExecution execution){
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- execution.setVariable("prefix", Prefix)
- try{
- utils.log("DEBUG", " === Started assignVolumeHeatId Process === ", isDebugEnabled)
-
- String response = execution.getVariable("queryAAIVolumeGroupResponse")
- String heatStackId = utils.getNodeText1(response, "heat-stack-id")
- execution.setVariable("volumeHeatStackId", heatStackId)
- execution.setVariable("ConfirmVolumeGroupTenantResponse", heatStackId)
- // TODO: Should deprecate use of processKey+Response variable for the response. Will use "WorkflowResponse" instead
- execution.setVariable("WorkflowResponse", heatStackId)
- utils.log("DEBUG", "Volume Heat Stack Id is: " + heatStackId, isDebugEnabled)
-
- }catch(Exception e){
- utils.log("ERROR", "Exception Occured Processing assignVolumeHeatId. Exception is:\n" + e, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured in assignVolumeHeatId.")
- }
- utils.log("DEBUG", "=== COMPLETED assignVolumeHeatId Process === ", isDebugEnabled)
- utils.log("DEBUG", "======== COMPLETED Confirm Volume Group Tenant Subflow ======== ", isDebugEnabled)
-}
-
- public void assignWorkflowException(DelegateExecution execution, String message){
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- execution.setVariable("prefix", Prefix)
- String processKey = getProcessKey(execution);
- utils.log("DEBUG", " === STARTED Assign Workflow Exception === ", isDebugEnabled)
- try{
- String volumeGroupId = execution.getVariable("volumeGroupId")
- int errorCode = 1
- String errorMessage = "Volume Group " + volumeGroupId + " " + message
-
- exceptionUtil.buildWorkflowException(execution, errorCode, errorMessage)
- }catch(Exception e){
- utils.log("ERROR", "Exception Occured Processing assignWorkflowException. Exception is:\n" + e, isDebugEnabled)
- }
- utils.log("DEBUG", "=== COMPLETED Assign Workflow Exception ==== ", isDebugEnabled)
- }
-
-
-
-}
-
+/*- + * ============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.common.scripts + +import org.onap.so.bpmn.core.UrnPropertiesReader + +import javax.xml.parsers.DocumentBuilder +import javax.xml.parsers.DocumentBuilderFactory + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.rest.APIResponse +import org.w3c.dom.Document +import org.w3c.dom.Element +import org.w3c.dom.Node +import org.w3c.dom.NodeList +import org.xml.sax.InputSource +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + +/** + * Vnf Module Subflow for confirming the volume group belongs + * to the tenant + * + * @param tenantId + * @param volumeGroupId + * + */ +class ConfirmVolumeGroupTenant extends AbstractServiceTaskProcessor{ + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ConfirmVolumeGroupTenant.class); + + String Prefix="CVGT_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + + public void preProcessRequest(DelegateExecution execution){ + execution.setVariable("prefix", Prefix) + msoLogger.trace("STARTED Confirm Volume Group Tenant Subflow ") + String processKey = getProcessKey(execution); + try{ + msoLogger.trace("Started QueryAAIForVolumeGroup Process ") + + String volumeGroupId = execution.getVariable("volumeGroupId") + String incomingGroupName = execution.getVariable("volumeGroupName") + String incomingTenantId = execution.getVariable("tenantId") + def aicCloudRegion = execution.getVariable("aicCloudRegion") + String aai = UrnPropertiesReader.getVariable("aai.endpoint", execution) + + AaiUtil aaiUriUtil = new AaiUtil(this) + def aai_uri = aaiUriUtil.getCloudInfrastructureCloudRegionUri(execution) + msoLogger.debug('AAI URI is: ' + aai_uri) + + String path = aai + "${aai_uri}/${aicCloudRegion}/volume-groups/volume-group/" + volumeGroupId + + APIResponse queryAAIForVolumeGroupResponse = aaiUriUtil.executeAAIGetCall(execution, path) + + def responseCode = queryAAIForVolumeGroupResponse.getStatusCode() + execution.setVariable("queryVolumeGroupResponseCode", responseCode) + String response = queryAAIForVolumeGroupResponse.getResponseBodyAsString() + + msoLogger.debug("ConfirmVolumeGroup Response: " + response) + msoLogger.debug("ConfirmVolumeGroup Response Code: " + responseCode) + + if(responseCode == 200 && response != null){ + execution.setVariable("queryAAIVolumeGroupResponse", response) + msoLogger.debug("QueryAAIForVolumeGroup Received a Good REST Response is: \n" + response) + + String volumeGroupTenantId = "" + InputSource source = new InputSource(new StringReader(response)); + DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); + docFactory.setNamespaceAware(true) + DocumentBuilder docBuilder = docFactory.newDocumentBuilder() + Document createVCERequestXml = docBuilder.parse(source) + NodeList nodeList = createVCERequestXml.getElementsByTagNameNS("*", "relationship") + for (int x = 0; x < nodeList.getLength(); x++) { + Node node = nodeList.item(x) + if (node.getNodeType() == Node.ELEMENT_NODE) { + Element eElement = (Element) node + String e = eElement.getElementsByTagNameNS("*", "related-to").item(0).getTextContent() + if(e.equals("tenant")){ + NodeList relationDataList = eElement.getElementsByTagNameNS("*", "relationship-data") + for (int d = 0; d < relationDataList.getLength(); d++) { + Node dataNode = relationDataList.item(d) + if (dataNode.getNodeType() == Node.ELEMENT_NODE) { + Element dElement = (Element) dataNode + String key = dElement.getElementsByTagNameNS("*", "relationship-key").item(0).getTextContent() + if(key.equals("tenant.tenant-id")){ + volumeGroupTenantId = dElement.getElementsByTagNameNS("*", "relationship-value").item(0).getTextContent() + } + } + } + } + } + } + + //Determine if Tenant Ids match + if(incomingTenantId.equals(volumeGroupTenantId)){ + msoLogger.debug("Tenant Ids Match") + execution.setVariable("tenantIdsMatch", true) + }else{ + msoLogger.debug("Tenant Ids DO NOT Match") + execution.setVariable("tenantIdsMatch", false) + } + + //Determine if Volume Group Names match + String volumeGroupName = utils.getNodeText(response, "volume-group-name") + if(incomingGroupName == null || incomingGroupName.length() < 1){ + msoLogger.debug("Incoming Volume Group Name is NOT Provided.") + execution.setVariable("groupNamesMatch", true) + }else{ + msoLogger.debug("Incoming Volume Group Name is: " + incomingGroupName) + if(volumeGroupName.equals(incomingGroupName)){ + msoLogger.debug("Volume Group Names Match.") + execution.setVariable("groupNamesMatch", true) + }else{ + msoLogger.debug("Volume Group Names DO NOT Match.") + execution.setVariable("groupNamesMatch", false) + } + } + }else{ + msoLogger.debug("QueryAAIForVolumeGroup Bad REST Response!") + exceptionUtil.buildAndThrowWorkflowException(execution, 1, "Error Searching AAI for Volume Group. Received a Bad Response.") + } + + }catch(BpmnError b){ + throw b + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing queryAAIForVolumeGroup.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e); + exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured in preProcessRequest.") + } + msoLogger.trace("COMPLETED queryAAIForVolumeGroup Process ") + } + + public void assignVolumeHeatId(DelegateExecution execution){ + execution.setVariable("prefix", Prefix) + try{ + msoLogger.trace("Started assignVolumeHeatId Process ") + + String response = execution.getVariable("queryAAIVolumeGroupResponse") + String heatStackId = utils.getNodeText(response, "heat-stack-id") + execution.setVariable("volumeHeatStackId", heatStackId) + execution.setVariable("ConfirmVolumeGroupTenantResponse", heatStackId) + // TODO: Should deprecate use of processKey+Response variable for the response. Will use "WorkflowResponse" instead + execution.setVariable("WorkflowResponse", heatStackId) + msoLogger.debug("Volume Heat Stack Id is: " + heatStackId) + + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing assignVolumeHeatId.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e); + exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured in assignVolumeHeatId.") + } + msoLogger.trace("COMPLETED assignVolumeHeatId Process ") + msoLogger.trace("COMPLETED Confirm Volume Group Tenant Subflow ") +} + + public void assignWorkflowException(DelegateExecution execution, String message){ + execution.setVariable("prefix", Prefix) + String processKey = getProcessKey(execution); + msoLogger.trace("STARTED Assign Workflow Exception ") + try{ + String volumeGroupId = execution.getVariable("volumeGroupId") + int errorCode = 1 + String errorMessage = "Volume Group " + volumeGroupId + " " + message + + exceptionUtil.buildWorkflowException(execution, errorCode, errorMessage) + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing assignWorkflowException.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e); + } + msoLogger.trace("COMPLETED Assign Workflow Exception =") + } + + + +} + diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CreateAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy index 41036e7f43..84dd70682d 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CreateAAIVfModule.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy @@ -1,635 +1,612 @@ -/*-
- * ============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.common.scripts
-import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.openecomp.mso.bpmn.core.RollbackData
-import org.openecomp.mso.bpmn.core.WorkflowException
-import org.openecomp.mso.rest.APIResponse
-import org.springframework.web.util.UriUtils
-
-
-public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
-
- def Prefix="CAAIVfMod_"
- ExceptionUtil exceptionUtil = new ExceptionUtil()
- public void initProcessVariables(DelegateExecution execution) {
- execution.setVariable("prefix",Prefix)
- execution.setVariable("CAAIVfMod_vnfId",null)
- execution.setVariable("CAAIVfMod_vnfName",null)
- execution.setVariable("CAAIVfMod_vnfType",null)
- execution.setVariable("CAAIVfMod_serviceId",null)
- execution.setVariable("CAAIVfMod_personaId",null)
- execution.setVariable("CAAIVfMod_personaVer",null)
- execution.setVariable("CAAIVfMod_modelCustomizationId",null)
- execution.setVariable("CAAIVfMod_vnfPersonaId",null)
- execution.setVariable("CAAIVfMod_vnfPersonaVer",null)
- execution.setVariable("CAAIVfMod_isBaseVfModule", false)
- execution.setVariable("CAAIVfMod_moduleName",null)
- execution.setVariable("CAAIVfMod_moduleModelName",null)
- execution.setVariable("CAAIVfMod_newGenericVnf",false)
- execution.setVariable("CAAIVfMod_genericVnfGetEndpoint",null)
- execution.setVariable("CAAIVfMod_genericVnfPutEndpoint",null)
- execution.setVariable("CAAIVfMod_aaiNamespace",null)
- execution.setVariable("CAAIVfMod_moduleExists",false)
- execution.setVariable("CAAIVfMod_baseModuleConflict", false)
- execution.setVariable("CAAIVfMod_vnfNameFromAAI", null)
-
-
- // CreateAAIVfModule workflow response variable placeholders
- execution.setVariable("CAAIVfMod_queryGenericVnfResponseCode",null)
- execution.setVariable("CAAIVfMod_queryGenericVnfResponse","")
- execution.setVariable("CAAIVfMod_createGenericVnfResponseCode",null)
- execution.setVariable("CAAIVfMod_createGenericVnfResponse","")
- execution.setVariable("CAAIVfMod_createVfModuleResponseCode",null)
- execution.setVariable("CAAIVfMod_createVfModuleResponse","")
- execution.setVariable("CAAIVfMod_parseModuleResponse","")
- execution.setVariable("CAAIVfMod_deleteGenericVnfResponseCode",null)
- execution.setVariable("CAAIVfMod_deleteGenericVnfResponse","")
- execution.setVariable("CAAIVfMod_deleteVfModuleResponseCode",null)
- execution.setVariable("CAAIVfMod_deleteVfModuleResponse","")
-// execution.setVariable("CAAIVfMod_ResponseCode",null)
-// execution.setVariable("CAAIVfMod_ErrorResponse","")
- execution.setVariable("CreateAAIVfModuleResponse","")
- execution.setVariable("RollbackData", null)
-
- }
-
- // parse the incoming CREATE_VF_MODULE request and store the Generic VNF
- // and VF Module data in the flow DelegateExecution
- public void preProcessRequest(DelegateExecution execution) {
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- initProcessVariables(execution)
-
- def vnfId = execution.getVariable("vnfId")
- if (vnfId == null || vnfId.isEmpty()) {
- execution.setVariable("CAAIVfMod_newGenericVnf", true)
- execution.setVariable("CAAIVfMod_vnfId","")
- }
- else {
- execution.setVariable("CAAIVfMod_vnfId",vnfId)
- }
-
- def vnfName = execution.getVariable("vnfName")
- execution.setVariable("CAAIVfMod_vnfName", vnfName)
-
- String vnfType = execution.getVariable("vnfType")
- if (vnfType != null && !vnfType.isEmpty()) {
- execution.setVariable("CAAIVfMod_vnfType", vnfType)
- } else {
- execution.setVariable("CAAIVfMod_vnfType","")
- }
-
- execution.setVariable("CAAIVfMod_serviceId", execution.getVariable("serviceId"))
-
- String personaModelId = execution.getVariable("personaModelId")
-
- if (personaModelId != null && !personaModelId.isEmpty()) {
- execution.setVariable("CAAIVfMod_personaId",personaModelId)
- } else {
- execution.setVariable("CAAIVfMod_personaId","")
- }
-
- String personaModelVersion = execution.getVariable("personaModelVersion")
-
- if (personaModelVersion != null && !personaModelVersion.isEmpty()) {
- execution.setVariable("CAAIVfMod_personaVer", personaModelVersion)
- } else {
- execution.setVariable("CAAIVfMod_personaVer","")
- }
-
-
- String modelCustomizationId = execution.getVariable("modelCustomizationId")
-
- if (modelCustomizationId != null && !modelCustomizationId.isEmpty()) {
- execution.setVariable("CAAIVfMod_modelCustomizationId",modelCustomizationId)
- } else {
- execution.setVariable("CAAIVfMod_modelCustomizationId","")
- }
-
- String vnfPersonaModelId = execution.getVariable("vnfPersonaModelId")
-
- if (vnfPersonaModelId != null && !vnfPersonaModelId.isEmpty()) {
- execution.setVariable("CAAIVfMod_vnfPersonaId",vnfPersonaModelId)
- } else {
- execution.setVariable("CAAIVfMod_vnfPersonaId","")
- }
-
- String vnfPersonaModelVersion = execution.getVariable("vnfPersonaModelVersion")
-
- if (vnfPersonaModelVersion != null && !vnfPersonaModelVersion.isEmpty()) {
- execution.setVariable("CAAIVfMod_vnfPersonaVer",vnfPersonaModelVersion)
- } else {
- execution.setVariable("CAAIVfMod_vnfPersonaVer","")
- }
-
- //isBaseVfModule
- Boolean isBaseVfModule = false
- String isBaseVfModuleString = execution.getVariable("isBaseVfModule")
- if (isBaseVfModuleString != null && isBaseVfModuleString.equals("true")) {
- isBaseVfModule = true
- }
- execution.setVariable("CAAIVfMod_isBaseVfModule", isBaseVfModule)
-
- String isVidRequest = execution.getVariable("isVidRequest")
- if (isVidRequest != null && "true".equals(isVidRequest)) {
- logDebug("VID Request received", isDebugEnabled)
- }
-
- execution.setVariable("CAAIVfMod_moduleName",execution.getVariable("vfModuleName"))
- execution.setVariable("CAAIVfMod_moduleModelName",execution.getVariable("vfModuleModelName"))
-
- AaiUtil aaiUriUtil = new AaiUtil(this)
- def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution)
- logDebug('AAI URI is: ' + aai_uri, isDebugEnabled)
- String aaiNamespace = aaiUriUtil.getNamespaceFromUri(execution, aai_uri)
- logDebug('AAI namespace is: ' + aaiNamespace, isDebugEnabled)
-
- execution.setVariable("CAAIVfMod_aaiNamespace","${aaiNamespace}")
-
- if (vnfId == null || vnfId.isEmpty()) {
- // TBD - assert that the vnfName is not empty
- execution.setVariable("CAAIVfMod_genericVnfGetEndpoint",
- "${aai_uri}/?vnf-name=" +
- UriUtils.encode(vnfName,"UTF-8") + "&depth=1")
- } else {
- execution.setVariable("CAAIVfMod_genericVnfGetEndpoint",
- "${aai_uri}/" + UriUtils.encode(vnfId,"UTF-8") + "?depth=1")
- }
-
- utils.logAudit("CreateAAIVfModule VNF PUT Endpoint: ${aai_uri}/")
- execution.setVariable("CAAIVfMod_genericVnfPutEndpoint","${aai_uri}/")
- }
-
- // send a GET request to AA&I to retrieve the Generic VNF/VF Module information based on a Vnf Name
- // expect a 200 response with the information in the response body or a 404 if the Generic VNF does not exist
- public void queryAAIForGenericVnf(DelegateExecution execution) {
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- def endPoint = execution.getVariable("URN_aai_endpoint") + execution.getVariable("CAAIVfMod_genericVnfGetEndpoint")
-
- try {
- utils.log("DEBUG","queryAAIForGenericVnf() endpoint-" + endPoint, isDebugEnabled)
- utils.log("DEBUG", "invoking GET call to AAI endpoint :"+System.lineSeparator()+endPoint,isDebugEnabled)
- utils.logAudit("CreateAAIVfModule sending GET call to AAI Endpoint: " + endPoint)
-
- AaiUtil aaiUtil = new AaiUtil(this)
- APIResponse response = aaiUtil.executeAAIGetCall(execution, endPoint)
- def responseData = response.getResponseBodyAsString()
- def statusCode = response.getStatusCode()
- execution.setVariable("CAAIVfMod_queryGenericVnfResponseCode", statusCode)
- execution.setVariable("CAAIVfMod_queryGenericVnfResponse", responseData)
-
- utils.logAudit("CreateAAIVfModule Response Code: " + statusCode)
- utils.logAudit("CreateAAIVfModule Response data: " + responseData)
- utils.log("DEBUG", "Response code:" + statusCode, isDebugEnabled)
- utils.log("DEBUG", "Response:" + System.lineSeparator()+responseData,isDebugEnabled)
- } catch (Exception ex) {
- utils.log("DEBUG", "Exception occurred while executing AAI GET:" + ex.getMessage(),isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured in queryAAIForGenericVnf.")
-
- }
- }
-
- // process the result from queryAAIForGenericVnf()
- // note: this method is primarily for logging as the actual decision logic is embedded in the bpmn flow
- public void processAAIGenericVnfQuery(DelegateExecution execution) {
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- def result = execution.getVariable("CAAIVfMod_queryGenericVnfResponse")
-
- if (execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") == 404 &&
- execution.getVariable("CAAIVfMod_vnfId").isEmpty()) {
- utils.log("DEBUG", "New Generic VNF requested and it does not already exist", isDebugEnabled)
- } else if (execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") == 200 &&
- !execution.getVariable("CAAIVfMod_vnfId").isEmpty()) {
- utils.log("DEBUG", "Adding module to existing Generic VNF", isDebugEnabled)
- } else if (execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") == 200 &&
- execution.getVariable("CAAIVfMod_vnfId").isEmpty()) {
- utils.log("DEBUG", "Invalid request for new Generic VNF which already exists", isDebugEnabled)
- execution.setVariable("CAAIVfMod_queryGenericVnfResponse",
- "Invalid request for new Generic VNF which already exists, Vnf Name=" +
- execution.getVariable("CAAIVfMod_vnfName"))
- } else { // execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") == 404 &&
- // !execution.getVariable("CAAIVfMod_vnfId").isEmpty())
- utils.log("DEBUG", "Invalid request for Add-on Module requested for non-existant Generic VNF", isDebugEnabled)
- execution.setVariable("CAAIVfMod_createVfModuleResponse",
- "Invalid request for Add-on Module requested for non-existant Generic VNF, VNF Id=" +
- execution.getVariable("CAAIVfMod_vnfId"))
- }
- }
-
- // construct and send a PUT request to A&AI to create a new Generic VNF
- // note: to get here, the vnf-id in the original CREATE_VF_MODULE request was absent or ""
- public void createGenericVnf(DelegateExecution execution) {
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- // TBD - is this how we want to generate the Id for the new Generic VNF?
- def newVnfId = UUID.randomUUID().toString()
- def endPoint = execution.getVariable("URN_aai_endpoint") +
- execution.getVariable("CAAIVfMod_genericVnfPutEndpoint") + newVnfId
- // update the flow execution with the new Vnf Id
- execution.setVariable("CAAIVfMod_vnfId",newVnfId)
-
- // AaiUriUtil aaiUriUtil = new AaiUriUtil(this)
- // def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution)
- // logDebug('AAI URI is: ' + aai_uri, isDebugEnabled)
- // String namespace = aaiUriUtil.getNamespaceFromUri(aai_uri)
- // logDebug('AAI namespace is: ' + namespace, isDebugEnabled)
-
-
- String payload = """<generic-vnf xmlns="${execution.getVariable("CAAIVfMod_aaiNamespace")}">
- <vnf-id>${newVnfId}</vnf-id>
- <vnf-name>${execution.getVariable("CAAIVfMod_vnfName")}</vnf-name>
- <vnf-type>${execution.getVariable("CAAIVfMod_vnfType")}</vnf-type>
- <service-id>${execution.getVariable("CAAIVfMod_serviceId")}</service-id>
- <orchestration-status>Active</orchestration-status>
- <model-invariant-id>${execution.getVariable("CAAIVfMod_vnfPersonaId")}</model-invariant-id>
- <model-version-id>${execution.getVariable("CAAIVfMod_vnfPersonaVer")}</model-version-id>
- </generic-vnf>""" as String
- execution.setVariable("CAAIVfMod_createGenericVnfPayload", payload)
-
- try {
- utils.log("DEBUG","createGenericVnf() endpoint-" + endPoint, isDebugEnabled)
- utils.log("DEBUG", "invoking PUT call to AAI with payload:"+System.lineSeparator()+payload,isDebugEnabled)
- utils.logAudit("Sending PUT call to AAI with Endpoint /n" + endPoint + " with payload /n" + payload)
-
- AaiUtil aaiUtil = new AaiUtil(this);
- APIResponse response = aaiUtil.executeAAIPutCall(execution, endPoint, payload);
- def responseData = response.getResponseBodyAsString()
- def responseStatusCode = response.getStatusCode()
- execution.setVariable("CAAIVfMod_createGenericVnfResponseCode", responseStatusCode)
- execution.setVariable("CAAIVfMod_createGenericVnfResponse", responseData)
-
- utils.logAudit("Response Code: " + responseStatusCode)
- utils.logAudit("Response Data: " + responseData)
- utils.log("DEBUG", "Response code:" + responseStatusCode, isDebugEnabled)
- utils.log("DEBUG", "Response:" + System.lineSeparator()+responseData,isDebugEnabled)
- } catch (Exception ex) {
- ex.printStackTrace()
- utils.log("DEBUG", "Exception occurred while executing AAI PUT:" + ex.getMessage(),isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured in createGenericVnf.")
- }
- }
-
- // construct and send a PUT request to A&AI to create a Base or Add-on VF Module
- public void createVfModule(DelegateExecution execution, Boolean isBaseModule) {
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- // TBD - is this how we want to generate the Id for the new (Base) VF Module?
-
- // Generate the new VF Module ID here if it has not been provided by the parent process
- def newModuleId = execution.getVariable('newVfModuleId')
- if (newModuleId == null || newModuleId.isEmpty()) {
- newModuleId = UUID.randomUUID().toString()
- }
- def endPoint = execution.getVariable("URN_aai_endpoint") + execution.getVariable("CAAIVfMod_genericVnfPutEndpoint")
- // need to append the existing Vnf Id or the one generated in createGenericVnf() to the url
- endPoint = endPoint + UriUtils.encode(execution.getVariable("CAAIVfMod_vnfId"), "UTF-8") +
- "/vf-modules/vf-module/" + newModuleId;
- int moduleIndex = 0
- if (!isBaseModule) {
- def aaiVnfResponse = execution.getVariable("CAAIVfMod_queryGenericVnfResponse")
- AaiUtil aaiUtil = new AaiUtil(this)
- def personaModelId = execution.getVariable("CAAIVfMod_personaId")
-
- // Check if the response includes model-invariant-id or persona-model-id
- // note: getRequiredNodeText() throws an exception if the field is missing
- // need to retun a null for the subsequent "either/or" logic to work properly
-// def modelInvariantId = getRequiredNodeText(execution, aaiVnfResponse,'model-invariant-id')
- def modelInvariantId = getNodeText(aaiVnfResponse,'model-invariant-id', null)
- def fieldToCheck = 'model-invariant-id'
- if (!modelInvariantId) {
- fieldToCheck = 'persona-model-id'
- }
-
- moduleIndex = aaiUtil.getLowestUnusedVfModuleIndexFromAAIVnfResponse(execution, aaiVnfResponse,
- fieldToCheck, personaModelId)
- }
- def moduleIndexString = String.valueOf(moduleIndex)
-
- // if we get to this point, we may be about to create the Vf Module,
- // add rollback information about the Generic VNF for this base/add-on module
- def rollbackData = execution.getVariable("RollbackData")
- if (rollbackData == null) {
- rollbackData = new RollbackData();
- }
- rollbackData.put("VFMODULE", "vnfId", execution.getVariable("CAAIVfMod_vnfId"))
- rollbackData.put("VFMODULE", "vnfName", execution.getVariable("CAAIVfMod_vnfName"))
- rollbackData.put("VFMODULE", "isBaseModule", isBaseModule.toString())
- execution.setVariable("RollbackData", rollbackData)
- utils.log("DEBUG", "RollbackData:" + rollbackData, isDebugEnabled)
- String payload = """<vf-module xmlns="${execution.getVariable("CAAIVfMod_aaiNamespace")}">
- <vf-module-id>${newModuleId}</vf-module-id>
- <vf-module-name>${execution.getVariable("CAAIVfMod_moduleName")}</vf-module-name>
- <model-invariant-id>${execution.getVariable("CAAIVfMod_personaId")}</model-invariant-id>
- <model-version-id>${execution.getVariable("CAAIVfMod_personaVer")}</model-version-id>
- <model-customization-id>${execution.getVariable("CAAIVfMod_modelCustomizationId")}</model-customization-id>
- <is-base-vf-module>${isBaseModule}</is-base-vf-module>
- <orchestration-status>PendingCreate</orchestration-status>
- <module-index>${moduleIndex}</module-index>
- </vf-module>""" as String
- execution.setVariable("CAAIVfMod_createVfModulePayload", payload)
-
- try {
- utils.log("DEBUG","createVfModule() endpoint-" + endPoint, isDebugEnabled)
- utils.log("DEBUG", "invoking PUT call to AAI with payload:"+System.lineSeparator()+payload,isDebugEnabled)
- utils.logAudit("CreateAAIVfModule sending PUT call to AAI with endpoint /n" + endPoint + " with payload /n " + payload)
-
- AaiUtil aaiUtil = new AaiUtil(this)
- APIResponse response = aaiUtil.executeAAIPutCall(execution, endPoint, payload)
- def responseData = response.getResponseBodyAsString()
- def statusCode = response.getStatusCode()
- execution.setVariable("CAAIVfMod_createVfModuleResponseCode", statusCode)
- execution.setVariable("CAAIVfMod_createVfModuleResponse", responseData)
-
- utils.log("DEBUG", "Response code:" + statusCode, isDebugEnabled)
- utils.log("DEBUG", "Response:" + System.lineSeparator()+responseData,isDebugEnabled)
- utils.logAudit("Response Code: " + statusCode)
- utils.logAudit("Response data: " + responseData)
- // the base or add-on VF Module was successfully created,
- // add the module name to the rollback data and the response
- if (isOneOf(statusCode, 200, 201)) {
- rollbackData.put("VFMODULE", "vfModuleId", newModuleId)
- rollbackData.put("VFMODULE", "vfModuleName", execution.getVariable("CAAIVfMod_moduleName"))
- execution.setVariable("RollbackData", rollbackData)
- utils.log("DEBUG", "RollbackData:" + rollbackData, isDebugEnabled)
-
- String responseOut = ""
-
- String isVidRequest = execution.getVariable("isVidRequest")
-
- if (isBaseModule && (isVidRequest == null || "false".equals(isVidRequest))) {
-
- responseOut = """<CreateAAIVfModuleResponse>
- <vnf-id>${execution.getVariable("CAAIVfMod_vnfId")}</vnf-id>
- <vf-module-id>${newModuleId}</vf-module-id>
- <vf-module-index>${moduleIndexString}</vf-module-index>
- </CreateAAIVfModuleResponse>""" as String
- }
- else {
- responseOut = """<CreateAAIVfModuleResponse>
- <vnf-name>${execution.getVariable("CAAIVfMod_vnfNameFromAAI")}</vnf-name>
- <vnf-id>${execution.getVariable("CAAIVfMod_vnfId")}</vnf-id>
- <vf-module-id>${newModuleId}</vf-module-id>
- <vf-module-index>${moduleIndexString}</vf-module-index>
- </CreateAAIVfModuleResponse>""" as String
- }
-
- execution.setVariable("CreateAAIVfModuleResponse", responseOut)
- utils.log("DEBUG", "CreateAAIVfModuleResponse:" + System.lineSeparator()+responseOut,isDebugEnabled)
- utils.logAudit("CreateAAIVfModule Response /n " + responseOut)
- }
- } catch (Exception ex) {
- utils.log("DEBUG", "Exception occurred while executing AAI PUT:" + ex.getMessage(),isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured in createVfModule.")
- }
- }
-
- // parses the output from the result from queryAAIForGenericVnf() to determine if the vf-module-name
- // requested for an Add-on VF Module does not already exist for the specified Generic VNF
- // also retrieves VNF name from AAI response for existing VNF
- public void parseForAddOnModule(DelegateExecution execution) {
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- def xml = execution.getVariable("CAAIVfMod_queryGenericVnfResponse")
- def vnfNameFromAAI = utils.getNodeText1(xml, "vnf-name")
- execution.setVariable("CAAIVfMod_vnfNameFromAAI", vnfNameFromAAI)
- utils.log("DEBUG", "Obtained vnf-name from AAI for existing VNF: " + vnfNameFromAAI)
- def newModuleName = execution.getVariable("CAAIVfMod_moduleName")
- utils.log("DEBUG", "VF Module to be added: " + newModuleName, isDebugEnabled)
- def qryModuleNameList = utils.getMultNodes(xml, "vf-module-name")
- execution.setVariable("CAAIVfMod_moduleExists", false)
- if (qryModuleNameList != null) {
- utils.log("DEBUG", "Existing VF Module List: " + qryModuleNameList, isDebugEnabled)
- for (String qryModuleName : qryModuleNameList) {
- if (newModuleName.equals(qryModuleName)) {
- // a module with the requested name already exists - failure
- utils.log("DEBUG", "VF Module " + qryModuleName + " already exists for Generic VNF " +
- execution.getVariable("CAAIVfMod_vnfNameFromAAI"), isDebugEnabled)
- execution.setVariable("CAAIVfMod_moduleExists", true)
- execution.setVariable("CAAIVfMod_parseModuleResponse",
- "VF Module " + qryModuleName + " already exists for Generic VNF " +
- execution.getVariable("CAAIVfMod_vnfNameFromAAI"))
- break
- }
- }
- }
- if (execution.getVariable("CAAIVfMod_moduleExists") == false) {
- utils.log("DEBUG", "VF Module " + execution.getVariable("CAAIVfMod_moduleName") +
- " does not exist for Generic VNF " + execution.getVariable("CAAIVfMod_vnfNameFromAAI"), isDebugEnabled)
- execution.setVariable("CAAIVfMod_parseModuleResponse",
- "VF Module " + newModuleName + " does not exist for Generic VNF " +
- execution.getVariable("CAAIVfMod_vnfNameFromAAI"))
- }
- }
-
- // parses the output from the result from queryAAIForGenericVnf() to determine if the vf-module-name
- // requested for an Add-on VF Module does not already exist for the specified Generic VNF;
- // also retrieves VNF name from AAI response for existing VNF
- public void parseForBaseModule(DelegateExecution execution) {
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- def xml = execution.getVariable("CAAIVfMod_queryGenericVnfResponse")
- def vnfNameFromAAI = utils.getNodeText1(xml, "vnf-name")
- execution.setVariable("CAAIVfMod_vnfNameFromAAI", vnfNameFromAAI)
- utils.log("DEBUG", "Obtained vnf-name from AAI for existing VNF: " + vnfNameFromAAI)
- def newModuleName = execution.getVariable("CAAIVfMod_moduleName")
- utils.log("DEBUG", "VF Module to be added: " + newModuleName, isDebugEnabled)
- def qryModuleNameList = utils.getMultNodes(xml, "vf-module-name")
- execution.setVariable("CAAIVfMod_moduleExists", false)
- if (qryModuleNameList != null) {
- utils.log("DEBUG", "Existing VF Module List: " + qryModuleNameList, isDebugEnabled)
- for (String qryModuleName : qryModuleNameList) {
- if (newModuleName.equals(qryModuleName)) {
- // a module with the requested name already exists - failure
- utils.log("DEBUG", "VF Module " + qryModuleName + " already exists for Generic VNF " +
- execution.getVariable("CAAIVfMod_vnfNameFromAAI"), isDebugEnabled)
- execution.setVariable("CAAIVfMod_baseModuleConflict", true)
- execution.setVariable("CAAIVfMod_parseModuleResponse",
- "VF Module " + qryModuleName + " already exists for Generic VNF " +
- execution.getVariable("CAAIVfMod_vnfNameFromAAI"))
- break
- }
- }
- }
- def isBaseVfModuleList = utils.getMultNodes(xml, "is-base-vf-module")
- if (isBaseVfModuleList != null && !execution.getVariable("CAAIVfMod_baseModuleConflict")) {
-
- for (String baseValue : isBaseVfModuleList) {
- if (baseValue.equals("true")) {
- // a base module already exists in this VNF - failure
- utils.log("DEBUG", "Base VF Module already exists for Generic VNF " +
- execution.getVariable("CAAIVfMod_vnfNameFromAAI"), isDebugEnabled)
- execution.setVariable("CAAIVfMod_baseModuleConflict", true)
- execution.setVariable("CAAIVfMod_parseModuleResponse",
- "Base VF Module already exists for Generic VNF " +
- execution.getVariable("CAAIVfMod_vnfNameFromAAI"))
- break
- }
- }
-
- }
- if (execution.getVariable("CAAIVfMod_moduleExists") == false && execution.getVariable("CAAIVfMod_baseModuleConflict") == false) {
- utils.log("DEBUG", "VF Module " + execution.getVariable("CAAIVfMod_moduleName") +
- " does not exist for Generic VNF " + execution.getVariable("CAAIVfMod_vnfNameFromAAI"), isDebugEnabled)
- execution.setVariable("CAAIVfMod_parseModuleResponse",
- "VF Module " + newModuleName + " does not exist for Generic VNF " +
- execution.getVariable("CAAIVfMod_vnfNameFromAAI"))
- }
- }
-
- // generates a WorkflowException when the A&AI query returns a response code other than 200 or 404
- public void handleAAIQueryFailure(DelegateExecution execution) {
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
-
- utils.log("ERROR", "Error occurred attempting to query AAI, Response Code " +
- execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") + ", Error Response " +
- execution.getVariable("CAAIVfMod_queryGenericVnfResponse"), isDebugEnabled)
- int code = execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode")
- exceptionUtil.buildAndThrowWorkflowException(execution, code, "Error occurred attempting to query AAI")
-
- }
-
- // generates a WorkflowException if
- // - the A&AI Generic VNF PUT returns a response code other than 200 or 201
- // - the requested Generic VNF already exists but vnf-id == null
- // - the requested Generic VNF does not exist but vnf-id != null
- // - the A&AI VF Module PUT returns a response code other than 200 or 201
- // - the requested VF Module already exists for the Generic VNF
- public void handleCreateVfModuleFailure(DelegateExecution execution) {
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
-
- def errorCode
- def errorResponse
- if (execution.getVariable("CAAIVfMod_createGenericVnfResponseCode") != null &&
- !isOneOf(execution.getVariable("CAAIVfMod_createGenericVnfResponseCode"), 200, 201)) {
- utils.log("DEBUG", "Failure creating Generic VNF: " +
- execution.getVariable("CAAIVfMod_createGenericVnfResponse"), isDebugEnabled)
- errorResponse = execution.getVariable("CAAIVfMod_createGenericVnfResponse")
- errorCode = 5000
- } else if (execution.getVariable("CAAIVfMod_queryGenericVnfResponse") != null &&
- execution.getVariable("CAAIVfMod_newGenericVnf") == true) {
- // attempted to create a Generic VNF that already exists but vnf-id == null
- utils.log("DEBUG", execution.getVariable("CAAIVfMod_queryGenericVnfResponse"), isDebugEnabled)
- errorResponse = execution.getVariable("CAAIVfMod_queryGenericVnfResponse")
- errorCode = 1002
- } else if (execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") == 404 &&
- execution.getVariable("CAAIVfMod_newGenericVnf") == false) {
- // attempted to create a Generic VNF where vnf-name does not exist but vnf-id != null
- utils.log("DEBUG", execution.getVariable("CAAIVfMod_queryGenericVnfResponse"), isDebugEnabled)
- errorResponse = execution.getVariable("CAAIVfMod_queryGenericVnfResponse")
- errorCode = 1002
- } else if (execution.getVariable("CAAIVfMod_createVfModuleResponseCode") != null) {
- utils.log("DEBUG", "Failed to add VF Module: " +
- execution.getVariable("CAAIVfMod_createVfModuleResponse"), isDebugEnabled)
- errorResponse = execution.getVariable("CAAIVfMod_createVfModuleResponse")
- errorCode = 5000
- } else if (execution.getVariable("CAAIVfMod_moduleExists") == true) {
- utils.log("DEBUG", "Attempting to add VF Module that already exists: " +
- execution.getVariable("CAAIVfMod_parseModuleResponse"), isDebugEnabled)
- errorResponse = execution.getVariable("CAAIVfMod_parseModuleResponse")
- errorCode = 1002
- } else if (execution.getVariable("CAAIVfMod_baseModuleConflict") == true) {
- utils.log("DEBUG", "Attempting to add Base VF Module to VNF that already has a Base VF Module: " +
- execution.getVariable("CAAIVfMod_parseModuleResponse"), isDebugEnabled)
- errorResponse = execution.getVariable("CAAIVfMod_parseModuleResponse")
- errorCode = 1002
- } else {
- // if the responses get populated corerctly, we should never get here
- errorResponse = "Unknown error occurred during CreateAAIVfModule flow"
- errorCode = 2000
- }
-
- utils.log("ERROR", "Error occurred during CreateAAIVfModule flow: " + errorResponse, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, errorCode, errorResponse)
- utils.logAudit("Workflow exception occurred in CreateAAIVfModule: " + errorResponse)
- }
-
- /**
- * Performs a rollback.
- * TBD: This method requires additional testing once integrated with the
- * main CreateVfModule flow.
- * @param execution the execution
- */
- public void rollback(DelegateExecution execution) {
- def method = getClass().getSimpleName() + ".rollback(" +
- "execution=" + execution.getId() +
- ")"
- def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled")
- logDebug("Entered " + method, isDebugLogEnabled)
-
- try {
- RollbackData rollbackData = (RollbackData) execution.getVariable("RollbackData")
- logDebug("RollbackData:" + rollbackData, isDebugLogEnabled)
-
- AaiUtil aaiUriUtil = new AaiUtil(this)
- def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution)
- logDebug('AAI URI is: ' + aai_uri, isDebugLogEnabled)
- utils.logAudit("CreateAAIVfModule rollback AAI URI: " + aai_uri)
-
- if (rollbackData != null) {
- if (rollbackData.hasType("VFMODULE")) {
- // use the DeleteAAIVfModule groovy methods for the rollback
- def vnfId = rollbackData.get("VFMODULE", "vnfId")
- def vfModuleId = rollbackData.get("VFMODULE", "vfModuleId")
- def isBaseModule = rollbackData.get("VFMODULE", "isBaseModule")
- execution.setVariable("DAAIVfMod_vnfId", vnfId)
- execution.setVariable("DAAIVfMod_vfModuleId", vfModuleId)
- execution.setVariable("DAAIVfMod_genericVnfEndpoint", "${aai_uri}/" + vnfId)
- execution.setVariable("DAAIVfMod_vfModuleEndpoint", "${aai_uri}/" + vnfId +
- "/vf-modules/vf-module/" + vfModuleId)
- DeleteAAIVfModule dvm = new DeleteAAIVfModule()
- // query A&AI to get the needed information for the delete(s)
- dvm.queryAAIForGenericVnf(execution)
- dvm.parseForVfModule(execution)
-
- // roll back the base or add-on module
- dvm.deleteVfModule(execution)
- def responseCode = execution.getVariable("DAAIVfMod_deleteVfModuleResponseCode")
- def response = execution.getVariable("DAAIVfMod_deleteVfModuleResponseCode")
-
- if (isOneOf(responseCode, 200, 204)) {
- logDebug("Received " + responseCode + " to VF Module rollback request", isDebugLogEnabled)
-// execution.setVariable("RollbackResult", "SUCCESS")
- } else {
- logError("Received " + responseCode + " to VF Module rollback request: " + rollbackData +
- System.lineSeparator() + "Response: " + response)
- }
-
- // a new Generic VNF was created that needs to be rolled back
- if (isBaseModule.equals("true")) {
- dvm.deleteGenericVnf(execution)
- responseCode = execution.getVariable("DAAIVfMod_deleteGenericVnfResponseCode")
- response = execution.getVariable("DAAIVfMod_deleteGenericVnfResponse")
-
- if (isOneOf(responseCode, 200, 204)) {
- logDebug("Received " + responseCode + " to Generic VNF rollback request", isDebugLogEnabled)
- execution.setVariable("RollbackResult", "SUCCESS")
- } else {
- logError("Received " + responseCode + " to Generic VNF rollback request: " + rollbackData +
- System.lineSeparator() + "Response: " + response)
- }
- } else {
- execution.setVariable("RollbackResult", "SUCCESS")
- }
- }
- }
-
- logDebug("Exited " + method, isDebugLogEnabled)
- } catch (Exception e) {
- logError("Caught exception in " + method, e)
- }
- }
-}
+/*- + * ============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.common.scripts +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.core.RollbackData +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger +import org.onap.so.rest.APIResponse +import org.springframework.web.util.UriUtils + +public class CreateAAIVfModule extends AbstractServiceTaskProcessor{ + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateAAIVfModule.class); + + def Prefix="CAAIVfMod_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + public void initProcessVariables(DelegateExecution execution) { + execution.setVariable("prefix",Prefix) + execution.setVariable("CAAIVfMod_vnfId",null) + execution.setVariable("CAAIVfMod_vnfName",null) + execution.setVariable("CAAIVfMod_vnfType",null) + execution.setVariable("CAAIVfMod_serviceId",null) + execution.setVariable("CAAIVfMod_personaId",null) + execution.setVariable("CAAIVfMod_personaVer",null) + execution.setVariable("CAAIVfMod_modelCustomizationId",null) + execution.setVariable("CAAIVfMod_vnfPersonaId",null) + execution.setVariable("CAAIVfMod_vnfPersonaVer",null) + execution.setVariable("CAAIVfMod_isBaseVfModule", false) + execution.setVariable("CAAIVfMod_moduleName",null) + execution.setVariable("CAAIVfMod_moduleModelName",null) + execution.setVariable("CAAIVfMod_newGenericVnf",false) + execution.setVariable("CAAIVfMod_genericVnfGetEndpoint",null) + execution.setVariable("CAAIVfMod_genericVnfPutEndpoint",null) + execution.setVariable("CAAIVfMod_aaiNamespace",null) + execution.setVariable("CAAIVfMod_moduleExists",false) + execution.setVariable("CAAIVfMod_baseModuleConflict", false) + execution.setVariable("CAAIVfMod_vnfNameFromAAI", null) + + + // CreateAAIVfModule workflow response variable placeholders + execution.setVariable("CAAIVfMod_queryGenericVnfResponseCode",null) + execution.setVariable("CAAIVfMod_queryGenericVnfResponse","") + execution.setVariable("CAAIVfMod_createGenericVnfResponseCode",null) + execution.setVariable("CAAIVfMod_createGenericVnfResponse","") + execution.setVariable("CAAIVfMod_createVfModuleResponseCode",null) + execution.setVariable("CAAIVfMod_createVfModuleResponse","") + execution.setVariable("CAAIVfMod_parseModuleResponse","") + execution.setVariable("CAAIVfMod_deleteGenericVnfResponseCode",null) + execution.setVariable("CAAIVfMod_deleteGenericVnfResponse","") + execution.setVariable("CAAIVfMod_deleteVfModuleResponseCode",null) + execution.setVariable("CAAIVfMod_deleteVfModuleResponse","") +// execution.setVariable("CAAIVfMod_ResponseCode",null) +// execution.setVariable("CAAIVfMod_ErrorResponse","") + execution.setVariable("CreateAAIVfModuleResponse","") + execution.setVariable("RollbackData", null) + + } + + // parse the incoming CREATE_VF_MODULE request and store the Generic VNF + // and VF Module data in the flow DelegateExecution + public void preProcessRequest(DelegateExecution execution) { + initProcessVariables(execution) + + def vnfId = execution.getVariable("vnfId") + if (vnfId == null || vnfId.isEmpty()) { + execution.setVariable("CAAIVfMod_newGenericVnf", true) + execution.setVariable("CAAIVfMod_vnfId","") + } + else { + execution.setVariable("CAAIVfMod_vnfId",vnfId) + } + + def vnfName = execution.getVariable("vnfName") + execution.setVariable("CAAIVfMod_vnfName", vnfName) + + String vnfType = execution.getVariable("vnfType") + if (vnfType != null && !vnfType.isEmpty()) { + execution.setVariable("CAAIVfMod_vnfType", vnfType) + } else { + execution.setVariable("CAAIVfMod_vnfType","") + } + + execution.setVariable("CAAIVfMod_serviceId", execution.getVariable("serviceId")) + + String personaModelId = execution.getVariable("personaModelId") + + if (personaModelId != null && !personaModelId.isEmpty()) { + execution.setVariable("CAAIVfMod_personaId",personaModelId) + } else { + execution.setVariable("CAAIVfMod_personaId","") + } + + String personaModelVersion = execution.getVariable("personaModelVersion") + + if (personaModelVersion != null && !personaModelVersion.isEmpty()) { + execution.setVariable("CAAIVfMod_personaVer", personaModelVersion) + } else { + execution.setVariable("CAAIVfMod_personaVer","") + } + + + String modelCustomizationId = execution.getVariable("modelCustomizationId") + + if (modelCustomizationId != null && !modelCustomizationId.isEmpty()) { + execution.setVariable("CAAIVfMod_modelCustomizationId",modelCustomizationId) + } else { + execution.setVariable("CAAIVfMod_modelCustomizationId","") + } + + String vnfPersonaModelId = execution.getVariable("vnfPersonaModelId") + + if (vnfPersonaModelId != null && !vnfPersonaModelId.isEmpty()) { + execution.setVariable("CAAIVfMod_vnfPersonaId",vnfPersonaModelId) + } else { + execution.setVariable("CAAIVfMod_vnfPersonaId","") + } + + String vnfPersonaModelVersion = execution.getVariable("vnfPersonaModelVersion") + + if (vnfPersonaModelVersion != null && !vnfPersonaModelVersion.isEmpty()) { + execution.setVariable("CAAIVfMod_vnfPersonaVer",vnfPersonaModelVersion) + } else { + execution.setVariable("CAAIVfMod_vnfPersonaVer","") + } + + //isBaseVfModule + Boolean isBaseVfModule = false + String isBaseVfModuleString = execution.getVariable("isBaseVfModule") + if (isBaseVfModuleString != null && isBaseVfModuleString.equals("true")) { + isBaseVfModule = true + } + execution.setVariable("CAAIVfMod_isBaseVfModule", isBaseVfModule) + + String isVidRequest = execution.getVariable("isVidRequest") + if (isVidRequest != null && "true".equals(isVidRequest)) { + msoLogger.debug("VID Request received") + } + + execution.setVariable("CAAIVfMod_moduleName",execution.getVariable("vfModuleName")) + execution.setVariable("CAAIVfMod_moduleModelName",execution.getVariable("vfModuleModelName")) + + AaiUtil aaiUriUtil = new AaiUtil(this) + def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution) + msoLogger.debug('AAI URI is: ' + aai_uri) + String aaiNamespace = aaiUriUtil.getNamespaceFromUri(execution, aai_uri) + msoLogger.debug('AAI namespace is: ' + aaiNamespace) + + execution.setVariable("CAAIVfMod_aaiNamespace","${aaiNamespace}") + + if (vnfId == null || vnfId.isEmpty()) { + // TBD - assert that the vnfName is not empty + execution.setVariable("CAAIVfMod_genericVnfGetEndpoint", + "${aai_uri}/?vnf-name=" + + UriUtils.encode(vnfName,"UTF-8") + "&depth=1") + } else { + execution.setVariable("CAAIVfMod_genericVnfGetEndpoint", + "${aai_uri}/" + UriUtils.encode(vnfId,"UTF-8") + "?depth=1") + } + + msoLogger.debug("CreateAAIVfModule VNF PUT Endpoint: ${aai_uri}/") + execution.setVariable("CAAIVfMod_genericVnfPutEndpoint","${aai_uri}/") + } + + // send a GET request to AA&I to retrieve the Generic VNF/VF Module information based on a Vnf Name + // expect a 200 response with the information in the response body or a 404 if the Generic VNF does not exist + public void queryAAIForGenericVnf(DelegateExecution execution) { + def endPoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + execution.getVariable("CAAIVfMod_genericVnfGetEndpoint") + + try { + msoLogger.debug("queryAAIForGenericVnf() endpoint-" + endPoint) + msoLogger.debug("invoking GET call to AAI endpoint :"+System.lineSeparator()+endPoint) + msoLogger.debug("CreateAAIVfModule sending GET call to AAI Endpoint: " + endPoint) + + AaiUtil aaiUtil = new AaiUtil(this) + APIResponse response = aaiUtil.executeAAIGetCall(execution, endPoint) + def responseData = response.getResponseBodyAsString() + def statusCode = response.getStatusCode() + execution.setVariable("CAAIVfMod_queryGenericVnfResponseCode", statusCode) + execution.setVariable("CAAIVfMod_queryGenericVnfResponse", responseData) + + msoLogger.debug("CreateAAIVfModule Response Code: " + statusCode) + msoLogger.debug("CreateAAIVfModule Response data: " + responseData) + msoLogger.debug("Response code:" + statusCode) + msoLogger.debug("Response:" + System.lineSeparator()+responseData) + } catch (Exception ex) { + msoLogger.debug("Exception occurred while executing AAI GET:" + ex.getMessage()) + exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured in queryAAIForGenericVnf.") + + } + } + + // process the result from queryAAIForGenericVnf() + // note: this method is primarily for logging as the actual decision logic is embedded in the bpmn flow + public void processAAIGenericVnfQuery(DelegateExecution execution) { + def result = execution.getVariable("CAAIVfMod_queryGenericVnfResponse") + + if (execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") == 404 && + execution.getVariable("CAAIVfMod_vnfId").isEmpty()) { + msoLogger.debug("New Generic VNF requested and it does not already exist") + } else if (execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") == 200 && + !execution.getVariable("CAAIVfMod_vnfId").isEmpty()) { + msoLogger.debug("Adding module to existing Generic VNF") + } else if (execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") == 200 && + execution.getVariable("CAAIVfMod_vnfId").isEmpty()) { + msoLogger.debug("Invalid request for new Generic VNF which already exists") + execution.setVariable("CAAIVfMod_queryGenericVnfResponse", + "Invalid request for new Generic VNF which already exists, Vnf Name=" + + execution.getVariable("CAAIVfMod_vnfName")) + } else { // execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") == 404 && + // !execution.getVariable("CAAIVfMod_vnfId").isEmpty()) + msoLogger.debug("Invalid request for Add-on Module requested for non-existant Generic VNF") + execution.setVariable("CAAIVfMod_createVfModuleResponse", + "Invalid request for Add-on Module requested for non-existant Generic VNF, VNF Id=" + + execution.getVariable("CAAIVfMod_vnfId")) + } + } + + // construct and send a PUT request to A&AI to create a new Generic VNF + // note: to get here, the vnf-id in the original CREATE_VF_MODULE request was absent or "" + public void createGenericVnf(DelegateExecution execution) { + // TBD - is this how we want to generate the Id for the new Generic VNF? + def newVnfId = UUID.randomUUID().toString() + def endPoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + + execution.getVariable("CAAIVfMod_genericVnfPutEndpoint") + newVnfId + // update the flow execution with the new Vnf Id + execution.setVariable("CAAIVfMod_vnfId",newVnfId) + + // AaiUriUtil aaiUriUtil = new AaiUriUtil(this) + // def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution) + // msoLogger.debug('AAI URI is: ' + aai_uri) + // String namespace = aaiUriUtil.getNamespaceFromUri(aai_uri) + // msoLogger.debug('AAI namespace is: ' + namespace) + + + String payload = """<generic-vnf xmlns="${execution.getVariable("CAAIVfMod_aaiNamespace")}"> + <vnf-id>${MsoUtils.xmlEscape(newVnfId)}</vnf-id> + <vnf-name>${MsoUtils.xmlEscape(execution.getVariable("CAAIVfMod_vnfName"))}</vnf-name> + <vnf-type>${MsoUtils.xmlEscape(execution.getVariable("CAAIVfMod_vnfType"))}</vnf-type> + <service-id>${MsoUtils.xmlEscape(execution.getVariable("CAAIVfMod_serviceId"))}</service-id> + <orchestration-status>Active</orchestration-status> + <model-invariant-id>${MsoUtils.xmlEscape(execution.getVariable("CAAIVfMod_vnfPersonaId"))}</model-invariant-id> + <model-version-id>${MsoUtils.xmlEscape(execution.getVariable("CAAIVfMod_vnfPersonaVer"))}</model-version-id> + </generic-vnf>""" as String + execution.setVariable("CAAIVfMod_createGenericVnfPayload", payload) + + try { + msoLogger.debug("createGenericVnf() endpoint-" + endPoint) + msoLogger.debug("invoking PUT call to AAI with payload:"+System.lineSeparator()+payload) + msoLogger.debug("Sending PUT call to AAI with Endpoint /n" + endPoint + " with payload /n" + payload) + + AaiUtil aaiUtil = new AaiUtil(this); + APIResponse response = aaiUtil.executeAAIPutCall(execution, endPoint, payload); + def responseData = response.getResponseBodyAsString() + def responseStatusCode = response.getStatusCode() + execution.setVariable("CAAIVfMod_createGenericVnfResponseCode", responseStatusCode) + execution.setVariable("CAAIVfMod_createGenericVnfResponse", responseData) + + msoLogger.debug("Response Code: " + responseStatusCode) + msoLogger.debug("Response Data: " + responseData) + msoLogger.debug("Response code:" + responseStatusCode) + msoLogger.debug("Response:" + System.lineSeparator()+responseData) + } catch (Exception ex) { + ex.printStackTrace() + msoLogger.debug("Exception occurred while executing AAI PUT:" + ex.getMessage()) + exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured in createGenericVnf.") + } + } + + // construct and send a PUT request to A&AI to create a Base or Add-on VF Module + public void createVfModule(DelegateExecution execution, Boolean isBaseModule) { + // TBD - is this how we want to generate the Id for the new (Base) VF Module? + + // Generate the new VF Module ID here if it has not been provided by the parent process + def newModuleId = execution.getVariable('newVfModuleId') + if (newModuleId == null || newModuleId.isEmpty()) { + newModuleId = UUID.randomUUID().toString() + } + def endPoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + execution.getVariable("CAAIVfMod_genericVnfPutEndpoint") + // need to append the existing Vnf Id or the one generated in createGenericVnf() to the url + endPoint = endPoint + UriUtils.encode(execution.getVariable("CAAIVfMod_vnfId"), "UTF-8") + + "/vf-modules/vf-module/" + newModuleId; + int moduleIndex = 0 + if (!isBaseModule) { + def aaiVnfResponse = execution.getVariable("CAAIVfMod_queryGenericVnfResponse") + AaiUtil aaiUtil = new AaiUtil(this) + def personaModelId = execution.getVariable("CAAIVfMod_personaId") + + // Check if the response includes model-invariant-id or persona-model-id + // note: getRequiredNodeText() throws an exception if the field is missing + // need to retun a null for the subsequent "either/or" logic to work properly +// def modelInvariantId = getRequiredNodeText(execution, aaiVnfResponse,'model-invariant-id') + def modelInvariantId = getNodeText(aaiVnfResponse,'model-invariant-id', null) + def fieldToCheck = 'model-invariant-id' + if (!modelInvariantId) { + fieldToCheck = 'persona-model-id' + } + + moduleIndex = aaiUtil.getLowestUnusedVfModuleIndexFromAAIVnfResponse(execution, aaiVnfResponse, + fieldToCheck, personaModelId) + } + def moduleIndexString = String.valueOf(moduleIndex) + + // if we get to this point, we may be about to create the Vf Module, + // add rollback information about the Generic VNF for this base/add-on module + def rollbackData = execution.getVariable("RollbackData") + if (rollbackData == null) { + rollbackData = new RollbackData(); + } + rollbackData.put("VFMODULE", "vnfId", execution.getVariable("CAAIVfMod_vnfId")) + rollbackData.put("VFMODULE", "vnfName", execution.getVariable("CAAIVfMod_vnfName")) + rollbackData.put("VFMODULE", "isBaseModule", isBaseModule.toString()) + execution.setVariable("RollbackData", rollbackData) + msoLogger.debug("RollbackData:" + rollbackData) + String payload = """<vf-module xmlns="${execution.getVariable("CAAIVfMod_aaiNamespace")}"> + <vf-module-id>${MsoUtils.xmlEscape(newModuleId)}</vf-module-id> + <vf-module-name>${MsoUtils.xmlEscape(execution.getVariable("CAAIVfMod_moduleName"))}</vf-module-name> + <model-invariant-id>${MsoUtils.xmlEscape(execution.getVariable("CAAIVfMod_personaId"))}</model-invariant-id> + <model-version-id>${MsoUtils.xmlEscape(execution.getVariable("CAAIVfMod_personaVer"))}</model-version-id> + <model-customization-id>${MsoUtils.xmlEscape(execution.getVariable("CAAIVfMod_modelCustomizationId"))}</model-customization-id> + <is-base-vf-module>${MsoUtils.xmlEscape(isBaseModule)}</is-base-vf-module> + <orchestration-status>PendingCreate</orchestration-status> + <module-index>${MsoUtils.xmlEscape(moduleIndex)}</module-index> + </vf-module>""" as String + execution.setVariable("CAAIVfMod_createVfModulePayload", payload) + + try { + msoLogger.debug("createVfModule() endpoint-" + endPoint) + msoLogger.debug("invoking PUT call to AAI with payload:"+System.lineSeparator()+payload) + msoLogger.debug("CreateAAIVfModule sending PUT call to AAI with endpoint /n" + endPoint + " with payload /n " + payload) + + AaiUtil aaiUtil = new AaiUtil(this) + APIResponse response = aaiUtil.executeAAIPutCall(execution, endPoint, payload) + def responseData = response.getResponseBodyAsString() + def statusCode = response.getStatusCode() + execution.setVariable("CAAIVfMod_createVfModuleResponseCode", statusCode) + execution.setVariable("CAAIVfMod_createVfModuleResponse", responseData) + + msoLogger.debug("Response code:" + statusCode) + msoLogger.debug("Response:" + System.lineSeparator()+responseData) + msoLogger.debug("Response Code: " + statusCode) + msoLogger.debug("Response data: " + responseData) + // the base or add-on VF Module was successfully created, + // add the module name to the rollback data and the response + if (isOneOf(statusCode, 200, 201)) { + rollbackData.put("VFMODULE", "vfModuleId", newModuleId) + rollbackData.put("VFMODULE", "vfModuleName", execution.getVariable("CAAIVfMod_moduleName")) + execution.setVariable("RollbackData", rollbackData) + msoLogger.debug("RollbackData:" + rollbackData) + + String responseOut = "" + + String isVidRequest = execution.getVariable("isVidRequest") + + if (isBaseModule && (isVidRequest == null || "false".equals(isVidRequest))) { + + responseOut = """<CreateAAIVfModuleResponse> + <vnf-id>${MsoUtils.xmlEscape(execution.getVariable("CAAIVfMod_vnfId"))}</vnf-id> + <vf-module-id>${MsoUtils.xmlEscape(newModuleId)}</vf-module-id> + <vf-module-index>${MsoUtils.xmlEscape(moduleIndexString)}</vf-module-index> + </CreateAAIVfModuleResponse>""" as String + } + else { + responseOut = """<CreateAAIVfModuleResponse> + <vnf-name>${MsoUtils.xmlEscape(execution.getVariable("CAAIVfMod_vnfNameFromAAI"))}</vnf-name> + <vnf-id>${MsoUtils.xmlEscape(execution.getVariable("CAAIVfMod_vnfId"))}</vnf-id> + <vf-module-id>${MsoUtils.xmlEscape(newModuleId)}</vf-module-id> + <vf-module-index>${MsoUtils.xmlEscape(moduleIndexString)}</vf-module-index> + </CreateAAIVfModuleResponse>""" as String + } + + execution.setVariable("CreateAAIVfModuleResponse", responseOut) + msoLogger.debug("CreateAAIVfModuleResponse:" + System.lineSeparator()+responseOut) + msoLogger.debug("CreateAAIVfModule Response /n " + responseOut) + } + } catch (Exception ex) { + msoLogger.debug("Exception occurred while executing AAI PUT:" + ex.getMessage()) + exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured in createVfModule.") + } + } + + // parses the output from the result from queryAAIForGenericVnf() to determine if the vf-module-name + // requested for an Add-on VF Module does not already exist for the specified Generic VNF + // also retrieves VNF name from AAI response for existing VNF + public void parseForAddOnModule(DelegateExecution execution) { + def xml = execution.getVariable("CAAIVfMod_queryGenericVnfResponse") + def vnfNameFromAAI = utils.getNodeText(xml, "vnf-name") + execution.setVariable("CAAIVfMod_vnfNameFromAAI", vnfNameFromAAI) + msoLogger.debug("Obtained vnf-name from AAI for existing VNF: " + vnfNameFromAAI) + def newModuleName = execution.getVariable("CAAIVfMod_moduleName") + msoLogger.debug("VF Module to be added: " + newModuleName) + def qryModuleNameList = utils.getMultNodes(xml, "vf-module-name") + execution.setVariable("CAAIVfMod_moduleExists", false) + if (qryModuleNameList != null) { + msoLogger.debug("Existing VF Module List: " + qryModuleNameList) + for (String qryModuleName : qryModuleNameList) { + if (newModuleName.equals(qryModuleName)) { + // a module with the requested name already exists - failure + msoLogger.debug("VF Module " + qryModuleName + " already exists for Generic VNF " + execution.getVariable("CAAIVfMod_vnfNameFromAAI")) + execution.setVariable("CAAIVfMod_moduleExists", true) + execution.setVariable("CAAIVfMod_parseModuleResponse", + "VF Module " + qryModuleName + " already exists for Generic VNF " + + execution.getVariable("CAAIVfMod_vnfNameFromAAI")) + break + } + } + } + if (execution.getVariable("CAAIVfMod_moduleExists") == false) { + msoLogger.debug("VF Module " + execution.getVariable("CAAIVfMod_moduleName") + " does not exist for Generic VNF " + execution.getVariable("CAAIVfMod_vnfNameFromAAI")) + execution.setVariable("CAAIVfMod_parseModuleResponse", + "VF Module " + newModuleName + " does not exist for Generic VNF " + + execution.getVariable("CAAIVfMod_vnfNameFromAAI")) + } + } + + // parses the output from the result from queryAAIForGenericVnf() to determine if the vf-module-name + // requested for an Add-on VF Module does not already exist for the specified Generic VNF; + // also retrieves VNF name from AAI response for existing VNF + public void parseForBaseModule(DelegateExecution execution) { + def xml = execution.getVariable("CAAIVfMod_queryGenericVnfResponse") + def vnfNameFromAAI = utils.getNodeText(xml, "vnf-name") + execution.setVariable("CAAIVfMod_vnfNameFromAAI", vnfNameFromAAI) + msoLogger.debug("Obtained vnf-name from AAI for existing VNF: " + vnfNameFromAAI) + def newModuleName = execution.getVariable("CAAIVfMod_moduleName") + msoLogger.debug("VF Module to be added: " + newModuleName) + def qryModuleNameList = utils.getMultNodes(xml, "vf-module-name") + execution.setVariable("CAAIVfMod_moduleExists", false) + if (qryModuleNameList != null) { + msoLogger.debug("Existing VF Module List: " + qryModuleNameList) + for (String qryModuleName : qryModuleNameList) { + if (newModuleName.equals(qryModuleName)) { + // a module with the requested name already exists - failure + msoLogger.debug("VF Module " + qryModuleName + " already exists for Generic VNF " + execution.getVariable("CAAIVfMod_vnfNameFromAAI")) + execution.setVariable("CAAIVfMod_baseModuleConflict", true) + execution.setVariable("CAAIVfMod_parseModuleResponse", + "VF Module " + qryModuleName + " already exists for Generic VNF " + + execution.getVariable("CAAIVfMod_vnfNameFromAAI")) + break + } + } + } + def isBaseVfModuleList = utils.getMultNodes(xml, "is-base-vf-module") + if (isBaseVfModuleList != null && !execution.getVariable("CAAIVfMod_baseModuleConflict")) { + + for (String baseValue : isBaseVfModuleList) { + if (baseValue.equals("true")) { + // a base module already exists in this VNF - failure + msoLogger.debug("Base VF Module already exists for Generic VNF " + execution.getVariable("CAAIVfMod_vnfNameFromAAI")) + execution.setVariable("CAAIVfMod_baseModuleConflict", true) + execution.setVariable("CAAIVfMod_parseModuleResponse", + "Base VF Module already exists for Generic VNF " + + execution.getVariable("CAAIVfMod_vnfNameFromAAI")) + break + } + } + + } + if (execution.getVariable("CAAIVfMod_moduleExists") == false && execution.getVariable("CAAIVfMod_baseModuleConflict") == false) { + msoLogger.debug("VF Module " + execution.getVariable("CAAIVfMod_moduleName") + " does not exist for Generic VNF " + execution.getVariable("CAAIVfMod_vnfNameFromAAI")) + execution.setVariable("CAAIVfMod_parseModuleResponse", + "VF Module " + newModuleName + " does not exist for Generic VNF " + + execution.getVariable("CAAIVfMod_vnfNameFromAAI")) + } + } + + // generates a WorkflowException when the A&AI query returns a response code other than 200 or 404 + public void handleAAIQueryFailure(DelegateExecution execution) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Error occurred attempting to query AAI, Response Code " + execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") + ", Error Response " + execution.getVariable("CAAIVfMod_queryGenericVnfResponse"), "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + int code = execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") + exceptionUtil.buildAndThrowWorkflowException(execution, code, "Error occurred attempting to query AAI") + + } + + // generates a WorkflowException if + // - the A&AI Generic VNF PUT returns a response code other than 200 or 201 + // - the requested Generic VNF already exists but vnf-id == null + // - the requested Generic VNF does not exist but vnf-id != null + // - the A&AI VF Module PUT returns a response code other than 200 or 201 + // - the requested VF Module already exists for the Generic VNF + public void handleCreateVfModuleFailure(DelegateExecution execution) { + def errorCode + def errorResponse + if (execution.getVariable("CAAIVfMod_createGenericVnfResponseCode") != null && + !isOneOf(execution.getVariable("CAAIVfMod_createGenericVnfResponseCode"), 200, 201)) { + msoLogger.debug("Failure creating Generic VNF: " + execution.getVariable("CAAIVfMod_createGenericVnfResponse")) + errorResponse = execution.getVariable("CAAIVfMod_createGenericVnfResponse") + errorCode = 5000 + } else if (execution.getVariable("CAAIVfMod_queryGenericVnfResponse") != null && + execution.getVariable("CAAIVfMod_newGenericVnf") == true) { + // attempted to create a Generic VNF that already exists but vnf-id == null + msoLogger.debug(execution.getVariable("CAAIVfMod_queryGenericVnfResponse")) + errorResponse = execution.getVariable("CAAIVfMod_queryGenericVnfResponse") + errorCode = 1002 + } else if (execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") == 404 && + execution.getVariable("CAAIVfMod_newGenericVnf") == false) { + // attempted to create a Generic VNF where vnf-name does not exist but vnf-id != null + msoLogger.debug(execution.getVariable("CAAIVfMod_queryGenericVnfResponse")) + errorResponse = execution.getVariable("CAAIVfMod_queryGenericVnfResponse") + errorCode = 1002 + } else if (execution.getVariable("CAAIVfMod_createVfModuleResponseCode") != null) { + msoLogger.debug("Failed to add VF Module: " + execution.getVariable("CAAIVfMod_createVfModuleResponse")) + errorResponse = execution.getVariable("CAAIVfMod_createVfModuleResponse") + errorCode = 5000 + } else if (execution.getVariable("CAAIVfMod_moduleExists") == true) { + msoLogger.debug("Attempting to add VF Module that already exists: " + execution.getVariable("CAAIVfMod_parseModuleResponse")) + errorResponse = execution.getVariable("CAAIVfMod_parseModuleResponse") + errorCode = 1002 + } else if (execution.getVariable("CAAIVfMod_baseModuleConflict") == true) { + msoLogger.debug("Attempting to add Base VF Module to VNF that already has a Base VF Module: " + execution.getVariable("CAAIVfMod_parseModuleResponse")) + errorResponse = execution.getVariable("CAAIVfMod_parseModuleResponse") + errorCode = 1002 + } else { + // if the responses get populated corerctly, we should never get here + errorResponse = "Unknown error occurred during CreateAAIVfModule flow" + errorCode = 2000 + } + + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Error occurred during CreateAAIVfModule flow", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, errorResponse); + exceptionUtil.buildAndThrowWorkflowException(execution, errorCode, errorResponse) + msoLogger.debug("Workflow exception occurred in CreateAAIVfModule: " + errorResponse) + } + + /** + * Performs a rollback. + * TBD: This method requires additional testing once integrated with the + * main CreateVfModule flow. + * @param execution the execution + */ + public void rollback(DelegateExecution execution) { + def method = getClass().getSimpleName() + ".rollback(" + + "execution=" + execution.getId() + + ")" + msoLogger.debug("Entered " + method) + + try { + RollbackData rollbackData = (RollbackData) execution.getVariable("RollbackData") + msoLogger.debug("RollbackData:" + rollbackData) + + AaiUtil aaiUriUtil = new AaiUtil(this) + def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution) + msoLogger.debug('AAI URI is: ' + aai_uri) + msoLogger.debug("CreateAAIVfModule rollback AAI URI: " + aai_uri) + + if (rollbackData != null) { + if (rollbackData.hasType("VFMODULE")) { + // use the DeleteAAIVfModule groovy methods for the rollback + def vnfId = rollbackData.get("VFMODULE", "vnfId") + def vfModuleId = rollbackData.get("VFMODULE", "vfModuleId") + def isBaseModule = rollbackData.get("VFMODULE", "isBaseModule") + execution.setVariable("DAAIVfMod_vnfId", vnfId) + execution.setVariable("DAAIVfMod_vfModuleId", vfModuleId) + execution.setVariable("DAAIVfMod_genericVnfEndpoint", "${aai_uri}/" + vnfId) + execution.setVariable("DAAIVfMod_vfModuleEndpoint", "${aai_uri}/" + vnfId + + "/vf-modules/vf-module/" + vfModuleId) + DeleteAAIVfModule dvm = new DeleteAAIVfModule() + // query A&AI to get the needed information for the delete(s) + dvm.queryAAIForGenericVnf(execution) + dvm.parseForVfModule(execution) + + // roll back the base or add-on module + dvm.deleteVfModule(execution) + def responseCode = execution.getVariable("DAAIVfMod_deleteVfModuleResponseCode") + def response = execution.getVariable("DAAIVfMod_deleteVfModuleResponseCode") + + if (isOneOf(responseCode, 200, 204)) { + msoLogger.debug("Received " + responseCode + " to VF Module rollback request") +// execution.setVariable("RollbackResult", "SUCCESS") + } else { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Received " + responseCode + " to VF Module rollback request", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, rollbackData + System.lineSeparator() + "Response: " + response); + } + + // a new Generic VNF was created that needs to be rolled back + if (isBaseModule.equals("true")) { + dvm.deleteGenericVnf(execution) + responseCode = execution.getVariable("DAAIVfMod_deleteGenericVnfResponseCode") + response = execution.getVariable("DAAIVfMod_deleteGenericVnfResponse") + + if (isOneOf(responseCode, 200, 204)) { + msoLogger.debug("Received " + responseCode + " to Generic VNF rollback request") + execution.setVariable("RollbackResult", "SUCCESS") + } else { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Received " + responseCode + " to Generic VNF rollback request", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, rollbackData + System.lineSeparator() + "Response: " + response); + } + } else { + execution.setVariable("RollbackResult", "SUCCESS") + } + } + } + + msoLogger.debug("Exited " + method) + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Caught exception in " + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + } + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CreateAAIVfModuleVolumeGroup.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleVolumeGroup.groovy index 5edf391bb4..ec691f299e 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CreateAAIVfModuleVolumeGroup.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleVolumeGroup.groovy @@ -1,334 +1,327 @@ -/*-
- * ============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.common.scripts
-
-import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.openecomp.mso.rest.APIResponse
-
-
-public class CreateAAIVfModuleVolumeGroup extends AbstractServiceTaskProcessor {
-
- private XmlParser xmlParser = new XmlParser()
- ExceptionUtil exceptionUtil = new ExceptionUtil()
-
- /**
- * Initialize the flow's variables.
- *
- * @param execution The flow's execution instance.
- */
- public void initProcessVariables(DelegateExecution execution) {
- execution.setVariable('prefix', 'CAAIVfModVG_')
- execution.setVariable('CAAIVfModVG_vnfId', null)
- execution.setVariable('CAAIVfModVG_vfModuleId', null)
- execution.setVariable('CAAIVfModVG_aicCloudRegion', null)
- execution.setVariable('CAAIVfModVG_volumeGroupId', null)
- execution.setVariable('CAAIVfModVG_getVfModuleResponseCode' ,null)
- execution.setVariable('CAAIVfModVG_getVfModuleResponse', '')
- execution.setVariable('CAAIVfModVG_updateVfModuleResponseCode', null)
- execution.setVariable('CAAIVfModVG_updateVfModuleResponse', '')
- }
-
- /**
- * Check for missing elements in the received request.
- *
- * @param execution The flow's execution instance.
- */
- public void preProcessRequest(DelegateExecution execution) {
- def method = getClass().getSimpleName() + '.preProcessRequest(' +
- 'execution=' + execution.getId() +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- try {
- def xml = execution.getVariable('CreateAAIVfModuleVolumeGroupRequest')
- logDebug('Received request xml:\n' + xml, isDebugLogEnabled)
- utils.logAudit("CreateAAIVfModuleVolume Received Request XML: " + xml)
- initProcessVariables(execution)
-
- def vnfId = getRequiredNodeText(execution, xml,'vnf-id')
- execution.setVariable('CAAIVfModVG_vnfId', vnfId)
-
- def vfModuleId = getRequiredNodeText(execution, xml,'vf-module-id')
- execution.setVariable('CAAIVfModVG_vfModuleId', vfModuleId)
-
- def aicCloudRegion = getRequiredNodeText(execution, xml,'aic-cloud-region')
- execution.setVariable('CAAIVfModVG_aicCloudRegion', aicCloudRegion)
-
- def volumeGroupId = getRequiredNodeText(execution, xml,'volume-group-id')
- execution.setVariable('CAAIVfModVG_volumeGroupId', volumeGroupId)
-
- logDebug('Exited ' + method, isDebugLogEnabled)
- } catch (BpmnError e) {
- throw e;
- } catch (Exception e) {
- logError('Caught exception in ' + method, e)
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessRequest(): ' + e.getMessage())
-
- }
- }
-
- /**
- * Using the received vnfId and vfModuleId, query AAI to get the corresponding VF Module.
- * A 200 response is expected with the VF Module in the response body.
- *
- * @param execution The flow's execution instance.
- */
- public void getVfModule(DelegateExecution execution) {
- def method = getClass().getSimpleName() + '.getVfModule(' +
- 'execution=' + execution.getId() +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- try {
- def vnfId = execution.getVariable('CAAIVfModVG_vnfId')
- def vfModuleId = execution.getVariable('CAAIVfModVG_vfModuleId')
-
- // Construct endpoint
- AaiUtil aaiUtil = new AaiUtil(this)
- def aai_uri = aaiUtil.getNetworkGenericVnfUri(execution)
- logDebug('AAI URI is: ' + aai_uri, isDebugLogEnabled)
- String endPoint = execution.getVariable('URN_aai_endpoint') + aai_uri + '/' + URLEncoder.encode(vnfId, "UTF-8") + '/vf-modules/vf-module/' + URLEncoder.encode(vfModuleId, "UTF-8")
-
- try {
- logDebug('sending GET to AAI endpoint \'' + endPoint + '\'', isDebugLogEnabled)
- utils.logAudit("aaiResponse GET TO AAI Endpoint: " + endPoint)
- APIResponse response = aaiUtil.executeAAIGetCall(execution, endPoint)
- def responseData = response.getResponseBodyAsString()
- execution.setVariable('CAAIVfModVG_getVfModuleResponseCode', response.getStatusCode())
- execution.setVariable('CAAIVfModVG_getVfModuleResponse', responseData)
-
- utils.logAudit("CreateAAIVfModule Response Code: " + response.getStatusCode())
- utils.logAudit("CreateAAIVfModule Response: " + response)
- logDebug('Response code:' + response.getStatusCode(), isDebugLogEnabled)
- logDebug('Response:' + System.lineSeparator() + responseData, isDebugLogEnabled)
- } catch (Exception ex) {
- ex.printStackTrace()
- logDebug('Exception occurred while executing AAI GET:' + ex.getMessage(),isDebugLogEnabled)
- execution.setVariable('CAAIVfModVG_getVfModuleResponseCode', 500)
- execution.setVariable('CAAIVfModVG_getVfModuleResponse', 'AAI GET Failed:' + ex.getMessage())
- }
- logDebug('Exited ' + method, isDebugLogEnabled)
- } catch (BpmnError e) {
- throw e;
- } catch (Exception e) {
- logError('Caught exception in ' + method, e)
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in getVfModule(): ' + e.getMessage())
- }
- }
-
- /**
- * Construct and send a PUT request to AAI to update the VF Module with the
- * created Volume Group relationship.
- *
- * @param execution The flow's execution instance.
- */
- public void updateVfModule(DelegateExecution execution) {
- def method = getClass().getSimpleName() + '.updateVfModule(' +
- 'execution=' + execution.getId() +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- try {
- def vnfId = execution.getVariable('CAAIVfModVG_vnfId')
- def vfModuleId = execution.getVariable('CAAIVfModVG_vfModuleId')
- def vfModule = execution.getVariable('CAAIVfModVG_getVfModuleResponse')
- def origRequest = execution.getVariable('CreateAAIVfModuleVolumeGroupRequest')
- def Node vfModuleNode = xmlParser.parseText(vfModule)
-
- // Confirm resource-version is in retrieved VF Module
- if (utils.getChildNode(vfModuleNode, 'resource-version') == null) {
- def msg = 'Can\'t update VF Module ' + vfModuleId + ' since \'resource-version\' is missing'
- logError(msg)
- throw new Exception(msg)
- }
-
- // Construct payload by creating a Volume Group relationhip and inserting it into the VF Module
- def aicCloudRegion = execution.getVariable('CAAIVfModVG_aicCloudRegion')
- def volumeGroupId = execution.getVariable('CAAIVfModVG_volumeGroupId')
- def Node vgRelationshipNode = createVolumeGroupRelationshipNode(aicCloudRegion, volumeGroupId)
- insertVolumeGroupRelationshipNode(vfModuleNode, vgRelationshipNode)
- def payload = utils.nodeToString(vfModuleNode)
-
- // Construct endpoint
- AaiUtil aaiUtil = new AaiUtil(this)
- def aai_uri = aaiUtil.getNetworkGenericVnfUri(execution)
- logDebug('AAI URI is: ' + aai_uri, isDebugLogEnabled)
- String endPoint = execution.getVariable('URN_aai_endpoint') + aai_uri + '/' + URLEncoder.encode(vnfId, "UTF-8") + '/vf-modules/vf-module/' + URLEncoder.encode(vfModuleId, "UTF-8")
-
- try {
- utils.logAudit("CreateAAIVfModuleVolume Sendind PUT to AAI Endpoint \n " + endPoint + " with payload \n " + payload)
- logDebug('sending PUT to AAI endpoint \'' + endPoint + '\'' + 'with payload \n' + payload, isDebugLogEnabled)
- APIResponse response = aaiUtil.executeAAIPutCall(execution, endPoint, payload)
- def responseData = response.getResponseBodyAsString()
- execution.setVariable('CAAIVfModVG_updateVfModuleResponseCode', response.getStatusCode())
- execution.setVariable('CAAIVfModVG_updateVfModuleResponse', responseData)
-
- utils.logAudit("CreateAAIVfModule Response code: " + response.getStatusCode())
- utils.logAudit("CreateAAIVfModule Response: " + responseData)
- logDebug('Response code:' + response.getStatusCode(), isDebugLogEnabled)
- logDebug('Response:' + System.lineSeparator() + responseData, isDebugLogEnabled)
- } catch (Exception ex) {
- ex.printStackTrace()
- logDebug('Exception occurred while executing AAI PUT:' + ex.getMessage(),isDebugLogEnabled)
- execution.setVariable('CAAIVfModVG_updateVfModuleResponseCode', 500)
- execution.setVariable('CAAIVfModVG_updateVfModuleResponse', 'AAI PUT Failed:' + ex.getMessage())
- }
- logDebug('Exited ' + method, isDebugLogEnabled)
- } catch (BpmnError e) {
- throw e;
- } catch (Exception e) {
- logError('Caught exception in ' + method, e)
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in updateVfModule(): ' + e.getMessage())
- }
- }
-
- /**
- * Construct a Volume Group relationship Node with the given AIC Cloud Region and
- * Volume Group ID for insertion into a VF Module.
- *
- * @param aicCloudRegion Cloud Region ID to use in the Volume Group relationship
- * @param volumeGroupId Volume Group ID to use in the Volume Group relationship
- * @return a Node representing the new Volume Group relationship
- */
- private Node createVolumeGroupRelationshipNode(String aicCloudRegion, String volumeGroupId) {
-
- def Node relatedTo = new Node(null, 'related-to', 'volume-group')
-
- def Node relationshipKeyCO = new Node(null, 'relationship-key', 'cloud-region.cloud-owner')
- def Node relationshipValueCO = new Node(null, 'relationship-value', 'att-aic')
- def Node relationshipDataCO = new Node(null, 'relationship-data')
- relationshipDataCO.append(relationshipKeyCO)
- relationshipDataCO.append(relationshipValueCO)
-
- def Node relationshipKeyCRI = new Node(null, 'relationship-key', 'cloud-region.cloud-region-id')
- def Node relationshipValueCRI = new Node(null, 'relationship-value', aicCloudRegion)
- def Node relationshipDataCRI = new Node(null, 'relationship-data')
- relationshipDataCRI.append(relationshipKeyCRI)
- relationshipDataCRI.append(relationshipValueCRI)
-
- def Node relationshipKeyVGI = new Node(null, 'relationship-key', 'volume-group.volume-group-id')
- def Node relationshipValueVGI = new Node(null, 'relationship-value', volumeGroupId)
- def Node relationshipDataVGI = new Node(null, 'relationship-data')
- relationshipDataVGI.append(relationshipKeyVGI)
- relationshipDataVGI.append(relationshipValueVGI)
-
- def Node volumeGroupRelationship = new Node(null, 'relationship')
- volumeGroupRelationship.append(relatedTo)
- volumeGroupRelationship.append(relationshipDataCO)
- volumeGroupRelationship.append(relationshipDataCRI)
- volumeGroupRelationship.append(relationshipDataVGI)
-
- return volumeGroupRelationship;
- }
-
- /**
- * Insert the given Volume Group relationship Node into the given VF Module.
- * If the VF Module does NOT contain a relationship list:
- * - Create a relationship list containing the Volume Group relationship and insert it into the VF Module
- * If the VF Module contains a relationship list but not a Volume Group relationship:
- * - Insert the the Volume Group relationship into the relationship lsit
- * If the VF Module contains a relationship list and has a Volume Group relationship:
- * - Replace the existing Volume Group relationship with the new one
- * @param vfModuleNode
- * @param volumeGroupRelationshipNode
- */
- private void insertVolumeGroupRelationshipNode(Node vfModuleNode, Node volumeGroupRelationshipNode) {
- def Node relationshipList = utils.getChildNode(vfModuleNode, 'relationship-list')
- if (relationshipList == null) {
- relationshipList = new Node(null, 'relationship-list')
- relationshipList.append(volumeGroupRelationshipNode)
- vfModuleNode.append(relationshipList)
- } else {
- def Node currVolumeGroupRelationshipNode = getCurrVolumeGroupRelationshipNode(relationshipList)
- if (currVolumeGroupRelationshipNode == null) {
- relationshipList.append(volumeGroupRelationshipNode)
- } else {
- currVolumeGroupRelationshipNode.replaceNode(volumeGroupRelationshipNode)
- }
- }
- }
-
- /**
- * Find and return the value of the Volume Group ID for the specified VF Module. If
- * the value of the Volume Group ID cannot be found for any reason, 'null' is returned.
- *
- * @param vfModuleNode VF Module (as a Node) retrieved from AAI.
- * @return the value of the Volume Group ID for the specified VF Module. If the
- * value of the Volume Group ID cannot be found for any reason, 'null' is returned.
- */
- private Node getCurrVolumeGroupRelationshipNode(Node relationshipList) {
- def Node currVolumeGroupRelationshipNode = null
- def NodeList relationships = utils.getIdenticalChildren(relationshipList, 'relationship')
- for (Node relationshipNode in relationships) {
- def String relatedTo = utils.getChildNodeText(relationshipNode, 'related-to')
- if ((relatedTo != null) && relatedTo.equals('volume-group')) {
- currVolumeGroupRelationshipNode = relationshipNode
- }
- }
- return currVolumeGroupRelationshipNode
- }
-
- /**
- * Generates a WorkflowException if the AAI query returns a response code other than 200.
- *
- * @param execution The flow's execution instance.
- */
- public void handleAAIQueryFailure(DelegateExecution execution) {
- def method = getClass().getSimpleName() + '.handleAAIQueryFailure(' +
- 'execution=' + execution.getId() +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- logError('Error occurred attempting to query AAI, Response Code ' +
- execution.getVariable('CAAIVfModVG_getVfModuleResponseCode') + ', Error Response ' +
- execution.getVariable('CAAIVfModVG_getVfModuleResponse'))
- ExceptionUtil exceptionUtil = new ExceptionUtil()
- exceptionUtil.buildWorkflowException(execution, 5000, execution.getVariable('CAAIVfModVG_getVfModuleResponse'))
-
- logDebug('Exited ' + method, isDebugLogEnabled)
- }
-
- /**
- * Generates a WorkflowException if updating a VF Module in AAI returns a response code other than 200.
- *
- * @param execution The flow's execution instance.
- */
- public void handleUpdateVfModuleFailure(DelegateExecution execution) {
- def method = getClass().getSimpleName() + '.handleUpdateVfModuleFailure(' +
- 'execution=' + execution.getId() +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- logError('Error occurred attempting to update VF Module in AAI, Response Code ' +
- execution.getVariable('CAAIVfModVG_updateVfModuleResponseCode') + ', Error Response ' +
- execution.getVariable('CAAIVfModVG_updateVfModuleResponse'))
- ExceptionUtil exceptionUtil = new ExceptionUtil()
- exceptionUtil.buildWorkflowException(execution, 5000, execution.getVariable('CAAIVfModVG_updateVfModuleResponse'))
-
- logDebug('Exited ' + method, isDebugLogEnabled)
- }
-}
+/*- + * ============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.common.scripts + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.rest.APIResponse +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + +public class CreateAAIVfModuleVolumeGroup extends AbstractServiceTaskProcessor { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateAAIVfModuleVolumeGroup.class); + + private XmlParser xmlParser = new XmlParser() + ExceptionUtil exceptionUtil = new ExceptionUtil() + + /** + * Initialize the flow's variables. + * + * @param execution The flow's execution instance. + */ + public void initProcessVariables(DelegateExecution execution) { + execution.setVariable('prefix', 'CAAIVfModVG_') + execution.setVariable('CAAIVfModVG_vnfId', null) + execution.setVariable('CAAIVfModVG_vfModuleId', null) + execution.setVariable('CAAIVfModVG_aicCloudRegion', null) + execution.setVariable('CAAIVfModVG_volumeGroupId', null) + execution.setVariable('CAAIVfModVG_getVfModuleResponseCode' ,null) + execution.setVariable('CAAIVfModVG_getVfModuleResponse', '') + execution.setVariable('CAAIVfModVG_updateVfModuleResponseCode', null) + execution.setVariable('CAAIVfModVG_updateVfModuleResponse', '') + } + + /** + * Check for missing elements in the received request. + * + * @param execution The flow's execution instance. + */ + public void preProcessRequest(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.preProcessRequest(' + + 'execution=' + execution.getId() + + ')' + msoLogger.trace('Entered ' + method) + + try { + def xml = execution.getVariable('CreateAAIVfModuleVolumeGroupRequest') + msoLogger.debug('Received request xml:\n' + xml) + msoLogger.debug("CreateAAIVfModuleVolume Received Request XML: " + xml) + initProcessVariables(execution) + + def vnfId = getRequiredNodeText(execution, xml,'vnf-id') + execution.setVariable('CAAIVfModVG_vnfId', vnfId) + + def vfModuleId = getRequiredNodeText(execution, xml,'vf-module-id') + execution.setVariable('CAAIVfModVG_vfModuleId', vfModuleId) + + def aicCloudRegion = getRequiredNodeText(execution, xml,'aic-cloud-region') + execution.setVariable('CAAIVfModVG_aicCloudRegion', aicCloudRegion) + + def volumeGroupId = getRequiredNodeText(execution, xml,'volume-group-id') + execution.setVariable('CAAIVfModVG_volumeGroupId', volumeGroupId) + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessRequest(): ' + e.getMessage()) + + } + } + + /** + * Using the received vnfId and vfModuleId, query AAI to get the corresponding VF Module. + * A 200 response is expected with the VF Module in the response body. + * + * @param execution The flow's execution instance. + */ + public void getVfModule(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.getVfModule(' + + 'execution=' + execution.getId() + + ')' + msoLogger.trace('Entered ' + method) + + try { + def vnfId = execution.getVariable('CAAIVfModVG_vnfId') + def vfModuleId = execution.getVariable('CAAIVfModVG_vfModuleId') + + // Construct endpoint + AaiUtil aaiUtil = new AaiUtil(this) + def aai_uri = aaiUtil.getNetworkGenericVnfUri(execution) + msoLogger.debug('AAI URI is: ' + aai_uri) + String endPoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + aai_uri + '/' + URLEncoder.encode(vnfId, "UTF-8") + '/vf-modules/vf-module/' + URLEncoder.encode(vfModuleId, "UTF-8") + + try { + msoLogger.debug('sending GET to AAI endpoint \'' + endPoint + '\'') + msoLogger.debug("aaiResponse GET TO AAI Endpoint: " + endPoint) + APIResponse response = aaiUtil.executeAAIGetCall(execution, endPoint) + def responseData = response.getResponseBodyAsString() + execution.setVariable('CAAIVfModVG_getVfModuleResponseCode', response.getStatusCode()) + execution.setVariable('CAAIVfModVG_getVfModuleResponse', responseData) + + msoLogger.debug("CreateAAIVfModule Response Code: " + response.getStatusCode()) + msoLogger.debug("CreateAAIVfModule Response: " + response) + msoLogger.debug('Response code:' + response.getStatusCode()) + msoLogger.debug('Response:' + System.lineSeparator() + responseData) + } catch (Exception ex) { + ex.printStackTrace() + msoLogger.debug('Exception occurred while executing AAI GET:' + ex.getMessage()) + execution.setVariable('CAAIVfModVG_getVfModuleResponseCode', 500) + execution.setVariable('CAAIVfModVG_getVfModuleResponse', 'AAI GET Failed:' + ex.getMessage()) + } + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in getVfModule(): ' + e.getMessage()) + } + } + + /** + * Construct and send a PUT request to AAI to update the VF Module with the + * created Volume Group relationship. + * + * @param execution The flow's execution instance. + */ + public void updateVfModule(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.updateVfModule(' + + 'execution=' + execution.getId() + + ')' + msoLogger.trace('Entered ' + method) + + try { + def vnfId = execution.getVariable('CAAIVfModVG_vnfId') + def vfModuleId = execution.getVariable('CAAIVfModVG_vfModuleId') + def vfModule = execution.getVariable('CAAIVfModVG_getVfModuleResponse') + def origRequest = execution.getVariable('CreateAAIVfModuleVolumeGroupRequest') + def Node vfModuleNode = xmlParser.parseText(vfModule) + + // Confirm resource-version is in retrieved VF Module + if (utils.getChildNode(vfModuleNode, 'resource-version') == null) { + def msg = 'Can\'t update VF Module ' + vfModuleId + ' since \'resource-version\' is missing' + msoLogger.error( msg); + throw new Exception(msg) + } + + // Construct payload by creating a Volume Group relationhip and inserting it into the VF Module + def aicCloudRegion = execution.getVariable('CAAIVfModVG_aicCloudRegion') + def volumeGroupId = execution.getVariable('CAAIVfModVG_volumeGroupId') + def Node vgRelationshipNode = createVolumeGroupRelationshipNode(aicCloudRegion, volumeGroupId) + insertVolumeGroupRelationshipNode(vfModuleNode, vgRelationshipNode) + def payload = utils.nodeToString(vfModuleNode) + + // Construct endpoint + AaiUtil aaiUtil = new AaiUtil(this) + def aai_uri = aaiUtil.getNetworkGenericVnfUri(execution) + msoLogger.debug('AAI URI is: ' + aai_uri) + String endPoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + aai_uri + '/' + URLEncoder.encode(vnfId, "UTF-8") + '/vf-modules/vf-module/' + URLEncoder.encode(vfModuleId, "UTF-8") + + try { + msoLogger.debug("CreateAAIVfModuleVolume Sendind PUT to AAI Endpoint \n " + endPoint + " with payload \n " + payload) + msoLogger.debug('sending PUT to AAI endpoint \'' + endPoint + '\'' + 'with payload \n' + payload) + APIResponse response = aaiUtil.executeAAIPutCall(execution, endPoint, payload) + def responseData = response.getResponseBodyAsString() + execution.setVariable('CAAIVfModVG_updateVfModuleResponseCode', response.getStatusCode()) + execution.setVariable('CAAIVfModVG_updateVfModuleResponse', responseData) + + msoLogger.debug("CreateAAIVfModule Response code: " + response.getStatusCode()) + msoLogger.debug("CreateAAIVfModule Response: " + responseData) + msoLogger.debug('Response code:' + response.getStatusCode()) + msoLogger.debug('Response:' + System.lineSeparator() + responseData) + } catch (Exception ex) { + ex.printStackTrace() + msoLogger.debug('Exception occurred while executing AAI PUT:' + ex.getMessage()) + execution.setVariable('CAAIVfModVG_updateVfModuleResponseCode', 500) + execution.setVariable('CAAIVfModVG_updateVfModuleResponse', 'AAI PUT Failed:' + ex.getMessage()) + } + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in updateVfModule(): ' + e.getMessage()) + } + } + + /** + * Construct a Volume Group relationship Node with the given AIC Cloud Region and + * Volume Group ID for insertion into a VF Module. + * + * @param aicCloudRegion Cloud Region ID to use in the Volume Group relationship + * @param volumeGroupId Volume Group ID to use in the Volume Group relationship + * @return a Node representing the new Volume Group relationship + */ + private Node createVolumeGroupRelationshipNode(String aicCloudRegion, String volumeGroupId) { + + def Node relatedTo = new Node(null, 'related-to', 'volume-group') + + def Node relationshipKeyCO = new Node(null, 'relationship-key', 'cloud-region.cloud-owner') + def Node relationshipValueCO = new Node(null, 'relationship-value', 'att-aic') + def Node relationshipDataCO = new Node(null, 'relationship-data') + relationshipDataCO.append(relationshipKeyCO) + relationshipDataCO.append(relationshipValueCO) + + def Node relationshipKeyCRI = new Node(null, 'relationship-key', 'cloud-region.cloud-region-id') + def Node relationshipValueCRI = new Node(null, 'relationship-value', aicCloudRegion) + def Node relationshipDataCRI = new Node(null, 'relationship-data') + relationshipDataCRI.append(relationshipKeyCRI) + relationshipDataCRI.append(relationshipValueCRI) + + def Node relationshipKeyVGI = new Node(null, 'relationship-key', 'volume-group.volume-group-id') + def Node relationshipValueVGI = new Node(null, 'relationship-value', volumeGroupId) + def Node relationshipDataVGI = new Node(null, 'relationship-data') + relationshipDataVGI.append(relationshipKeyVGI) + relationshipDataVGI.append(relationshipValueVGI) + + def Node volumeGroupRelationship = new Node(null, 'relationship') + volumeGroupRelationship.append(relatedTo) + volumeGroupRelationship.append(relationshipDataCO) + volumeGroupRelationship.append(relationshipDataCRI) + volumeGroupRelationship.append(relationshipDataVGI) + + return volumeGroupRelationship; + } + + /** + * Insert the given Volume Group relationship Node into the given VF Module. + * If the VF Module does NOT contain a relationship list: + * - Create a relationship list containing the Volume Group relationship and insert it into the VF Module + * If the VF Module contains a relationship list but not a Volume Group relationship: + * - Insert the the Volume Group relationship into the relationship lsit + * If the VF Module contains a relationship list and has a Volume Group relationship: + * - Replace the existing Volume Group relationship with the new one + * @param vfModuleNode + * @param volumeGroupRelationshipNode + */ + private void insertVolumeGroupRelationshipNode(Node vfModuleNode, Node volumeGroupRelationshipNode) { + def Node relationshipList = utils.getChildNode(vfModuleNode, 'relationship-list') + if (relationshipList == null) { + relationshipList = new Node(null, 'relationship-list') + relationshipList.append(volumeGroupRelationshipNode) + vfModuleNode.append(relationshipList) + } else { + def Node currVolumeGroupRelationshipNode = getCurrVolumeGroupRelationshipNode(relationshipList) + if (currVolumeGroupRelationshipNode == null) { + relationshipList.append(volumeGroupRelationshipNode) + } else { + currVolumeGroupRelationshipNode.replaceNode(volumeGroupRelationshipNode) + } + } + } + + /** + * Find and return the value of the Volume Group ID for the specified VF Module. If + * the value of the Volume Group ID cannot be found for any reason, 'null' is returned. + * + * @param vfModuleNode VF Module (as a Node) retrieved from AAI. + * @return the value of the Volume Group ID for the specified VF Module. If the + * value of the Volume Group ID cannot be found for any reason, 'null' is returned. + */ + private Node getCurrVolumeGroupRelationshipNode(Node relationshipList) { + def Node currVolumeGroupRelationshipNode = null + def NodeList relationships = utils.getIdenticalChildren(relationshipList, 'relationship') + for (Node relationshipNode in relationships) { + def String relatedTo = utils.getChildNodeText(relationshipNode, 'related-to') + if ((relatedTo != null) && relatedTo.equals('volume-group')) { + currVolumeGroupRelationshipNode = relationshipNode + } + } + return currVolumeGroupRelationshipNode + } + + /** + * Generates a WorkflowException if the AAI query returns a response code other than 200. + * + * @param execution The flow's execution instance. + */ + public void handleAAIQueryFailure(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.handleAAIQueryFailure(' + + 'execution=' + execution.getId() + + ')' + msoLogger.trace('Entered ' + method) + msoLogger.error( 'Error occurred attempting to query AAI, Response Code ' + execution.getVariable('CAAIVfModVG_getVfModuleResponseCode')); + ExceptionUtil exceptionUtil = new ExceptionUtil() + exceptionUtil.buildWorkflowException(execution, 5000, execution.getVariable('CAAIVfModVG_getVfModuleResponse')) + + msoLogger.trace('Exited ' + method) + } + + /** + * Generates a WorkflowException if updating a VF Module in AAI returns a response code other than 200. + * + * @param execution The flow's execution instance. + */ + public void handleUpdateVfModuleFailure(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.handleUpdateVfModuleFailure(' + + 'execution=' + execution.getId() + + ')' + msoLogger.trace('Entered ' + method) + + msoLogger.error('Error occurred attempting to update VF Module in AAI, Response Code ' + execution.getVariable('CAAIVfModVG_updateVfModuleResponseCode')); + ExceptionUtil exceptionUtil = new ExceptionUtil() + exceptionUtil.buildWorkflowException(execution, 5000, execution.getVariable('CAAIVfModVG_updateVfModuleResponse')) + + msoLogger.trace('Exited ' + method) + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CustomE2EGetService.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CustomE2EGetService.groovy index 86b35853ba..5aef1d6ea5 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CustomE2EGetService.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CustomE2EGetService.groovy @@ -1,443 +1,440 @@ -/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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.common.scripts
-
-import static org.apache.commons.lang3.StringUtils.*
-
-import org.apache.commons.lang3.*
-import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.openecomp.mso.rest.APIResponse
-import org.springframework.web.util.UriUtils
-
-
-/**
- * This class supports the GenericGetService Sub Flow.
- * This Generic sub flow can be used by any flow for accomplishing
- * the goal of getting a Service-Instance or Service-Subscription (from AAI).
- * The calling flow must set the GENGS_type variable as "service-instance"
- * or "service-subscription".
- *
- * When using to Get a Service-Instance:
- * If the global-customer-id and service-type are not provided
- * this flow executes a query to get the service- Url using the
- * Service Id or Name (whichever is provided).
- *
- * When using to Get a Service-Subscription:
- * The global-customer-id and service-type must be
- * provided.
- *
- * Upon successful completion of this sub flow the
- * GENGS_SuccessIndicator will be true and the query response payload
- * will be set to GENGS_service. An MSOWorkflowException will
- * be thrown upon unsuccessful completion or if an error occurs
- * at any time during this sub flow. Please map variables
- * to the corresponding variable names below.
- *
- * Note - If this sub flow receives a Not Found (404) response
- * from AAI at any time this will be considered an acceptable
- * successful response however the GENGS_FoundIndicator
- * will be set to false. This variable will allow the calling flow
- * to distinguish between the two Success scenarios,
- * "Success where service- is found" and
- * "Success where service- is NOT found".
- *
- *
- * Variable Mapping Below:
- *
- * In Mapping Variables:
- * For Allotted-Resource:
- * @param - GENGS_allottedResourceId
- * @param - GENGS_type
- * @param (Optional) - GENGS_serviceInstanceId
- * @param (Optional) - GENGS_serviceType
- * @param (Optional) - GENGS_globalCustomerId
- *
- * For Service-Instance:
- * @param - GENGS_serviceInstanceId or @param - GENGS_serviceInstanceName
- * @param - GENGS_type
- * @param (Optional) - GENGS_serviceType
- * @param (Optional) - GENGS_globalCustomerId
- *
- * For Service-Subscription:
- * @param - GENGS_type
- * @param - GENGS_serviceType
- * @param - GENGS_globalCustomerId
- *
- *
- * Out Mapping Variables:
- * @param - GENGS_service
- * @param - GENGS_FoundIndicator
- * @param - WorkflowException
- */
-class CustomE2EGetService extends AbstractServiceTaskProcessor{
-
- String Prefix = "GENGS_"
- ExceptionUtil exceptionUtil = new ExceptionUtil()
-
- /**
- * This method validates the incoming variables and
- * determines the subsequent event based on which
- * variables the calling flow provided.
- *
- * @param - execution
- *
- */
- public void preProcessRequest(DelegateExecution execution) {
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- execution.setVariable("prefix",Prefix)
- utils.log("DEBUG", " *** STARTED GenericGetService PreProcessRequest Process*** ", isDebugEnabled)
-
- execution.setVariable("GENGS_obtainObjectsUrl", false)
- execution.setVariable("GENGS_obtainServiceInstanceUrlByName", false)
- execution.setVariable("GENGS_SuccessIndicator", false)
- execution.setVariable("GENGS_FoundIndicator", false)
- execution.setVariable("GENGS_resourceLink", null)
- execution.setVariable("GENGS_siResourceLink", null)
-
- try{
- // Get Variables
- String allottedResourceId = execution.getVariable("GENGS_allottedResourceId")
- String serviceInstanceId = execution.getVariable("GENGS_serviceInstanceId")
- String serviceInstanceName = execution.getVariable("GENGS_serviceInstanceName")
- String serviceType = execution.getVariable("GENGS_serviceType")
- String globalCustomerId = execution.getVariable("GENGS_globalCustomerId")
- String type = execution.getVariable("GENGS_type")
-
- if(type != null){
- utils.log("DEBUG", "Incoming GENGS_type is: " + type, isDebugEnabled)
- if(type.equalsIgnoreCase("allotted-resource")){
- if(isBlank(allottedResourceId)){
- utils.log("DEBUG", "Incoming allottedResourceId is null. Allotted Resource Id is required to Get an allotted-resource.", isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming allottedResourceId is null. Allotted Resource Id is required to Get an allotted-resource.")
- }else{
- utils.log("DEBUG", "Incoming Allotted Resource Id is: " + allottedResourceId, isDebugEnabled)
- if(isBlank(globalCustomerId) || isBlank(serviceType) || isBlank(serviceInstanceId)){
- execution.setVariable("GENGS_obtainObjectsUrl", true)
- }else{
- utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled)
- utils.log("DEBUG", "Incoming Service Type is: " + serviceType, isDebugEnabled)
- utils.log("DEBUG", "Incoming Global Customer Id is: " + globalCustomerId, isDebugEnabled)
- }
- }
- }else if(type.equalsIgnoreCase("service-instance")){
- if(isBlank(serviceInstanceId) && isBlank(serviceInstanceName)){
- utils.log("DEBUG", "Incoming serviceInstanceId and serviceInstanceName are null. ServiceInstanceId or ServiceInstanceName is required to Get a service-instance.", isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming serviceInstanceId and serviceInstanceName are null. ServiceInstanceId or ServiceInstanceName is required to Get a service-instance.")
- }else{
- utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled)
- utils.log("DEBUG", "Incoming Service Instance Name is: " + serviceInstanceName, isDebugEnabled)
- if(isBlank(globalCustomerId) || isBlank(serviceType)){
- execution.setVariable("GENGS_obtainObjectsUrl", true)
- if(isBlank(serviceInstanceId)){
- execution.setVariable("GENGS_obtainServiceInstanceUrlByName", true)
- }
- }else{
- utils.log("DEBUG", "Incoming Global Customer Id is: " + globalCustomerId, isDebugEnabled)
- utils.log("DEBUG", "Incoming Service Type is: " + serviceType, isDebugEnabled)
- }
- }
- }else if(type.equalsIgnoreCase("service-subscription")){
- if(isBlank(serviceType) || isBlank(globalCustomerId)){
- utils.log("DEBUG", "Incoming ServiceType or GlobalCustomerId is null. These variables are required to Get a service-subscription.", isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming ServiceType or GlobalCustomerId is null. These variables are required to Get a service-subscription.")
- }else{
- utils.log("DEBUG", "Incoming Service Type is: " + serviceType, isDebugEnabled)
- utils.log("DEBUG", "Incoming Global Customer Id is: " + globalCustomerId, isDebugEnabled)
- }
- }else{
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Type is Invalid. Please Specify Type as service-instance or service-subscription")
- }
- }else{
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Incoming GENGS_type is null. Variable is Required.")
- }
-
- }catch(BpmnError b){
- utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled)
- throw b
- }catch(Exception e){
- utils.log("DEBUG", "Internal Error encountered within GenericGetService PreProcessRequest method!" + e, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in GenericGetService PreProcessRequest")
-
- }
- utils.log("DEBUG", "*** COMPLETED GenericGetService PreProcessRequest Process ***", isDebugEnabled)
- }
-
- /**
- * This method obtains the Url to the provided service instance
- * using the Service Instance Id.
- *
- * @param - execution
- */
- public void obtainServiceInstanceUrlById(DelegateExecution execution){
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- execution.setVariable("prefix",Prefix)
- utils.log("DEBUG", " *** STARTED GenericGetService ObtainServiceInstanceUrlById Process*** ", isDebugEnabled)
- try {
- AaiUtil aaiUriUtil = new AaiUtil(this)
- String aai_uri = aaiUriUtil.getSearchNodesQueryEndpoint(execution)
- String aai_endpoint = execution.getVariable("URN_aai_endpoint")
-
- String type = execution.getVariable("GENGS_type")
- String path = ""
- if(type.equalsIgnoreCase("service-instance")){
- String serviceInstanceId = execution.getVariable("GENGS_serviceInstanceId")
- utils.log("DEBUG", " Querying Node for Service-Instance URL by using Service-Instance Id: " + serviceInstanceId, isDebugEnabled)
- path = "${aai_uri}?search-node-type=service-instance&filter=service-instance-id:EQUALS:${serviceInstanceId}"
- utils.logAudit("Service Instance Node Query Url is: " + path)
- utils.log("DEBUG", "Service Instance Node Query Url is: " + path, isDebugEnabled)
- }else if(type.equalsIgnoreCase("allotted-resource")){
- String allottedResourceId = execution.getVariable("GENGS_allottedResourceId")
- utils.log("DEBUG", " Querying Node for Service-Instance URL by using Allotted Resource Id: " + allottedResourceId, isDebugEnabled)
- path = "${aai_uri}?search-node-type=allotted-resource&filter=id:EQUALS:${allottedResourceId}"
- utils.logAudit("Allotted Resource Node Query Url is: " + path)
- utils.log("DEBUG", "Allotted Resource Node Query Url is: " + path, isDebugEnabled)
- }
-
- //String url = "${aai_endpoint}${path}" host name needs to be removed from property
- String url = "${path}"
- execution.setVariable("GENGS_genericQueryPath", url)
-
- APIResponse response = aaiUriUtil.executeAAIGetCall(execution, url)
- int responseCode = response.getStatusCode()
- execution.setVariable("GENGS_genericQueryResponseCode", responseCode)
- utils.log("DEBUG", " GET Service Instance response code is: " + responseCode, isDebugEnabled)
- utils.logAudit("GenericGetService AAI GET Response Code: " + responseCode)
-
- String aaiResponse = response.getResponseBodyAsString()
- execution.setVariable("GENGS_obtainSIUrlResponseBeforeUnescaping", aaiResponse)
- utils.log("DEBUG", "GenericGetService AAI Response before unescaping: " + aaiResponse, isDebugEnabled)
- aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse)
- execution.setVariable("GENGS_genericQueryResponse", aaiResponse)
- utils.logAudit("GenericGetService AAI Response: " + aaiResponse)
- utils.log("DEBUG", "GenericGetService AAI Response: " + aaiResponse, isDebugEnabled)
-
- //Process Response
- if(responseCode == 200){
- utils.log("DEBUG", "Generic Query Received a Good Response Code", isDebugEnabled)
- execution.setVariable("GENGS_SuccessIndicator", true)
- if(utils.nodeExists(aaiResponse, "result-data")){
- utils.log("DEBUG", "Generic Query Response Does Contain Data" , isDebugEnabled)
- execution.setVariable("GENGS_FoundIndicator", true)
- String resourceLink = utils.getNodeText1(aaiResponse, "resource-link")
- execution.setVariable("GENGS_resourceLink", resourceLink)
- execution.setVariable("GENGS_siResourceLink", resourceLink)
- }else{
- utils.log("DEBUG", "Generic Query Response Does NOT Contains Data" , isDebugEnabled)
- execution.setVariable("WorkflowResponse", " ") //for junits
- }
- }else if(responseCode == 404){
- utils.log("DEBUG", "Generic Query Received a Not Found (404) Response", isDebugEnabled)
- execution.setVariable("GENGS_SuccessIndicator", true)
- execution.setVariable("WorkflowResponse", " ") //for junits
- }else{
- utils.log("DEBUG", "Generic Query Received a BAD REST Response: \n" + aaiResponse, isDebugEnabled)
- exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode)
- throw new BpmnError("MSOWorkflowException")
- }
- }catch(BpmnError b){
- utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled)
- throw b
- }catch(Exception e){
- utils.log("ERROR", " Error encountered within GenericGetService ObtainServiceInstanceUrlById method!" + e, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During ObtainServiceInstanceUrlById")
- }
- utils.log("DEBUG", " *** COMPLETED GenericGetService ObtainServiceInstanceUrlById Process*** ", isDebugEnabled)
- }
-
- /**
- * This method obtains the Url to the provided service instance
- * using the Service Instance Name.
- *
- * @param - execution
- */
- public void obtainServiceInstanceUrlByName(DelegateExecution execution){
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- execution.setVariable("prefix",Prefix)
- utils.log("DEBUG", " *** STARTED GenericGetService ObtainServiceInstanceUrlByName Process*** ", isDebugEnabled)
- try {
- String serviceInstanceName = execution.getVariable("GENGS_serviceInstanceName")
- utils.log("DEBUG", " Querying Node for Service-Instance URL by using Service-Instance Name " + serviceInstanceName, isDebugEnabled)
-
- AaiUtil aaiUriUtil = new AaiUtil(this)
- String aai_uri = aaiUriUtil.getSearchNodesQueryEndpoint(execution)
- String aai_endpoint = execution.getVariable("URN_aai_endpoint")
- String path = "${aai_uri}?search-node-type=service-instance&filter=service-instance-name:EQUALS:${serviceInstanceName}"
-
- //String url = "${aai_endpoint}${path}" host name needs to be removed from property
- String url = "${path}"
- execution.setVariable("GENGS_obtainSIUrlPath", url)
-
- utils.logAudit("GenericGetService AAI Endpoint: " + aai_endpoint)
- APIResponse response = aaiUriUtil.executeAAIGetCall(execution, url)
- int responseCode = response.getStatusCode()
- execution.setVariable("GENGS_obtainSIUrlResponseCode", responseCode)
- utils.log("DEBUG", " GET Service Instance response code is: " + responseCode, isDebugEnabled)
- utils.logAudit("GenericGetService AAI Response Code: " + responseCode)
-
- String aaiResponse = response.getResponseBodyAsString()
- aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse)
- execution.setVariable("GENGS_obtainSIUrlResponse", aaiResponse)
- utils.logAudit("GenericGetService AAI Response: " + aaiResponse)
- //Process Response
- if(responseCode == 200){
- utils.log("DEBUG", " Query for Service Instance Url Received a Good Response Code", isDebugEnabled)
- execution.setVariable("GENGS_SuccessIndicator", true)
- if(utils.nodeExists(aaiResponse, "result-data")){
- utils.log("DEBUG", "Query for Service Instance Url Response Does Contain Data" , isDebugEnabled)
- execution.setVariable("GENGS_FoundIndicator", true)
- String resourceLink = utils.getNodeText1(aaiResponse, "resource-link")
- execution.setVariable("GENGS_resourceLink", resourceLink)
- execution.setVariable("GENGS_siResourceLink", resourceLink)
- }else{
- utils.log("DEBUG", "Query for Service Instance Url Response Does NOT Contains Data" , isDebugEnabled)
- execution.setVariable("WorkflowResponse", " ") //for junits
- }
- }else if(responseCode == 404){
- utils.log("DEBUG", " Query for Service Instance Received a Not Found (404) Response", isDebugEnabled)
- execution.setVariable("GENGS_SuccessIndicator", true)
- execution.setVariable("WorkflowResponse", " ") //for junits
- }else{
- utils.log("DEBUG", "Query for Service Instance Received a BAD REST Response: \n" + aaiResponse, isDebugEnabled)
- exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode)
- throw new BpmnError("MSOWorkflowException")
- }
- }catch(BpmnError b){
- utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled)
- throw b
- }catch(Exception e){
- utils.log("ERROR", " Error encountered within GenericGetService ObtainServiceInstanceUrlByName method!" + e, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During ObtainServiceInstanceUrlByName")
- }
- utils.log("DEBUG", " *** COMPLETED GenericGetService ObtainServiceInstanceUrlByName Process*** ", isDebugEnabled)
- }
-
-
- /**
- * This method executes a GET call to AAI to obtain the
- * service-instance or service-subscription
- *
- * @param - execution
- */
- public void getServiceObject(DelegateExecution execution){
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- execution.setVariable("prefix",Prefix)
- utils.log("DEBUG", " *** STARTED GenericGetService GetServiceObject Process*** ", isDebugEnabled)
- try {
- String type = execution.getVariable("GENGS_type")
- AaiUtil aaiUriUtil = new AaiUtil(this)
- String aai_endpoint = execution.getVariable("URN_aai_endpoint")
- String serviceEndpoint = ""
-
- utils.logAudit("GenericGetService getServiceObject AAI Endpoint: " + aai_endpoint)
- if(type.equalsIgnoreCase("service-instance")){
- String siResourceLink = execution.getVariable("GENGS_resourceLink")
- if(isBlank(siResourceLink)){
- String serviceInstanceId = execution.getVariable("GENGS_serviceInstanceId")
- utils.log("DEBUG", " Incoming GENGS_serviceInstanceId is: " + serviceInstanceId, isDebugEnabled)
- String serviceType = execution.getVariable("GENGS_serviceType")
- utils.log("DEBUG", " Incoming GENGS_serviceType is: " + serviceType, isDebugEnabled)
- String globalCustomerId = execution.getVariable("GENGS_globalCustomerId")
- utils.log("DEBUG", "Incoming Global Customer Id is: " + globalCustomerId, isDebugEnabled)
-
- String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution)
- logDebug('AAI URI is: ' + aai_uri, isDebugEnabled)
- serviceEndpoint = "${aai_uri}/" + UriUtils.encode(globalCustomerId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + UriUtils.encode(serviceInstanceId,"UTF-8")
- }else{
- utils.log("DEBUG", "Incoming Service Instance Url is: " + siResourceLink, isDebugEnabled)
- String[] split = siResourceLink.split("/aai/")
- serviceEndpoint = "/aai/" + split[1]
- }
- }else if(type.equalsIgnoreCase("allotted-resource")){
- String siResourceLink = execution.getVariable("GENGS_resourceLink")
- if(isBlank(siResourceLink)){
- String allottedResourceId = execution.getVariable("GENGS_allottedResourceId")
- utils.log("DEBUG", " Incoming GENGS_allottedResourceId is: " + allottedResourceId, isDebugEnabled)
- String serviceInstanceId = execution.getVariable("GENGS_serviceInstanceId")
- utils.log("DEBUG", " Incoming GENGS_serviceInstanceId is: " + serviceInstanceId, isDebugEnabled)
- String serviceType = execution.getVariable("GENGS_serviceType")
- utils.log("DEBUG", " Incoming GENGS_serviceType is: " + serviceType, isDebugEnabled)
- String globalCustomerId = execution.getVariable("GENGS_globalCustomerId")
- utils.log("DEBUG", "Incoming Global Customer Id is: " + globalCustomerId, isDebugEnabled)
-
- String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution)
- logDebug('AAI URI is: ' + aai_uri, isDebugEnabled)
- serviceEndpoint = "${aai_uri}/" + UriUtils.encode(globalCustomerId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + UriUtils.encode(serviceInstanceId,"UTF-8") + "/allotted-resources/allotted-resource/" + UriUtils.encode(allottedResourceId,"UTF-8")
- }else{
- utils.log("DEBUG", "Incoming Allotted-Resource Url is: " + siResourceLink, isDebugEnabled)
- String[] split = siResourceLink.split("/aai/")
- serviceEndpoint = "/aai/" + split[1]
- }
- }else if(type.equalsIgnoreCase("service-subscription")){
- String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution)
- String globalCustomerId = execution.getVariable("GENGS_globalCustomerId")
- String serviceType = execution.getVariable("GENGS_serviceType")
- serviceEndpoint = "${aai_uri}/" + UriUtils.encode(globalCustomerId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8")
- }
-
- String serviceUrl = "${aai_endpoint}" + serviceEndpoint
-
- execution.setVariable("GENGS_getServiceUrl", serviceUrl)
- utils.log("DEBUG", "GET Service AAI Path is: \n" + serviceUrl, isDebugEnabled)
-
- APIResponse response = aaiUriUtil.executeAAIGetCall(execution, serviceUrl)
- int responseCode = response.getStatusCode()
- execution.setVariable("GENGS_getServiceResponseCode", responseCode)
- utils.log("DEBUG", " GET Service response code is: " + responseCode, isDebugEnabled)
- utils.logAudit("GenericGetService AAI Response Code: " + responseCode)
-
- String aaiResponse = response.getResponseBodyAsString()
- aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse)
- execution.setVariable("GENGS_getServiceResponse", aaiResponse)
- utils.logAudit("GenericGetService AAI Response: " + aaiResponse)
- //Process Response
- if(responseCode == 200 || responseCode == 202){
- utils.log("DEBUG", "GET Service Received a Good Response Code", isDebugEnabled)
- if(utils.nodeExists(aaiResponse, "service-instance") || utils.nodeExists(aaiResponse, "service-subscription")){
- utils.log("DEBUG", "GET Service Response Contains a service-instance" , isDebugEnabled)
- execution.setVariable("GENGS_FoundIndicator", true)
- execution.setVariable("GENGS_service", aaiResponse)
- execution.setVariable("WorkflowResponse", aaiResponse)
-
- }else{
- utils.log("DEBUG", "GET Service Response Does NOT Contain Data" , isDebugEnabled)
- }
- }else if(responseCode == 404){
- utils.log("DEBUG", "GET Service Received a Not Found (404) Response", isDebugEnabled)
- execution.setVariable("WorkflowResponse", " ") //for junits
- }
- else{
- utils.log("DEBUG", " GET Service Received a Bad Response: \n" + aaiResponse, isDebugEnabled)
- exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode)
- throw new BpmnError("MSOWorkflowException")
- }
- }catch(BpmnError b){
- utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled)
- throw b
- }catch(Exception e){
- utils.log("DEBUG", " Error encountered within GenericGetService GetServiceObject method!" + e, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During GenericGetService")
- }
- utils.log("DEBUG", " *** COMPLETED GenericGetService GetServiceObject Process*** ", isDebugEnabled)
- }
-
+/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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.common.scripts + +import static org.apache.commons.lang3.StringUtils.* + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.rest.APIResponse +import org.springframework.web.util.UriUtils +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + + +/** + * This class supports the GenericGetService Sub Flow. + * This Generic sub flow can be used by any flow for accomplishing + * the goal of getting a Service-Instance or Service-Subscription (from AAI). + * The calling flow must set the GENGS_type variable as "service-instance" + * or "service-subscription". + * + * When using to Get a Service-Instance: + * If the global-customer-id and service-type are not provided + * this flow executes a query to get the service- Url using the + * Service Id or Name (whichever is provided). + * + * When using to Get a Service-Subscription: + * The global-customer-id and service-type must be + * provided. + * + * Upon successful completion of this sub flow the + * GENGS_SuccessIndicator will be true and the query response payload + * will be set to GENGS_service. An MSOWorkflowException will + * be thrown upon unsuccessful completion or if an error occurs + * at any time during this sub flow. Please map variables + * to the corresponding variable names below. + * + * Note - If this sub flow receives a Not Found (404) response + * from AAI at any time this will be considered an acceptable + * successful response however the GENGS_FoundIndicator + * will be set to false. This variable will allow the calling flow + * to distinguish between the two Success scenarios, + * "Success where service- is found" and + * "Success where service- is NOT found". + * + * + * Variable Mapping Below: + * + * In Mapping Variables: + * For Allotted-Resource: + * @param - GENGS_allottedResourceId + * @param - GENGS_type + * @param (Optional) - GENGS_serviceInstanceId + * @param (Optional) - GENGS_serviceType + * @param (Optional) - GENGS_globalCustomerId + * + * For Service-Instance: + * @param - GENGS_serviceInstanceId or @param - GENGS_serviceInstanceName + * @param - GENGS_type + * @param (Optional) - GENGS_serviceType + * @param (Optional) - GENGS_globalCustomerId + * + * For Service-Subscription: + * @param - GENGS_type + * @param - GENGS_serviceType + * @param - GENGS_globalCustomerId + * + * + * Out Mapping Variables: + * @param - GENGS_service + * @param - GENGS_FoundIndicator + * @param - WorkflowException + */ +class CustomE2EGetService extends AbstractServiceTaskProcessor{ + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CustomE2EGetService.class); + + String Prefix = "GENGS_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + + /** + * This method validates the incoming variables and + * determines the subsequent event based on which + * variables the calling flow provided. + * + * @param - execution + * + */ + public void preProcessRequest(DelegateExecution execution) { + execution.setVariable("prefix",Prefix) + msoLogger.trace("STARTED GenericGetService PreProcessRequest Process") + + execution.setVariable("GENGS_obtainObjectsUrl", false) + execution.setVariable("GENGS_obtainServiceInstanceUrlByName", false) + execution.setVariable("GENGS_SuccessIndicator", false) + execution.setVariable("GENGS_FoundIndicator", false) + execution.setVariable("GENGS_resourceLink", null) + execution.setVariable("GENGS_siResourceLink", null) + + try{ + // Get Variables + String allottedResourceId = execution.getVariable("GENGS_allottedResourceId") + String serviceInstanceId = execution.getVariable("GENGS_serviceInstanceId") + String serviceInstanceName = execution.getVariable("GENGS_serviceInstanceName") + String serviceType = execution.getVariable("GENGS_serviceType") + String globalCustomerId = execution.getVariable("GENGS_globalCustomerId") + String type = execution.getVariable("GENGS_type") + + if(type != null){ + msoLogger.debug("Incoming GENGS_type is: " + type) + if(type.equalsIgnoreCase("allotted-resource")){ + if(isBlank(allottedResourceId)){ + msoLogger.debug("Incoming allottedResourceId is null. Allotted Resource Id is required to Get an allotted-resource.") + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming allottedResourceId is null. Allotted Resource Id is required to Get an allotted-resource.") + }else{ + msoLogger.debug("Incoming Allotted Resource Id is: " + allottedResourceId) + if(isBlank(globalCustomerId) || isBlank(serviceType) || isBlank(serviceInstanceId)){ + execution.setVariable("GENGS_obtainObjectsUrl", true) + }else{ + msoLogger.debug("Incoming Service Instance Id is: " + serviceInstanceId) + msoLogger.debug("Incoming Service Type is: " + serviceType) + msoLogger.debug("Incoming Global Customer Id is: " + globalCustomerId) + } + } + }else if(type.equalsIgnoreCase("service-instance")){ + if(isBlank(serviceInstanceId) && isBlank(serviceInstanceName)){ + msoLogger.debug("Incoming serviceInstanceId and serviceInstanceName are null. ServiceInstanceId or ServiceInstanceName is required to Get a service-instance.") + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming serviceInstanceId and serviceInstanceName are null. ServiceInstanceId or ServiceInstanceName is required to Get a service-instance.") + }else{ + msoLogger.debug("Incoming Service Instance Id is: " + serviceInstanceId) + msoLogger.debug("Incoming Service Instance Name is: " + serviceInstanceName) + if(isBlank(globalCustomerId) || isBlank(serviceType)){ + execution.setVariable("GENGS_obtainObjectsUrl", true) + if(isBlank(serviceInstanceId)){ + execution.setVariable("GENGS_obtainServiceInstanceUrlByName", true) + } + }else{ + msoLogger.debug("Incoming Global Customer Id is: " + globalCustomerId) + msoLogger.debug("Incoming Service Type is: " + serviceType) + } + } + }else if(type.equalsIgnoreCase("service-subscription")){ + if(isBlank(serviceType) || isBlank(globalCustomerId)){ + msoLogger.debug("Incoming ServiceType or GlobalCustomerId is null. These variables are required to Get a service-subscription.") + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming ServiceType or GlobalCustomerId is null. These variables are required to Get a service-subscription.") + }else{ + msoLogger.debug("Incoming Service Type is: " + serviceType) + msoLogger.debug("Incoming Global Customer Id is: " + globalCustomerId) + } + }else{ + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Type is Invalid. Please Specify Type as service-instance or service-subscription") + } + }else{ + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Incoming GENGS_type is null. Variable is Required.") + } + + }catch(BpmnError b){ + msoLogger.debug("Rethrowing MSOWorkflowException") + throw b + }catch(Exception e){ + msoLogger.debug("Internal Error encountered within GenericGetService PreProcessRequest method!" + e) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in GenericGetService PreProcessRequest") + + } + msoLogger.trace("COMPLETED GenericGetService PreProcessRequest Process ") + } + + /** + * This method obtains the Url to the provided service instance + * using the Service Instance Id. + * + * @param - execution + */ + public void obtainServiceInstanceUrlById(DelegateExecution execution){ + execution.setVariable("prefix",Prefix) + msoLogger.trace("STARTED GenericGetService ObtainServiceInstanceUrlById Process") + try { + AaiUtil aaiUriUtil = new AaiUtil(this) + String aai_uri = aaiUriUtil.getSearchNodesQueryEndpoint(execution) + String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + + String type = execution.getVariable("GENGS_type") + String path = "" + if(type.equalsIgnoreCase("service-instance")){ + String serviceInstanceId = execution.getVariable("GENGS_serviceInstanceId") + msoLogger.debug(" Querying Node for Service-Instance URL by using Service-Instance Id: " + serviceInstanceId) + path = "${aai_uri}?search-node-type=service-instance&filter=service-instance-id:EQUALS:${serviceInstanceId}" + msoLogger.debug("Service Instance Node Query Url is: " + path) + msoLogger.debug("Service Instance Node Query Url is: " + path) + }else if(type.equalsIgnoreCase("allotted-resource")){ + String allottedResourceId = execution.getVariable("GENGS_allottedResourceId") + msoLogger.debug(" Querying Node for Service-Instance URL by using Allotted Resource Id: " + allottedResourceId) + path = "${aai_uri}?search-node-type=allotted-resource&filter=id:EQUALS:${allottedResourceId}" + msoLogger.debug("Allotted Resource Node Query Url is: " + path) + msoLogger.debug("Allotted Resource Node Query Url is: " + path) + } + + //String url = "${aai_endpoint}${path}" host name needs to be removed from property + String url = "${path}" + execution.setVariable("GENGS_genericQueryPath", url) + + APIResponse response = aaiUriUtil.executeAAIGetCall(execution, url) + int responseCode = response.getStatusCode() + execution.setVariable("GENGS_genericQueryResponseCode", responseCode) + msoLogger.debug(" GET Service Instance response code is: " + responseCode) + msoLogger.debug("GenericGetService AAI GET Response Code: " + responseCode) + + String aaiResponse = response.getResponseBodyAsString() + execution.setVariable("GENGS_obtainSIUrlResponseBeforeUnescaping", aaiResponse) + msoLogger.debug("GenericGetService AAI Response before unescaping: " + aaiResponse) + execution.setVariable("GENGS_genericQueryResponse", aaiResponse) + msoLogger.debug("GenericGetService AAI Response: " + aaiResponse) + msoLogger.debug("GenericGetService AAI Response: " + aaiResponse) + + //Process Response + if(responseCode == 200){ + msoLogger.debug("Generic Query Received a Good Response Code") + execution.setVariable("GENGS_SuccessIndicator", true) + if(utils.nodeExists(aaiResponse, "result-data")){ + msoLogger.debug("Generic Query Response Does Contain Data" ) + execution.setVariable("GENGS_FoundIndicator", true) + String resourceLink = utils.getNodeText(aaiResponse, "resource-link") + execution.setVariable("GENGS_resourceLink", resourceLink) + execution.setVariable("GENGS_siResourceLink", resourceLink) + }else{ + msoLogger.debug("Generic Query Response Does NOT Contains Data" ) + execution.setVariable("WorkflowResponse", " ") //for junits + } + }else if(responseCode == 404){ + msoLogger.debug("Generic Query Received a Not Found (404) Response") + execution.setVariable("GENGS_SuccessIndicator", true) + execution.setVariable("WorkflowResponse", " ") //for junits + }else{ + msoLogger.debug("Generic Query Received a BAD REST Response: \n" + aaiResponse) + exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) + throw new BpmnError("MSOWorkflowException") + } + }catch(BpmnError b){ + msoLogger.debug("Rethrowing MSOWorkflowException") + throw b + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Error encountered within GenericGetService ObtainServiceInstanceUrlById method!" + e, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During ObtainServiceInstanceUrlById") + } + msoLogger.trace("COMPLETED GenericGetService ObtainServiceInstanceUrlById Process") + } + + /** + * This method obtains the Url to the provided service instance + * using the Service Instance Name. + * + * @param - execution + */ + public void obtainServiceInstanceUrlByName(DelegateExecution execution){ + execution.setVariable("prefix",Prefix) + msoLogger.trace("STARTED GenericGetService ObtainServiceInstanceUrlByName Process") + try { + String serviceInstanceName = execution.getVariable("GENGS_serviceInstanceName") + msoLogger.debug(" Querying Node for Service-Instance URL by using Service-Instance Name " + serviceInstanceName) + + AaiUtil aaiUriUtil = new AaiUtil(this) + String aai_uri = aaiUriUtil.getSearchNodesQueryEndpoint(execution) + String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + String path = "${aai_uri}?search-node-type=service-instance&filter=service-instance-name:EQUALS:${serviceInstanceName}" + + //String url = "${aai_endpoint}${path}" host name needs to be removed from property + String url = "${path}" + execution.setVariable("GENGS_obtainSIUrlPath", url) + + msoLogger.debug("GenericGetService AAI Endpoint: " + aai_endpoint) + APIResponse response = aaiUriUtil.executeAAIGetCall(execution, url) + int responseCode = response.getStatusCode() + execution.setVariable("GENGS_obtainSIUrlResponseCode", responseCode) + msoLogger.debug(" GET Service Instance response code is: " + responseCode) + msoLogger.debug("GenericGetService AAI Response Code: " + responseCode) + + String aaiResponse = response.getResponseBodyAsString() + execution.setVariable("GENGS_obtainSIUrlResponse", aaiResponse) + msoLogger.debug("GenericGetService AAI Response: " + aaiResponse) + //Process Response + if(responseCode == 200){ + msoLogger.debug(" Query for Service Instance Url Received a Good Response Code") + execution.setVariable("GENGS_SuccessIndicator", true) + if(utils.nodeExists(aaiResponse, "result-data")){ + msoLogger.debug("Query for Service Instance Url Response Does Contain Data" ) + execution.setVariable("GENGS_FoundIndicator", true) + String resourceLink = utils.getNodeText(aaiResponse, "resource-link") + execution.setVariable("GENGS_resourceLink", resourceLink) + execution.setVariable("GENGS_siResourceLink", resourceLink) + }else{ + msoLogger.debug("Query for Service Instance Url Response Does NOT Contains Data" ) + execution.setVariable("WorkflowResponse", " ") //for junits + } + }else if(responseCode == 404){ + msoLogger.debug(" Query for Service Instance Received a Not Found (404) Response") + execution.setVariable("GENGS_SuccessIndicator", true) + execution.setVariable("WorkflowResponse", " ") //for junits + }else{ + msoLogger.debug("Query for Service Instance Received a BAD REST Response: \n" + aaiResponse) + exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) + throw new BpmnError("MSOWorkflowException") + } + }catch(BpmnError b){ + msoLogger.debug("Rethrowing MSOWorkflowException") + throw b + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Error encountered within GenericGetService ObtainServiceInstanceUrlByName method!" + e, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During ObtainServiceInstanceUrlByName") + } + msoLogger.trace("COMPLETED GenericGetService ObtainServiceInstanceUrlByName Process") + } + + + /** + * This method executes a GET call to AAI to obtain the + * service-instance or service-subscription + * + * @param - execution + */ + public void getServiceObject(DelegateExecution execution){ + execution.setVariable("prefix",Prefix) + msoLogger.trace("STARTED GenericGetService GetServiceObject Process") + try { + String type = execution.getVariable("GENGS_type") + AaiUtil aaiUriUtil = new AaiUtil(this) + String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + String serviceEndpoint = "" + + msoLogger.debug("GenericGetService getServiceObject AAI Endpoint: " + aai_endpoint) + if(type.equalsIgnoreCase("service-instance")){ + String siResourceLink = execution.getVariable("GENGS_resourceLink") + if(isBlank(siResourceLink)){ + String serviceInstanceId = execution.getVariable("GENGS_serviceInstanceId") + msoLogger.debug(" Incoming GENGS_serviceInstanceId is: " + serviceInstanceId) + String serviceType = execution.getVariable("GENGS_serviceType") + msoLogger.debug(" Incoming GENGS_serviceType is: " + serviceType) + String globalCustomerId = execution.getVariable("GENGS_globalCustomerId") + msoLogger.debug("Incoming Global Customer Id is: " + globalCustomerId) + + String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) + msoLogger.debug('AAI URI is: ' + aai_uri) + serviceEndpoint = "${aai_uri}/" + UriUtils.encode(globalCustomerId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + UriUtils.encode(serviceInstanceId,"UTF-8") + }else{ + msoLogger.debug("Incoming Service Instance Url is: " + siResourceLink) + String[] split = siResourceLink.split("/aai/") + serviceEndpoint = "/aai/" + split[1] + } + }else if(type.equalsIgnoreCase("allotted-resource")){ + String siResourceLink = execution.getVariable("GENGS_resourceLink") + if(isBlank(siResourceLink)){ + String allottedResourceId = execution.getVariable("GENGS_allottedResourceId") + msoLogger.debug(" Incoming GENGS_allottedResourceId is: " + allottedResourceId) + String serviceInstanceId = execution.getVariable("GENGS_serviceInstanceId") + msoLogger.debug(" Incoming GENGS_serviceInstanceId is: " + serviceInstanceId) + String serviceType = execution.getVariable("GENGS_serviceType") + msoLogger.debug(" Incoming GENGS_serviceType is: " + serviceType) + String globalCustomerId = execution.getVariable("GENGS_globalCustomerId") + msoLogger.debug("Incoming Global Customer Id is: " + globalCustomerId) + + String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) + msoLogger.debug('AAI URI is: ' + aai_uri) + serviceEndpoint = "${aai_uri}/" + UriUtils.encode(globalCustomerId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + UriUtils.encode(serviceInstanceId,"UTF-8") + "/allotted-resources/allotted-resource/" + UriUtils.encode(allottedResourceId,"UTF-8") + }else{ + msoLogger.debug("Incoming Allotted-Resource Url is: " + siResourceLink) + String[] split = siResourceLink.split("/aai/") + serviceEndpoint = "/aai/" + split[1] + } + }else if(type.equalsIgnoreCase("service-subscription")){ + String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) + String globalCustomerId = execution.getVariable("GENGS_globalCustomerId") + String serviceType = execution.getVariable("GENGS_serviceType") + serviceEndpoint = "${aai_uri}/" + UriUtils.encode(globalCustomerId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + } + + String serviceUrl = "${aai_endpoint}" + serviceEndpoint + + execution.setVariable("GENGS_getServiceUrl", serviceUrl) + msoLogger.debug("GET Service AAI Path is: \n" + serviceUrl) + + APIResponse response = aaiUriUtil.executeAAIGetCall(execution, serviceUrl) + int responseCode = response.getStatusCode() + execution.setVariable("GENGS_getServiceResponseCode", responseCode) + msoLogger.debug(" GET Service response code is: " + responseCode) + msoLogger.debug("GenericGetService AAI Response Code: " + responseCode) + + String aaiResponse = response.getResponseBodyAsString() + execution.setVariable("GENGS_getServiceResponse", aaiResponse) + msoLogger.debug("GenericGetService AAI Response: " + aaiResponse) + //Process Response + if(responseCode == 200 || responseCode == 202){ + msoLogger.debug("GET Service Received a Good Response Code") + if(utils.nodeExists(aaiResponse, "service-instance") || utils.nodeExists(aaiResponse, "service-subscription")){ + msoLogger.debug("GET Service Response Contains a service-instance" ) + execution.setVariable("GENGS_FoundIndicator", true) + execution.setVariable("GENGS_service", aaiResponse) + execution.setVariable("WorkflowResponse", aaiResponse) + + }else{ + msoLogger.debug("GET Service Response Does NOT Contain Data" ) + } + }else if(responseCode == 404){ + msoLogger.debug("GET Service Received a Not Found (404) Response") + execution.setVariable("WorkflowResponse", " ") //for junits + } + else{ + msoLogger.debug(" GET Service Received a Bad Response: \n" + aaiResponse) + exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) + throw new BpmnError("MSOWorkflowException") + } + }catch(BpmnError b){ + msoLogger.debug("Rethrowing MSOWorkflowException") + throw b + }catch(Exception e){ + msoLogger.debug(" Error encountered within GenericGetService GetServiceObject method!" + e) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During GenericGetService") + } + msoLogger.trace("COMPLETED GenericGetService GetServiceObject Process") + } + }
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CustomE2EPutService.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CustomE2EPutService.groovy index 2c42ef03b3..43d540cc74 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CustomE2EPutService.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CustomE2EPutService.groovy @@ -8,9 +8,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,7 +18,8 @@ * limitations under the License. * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.common.scripts + +package org.onap.so.bpmn.common.scripts import static org.apache.commons.lang3.StringUtils.*; @@ -27,14 +28,17 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; import org.apache.commons.codec.binary.Base64 import org.apache.commons.lang3.* -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.rest.APIResponse; -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.rest.APIResponse; +import org.onap.so.rest.RESTClient +import org.onap.so.rest.RESTConfig import java.net.URLEncoder; import org.springframework.web.util.UriUtils +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger /** * This class supports the GenericPutService Sub Flow. @@ -73,22 +77,22 @@ import org.springframework.web.util.UriUtils class CustomE2EPutService extends AbstractServiceTaskProcessor{ + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CustomE2EPutService.class); String Prefix = "GENPS_" ExceptionUtil exceptionUtil = new ExceptionUtil() public void preProcessRequest(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) - utils.log("DEBUG", " *** STARTED GenericPutService PreProcessRequest Process*** ", isDebugEnabled) + msoLogger.trace("STARTED GenericPutService PreProcessRequest Process") execution.setVariable("GENPS_SuccessIndicator", false) try{ // Get Variables String requestId = execution.getVariable("GENPS_requestId") - utils.log("DEBUG", "Incoming GENPS_requestId is: " + requestId, isDebugEnabled) + msoLogger.debug("Incoming GENPS_requestId is: " + requestId) String globalSubscriberId = execution.getVariable("GENPS_globalSubscriberId") String serviceInstanceId = execution.getVariable("GENPS_serviceInstanceId") @@ -98,53 +102,53 @@ class CustomE2EPutService extends AbstractServiceTaskProcessor{ String type = execution.getVariable("GENPS_type") if(type != null){ - utils.log("DEBUG", "Incoming GENPS_type is: " + type, isDebugEnabled) + msoLogger.debug("Incoming GENPS_type is: " + type) if(type.equalsIgnoreCase("service-instance")){ if(isBlank(globalSubscriberId) || isBlank(serviceType) || isBlank(serviceInstanceId)){ - utils.log("DEBUG", "Incoming Required Variable is missing or null!", isDebugEnabled) + msoLogger.debug("Incoming Required Variable is missing or null!") exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Required Variable is Missing or Null!") }else{ - utils.log("DEBUG", "Incoming Global Subscriber Id is: " + globalSubscriberId, isDebugEnabled) - utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled) - utils.log("DEBUG", "Incoming Service Type is: " + serviceType, isDebugEnabled) + msoLogger.debug("Incoming Global Subscriber Id is: " + globalSubscriberId) + msoLogger.debug("Incoming Service Instance Id is: " + serviceInstanceId) + msoLogger.debug("Incoming Service Type is: " + serviceType) } }else if(type.equalsIgnoreCase("service-subscription")){ if(isBlank(serviceType) || isBlank(globalSubscriberId)){ - utils.log("DEBUG", "Incoming ServiceType or GlobalSubscriberId is null. These variables are required to create a service-subscription.", isDebugEnabled) + msoLogger.debug("Incoming ServiceType or GlobalSubscriberId is null. These variables are required to create a service-subscription.") exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming ServiceType or GlobalCustomerId is null. These variables are required to Get a service-subscription.") }else{ - utils.log("DEBUG", "Incoming Service Type is: " + serviceType, isDebugEnabled) - utils.log("DEBUG", "Incoming Global Subscriber Id is: " + globalSubscriberId, isDebugEnabled) + msoLogger.debug("Incoming Service Type is: " + serviceType) + msoLogger.debug("Incoming Global Subscriber Id is: " + globalSubscriberId) } }else if(type.equalsIgnoreCase("allotted-resource")){ if(isBlank(globalSubscriberId) || isBlank(serviceType) || isBlank(serviceInstanceId) || isBlank(allottedResourceId)){ - utils.log("DEBUG", "Incoming Global Subscriber Id is: " + globalSubscriberId, isDebugEnabled) - utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled) - utils.log("DEBUG", "Incoming Service Type is: " + serviceType, isDebugEnabled) - utils.log("DEBUG", "Incoming Allotted Resource Id is: " + allottedResourceId, isDebugEnabled) - utils.log("DEBUG", "Incoming Required Variable is missing or null!", isDebugEnabled) + msoLogger.debug("Incoming Global Subscriber Id is: " + globalSubscriberId) + msoLogger.debug("Incoming Service Instance Id is: " + serviceInstanceId) + msoLogger.debug("Incoming Service Type is: " + serviceType) + msoLogger.debug("Incoming Allotted Resource Id is: " + allottedResourceId) + msoLogger.debug("Incoming Required Variable is missing or null!") exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Required Variable is Missing or Null!") }else{ - utils.log("DEBUG", "Incoming Global Subscriber Id is: " + globalSubscriberId, isDebugEnabled) - utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled) - utils.log("DEBUG", "Incoming Service Type is: " + serviceType, isDebugEnabled) - utils.log("DEBUG", "Incoming Allotted Resource Id is: " + allottedResourceId, isDebugEnabled) + msoLogger.debug("Incoming Global Subscriber Id is: " + globalSubscriberId) + msoLogger.debug("Incoming Service Instance Id is: " + serviceInstanceId) + msoLogger.debug("Incoming Service Type is: " + serviceType) + msoLogger.debug("Incoming Allotted Resource Id is: " + allottedResourceId) } }else if(type.equalsIgnoreCase("tunnel-xconnect")){ if(isBlank(globalSubscriberId) || isBlank(serviceType) || isBlank(serviceInstanceId) || isBlank(allottedResourceId) || isBlank(tunnelXconnectId)){ - utils.log("DEBUG", "Incoming Global Subscriber Id is: " + globalSubscriberId, isDebugEnabled) - utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled) - utils.log("DEBUG", "Incoming Service Type is: " + serviceType, isDebugEnabled) - utils.log("DEBUG", "Incoming Allotted Resource Id is: " + allottedResourceId, isDebugEnabled) - utils.log("DEBUG", "Incoming Tunnel Xconnect Id is: " + tunnelXconnectId, isDebugEnabled) - utils.log("DEBUG", "Incoming Required Variable is missing or null!", isDebugEnabled) + msoLogger.debug("Incoming Global Subscriber Id is: " + globalSubscriberId) + msoLogger.debug("Incoming Service Instance Id is: " + serviceInstanceId) + msoLogger.debug("Incoming Service Type is: " + serviceType) + msoLogger.debug("Incoming Allotted Resource Id is: " + allottedResourceId) + msoLogger.debug("Incoming Tunnel Xconnect Id is: " + tunnelXconnectId) + msoLogger.debug("Incoming Required Variable is missing or null!") exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Required Variable is Missing or Null!") }else{ - utils.log("DEBUG", "Incoming Global Subscriber Id is: " + globalSubscriberId, isDebugEnabled) - utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled) - utils.log("DEBUG", "Incoming Service Type is: " + serviceType, isDebugEnabled) - utils.log("DEBUG", "Incoming Allotted Resource Id is: " + allottedResourceId, isDebugEnabled) - utils.log("DEBUG", "Incoming Tunnel Xconnect Id is: " + tunnelXconnectId, isDebugEnabled) + msoLogger.debug("Incoming Global Subscriber Id is: " + globalSubscriberId) + msoLogger.debug("Incoming Service Instance Id is: " + serviceInstanceId) + msoLogger.debug("Incoming Service Type is: " + serviceType) + msoLogger.debug("Incoming Allotted Resource Id is: " + allottedResourceId) + msoLogger.debug("Incoming Tunnel Xconnect Id is: " + tunnelXconnectId) } }else{ exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Type is Invalid. Please Specify Type as service-instance or service-subscription") @@ -154,14 +158,14 @@ class CustomE2EPutService extends AbstractServiceTaskProcessor{ } }catch(BpmnError b){ - utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled) + msoLogger.debug("Rethrowing MSOWorkflowException") throw b }catch(Exception e){ - utils.log("ERROR", " Error encountered within GenericPutService PreProcessRequest method!" + e, isDebugEnabled) + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Error encountered within GenericPutService PreProcessRequest method!" + e, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in GenericPutService PreProcessRequest") } - utils.log("DEBUG", "*** COMPLETED GenericPutService PreProcessRequest Process ***", isDebugEnabled) + msoLogger.trace("COMPLETED GenericPutService PreProcessRequest Process ") } @@ -175,35 +179,34 @@ class CustomE2EPutService extends AbstractServiceTaskProcessor{ * */ public void putServiceInstance(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) - utils.log("DEBUG", " *** STARTED GenericPutService PutServiceInstance method*** ", isDebugEnabled) + msoLogger.trace("STARTED GenericPutService PutServiceInstance method") try { String type = execution.getVariable("GENPS_type") AaiUtil aaiUriUtil = new AaiUtil(this) String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) - logDebug('AAI URI is: ' + aai_uri, isDebugEnabled) + msoLogger.debug('AAI URI is: ' + aai_uri) String namespace = aaiUriUtil.getNamespaceFromUri(execution, aai_uri) - logDebug('AAI namespace is: ' + namespace, isDebugEnabled) + msoLogger.debug('AAI namespace is: ' + namespace) - String aai_endpoint = execution.getVariable("URN_aai_endpoint") + String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) String serviceAaiPath = "" String payload = execution.getVariable("GENPS_payload") execution.setVariable("GENPS_payload", payload) - utils.log("DEBUG", "Incoming GENPS_payload is: " + payload, isDebugEnabled) - utils.logAudit(payload) + msoLogger.debug("Incoming GENPS_payload is: " + payload) + msoLogger.debug(payload) String serviceType = execution.getVariable("GENPS_serviceType") - utils.log("DEBUG", " Incoming GENPS_serviceType is: " + serviceType, isDebugEnabled) + msoLogger.debug(" Incoming GENPS_serviceType is: " + serviceType) String globalSubscriberId = execution.getVariable("GENPS_globalSubscriberId") - utils.log("DEBUG", "Incoming Global Subscriber Id is: " + globalSubscriberId, isDebugEnabled) + msoLogger.debug("Incoming Global Subscriber Id is: " + globalSubscriberId) // This IF clause is if we need to create a new Service Instance if(type.equalsIgnoreCase("service-instance")){ String serviceInstanceId = execution.getVariable("GENPS_serviceInstanceId") - utils.log("DEBUG", " Incoming GENPS_serviceInstanceId is: " + serviceInstanceId, isDebugEnabled) + msoLogger.debug(" Incoming GENPS_serviceInstanceId is: " + serviceInstanceId) // serviceAaiPath = "${aai_endpoint}${aai_uri}/" + URLEncoder.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + URLEncoder.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + URLEncoder.encode(serviceInstanceId,"UTF-8") serviceAaiPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + UriUtils.encode(serviceInstanceId,"UTF-8") @@ -215,41 +218,40 @@ class CustomE2EPutService extends AbstractServiceTaskProcessor{ }else if(type.equalsIgnoreCase("allotted-resource")){ String serviceInstanceId = execution.getVariable("GENPS_serviceInstanceId") - utils.log("DEBUG", " Incoming GENPS_serviceInstanceId is: " + serviceInstanceId, isDebugEnabled) + msoLogger.debug(" Incoming GENPS_serviceInstanceId is: " + serviceInstanceId) String allottedResourceId = execution.getVariable("GENPS_allottedResourceId") - utils.log("DEBUG", " Incoming GENPS_allottedResourceId is: " + allottedResourceId, isDebugEnabled) + msoLogger.debug(" Incoming GENPS_allottedResourceId is: " + allottedResourceId) // serviceAaiPath = "${aai_endpoint}${aai_uri}/" + URLEncoder.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + URLEncoder.encode(serviceType,"UTF-8") serviceAaiPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + UriUtils.encode(serviceInstanceId,"UTF-8") + "/allotted-resources/allotted-resource/" + UriUtils.encode(allottedResourceId,"UTF-8") }else if(type.equalsIgnoreCase("tunnel-xconnect")){ String serviceInstanceId = execution.getVariable("GENPS_serviceInstanceId") - utils.log("DEBUG", " Incoming GENPS_serviceInstanceId is: " + serviceInstanceId, isDebugEnabled) + msoLogger.debug(" Incoming GENPS_serviceInstanceId is: " + serviceInstanceId) String allottedResourceId = execution.getVariable("GENPS_allottedResourceId") - utils.log("DEBUG", " Incoming GENPS_allottedResourceId is: " + allottedResourceId, isDebugEnabled) + msoLogger.debug(" Incoming GENPS_allottedResourceId is: " + allottedResourceId) String tunnelXconnectId = execution.getVariable("GENPS_tunnelXconnectId") - utils.log("DEBUG", " Incoming GENPS_tunnelXconnectId is: " + tunnelXconnectId, isDebugEnabled) + msoLogger.debug(" Incoming GENPS_tunnelXconnectId is: " + tunnelXconnectId) // serviceAaiPath = "${aai_endpoint}${aai_uri}/" + URLEncoder.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + URLEncoder.encode(serviceType,"UTF-8") serviceAaiPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + UriUtils.encode(serviceInstanceId,"UTF-8") + "/allotted-resources/allotted-resource/" + UriUtils.encode(allottedResourceId,"UTF-8") + "/tunnel-xconnects/tunnel-xconnect/" + UriUtils.encode(tunnelXconnectId,"UTF-8") } String resourceVersion = execution.getVariable("GENPS_serviceResourceVersion") - utils.log("DEBUG", "Incoming Resource Version is: " + resourceVersion, isDebugEnabled) + msoLogger.debug("Incoming Resource Version is: " + resourceVersion) if(resourceVersion !=null){ serviceAaiPath = serviceAaiPath +'?resource-version=' + UriUtils.encode(resourceVersion,"UTF-8") } execution.setVariable("GENPS_putServiceInstanceAaiPath", serviceAaiPath) - utils.log("DEBUG", "PUT Service Instance AAI Path is: " + "\n" + serviceAaiPath, isDebugEnabled) + msoLogger.debug("PUT Service Instance AAI Path is: " + "\n" + serviceAaiPath) APIResponse response = aaiUriUtil.executeAAIPutCall(execution, serviceAaiPath, payload) int responseCode = response.getStatusCode() execution.setVariable("GENPS_putServiceInstanceResponseCode", responseCode) - utils.log("DEBUG", " Put Service Instance response code is: " + responseCode, isDebugEnabled) + msoLogger.debug(" Put Service Instance response code is: " + responseCode) String aaiResponse = response.getResponseBodyAsString() - aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse) execution.setVariable("GENPS_putServiceInstanceResponse", aaiResponse) @@ -257,23 +259,23 @@ class CustomE2EPutService extends AbstractServiceTaskProcessor{ if(responseCode == 200 || responseCode == 201 || responseCode == 202 ) //200 OK 201 CREATED 202 ACCEPTED { - utils.log("DEBUG", "PUT Service Instance Received a Good Response", isDebugEnabled) + msoLogger.debug("PUT Service Instance Received a Good Response") execution.setVariable("GENPS_SuccessIndicator", true) } else{ - utils.log("DEBUG", "Put Generic Service Instance Received a Bad Response Code. Response Code is: " + responseCode, isDebugEnabled) + msoLogger.debug("Put Generic Service Instance Received a Bad Response Code. Response Code is: " + responseCode) exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) throw new BpmnError("MSOWorkflowException") } }catch(BpmnError b){ - utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled) + msoLogger.debug("Rethrowing MSOWorkflowException") throw b }catch(Exception e){ - utils.log("ERROR", " Error encountered within GenericPutService PutServiceInstance method!" + e, isDebugEnabled) + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Error encountered within GenericPutService PutServiceInstance method!" + e, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During Put Service Instance") } - utils.log("DEBUG", " *** COMPLETED GenericPutService PutServiceInstance Process*** ", isDebugEnabled) + msoLogger.trace("COMPLETED GenericPutService PutServiceInstance Process") } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/DecomposeService.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DecomposeService.groovy index 7a81ce519e..739bc4b7ed 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/DecomposeService.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DecomposeService.groovy @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,26 +17,19 @@ * limitations under the License. * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.common.scripts -import org.openecomp.mso.bpmn.core.json.DecomposeJsonUtil; +package org.onap.so.bpmn.common.scripts import static org.apache.commons.lang3.StringUtils.*; - import org.apache.commons.lang3.* import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.json.JSONObject; -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.openecomp.mso.bpmn.common.scripts.CatalogDbUtils -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition -import org.openecomp.mso.bpmn.core.json.JsonUtils - -import com.att.ecomp.mso.bpmn.core.domain.* - -import groovy.json.* +import org.onap.so.bpmn.core.domain.ServiceDecomposition +import org.onap.so.bpmn.core.json.DecomposeJsonUtil; +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.logger.MsoLogger /** * This groovy class supports the <class>DecomposeService.bpmn</class> process. @@ -58,6 +51,8 @@ import groovy.json.* * */ public class DecomposeService extends AbstractServiceTaskProcessor { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DecomposeService.class); + String Prefix="DDS_" ExceptionUtil exceptionUtil = new ExceptionUtil() @@ -65,10 +60,9 @@ public class DecomposeService extends AbstractServiceTaskProcessor { JsonUtils jsonUtils = new JsonUtils() public void preProcessRequest (DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") String msg = "" - utils.log("DEBUG"," ***** preProcessRequest of DecomposeService *****", isDebugEnabled) - setBasicDBAuthHeader(execution, isDebugEnabled) + msoLogger.trace("preProcessRequest of DecomposeService ") + setBasicDBAuthHeader(execution, execution.getVariable('isDebugLogEnabled')) try { execution.setVariable("prefix", Prefix) @@ -89,16 +83,15 @@ public class DecomposeService extends AbstractServiceTaskProcessor { throw e; } catch (Exception ex){ msg = "Exception in preProcessRequest " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) + msoLogger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - utils.log("DEBUG"," ***** Exit preProcessRequest of DecomposeService *****", isDebugEnabled) + msoLogger.trace("Exit preProcessRequest of DecomposeService ") } public void queryCatalogDb (DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") String msg = "" - utils.log("DEBUG"," ***** queryCatalogDB of DecomposeService *****", isDebugEnabled) + msoLogger.trace("queryCatalogDB of DecomposeService ") try { @@ -107,8 +100,8 @@ public class DecomposeService extends AbstractServiceTaskProcessor { String serviceModelUuid = execution.getVariable("DDS_serviceModelUuid") String modelVersion = execution.getVariable("DDS_modelVersion") - utils.log("DEBUG", "serviceModelInvariantId: " + serviceModelInvariantId, isDebugEnabled) - utils.log("DEBUG", "modelVersion: " + modelVersion, isDebugEnabled) + msoLogger.debug("serviceModelInvariantId: " + serviceModelInvariantId) + msoLogger.debug("modelVersion: " + modelVersion) JSONObject catalogDbResponse = null if(serviceModelUuid != null && serviceModelUuid.length() > 0) @@ -120,31 +113,30 @@ public class DecomposeService extends AbstractServiceTaskProcessor { if (catalogDbResponse == null || catalogDbResponse.toString().equalsIgnoreCase("null")) { msg = "No data found in Catalog DB" - utils.log("DEBUG", msg, isDebugEnabled) + msoLogger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } String catalogDbResponseString = catalogDbResponse.toString() execution.setVariable("DDS_catalogDbResponse", catalogDbResponseString) - utils.log("DEBUG", "catalog DB response string: "+ catalogDbResponseString, isDebugEnabled) + msoLogger.debug("catalog DB response string: "+ catalogDbResponseString) } catch (BpmnError e) { throw e; } catch (Exception ex){ msg = "Exception in queryCatalogDb " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) + msoLogger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - utils.log("DEBUG"," ***** Exit queryCatalogDb of DecomposeService *****", isDebugEnabled) + msoLogger.trace("Exit queryCatalogDb of DecomposeService ") } public void actuallyDecomposeService (DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") String msg = "" - utils.log("DEBUG"," ***** actuallyDecomposeService of DecomposeService *****", isDebugEnabled) + msoLogger.trace("actuallyDecomposeService of DecomposeService ") try { @@ -153,9 +145,9 @@ public class DecomposeService extends AbstractServiceTaskProcessor { String serviceInstanceId = execution.getVariable("serviceInstanceId") String serviceModelInvariantId = execution.getVariable("DDS_serviceModelInvariantId") - utils.log("DEBUG", "serviceModelInvariantId: " + serviceModelInvariantId, isDebugEnabled) + msoLogger.debug("serviceModelInvariantId: " + serviceModelInvariantId) - utils.log("DEBUG", "getting service decomposition", isDebugEnabled) + msoLogger.debug("getting service decomposition") String catalogDbResponse = execution.getVariable("DDS_catalogDbResponse") ServiceDecomposition serviceDecomposition = DecomposeJsonUtil.jsonToServiceDecomposition(catalogDbResponse, serviceInstanceId) @@ -163,16 +155,16 @@ public class DecomposeService extends AbstractServiceTaskProcessor { execution.setVariable("serviceDecomposition", serviceDecomposition) execution.setVariable("serviceDecompositionString", serviceDecomposition.toJsonString()) - utils.log("DEBUG", "service decomposition: "+ serviceDecomposition.toJsonString(), isDebugEnabled) + msoLogger.debug("service decomposition: "+ serviceDecomposition.toJsonString()) } catch (BpmnError e) { throw e; } catch (Exception ex){ msg = "Exception in actuallyDecomposeService " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) + msoLogger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - utils.log("DEBUG"," ***** Exit actuallyDecomposeService of DecomposeService *****", isDebugEnabled) + msoLogger.trace("Exit actuallyDecomposeService of DecomposeService ") } } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/DeleteAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy index 54e3da54d2..bb9846c112 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/DeleteAAIVfModule.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy @@ -1,350 +1,335 @@ -/*-
- * ============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.common.scripts
-import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.openecomp.mso.bpmn.core.WorkflowException
-import org.openecomp.mso.rest.APIResponse
-import org.openecomp.mso.rest.RESTClient;
-import org.openecomp.mso.rest.RESTConfig;
-
-
-public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{
-
- def Prefix="DAAIVfMod_"
- ExceptionUtil exceptionUtil = new ExceptionUtil()
- private MsoUtils utils = new MsoUtils()
- public void initProcessVariables(DelegateExecution execution) {
- execution.setVariable("prefix",Prefix)
- execution.setVariable("DAAIVfMod_vnfId",null)
- execution.setVariable("DAAIVfMod_vnfName",null)
- execution.setVariable("DAAIVfMod_genVnfRsrcVer",null)
- execution.setVariable("DAAIVfMod_vfModuleId",null)
- execution.setVariable("DAAIVfMod_vfModRsrcVer",null)
- execution.setVariable("DAAIVfMod_genericVnfEndpoint",null)
- execution.setVariable("DAAIVfMod_vfModuleEndpoint",null)
- execution.setVariable("DAAIVfMod_moduleExists",false)
- execution.setVariable("DAAIVfMod_isBaseModule", false)
- execution.setVariable("DAAIVfMod_isLastModule", false)
-
- // DeleteAAIVfModule workflow response variable placeholders
- execution.setVariable("DAAIVfMod_queryGenericVnfResponseCode",null)
- execution.setVariable("DAAIVfMod_queryGenericVnfResponse","")
- execution.setVariable("DAAIVfMod_parseModuleResponse","")
- execution.setVariable("DAAIVfMod_deleteGenericVnfResponseCode",null)
- execution.setVariable("DAAIVfMod_deleteGenericVnfResponse","")
- execution.setVariable("DAAIVfMod_deleteVfModuleResponseCode",null)
- execution.setVariable("DAAIVfMod_deleteVfModuleResponse","")
-
- }
-
- // parse the incoming DELETE_VF_MODULE request and store the Generic Vnf
- // and Vf Module Ids in the flow DelegateExecution
- public void preProcessRequest(DelegateExecution execution) {
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- def xml = execution.getVariable("DeleteAAIVfModuleRequest")
- utils.logAudit("DeleteAAIVfModule Request: " + xml)
- utils.log("DEBUG", "input request xml:" + xml, isDebugEnabled)
- initProcessVariables(execution)
- def vnfId = utils.getNodeText(xml,"vnf-id")
- def vfModuleId = utils.getNodeText(xml,"vf-module-id")
- execution.setVariable("DAAIVfMod_vnfId", vnfId)
- execution.setVariable("DAAIVfMod_vfModuleId", vfModuleId)
-
- AaiUtil aaiUriUtil = new AaiUtil(this)
- def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution)
- logDebug('AAI URI is: ' + aai_uri, isDebugEnabled)
-
- execution.setVariable("DAAIVfMod_genericVnfEndpoint", "${aai_uri}/" + vnfId)
- execution.setVariable("DAAIVfMod_vfModuleEndpoint", "${aai_uri}/" + vnfId +
- "/vf-modules/vf-module/" + vfModuleId)
- }
-
- // send a GET request to AA&I to retrieve the Generic Vnf/Vf Module information based on a Vnf Id
- // expect a 200 response with the information in the response body or a 404 if the Generic Vnf does not exist
- public void queryAAIForGenericVnf(DelegateExecution execution) {
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- def delModuleId = execution.getVariable("DAAIVfMod_vfModuleId")
- def endPoint = execution.getVariable("URN_aai_endpoint") + execution.getVariable("DAAIVfMod_genericVnfEndpoint") + "?depth=1"
- utils.logAudit("DeleteAAIVfModule endPoint: " + endPoint)
- def aaiRequestId = utils.getRequestID()
-
- RESTConfig config = new RESTConfig(endPoint);
- utils.log("DEBUG","queryAAIForGenericVnf() endpoint-" + endPoint, isDebugEnabled)
- def responseData = ""
- try {
- RESTClient client = new RESTClient(config).addHeader("X-TransactionId", aaiRequestId).addHeader("X-FromAppId", "MSO").
- addHeader("Accept","application/xml");
- String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey"))
-
- if (basicAuthCred != null && !"".equals(basicAuthCred)) {
- client.addAuthorizationHeader(basicAuthCred)
- }
- utils.log("DEBUG", "invoking GET call to AAI endpoint :"+System.lineSeparator()+endPoint,isDebugEnabled)
- APIResponse response = client.httpGet()
- utils.logAudit("DeleteAAIVfModule - invoking httpGet to AAI")
-
- responseData = response.getResponseBodyAsString()
- execution.setVariable("DAAIVfMod_queryGenericVnfResponseCode", response.getStatusCode())
- execution.setVariable("DAAIVfMod_queryGenericVnfResponse", responseData)
- utils.logAudit("AAI Response: " + responseData)
- utils.log("DEBUG", "Response code:" + response.getStatusCode(), isDebugEnabled)
- utils.log("DEBUG", "Response:" + System.lineSeparator()+responseData,isDebugEnabled)
- } catch (Exception ex) {
- utils.log("DEBUG", "Exception occurred while executing AAI GET:" + ex.getMessage(),isDebugEnabled)
- execution.setVariable("DAAIVfMod_queryGenericVnfResponse", "AAI GET Failed:" + ex.getMessage())
- exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured during queryAAIForGenericVnf")
-
- }
- }
-
- // construct and send a DELETE request to A&AI to delete a Generic Vnf
- // note: to get here, all the modules associated with the Generic Vnf must already be deleted
- public void deleteGenericVnf(DelegateExecution execution) {
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- def aaiRequestId = utils.getRequestID()
- def endPoint = execution.getVariable("URN_aai_endpoint") + execution.getVariable("DAAIVfMod_genericVnfEndpoint") +
- "/?resource-version=" + execution.getVariable("DAAIVfMod_genVnfRsrcVer")
- utils.logAudit("AAI endPoint: " + endPoint)
- RESTConfig config = new RESTConfig(endPoint);
- utils.log("DEBUG","deleteGenericVnf() endpoint-" + endPoint, isDebugEnabled)
- def responseData = ""
- try {
- RESTClient client = new RESTClient(config).addHeader("X-TransactionId", aaiRequestId).addHeader("X-FromAppId", "MSO").
- addHeader("Accept","application/xml");
-
- String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey"))
-
- if (basicAuthCred != null && !"".equals(basicAuthCred)) {
- client.addAuthorizationHeader(basicAuthCred)
- }
- APIResponse response = client.httpDelete()
-
- responseData = response.getResponseBodyAsString()
- execution.setVariable("DAAIVfMod_deleteGenericVnfResponseCode", response.getStatusCode())
- execution.setVariable("DAAIVfMod_deleteGenericVnfResponse", responseData)
- utils.log("DEBUG", "Response code:" + response.getStatusCode(), isDebugEnabled)
- utils.log("DEBUG", "Response:" + System.lineSeparator()+responseData,isDebugEnabled)
- } catch (Exception ex) {
- ex.printStackTrace()
- utils.log("DEBUG", "Exception occurred while executing AAI DELETE:" + ex.getMessage(),isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured during deleteGenericVnf")
- }
- }
-
- // construct and send a DELETE request to A&AI to delete the Base or Add-on Vf Module
- public void deleteVfModule(DelegateExecution execution) {
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- def endPoint = execution.getVariable("URN_aai_endpoint") + execution.getVariable("DAAIVfMod_vfModuleEndpoint") +
- "/?resource-version=" + execution.getVariable("DAAIVfMod_vfModRsrcVer")
- def aaiRequestId = utils.getRequestID()
-
- RESTConfig config = new RESTConfig(endPoint);
- utils.log("DEBUG","deleteVfModule() endpoint-" + endPoint, isDebugEnabled)
- def responseData = ""
- try {
- RESTClient client = new RESTClient(config).addHeader("X-TransactionId", aaiRequestId).addHeader("X-FromAppId", "MSO").
- addHeader("Accept","application/xml");
-
- String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey"))
-
- if (basicAuthCred != null && !"".equals(basicAuthCred)) {
- client.addAuthorizationHeader(basicAuthCred)
- }
- APIResponse response = client.httpDelete()
-
- utils.logAudit("DeleteAAIVfModule - invoking httpDelete to AAI")
-
- responseData = response.getResponseBodyAsString()
- execution.setVariable("DAAIVfMod_deleteVfModuleResponseCode", response.getStatusCode())
- execution.setVariable("DAAIVfMod_deleteVfModuleResponse", responseData)
- utils.logAudit("DeleteAAIVfModule - AAI Response" + responseData)
- utils.log("DEBUG", "Response code:" + response.getStatusCode(), isDebugEnabled)
- utils.log("DEBUG", "Response:" + System.lineSeparator()+responseData,isDebugEnabled)
-
- } catch (Exception ex) {
- ex.printStackTrace()
- utils.log("DEBUG", "Exception occurred while executing AAI PUT:" + ex.getMessage(),isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured during deleteVfModule")
- }
- }
-
- // parses the output from the result from queryAAIForGenericVnf() to determine if the Vf Module
- // to be deleted exists for the specified Generic Vnf and if it is the Base Module,
- // there are no Add-on Modules present
- public void parseForVfModule(DelegateExecution execution) {
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- def xml = execution.getVariable("DAAIVfMod_queryGenericVnfResponse")
- utils.logAudit("DeleteAAIVfModule - queryGenericVnfResponse" + xml)
-
- def delModuleId = execution.getVariable("DAAIVfMod_vfModuleId")
- utils.log("DEBUG", "Vf Module to be deleted: " + delModuleId, isDebugEnabled)
- List <String> qryModuleIdList = utils.getMultNodes(xml, "vf-module-id")
- List <String> qryBaseModuleList = utils.getMultNodes(xml, "is-base-vf-module")
- List <String> qryResourceVerList = utils.getMultNodes(xml, "resource-version")
- execution.setVariable("DAAIVfMod_moduleExists", false)
- execution.setVariable("DAAIVfMod_isBaseModule", false)
- execution.setVariable("DAAIVfMod_isLastModule", false)
- //
- def isBaseVfModule = "false"
- // loop through the Vf Module Ids looking for a match
- if (qryModuleIdList != null && !qryModuleIdList.empty) {
- utils.log("DEBUG", "Existing Vf Module Id List: " + qryModuleIdList, isDebugEnabled)
- utils.log("DEBUG", "Existing Vf Module Resource Version List: " + qryResourceVerList, isDebugEnabled)
- def moduleCntr = 0
- // the Generic Vnf resource-version in the 1st entry in the query response
- execution.setVariable("DAAIVfMod_genVnfRsrcVer", qryResourceVerList[moduleCntr])
- for (String qryModuleId : qryModuleIdList) {
- if (delModuleId.equals(qryModuleId)) {
- // a Vf Module with the requested Id exists
- execution.setVariable("DAAIVfMod_moduleExists", true)
- // find the corresponding value for the is-base-vf-module field
- isBaseVfModule = qryBaseModuleList[moduleCntr]
- // find the corresponding value for the resource-version field
- // note: the Generic Vnf entry also has a resource-version field, so
- // add 1 to the index to get the corresponding Vf Module value
- execution.setVariable("DAAIVfMod_vfModRsrcVer", qryResourceVerList[moduleCntr+1])
- utils.log("DEBUG", "Match found for Vf Module Id " + qryModuleId + " for Generic Vnf Id " +
- execution.getVariable("DAAIVfMod_vnfId") + ", Base Module is " + isBaseVfModule +
- ", Resource Version is " + execution.getVariable("vfModRsrcVer"), isDebugEnabled)
- break
- }
- moduleCntr++
- }
- }
-
- // determine if the module to be deleted is a Base Module and/or the Last Module
- if (execution.getVariable("DAAIVfMod_moduleExists") == true) {
- if (isBaseVfModule.equals("true") && qryModuleIdList.size() != 1) {
- execution.setVariable("DAAIVfMod_parseModuleResponse",
- "Found Vf Module Id " + delModuleId + " for Generic Vnf Id " +
- execution.getVariable("DAAIVfMod_vnfId") + ": is Base Module, not Last Module")
- execution.setVariable("DAAIVfMod_isBaseModule", true)
- } else {
- if (isBaseVfModule.equals("true") && qryModuleIdList.size() == 1) {
- execution.setVariable("DAAIVfMod_parseModuleResponse",
- "Found Vf Module Id " + delModuleId + " for Generic Vnf Id " +
- execution.getVariable("DAAIVfMod_vnfId") + ": is Base Module and Last Module")
- execution.setVariable("DAAIVfMod_isBaseModule", true)
- execution.setVariable("DAAIVfMod_isLastModule", true)
- } else {
- if (qryModuleIdList.size() == 1) {
- execution.setVariable("DAAIVfMod_parseModuleResponse",
- "Found Vf Module Id " + delModuleId + " for Generic Vnf Id " +
- execution.getVariable("DAAIVfMod_vnfId") + ": is Not Base Module, is Last Module")
- execution.setVariable("DAAIVfMod_isLastModule", true)
- } else {
- execution.setVariable("DAAIVfMod_parseModuleResponse",
- "Found Vf Module Id " + delModuleId + " for Generic Vnf Id " +
- execution.getVariable("DAAIVfMod_vnfId") + ": is Not Base Module and Not Last Module")
- }
- }
- }
- utils.log("DEBUG", execution.getVariable("DAAIVfMod_parseModuleResponse"), isDebugEnabled)
- } else { // (execution.getVariable("DAAIVfMod_moduleExists") == false)
- utils.log("DEBUG", "Vf Module Id " + delModuleId + " does not exist for Generic Vnf Id " +
- execution.getVariable("DAAIVfMod_vnfId"), isDebugEnabled)
- execution.setVariable("DAAIVfMod_parseModuleResponse",
- "Vf Module Id " + delModuleId + " does not exist for Generic Vnf Id " +
- execution.getVariable("DAAIVfMod_vnfName"))
- }
- }
-
- // parses the output from the result from queryAAIForGenericVnf() to determine if the Vf Module
- // to be deleted exists for the specified Generic Vnf and if it is the Base Module,
- // there are no Add-on Modules present
- public void parseForResourceVersion(DelegateExecution execution) {
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- def xml = execution.getVariable("DAAIVfMod_queryGenericVnfResponse")
- utils.logAudit("DeleteAAIVfModule - queryGenericVnfResponse" + xml)
- String resourceVer = utils.getNodeText1(xml, "resource-version")
- execution.setVariable("DAAIVfMod_genVnfRsrcVer", resourceVer)
- utils.log("DEBUG", "Latest Generic VNF Resource Version: " + resourceVer)
- }
-
-
- // generates a WorkflowException if the A&AI query returns a response code other than 200
- public void handleAAIQueryFailure(DelegateExecution execution) {
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
-
- utils.log("ERROR", "Error occurred attempting to query AAI, Response Code " +
- execution.getVariable("DAAIVfMod_queryGenericVnfResponseCode") + ", Error Response " +
- execution.getVariable("DAAIVfMod_queryGenericVnfResponse"), isDebugEnabled)
- def errorCode = 5000
- // set the errorCode to distinguish between a A&AI failure
- // and the Generic Vnf Id not found
- if (execution.getVariable("DAAIVfMod_queryGenericVnfResponseCode") == 404) {
- errorCode = 1002
- }
- exceptionUtil.buildAndThrowWorkflowException(execution, errorCode, execution.getVariable("DAAIVfMod_queryGenericVnfResponse"))
- }
-
- // generates a WorkflowException if
- // - the A&AI Vf Module DELETE returns a response code other than 200
- // - the Vf Module is a Base Module that is not the last Vf Module
- // - the Vf Module does not exist for the Generic Vnf
- public void handleDeleteVfModuleFailure(DelegateExecution execution) {
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
-
- def errorCode = 2000
- def errorResponse = ""
- if (execution.getVariable("DAAIVfMod_deleteVfModuleResponseCode") != null &&
- execution.getVariable("DAAIVfMod_deleteVfModuleResponseCode") != 200) {
- utils.log("DEBUG", "AAI failure deleting a Vf Module: " +
- execution.getVariable("DAAIVfMod_deleteVfModuleResponse"), isDebugEnabled)
- errorResponse = execution.getVariable("DAAIVfMod_deleteVfModuleResponse")
- utils.logAudit("DeleteAAIVfModule - deleteVfModuleResponse" + errorResponse)
- errorCode = 5000
- } else {
- if (execution.getVariable("DAAIVfMod_isBaseModule", true) == true &&
- execution.getVariable("DAAIVfMod_isLastModule") == false) {
- // attempt to delete a Base Module that is not the last Vf Module
- utils.log("DEBUG", execution.getVariable("DAAIVfMod_parseModuleResponse"), isDebugEnabled)
- errorResponse = execution.getVariable("DAAIVfMod_parseModuleResponse")
- utils.logAudit("DeleteAAIVfModule - parseModuleResponse" + errorResponse)
- errorCode = 1002
- } else {
- // attempt to delete a non-existant Vf Module
- if (execution.getVariable("DAAIVfMod_moduleExists") == false) {
- utils.log("DEBUG", execution.getVariable("DAAIVfMod_parseModuleResponse"), isDebugEnabled)
- errorResponse = execution.getVariable("DAAIVfMod_parseModuleResponse")
- utils.logAudit("DeleteAAIVfModule - parseModuleResponse" + errorResponse)
- errorCode = 1002
- } else {
- // if the responses get populated corerctly, we should never get here
- errorResponse = "Unknown error occurred during DeleteAAIVfModule flow"
- }
- }
- }
-
- utils.log("ERROR", "Error occurred during DeleteAAIVfModule flow: " + errorResponse, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, errorCode, errorResponse)
-
- }
-
- // generates a WorkflowException if
- // - the A&AI Generic Vnf DELETE returns a response code other than 200
- public void handleDeleteGenericVnfFailure(DelegateExecution execution) {
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- utils.log("ERROR", "AAI error occurred deleting the Generic Vnf: "
- + execution.getVariable("DAAIVfMod_deleteGenericVnfResponse"), isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 5000, execution.getVariable("DAAIVfMod_deleteGenericVnfResponse"))
- }
+/*- + * ============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.common.scripts +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.rest.APIResponse +import org.onap.so.rest.RESTClient; +import org.onap.so.rest.RESTConfig; +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + +public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{ + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DeleteAAIVfModule.class); + + def Prefix="DAAIVfMod_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + private MsoUtils utils = new MsoUtils() + public void initProcessVariables(DelegateExecution execution) { + execution.setVariable("prefix",Prefix) + execution.setVariable("DAAIVfMod_vnfId",null) + execution.setVariable("DAAIVfMod_vnfName",null) + execution.setVariable("DAAIVfMod_genVnfRsrcVer",null) + execution.setVariable("DAAIVfMod_vfModuleId",null) + execution.setVariable("DAAIVfMod_vfModRsrcVer",null) + execution.setVariable("DAAIVfMod_genericVnfEndpoint",null) + execution.setVariable("DAAIVfMod_vfModuleEndpoint",null) + execution.setVariable("DAAIVfMod_moduleExists",false) + execution.setVariable("DAAIVfMod_isBaseModule", false) + execution.setVariable("DAAIVfMod_isLastModule", false) + + // DeleteAAIVfModule workflow response variable placeholders + execution.setVariable("DAAIVfMod_queryGenericVnfResponseCode",null) + execution.setVariable("DAAIVfMod_queryGenericVnfResponse","") + execution.setVariable("DAAIVfMod_parseModuleResponse","") + execution.setVariable("DAAIVfMod_deleteGenericVnfResponseCode",null) + execution.setVariable("DAAIVfMod_deleteGenericVnfResponse","") + execution.setVariable("DAAIVfMod_deleteVfModuleResponseCode",null) + execution.setVariable("DAAIVfMod_deleteVfModuleResponse","") + + } + + // parse the incoming DELETE_VF_MODULE request and store the Generic Vnf + // and Vf Module Ids in the flow DelegateExecution + public void preProcessRequest(DelegateExecution execution) { + def xml = execution.getVariable("DeleteAAIVfModuleRequest") + msoLogger.debug("DeleteAAIVfModule Request: " + xml) + msoLogger.debug("input request xml:" + xml) + initProcessVariables(execution) + def vnfId = utils.getNodeText(xml,"vnf-id") + def vfModuleId = utils.getNodeText(xml,"vf-module-id") + execution.setVariable("DAAIVfMod_vnfId", vnfId) + execution.setVariable("DAAIVfMod_vfModuleId", vfModuleId) + + AaiUtil aaiUriUtil = new AaiUtil(this) + def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution) + msoLogger.debug('AAI URI is: ' + aai_uri) + + execution.setVariable("DAAIVfMod_genericVnfEndpoint", "${aai_uri}/" + vnfId) + execution.setVariable("DAAIVfMod_vfModuleEndpoint", "${aai_uri}/" + vnfId + + "/vf-modules/vf-module/" + vfModuleId) + } + + // send a GET request to AA&I to retrieve the Generic Vnf/Vf Module information based on a Vnf Id + // expect a 200 response with the information in the response body or a 404 if the Generic Vnf does not exist + public void queryAAIForGenericVnf(DelegateExecution execution) { + def delModuleId = execution.getVariable("DAAIVfMod_vfModuleId") + def endPoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + execution.getVariable("DAAIVfMod_genericVnfEndpoint") + "?depth=1" + msoLogger.debug("DeleteAAIVfModule endPoint: " + endPoint) + def aaiRequestId = utils.getRequestID() + + RESTConfig config = new RESTConfig(endPoint); + msoLogger.debug("queryAAIForGenericVnf() endpoint-" + endPoint) + def responseData = "" + try { + RESTClient client = new RESTClient(config).addHeader("X-TransactionId", aaiRequestId).addHeader("X-FromAppId", "MSO"). + addHeader("Accept","application/xml"); + String basicAuthCred = utils.getBasicAuth(UrnPropertiesReader.getVariable("aai.auth", execution),UrnPropertiesReader.getVariable("mso.msoKey", execution)) + + if (basicAuthCred != null && !"".equals(basicAuthCred)) { + client.addAuthorizationHeader(basicAuthCred) + } + msoLogger.debug("invoking GET call to AAI endpoint :"+System.lineSeparator()+endPoint) + APIResponse response = client.httpGet() + msoLogger.debug("DeleteAAIVfModule - invoking httpGet to AAI") + + responseData = response.getResponseBodyAsString() + execution.setVariable("DAAIVfMod_queryGenericVnfResponseCode", response.getStatusCode()) + execution.setVariable("DAAIVfMod_queryGenericVnfResponse", responseData) + msoLogger.debug("AAI Response: " + responseData) + msoLogger.debug("Response code:" + response.getStatusCode()) + msoLogger.debug("Response:" + System.lineSeparator()+responseData) + } catch (Exception ex) { + msoLogger.debug("Exception occurred while executing AAI GET:" + ex.getMessage()) + execution.setVariable("DAAIVfMod_queryGenericVnfResponse", "AAI GET Failed:" + ex.getMessage()) + exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured during queryAAIForGenericVnf") + + } + } + + // construct and send a DELETE request to A&AI to delete a Generic Vnf + // note: to get here, all the modules associated with the Generic Vnf must already be deleted + public void deleteGenericVnf(DelegateExecution execution) { + def aaiRequestId = utils.getRequestID() + def endPoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + execution.getVariable("DAAIVfMod_genericVnfEndpoint") + + "/?resource-version=" + execution.getVariable("DAAIVfMod_genVnfRsrcVer") + msoLogger.debug("AAI endPoint: " + endPoint) + RESTConfig config = new RESTConfig(endPoint); + msoLogger.debug("deleteGenericVnf() endpoint-" + endPoint) + def responseData = "" + try { + RESTClient client = new RESTClient(config).addHeader("X-TransactionId", aaiRequestId).addHeader("X-FromAppId", "MSO"). + addHeader("Accept","application/xml"); + + String basicAuthCred = utils.getBasicAuth(UrnPropertiesReader.getVariable("aai.auth", execution),UrnPropertiesReader.getVariable("mso.msoKey", execution)) + + if (basicAuthCred != null && !"".equals(basicAuthCred)) { + client.addAuthorizationHeader(basicAuthCred) + } + APIResponse response = client.httpDelete() + + responseData = response.getResponseBodyAsString() + execution.setVariable("DAAIVfMod_deleteGenericVnfResponseCode", response.getStatusCode()) + execution.setVariable("DAAIVfMod_deleteGenericVnfResponse", responseData) + msoLogger.debug("Response code:" + response.getStatusCode()) + msoLogger.debug("Response:" + System.lineSeparator()+responseData) + } catch (Exception ex) { + ex.printStackTrace() + msoLogger.debug("Exception occurred while executing AAI DELETE:" + ex.getMessage()) + exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured during deleteGenericVnf") + } + } + + // construct and send a DELETE request to A&AI to delete the Base or Add-on Vf Module + public void deleteVfModule(DelegateExecution execution) { + def endPoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + execution.getVariable("DAAIVfMod_vfModuleEndpoint") + + "/?resource-version=" + execution.getVariable("DAAIVfMod_vfModRsrcVer") + def aaiRequestId = utils.getRequestID() + + RESTConfig config = new RESTConfig(endPoint); + msoLogger.debug("deleteVfModule() endpoint-" + endPoint) + def responseData = "" + try { + RESTClient client = new RESTClient(config).addHeader("X-TransactionId", aaiRequestId).addHeader("X-FromAppId", "MSO"). + addHeader("Accept","application/xml"); + + String basicAuthCred = utils.getBasicAuth(UrnPropertiesReader.getVariable("aai.auth", execution),UrnPropertiesReader.getVariable("mso.msoKey", execution)) + + if (basicAuthCred != null && !"".equals(basicAuthCred)) { + client.addAuthorizationHeader(basicAuthCred) + } + APIResponse response = client.httpDelete() + + msoLogger.debug("DeleteAAIVfModule - invoking httpDelete to AAI") + + responseData = response.getResponseBodyAsString() + execution.setVariable("DAAIVfMod_deleteVfModuleResponseCode", response.getStatusCode()) + execution.setVariable("DAAIVfMod_deleteVfModuleResponse", responseData) + msoLogger.debug("DeleteAAIVfModule - AAI Response" + responseData) + msoLogger.debug("Response code:" + response.getStatusCode()) + msoLogger.debug("Response:" + System.lineSeparator()+responseData) + + } catch (Exception ex) { + ex.printStackTrace() + msoLogger.debug("Exception occurred while executing AAI PUT:" + ex.getMessage()) + exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured during deleteVfModule") + } + } + + // parses the output from the result from queryAAIForGenericVnf() to determine if the Vf Module + // to be deleted exists for the specified Generic Vnf and if it is the Base Module, + // there are no Add-on Modules present + public void parseForVfModule(DelegateExecution execution) { + def xml = execution.getVariable("DAAIVfMod_queryGenericVnfResponse") + msoLogger.debug("DeleteAAIVfModule - queryGenericVnfResponse" + xml) + + def delModuleId = execution.getVariable("DAAIVfMod_vfModuleId") + msoLogger.debug("Vf Module to be deleted: " + delModuleId) + List <String> qryModuleIdList = utils.getMultNodes(xml, "vf-module-id") + List <String> qryBaseModuleList = utils.getMultNodes(xml, "is-base-vf-module") + List <String> qryResourceVerList = utils.getMultNodes(xml, "resource-version") + execution.setVariable("DAAIVfMod_moduleExists", false) + execution.setVariable("DAAIVfMod_isBaseModule", false) + execution.setVariable("DAAIVfMod_isLastModule", false) + // + def isBaseVfModule = "false" + // loop through the Vf Module Ids looking for a match + if (qryModuleIdList != null && !qryModuleIdList.empty) { + msoLogger.debug("Existing Vf Module Id List: " + qryModuleIdList) + msoLogger.debug("Existing Vf Module Resource Version List: " + qryResourceVerList) + def moduleCntr = 0 + // the Generic Vnf resource-version in the 1st entry in the query response + execution.setVariable("DAAIVfMod_genVnfRsrcVer", qryResourceVerList[moduleCntr]) + for (String qryModuleId : qryModuleIdList) { + if (delModuleId.equals(qryModuleId)) { + // a Vf Module with the requested Id exists + execution.setVariable("DAAIVfMod_moduleExists", true) + // find the corresponding value for the is-base-vf-module field + isBaseVfModule = qryBaseModuleList[moduleCntr] + // find the corresponding value for the resource-version field + // note: the Generic Vnf entry also has a resource-version field, so + // add 1 to the index to get the corresponding Vf Module value + execution.setVariable("DAAIVfMod_vfModRsrcVer", qryResourceVerList[moduleCntr+1]) + msoLogger.debug("Match found for Vf Module Id " + qryModuleId + " for Generic Vnf Id " + execution.getVariable("DAAIVfMod_vnfId") + ", Base Module is " + isBaseVfModule + ", Resource Version is " + execution.getVariable("vfModRsrcVer")) + break + } + moduleCntr++ + } + } + + // determine if the module to be deleted is a Base Module and/or the Last Module + if (execution.getVariable("DAAIVfMod_moduleExists") == true) { + if (isBaseVfModule.equals("true") && qryModuleIdList.size() != 1) { + execution.setVariable("DAAIVfMod_parseModuleResponse", + "Found Vf Module Id " + delModuleId + " for Generic Vnf Id " + + execution.getVariable("DAAIVfMod_vnfId") + ": is Base Module, not Last Module") + execution.setVariable("DAAIVfMod_isBaseModule", true) + } else { + if (isBaseVfModule.equals("true") && qryModuleIdList.size() == 1) { + execution.setVariable("DAAIVfMod_parseModuleResponse", + "Found Vf Module Id " + delModuleId + " for Generic Vnf Id " + + execution.getVariable("DAAIVfMod_vnfId") + ": is Base Module and Last Module") + execution.setVariable("DAAIVfMod_isBaseModule", true) + execution.setVariable("DAAIVfMod_isLastModule", true) + } else { + if (qryModuleIdList.size() == 1) { + execution.setVariable("DAAIVfMod_parseModuleResponse", + "Found Vf Module Id " + delModuleId + " for Generic Vnf Id " + + execution.getVariable("DAAIVfMod_vnfId") + ": is Not Base Module, is Last Module") + execution.setVariable("DAAIVfMod_isLastModule", true) + } else { + execution.setVariable("DAAIVfMod_parseModuleResponse", + "Found Vf Module Id " + delModuleId + " for Generic Vnf Id " + + execution.getVariable("DAAIVfMod_vnfId") + ": is Not Base Module and Not Last Module") + } + } + } + msoLogger.debug(execution.getVariable("DAAIVfMod_parseModuleResponse")) + } else { // (execution.getVariable("DAAIVfMod_moduleExists") == false) + msoLogger.debug("Vf Module Id " + delModuleId + " does not exist for Generic Vnf Id " + execution.getVariable("DAAIVfMod_vnfId")) + execution.setVariable("DAAIVfMod_parseModuleResponse", + "Vf Module Id " + delModuleId + " does not exist for Generic Vnf Id " + + execution.getVariable("DAAIVfMod_vnfName")) + } + } + + // parses the output from the result from queryAAIForGenericVnf() to determine if the Vf Module + // to be deleted exists for the specified Generic Vnf and if it is the Base Module, + // there are no Add-on Modules present + public void parseForResourceVersion(DelegateExecution execution) { + def xml = execution.getVariable("DAAIVfMod_queryGenericVnfResponse") + msoLogger.debug("DeleteAAIVfModule - queryGenericVnfResponse" + xml) + String resourceVer = utils.getNodeText(xml, "resource-version") + execution.setVariable("DAAIVfMod_genVnfRsrcVer", resourceVer) + msoLogger.debug("Latest Generic VNF Resource Version: " + resourceVer) + } + + + // generates a WorkflowException if the A&AI query returns a response code other than 200 + public void handleAAIQueryFailure(DelegateExecution execution) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Error occurred attempting to query AAI, Response Code " + execution.getVariable("DAAIVfMod_queryGenericVnfResponseCode") + ", Error Response " + execution.getVariable("DAAIVfMod_queryGenericVnfResponse"), "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + def errorCode = 5000 + // set the errorCode to distinguish between a A&AI failure + // and the Generic Vnf Id not found + if (execution.getVariable("DAAIVfMod_queryGenericVnfResponseCode") == 404) { + errorCode = 1002 + } + exceptionUtil.buildAndThrowWorkflowException(execution, errorCode, execution.getVariable("DAAIVfMod_queryGenericVnfResponse")) + } + + // generates a WorkflowException if + // - the A&AI Vf Module DELETE returns a response code other than 200 + // - the Vf Module is a Base Module that is not the last Vf Module + // - the Vf Module does not exist for the Generic Vnf + public void handleDeleteVfModuleFailure(DelegateExecution execution) { + def errorCode = 2000 + def errorResponse = "" + if (execution.getVariable("DAAIVfMod_deleteVfModuleResponseCode") != null && + execution.getVariable("DAAIVfMod_deleteVfModuleResponseCode") != 200) { + msoLogger.debug("AAI failure deleting a Vf Module: " + execution.getVariable("DAAIVfMod_deleteVfModuleResponse")) + errorResponse = execution.getVariable("DAAIVfMod_deleteVfModuleResponse") + msoLogger.debug("DeleteAAIVfModule - deleteVfModuleResponse" + errorResponse) + errorCode = 5000 + } else { + if (execution.getVariable("DAAIVfMod_isBaseModule", true) == true && + execution.getVariable("DAAIVfMod_isLastModule") == false) { + // attempt to delete a Base Module that is not the last Vf Module + msoLogger.debug(execution.getVariable("DAAIVfMod_parseModuleResponse")) + errorResponse = execution.getVariable("DAAIVfMod_parseModuleResponse") + msoLogger.debug("DeleteAAIVfModule - parseModuleResponse" + errorResponse) + errorCode = 1002 + } else { + // attempt to delete a non-existant Vf Module + if (execution.getVariable("DAAIVfMod_moduleExists") == false) { + msoLogger.debug(execution.getVariable("DAAIVfMod_parseModuleResponse")) + errorResponse = execution.getVariable("DAAIVfMod_parseModuleResponse") + msoLogger.debug("DeleteAAIVfModule - parseModuleResponse" + errorResponse) + errorCode = 1002 + } else { + // if the responses get populated corerctly, we should never get here + errorResponse = "Unknown error occurred during DeleteAAIVfModule flow" + } + } + } + + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Error occurred during DeleteAAIVfModule flow", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, errorResponse); + exceptionUtil.buildAndThrowWorkflowException(execution, errorCode, errorResponse) + + } + + // generates a WorkflowException if + // - the A&AI Generic Vnf DELETE returns a response code other than 200 + public void handleDeleteGenericVnfFailure(DelegateExecution execution) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "AAI error occurred deleting the Generic Vnf", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, execution.getVariable("DAAIVfMod_deleteGenericVnfResponse")); + exceptionUtil.buildAndThrowWorkflowException(execution, 5000, execution.getVariable("DAAIVfMod_deleteGenericVnfResponse")) + } }
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ExceptionUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy index b65ce74c70..de5408fac5 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ExceptionUtil.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.common.scripts +package org.onap.so.bpmn.common.scripts import static org.apache.commons.lang3.StringUtils.* @@ -27,12 +27,18 @@ import com.google.common.xml.XmlEscapers import org.apache.commons.lang3.* import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution -import org.openecomp.mso.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + + /** * @version 1.0 */ class ExceptionUtil extends AbstractServiceTaskProcessor { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ExceptionUtil.class); + /** @@ -49,23 +55,22 @@ class ExceptionUtil extends AbstractServiceTaskProcessor { WorkflowException MapAAIExceptionToWorkflowException(String response, DelegateExecution execution) { def utils=new MsoUtils() - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") def prefix=execution.getVariable("prefix") def errorMsg = execution.getVariable(prefix+"ErrorResponse") - utils.log("DEBUG","=========== Begin MapAAIExceptionToWorkflowException ===========",isDebugEnabled) + msoLogger.trace("Begin MapAAIExceptionToWorkflowException ") String text = null def variables String errorCode = '5000' WorkflowException wfex - utils.log("DEBUG","response: " + response, isDebugEnabled) + msoLogger.debug("response: " + response) try{ try { //String msg = utils.getNodeXml(response, "Fault") variables = utils.getMultNodes(response, "variable") - text = utils.getNodeText1(response, "text") + text = utils.getNodeText(response, "text") } catch (Exception ex) { //Ignore the exception - cases include non xml payload - utils.log("DEBUG","error mapping error, ignoring: " + ex,isDebugEnabled) + msoLogger.debug("error mapping error, ignoring: " + ex) } if(text != null) { @@ -76,12 +81,12 @@ class ExceptionUtil extends AbstractServiceTaskProcessor { text = text.replaceFirst("%4", variables[3]) } String modifiedErrorMessage = 'Received error from A&AI (' + text +')' - utils.log("DEBUG", "ModifiedErrorMessage " + modifiedErrorMessage, isDebugEnabled) + msoLogger.debug("ModifiedErrorMessage " + modifiedErrorMessage) // let $ModifiedErrorMessage := concat( 'Received error from A',$exceptionaai:ampersand,'AI (' ,functx:replace-multi($ErrorMessage,$from,$Variables ),')') buildWorkflowException(execution, 5000, modifiedErrorMessage) wfex = execution.getVariable("WorkflowException") - utils.log("ERROR","Fault:"+ wfex) + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Fault", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, wfex.errorMessage); return wfex } else { try { @@ -91,18 +96,18 @@ class ExceptionUtil extends AbstractServiceTaskProcessor { int errorCodeInt = Integer.parseInt(errorCode) buildWorkflowException(execution, errorCodeInt, mappedErrorMessage) - utils.log("DEBUG", "mappedErrorMessage " + mappedErrorMessage, isDebugEnabled) + msoLogger.debug("mappedErrorMessage " + mappedErrorMessage) wfex = execution.getVariable("WorkflowException") - utils.log("ERROR","Fault:"+ wfex, isDebugEnabled) + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Fault", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, wfex.errorMessage); return wfex } catch(Exception ex) { - utils.log("DEBUG","error mapping error, return null: " + ex, isDebugEnabled) + msoLogger.debug("error mapping error, return null: " + ex) return null } } }catch(Exception e){ - utils.log("DEBUG", "Exception occured during MapAAIExceptionToWorkflowException: " + e, isDebugEnabled) + msoLogger.debug("Exception occured during MapAAIExceptionToWorkflowException: " + e) buildWorkflowException(execution, 5000, "Error mapping AAI Response to WorkflowException") } } @@ -120,8 +125,7 @@ class ExceptionUtil extends AbstractServiceTaskProcessor { */ WorkflowException MapAAIExceptionToWorkflowExceptionGeneric(DelegateExecution execution, String response, int resCode){ def utils=new MsoUtils() - def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG", "Start MapAAIExceptionToWorkflowExceptionGeneric Process", isDebugLogEnabled) + msoLogger.debug("Start MapAAIExceptionToWorkflowExceptionGeneric Process") WorkflowException wfex try { @@ -138,12 +142,12 @@ class ExceptionUtil extends AbstractServiceTaskProcessor { buildWorkflowException(execution, resCode, "Received a bad response from AAI") } } catch (Exception ex) { - utils.log("DEBUG", "Exception Occured during MapAAIExceptionToWorkflowExceptionGeneric: " + ex, isDebugLogEnabled) + msoLogger.debug("Exception Occured during MapAAIExceptionToWorkflowExceptionGeneric: " + ex) buildWorkflowException(execution, resCode, "Internal Error - Occured in MapAAIExceptionToWorkflowExceptionGeneric") } - utils.log("DEBUG", "Outgoing WorkflowException is: " + execution.getVariable("WorkflowException"), isDebugLogEnabled) - utils.log("DEBUG", "Completed MapAAIExceptionToWorkflowExceptionGeneric Process", isDebugLogEnabled) + msoLogger.debug("Outgoing WorkflowException is: " + execution.getVariable("WorkflowException")) + msoLogger.debug("Completed MapAAIExceptionToWorkflowExceptionGeneric Process") } /** @@ -164,14 +168,14 @@ class ExceptionUtil extends AbstractServiceTaskProcessor { String mes = XmlEscapers.xmlContentEscaper().escape(wfex.getErrorMessage()) int code = wfex.getErrorCode() xml = - """<aetgt:WorkflowException xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1"> - <aetgt:ErrorMessage>${mes}</aetgt:ErrorMessage> - <aetgt:ErrorCode>${code}</aetgt:ErrorCode> + """<aetgt:WorkflowException xmlns:aetgt="http://org.onap/so/workflow/schema/v1"> + <aetgt:ErrorMessage>${MsoUtils.xmlEscape(mes)}</aetgt:ErrorMessage> + <aetgt:ErrorCode>${MsoUtils.xmlEscape(code)}</aetgt:ErrorCode> </aetgt:WorkflowException>""" }else{ xml = - """<aetgt:WorkflowException xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1"> + """<aetgt:WorkflowException xmlns:aetgt="http://org.onap/so/workflow/schema/v1"> <aetgt:ErrorMessage>Internal Error</aetgt:ErrorMessage> <aetgt:ErrorCode>2500</aetgt:ErrorCode> </aetgt:WorkflowException>""" @@ -223,7 +227,7 @@ class ExceptionUtil extends AbstractServiceTaskProcessor { errorMessage="" } if( errorCode.equals('5010')){ - return 'Could not communicate with A&AI' + return 'Could not communicate with A&AI' }else if (errorCode.equals('5020')){ return 'No response from A&AI' }else{ @@ -264,13 +268,12 @@ class ExceptionUtil extends AbstractServiceTaskProcessor { */ public void buildWorkflowException(DelegateExecution execution, int errorCode, String errorMessage) { MsoUtils utils = new MsoUtils() - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') String processKey = getProcessKey(execution); - utils.log("DEBUG", "Building a WorkflowException for " + processKey, isDebugLogEnabled) + msoLogger.debug("Building a WorkflowException for " + processKey) WorkflowException exception = new WorkflowException(processKey, errorCode, errorMessage); execution.setVariable("WorkflowException", exception); - utils.log("DEBUG", "Outgoing WorkflowException is " + exception, isDebugLogEnabled) + msoLogger.debug("Outgoing WorkflowException is " + exception) } /** @@ -283,14 +286,13 @@ class ExceptionUtil extends AbstractServiceTaskProcessor { * @param errorMessage the error message */ public void buildAndThrowWorkflowException(DelegateExecution execution, int errorCode, String errorMessage) { - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') String processKey = getProcessKey(execution); - utils.log("Building a WorkflowException for Subflow " + processKey, isDebugLogEnabled) + msoLogger.debug("Building a WorkflowException for Subflow " + processKey) WorkflowException exception = new WorkflowException(processKey, errorCode, errorMessage); execution.setVariable("WorkflowException", exception); - utils.log("DEBUG", "Outgoing WorkflowException is " + exception, isDebugLogEnabled) - utils.log("DEBUG", "Throwing MSOWorkflowException", isDebugLogEnabled) + msoLogger.debug("Outgoing WorkflowException is " + exception) + msoLogger.debug("Throwing MSOWorkflowException") throw new BpmnError("MSOWorkflowException") } @@ -304,19 +306,18 @@ class ExceptionUtil extends AbstractServiceTaskProcessor { * */ public void processSubflowsBPMNException(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") String processKey = getProcessKey(execution) try{ - utils.log("DEBUG", "Started ProcessSubflowsBPMNException Method", isDebugEnabled) + msoLogger.debug("Started ProcessSubflowsBPMNException Method") if(execution.getVariable("WorkflowException") == null){ buildWorkflowException(execution, 2500, "Internal Error - Occured During " + processKey) } - utils.log("DEBUG", processKey + " Outgoing WorkflowException is: " + execution.getVariable("WorkflowException"), isDebugEnabled) + msoLogger.debug(processKey + " Outgoing WorkflowException is: " + execution.getVariable("WorkflowException")) }catch(Exception e){ - utils.log("DEBUG", "Caught Exception during ProcessSubflowsBPMNException Method: " + e, isDebugEnabled) + msoLogger.debug("Caught Exception during ProcessSubflowsBPMNException Method: " + e) } - utils.log("DEBUG", "Completed ProcessSubflowsBPMNException Method", isDebugEnabled) + msoLogger.debug("Completed ProcessSubflowsBPMNException Method") } /** @@ -331,10 +332,9 @@ class ExceptionUtil extends AbstractServiceTaskProcessor { * */ public String processMainflowsBPMNException(DelegateExecution execution, String requestInfo){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") String processKey = getProcessKey(execution) try{ - utils.log("DEBUG", "Started ProcessMainflowBPMNException Method", isDebugEnabled) + msoLogger.debug("Started ProcessMainflowBPMNException Method") if(execution.getVariable("WorkflowException") == null || isBlank(requestInfo)){ buildWorkflowException(execution, 2500, "Internal Error - WorkflowException Object and/or RequestInfo is null! " + processKey) } @@ -344,25 +344,26 @@ class ExceptionUtil extends AbstractServiceTaskProcessor { int errorCode = wfex.getErrorCode() String falloutHandlerRequest = - """<aetgt:FalloutHandlerRequest xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1" - xmlns:ns="http://org.openecomp/mso/request/types/v1" - xmlns:wfsch="http://org.openecomp/mso/workflow/schema/v1"> + """<aetgt:FalloutHandlerRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" + xmlns:ns="http://org.onap/so/request/types/v1" + xmlns:wfsch="http://org.onap/so/workflow/schema/v1"> ${requestInfo} - <aetgt:WorkflowException xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1"> - <aetgt:ErrorMessage>${errorMessage}</aetgt:ErrorMessage> - <aetgt:ErrorCode>${errorCode}</aetgt:ErrorCode> + <aetgt:WorkflowException xmlns:aetgt="http://org.onap/so/workflow/schema/v1"> + <aetgt:ErrorMessage>${MsoUtils.xmlEscape(errorMessage)}</aetgt:ErrorMessage> + <aetgt:ErrorCode>${MsoUtils.xmlEscape(errorCode)}</aetgt:ErrorCode> </aetgt:WorkflowException> </aetgt:FalloutHandlerRequest>""" - utils.log("DEBUG", processKey + " Outgoing WorkflowException is: " + execution.getVariable("WorkflowException"), isDebugEnabled) - utils.log("DEBUG", processKey + " Outgoing FalloutHandler Request is: " + falloutHandlerRequest, isDebugEnabled) + msoLogger.debug(processKey + " Outgoing WorkflowException is: " + execution.getVariable("WorkflowException")) + msoLogger.debug(processKey + " Outgoing FalloutHandler Request is: " + falloutHandlerRequest) + return falloutHandlerRequest }catch(Exception e){ - utils.log("DEBUG", "Caught Exception during ProcessMainflowBPMNException Method: " + e, isDebugEnabled) + msoLogger.debug("Caught Exception during ProcessMainflowBPMNException Method: " + e) return null } - utils.log("DEBUG", "Completed ProcessMainflowBPMNException Method", isDebugEnabled) + msoLogger.debug("Completed ProcessMainflowBPMNException Method") } /** @@ -374,20 +375,25 @@ class ExceptionUtil extends AbstractServiceTaskProcessor { * */ public void processJavaException(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") String processKey = getProcessKey(execution) try{ - utils.log("DEBUG", "Caught a Java Exception in " + processKey, isDebugEnabled) - utils.log("DEBUG", "Started processJavaException Method", isDebugEnabled) - buildWorkflowException(execution, 2500, "Catch a Java Lang Exception in " + processKey) + msoLogger.debug("Caught a Java Exception in " + processKey) + msoLogger.debug("Started processJavaException Method") + // if the BPMN flow java error handler sets "BPMN_javaExpMsg", append it to the WFE + String javaExpMsg = execution.getVariable("BPMN_javaExpMsg") + String wfeExpMsg = "Catch a Java Lang Exception in " + processKey + if (javaExpMsg != null && !javaExpMsg.empty) { + wfeExpMsg = wfeExpMsg + ": " + javaExpMsg + } + buildWorkflowException(execution, 2500, wfeExpMsg) }catch(BpmnError b){ throw b }catch(Exception e){ - utils.log("DEBUG", "Caught Exception during processJavaException Method: " + e, isDebugEnabled) + msoLogger.debug("Caught Exception during processJavaException Method: " + e) buildWorkflowException(execution, 2500, "Internal Error - During Process Java Exception") } - utils.log("DEBUG", "Completed processJavaException Method", isDebugEnabled) + msoLogger.debug("Completed processJavaException Method") } @@ -395,4 +401,22 @@ class ExceptionUtil extends AbstractServiceTaskProcessor { // TODO Auto-generated method stub } + + public String getErrorMessage(WorkflowException wfe, String processKey) { + if(wfe == null) { + return "Unexpected error encountered in " + processKey + } + else { + return wfe.getErrorMessage() + } + } + + public int getErrorCode(WorkflowException wfe) { + if(wfe == null) { + return 2500 + } + else { + return wfe.getErrorCode() + } + } } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/FalloutHandler.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/FalloutHandler.groovy index 0356397eaa..9732693f38 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/FalloutHandler.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/FalloutHandler.groovy @@ -1,380 +1,378 @@ -/*-
- * ============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.common.scripts
-
-import java.text.SimpleDateFormat
-
-import org.apache.commons.lang3.*
-import org.camunda.bpm.engine.delegate.DelegateExecution
-
-public class FalloutHandler extends AbstractServiceTaskProcessor {
- String Prefix="FH_"
- ExceptionUtil exceptionUtil = new ExceptionUtil()
-
- public initializeProcessVariables(DelegateExecution execution){
- def method = getClass().getSimpleName() + '.initializeProcessVariables(' +'execution=' + execution.getId() +')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- try {
- execution.setVariable("prefix",Prefix)
-
- //These variables are form the input Message to the BPMN
- execution.setVariable("FH_request_id","")
- execution.setVariable("FH_request_action","")
- execution.setVariable("FH_notification-url","")
- execution.setVariable("FH_mso-bpel-name","")
- execution.setVariable("FH_ErrorCode", "")
- execution.setVariable("FH_ErrorMessage", "")
-
- execution.setVariable("FH_notification-url-Ok", false)
- execution.setVariable("FH_request_id-Ok", false)
-
- //These variables are for Get Mso Aai Password Adapter
- execution.setVariable("FH_deliveryStatus", true)
-
- //update Response Status to pending ...Adapter variables
- execution.setVariable("FH_updateResponseStatusPayload", null)
- execution.setVariable("FH_updateResponseStatusResponse", null)
-
- //update Request Gamma ...Adapter variables
- execution.setVariable("FH_updateRequestGammaPayload", "")
- execution.setVariable("FH_updateRequestGammaResponse", null)
- execution.setVariable("FH_updateRequestGammaResponseCode", null)
-
- //update Request Infra ...Adapter variables
- execution.setVariable("FH_updateRequestInfraPayload", "")
- execution.setVariable("FH_updateRequestInfraResponse", null)
- execution.setVariable("FH_updateRequestInfraResponseCode", null)
-
- //assign True to success variable
- execution.setVariable("FH_success", true)
-
- //Set notify status to Failed variable
- execution.setVariable("FH_NOTIFY_STATUS", "SUCCESS")
-
- //Set DB update variable
- execution.setVariable("FH_updateRequestPayload", "")
- execution.setVariable("FH_updateRequestResponse", null)
- execution.setVariable("FH_updateRequestResponseCode", null)
-
- //Auth variables
- execution.setVariable("BasicAuthHeaderValue","")
-
- //Parameter list
- execution.setVariable("FH_parameterList", "")
-
- //Response variables
- execution.setVariable("FalloutHandlerResponse","")
- execution.setVariable("FH_ErrorResponse", null)
- execution.setVariable("FH_ResponseCode", "")
-
- } catch (Exception e) {
- logError('Caught exception in ' + method, e)
- // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method)
- }
- }
-
- public void preProcessRequest (DelegateExecution execution) {
- def method = getClass().getSimpleName() + '.preProcessRequest(' +'execution=' + execution.getId() +')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- // Initialize flow variables
- initializeProcessVariables(execution)
- setSuccessIndicator(execution, false)
-
- setBasicDBAuthHeader(execution, isDebugLogEnabled)
-
- try {
- def xml = execution.getVariable("FalloutHandlerRequest")
- utils.log("DEBUG", " XML --> " + xml, isDebugLogEnabled)
- utils.logAudit("FalloutHandler request: " + xml)
-
- //Check the incoming request type
- //Incoming request can be ACTIVE_REQUESTS (request-information node) or INFRA_ACTIVE_REQUESTS (request-info node)
- if (utils.nodeExists(xml, "request-information")) {
- execution.setVariable("FH_request_id-Ok", true) // Incoming request is for ACTIVE_REQUESTS
- }
-
- //Check notification-url for the incoming request type
- //ACTIVE_REQUESTS may have notificationurl node
- //INFRA_ACTIVE_REQUESTS notificationurl node does not exist
- def notificationurl = ""
- if (utils.nodeExists(xml, "notification-url")) {
- notificationurl = utils.getNodeText(xml,"notification-url")
- if(notificationurl != null && !notificationurl.isEmpty()) {
- utils.log("DEBUG", "********** Incoming notification Url is: " + notificationurl,isDebugLogEnabled);
- execution.setVariable("FH_notification-url-Ok", true)
- execution.setVariable("FH_notification-url",notificationurl)
- }
- }
-
- //Check request_id for the incoming request type
- //For INFRA_ACTIVE_REQUESTS payload request-id IS optional (Not sure why this is option since req id is primary key ... also tried exe through SOAP UI to check if MSO code handles null like auto generated seq not it does not)
- //For ACTIVE_REQUESTS payload request-id is NOT optional
- def request_id = ""
- if (utils.nodeExists(xml, "request-id")) {
- execution.setVariable("FH_request_id",utils.getNodeText(xml,"request-id"))
- }
- utils.logAudit("FH_request_id: " + execution.getVariable("FH_request_id"))
-
- // INFRA_ACTIVE_REQUESTS have "action" element ... mandatory
- // ACTIVE_REQUEST have "request-action" ... mandatory
- if (utils.nodeExists(xml, "request-action")) {
- execution.setVariable("FH_request_action",utils.getNodeText(xml,"request-action"))
- } else if (utils.nodeExists(xml, "action")) {
- execution.setVariable("FH_request_action",utils.getNodeText(xml,"action"))
- }
-
-
- //Check source for the incoming request type
- //For INFRA_ACTIVE_REQUESTS payload source IS optional
- //For ACTIVE_REQUESTS payload source is NOT optional
- def source = ""
- if (utils.nodeExists(xml, "source")) {
- execution.setVariable("FH_source",utils.getNodeText(xml,"source"))
- }
-
- //Check if ErrorCode node exists. If yes, initialize it from request xml, if no, it will stay with defaulf value already set in initializeProcessVariables() method above.
- def errorCode = ""
- if (utils.nodeExists(xml, "ErrorCode")) {
- errorCode = utils.getNodeText(xml,"ErrorCode")
- if(errorCode != null && !errorCode.isEmpty()) {
- execution.setVariable("FH_ErrorCode", errorCode)
- }
- }
- utils.logAudit("FH_ErrorCode: " + errorCode)
-
- //Check if ErrorMessage node exists. If yes, initialize it from request xml, if no, it will stay with defaulf value already set in initializeProcessVariables() method above.
- def errorMessage = ""
- if (utils.nodeExists(xml, "ErrorMessage")) {
- errorCode = utils.getNodeText(xml,"ErrorMessage")
- if(errorCode != null && !errorCode.isEmpty()) {
- errorCode = errorCode.replace("&", "&").replace("<", "<").replace(">", ">")
- execution.setVariable("FH_ErrorMessage", errorCode)
- }
- }
-
- //Check for Parameter List
- if (utils.nodeExists(xml, "parameter-list")) {
- def parameterList = utils.getNodeXml(xml, "parameter-list", false)
- execution.setVariable("FH_parameterList", parameterList)
- }
-
- utils.log("DEBUG","FH_notification-url-Ok --> " + execution.getVariable("FH_notification-url-Ok"),isDebugLogEnabled)
- utils.log("DEBUG","FH_request_id-OK --> " + execution.getVariable("FH_request_id-Ok"),isDebugLogEnabled)
-
- // set the DHV/Service Instantiation values if specified in the request
- execution.setVariable("FH_is_srv_inst_req", String.valueOf("true".equals(utils.getNodeText1(xml, "is-srv-inst-req"))))
- utils.log("DEBUG", "FH_is_srv_inst_req --> " + execution.getVariable("FH_is_srv_inst_req"), isDebugLogEnabled)
- execution.setVariable("FH_is_json_content", String.valueOf("JSON".equals(utils.getNodeText1(xml, "resp-content-type"))))
- utils.log("DEBUG", "FH_is_json_content --> " + execution.getVariable("FH_is_json_content"), isDebugLogEnabled)
- execution.setVariable("FH_service_inst_id", utils.getNodeText1(xml, "service-instance-id"))
- utils.log("DEBUG", "FH_service_inst_id --> " + execution.getVariable("FH_service_inst_id"), isDebugLogEnabled)
- execution.setVariable("FH_start_time", utils.getNodeText1(xml, "start-time"))
- utils.log("DEBUG", "FH_start_time --> " + execution.getVariable("FH_start_time"), isDebugLogEnabled)
- // this variable is used by the camunda flow to set the Content-Type for the async response
- if (execution.getVariable("FH_is_srv_inst_req").equals("true") &&
- execution.getVariable("FH_is_json_content").equals("true")) {
- execution.setVariable("FH_content_type", "application/json")
- } else {
- execution.setVariable("FH_content_type", "text/xml")
- }
- } catch (Exception e) {
- logError('Caught exception in ' + method, e)
- // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in" + method)
- }
-
- utils.log("DEBUG","OUTOF --> Initialize Variables Fallout Handler #########",isDebugLogEnabled);
- }
-
- public String updateRequestPayload (DelegateExecution execution){
- def method = getClass().getSimpleName() + '.updateRequestPayload(' +'execution=' + execution.getId() +')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- try {
- String payload = """
- <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.openecomp.mso/requestsdb">
- <soapenv:Header/>
- <soapenv:Body>
- <req:updateRequest>
- <requestId>${execution.getVariable("FH_request_id")}</requestId>
- <lastModifiedBy>BPEL</lastModifiedBy>
- <finalErrorMessage>${execution.getVariable("FH_ErrorMessage")}</finalErrorMessage>
- <finalErrorCode>${execution.getVariable("FH_ErrorCode")}</finalErrorCode>
- <status>FAILED</status>
- <responseStatus>${execution.getVariable("FH_NOTIFY_STATUS")}</responseStatus>
- </req:updateRequest>
- </soapenv:Body>
- </soapenv:Envelope>
- """
-
- utils.logAudit("updateRequestPayload: " + payload)
- execution.setVariable("FH_updateRequestPayload", payload)
- return execution.getVariable("FH_updateRequestPayload")
- } catch (Exception e) {
- logError('Caught exception in ' + method, e)
- // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method)
- }
- }
-
- public String updateRequestInfraPayload (DelegateExecution execution){
- def method = getClass().getSimpleName() + '.updateRequestInfraPayload(' +'execution=' + execution.getId() +')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- try {
- String payload = """
- <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.openecomp.mso/requestsdb">
- <soapenv:Header/>
- <soapenv:Body>
- <req:updateInfraRequest>
- <requestId>${execution.getVariable("FH_request_id")}</requestId>
- <lastModifiedBy>BPEL</lastModifiedBy>
- <statusMessage>${execution.getVariable("FH_ErrorMessage")}</statusMessage>
- <requestStatus>FAILED</requestStatus>
- <progress>100</progress>
- </req:updateInfraRequest>
- </soapenv:Body>
- </soapenv:Envelope>
- """
-
- execution.setVariable("FH_updateRequestInfraPayload", payload)
- utils.logAudit("updateRequestInfraPayload: " + payload)
- return execution.getVariable("FH_updateRequestInfraPayload")
- } catch (Exception e) {
- logError('Caught exception in ' + method, e)
- // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method)
- }
- }
-
- public String updateRequestGammaPayload (DelegateExecution execution){
- def method = getClass().getSimpleName() + '.updateRequestGammaPayload(' +'execution=' + execution.getId() +')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- try {
- String payload = """
- <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="${execution.getVariable("URN_mso_default_adapter_namespace")}/requestsdb">
- <soapenv:Header/>
- <soapenv:Body>
- <req:updateRequest>
- <requestId>${execution.getVariable("FH_request_id")}</requestId>
- <lastModifiedBy>BPEL</lastModifiedBy>
- <finalErrorMessage>${execution.getVariable("FH_ErrorMessage")}</finalErrorMessage>
- <finalErrorCode>${execution.getVariable("FH_ErrorCode")}</finalErrorCode>
- <status>FAILED</status>
- </req:updateRequest>
- </soapenv:Body>
- </soapenv:Envelope>
- """
-
- execution.setVariable("FH_updateRequestGammaPayload", payload)
- utils.logAudit("updateRequestGammaPayload: " + payload)
- return execution.getVariable("FH_updateRequestGammaPayload")
- } catch (Exception e) {
- logError('Caught exception in ' + method, e)
- // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method)
- }
- }
-
- public String updateResponseStatusPayload (DelegateExecution execution){
- def method = getClass().getSimpleName() + '.updateResponseStatusPayload(' +'execution=' + execution.getId() +')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- try {
- String payload = """
- <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.openecomp.mso/requestsdb">
- <soapenv:Header/>
- <soapenv:Body>
- <req:updateResponseStatus>
- <requestId>${execution.getVariable("FH_request_id")}</requestId>
- <lastModifiedBy>BPEL</lastModifiedBy>
- <responseStatus>SENDING_FINAL_NOTIFY</responseStatus>
- </req:updateResponseStatus>
- </soapenv:Body>
- </soapenv:Envelope>
- """
-
- execution.setVariable("FH_updateResponseStatusPayload", payload)
- utils.logAudit("updateResponseStatusPayload: " + payload)
- return execution.getVariable("FH_updateResponseStatusPayload")
- } catch (Exception e) {
- logError('Caught exception in ' + method, e)
- // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method)
- }
- }
-
- public void buildDBWorkflowException(DelegateExecution execution, String responseCodeVariable) {
- def method = getClass().getSimpleName() + '.buildDBWorkflowException(' +
- 'execution=' + execution.getId() +
- ', responseCodeVariable=' + responseCodeVariable + ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- try {
- def responseCode = execution.getVariable(responseCodeVariable)
- // If the HTTP response code was null, it means a connection fault occurred (a java exception)
- def errorMessage = responseCode == null ? "Could not connect to DB Adapter" : "DB Adapter returned ${responseCode} response"
- def errorCode = responseCode == null ? 7000 : 7020
- // exceptionUtil.buildWorkflowException(execution, errorCode, errorMessage)
- } catch (Exception e) {
- logError('Caught exception in ' + method, e)
- // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method)
- }
- }
-
- /**
- * Used to create a workflow response in success and failure cases.
- */
- public void postProcessResponse (DelegateExecution execution) {
- def method = getClass().getSimpleName() + '.postProcessResponse(' +'execution=' + execution.getId() +')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- try {
- Boolean success = (Boolean) execution.getVariable("FH_success")
- String out = success ? "Fallout Handler Succeeded" : "Fallout Handler Failed";
-
- def falloutHandlerResponse = """
- <workflow:FalloutHandlerResponse xmlns:workflow="http://org.openecomp/mso/workflow/schema/v1">
- <workflow:out>${out}</workflow:out>
- </workflow:FalloutHandlerResponse>
- """
-
- falloutHandlerResponse = utils.formatXml(falloutHandlerResponse)
- utils.logAudit("FalloutHandler Response: " + falloutHandlerResponse);
-
- execution.setVariable("FalloutHandlerResponse", falloutHandlerResponse)
- execution.setVariable("WorkflowResponse", falloutHandlerResponse)
- execution.setVariable("FH_ResponseCode", success ? "200" : "500")
- setSuccessIndicator(execution, success)
-
- logDebug("FalloutHandlerResponse =\n" + falloutHandlerResponse, isDebugLogEnabled)
- } catch (Exception e) {
- // Do NOT throw WorkflowException!
- logError('Caught exception in ' + method, e)
- }
- }
+/*- + * ============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.common.scripts + +import org.onap.so.bpmn.core.UrnPropertiesReader + +import java.text.SimpleDateFormat + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + +public class FalloutHandler extends AbstractServiceTaskProcessor { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, FalloutHandler.class); + + String Prefix="FH_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + + public initializeProcessVariables(DelegateExecution execution){ + def method = getClass().getSimpleName() + '.initializeProcessVariables(' +'execution=' + execution.getId() +')' + msoLogger.trace('Entered ' + method) + + try { + execution.setVariable("prefix",Prefix) + + //These variables are form the input Message to the BPMN + execution.setVariable("FH_request_id","") + execution.setVariable("FH_request_action","") + execution.setVariable("FH_notification-url","") + execution.setVariable("FH_mso-bpel-name","") + execution.setVariable("FH_ErrorCode", "") + execution.setVariable("FH_ErrorMessage", "") + + execution.setVariable("FH_notification-url-Ok", false) + execution.setVariable("FH_request_id-Ok", false) + + //These variables are for Get Mso Aai Password Adapter + execution.setVariable("FH_deliveryStatus", true) + + //update Response Status to pending ...Adapter variables + execution.setVariable("FH_updateResponseStatusPayload", null) + execution.setVariable("FH_updateResponseStatusResponse", null) + + //update Request Gamma ...Adapter variables + execution.setVariable("FH_updateRequestGammaPayload", "") + execution.setVariable("FH_updateRequestGammaResponse", null) + execution.setVariable("FH_updateRequestGammaResponseCode", null) + + //update Request Infra ...Adapter variables + execution.setVariable("FH_updateRequestInfraPayload", "") + execution.setVariable("FH_updateRequestInfraResponse", null) + execution.setVariable("FH_updateRequestInfraResponseCode", null) + + //assign True to success variable + execution.setVariable("FH_success", true) + + //Set notify status to Failed variable + execution.setVariable("FH_NOTIFY_STATUS", "SUCCESS") + + //Set DB update variable + execution.setVariable("FH_updateRequestPayload", "") + execution.setVariable("FH_updateRequestResponse", null) + execution.setVariable("FH_updateRequestResponseCode", null) + + //Auth variables + execution.setVariable("BasicAuthHeaderValue","") + + //Parameter list + execution.setVariable("FH_parameterList", "") + + //Response variables + execution.setVariable("FalloutHandlerResponse","") + execution.setVariable("FH_ErrorResponse", null) + execution.setVariable("FH_ResponseCode", "") + + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method) + } + } + + public void preProcessRequest (DelegateExecution execution) { + def method = getClass().getSimpleName() + '.preProcessRequest(' +'execution=' + execution.getId() +')' + msoLogger.trace('Entered ' + method) + + // Initialize flow variables + initializeProcessVariables(execution) + setSuccessIndicator(execution, false) + + setBasicDBAuthHeader(execution, execution.getVariable('isDebugLogEnabled')) + + try { + def xml = execution.getVariable("FalloutHandlerRequest") + msoLogger.debug(" XML --> " + xml) + msoLogger.debug("FalloutHandler request: " + xml) + + //Check the incoming request type + //Incoming request can be ACTIVE_REQUESTS (request-information node) or INFRA_ACTIVE_REQUESTS (request-info node) + if (utils.nodeExists(xml, "request-information")) { + execution.setVariable("FH_request_id-Ok", true) // Incoming request is for ACTIVE_REQUESTS + } + + //Check notification-url for the incoming request type + //ACTIVE_REQUESTS may have notificationurl node + //INFRA_ACTIVE_REQUESTS notificationurl node does not exist + def notificationurl = "" + if (utils.nodeExists(xml, "notification-url")) { + notificationurl = utils.getNodeText(xml,"notification-url") + if(notificationurl != null && !notificationurl.isEmpty()) { + msoLogger.debug("********** Incoming notification Url is: " + notificationurl); + execution.setVariable("FH_notification-url-Ok", true) + execution.setVariable("FH_notification-url",notificationurl) + } + } + + //Check request_id for the incoming request type + //For INFRA_ACTIVE_REQUESTS payload request-id IS optional (Not sure why this is option since req id is primary key ... also tried exe through SOAP UI to check if MSO code handles null like auto generated seq not it does not) + //For ACTIVE_REQUESTS payload request-id is NOT optional + def request_id = "" + if (utils.nodeExists(xml, "request-id")) { + execution.setVariable("FH_request_id",utils.getNodeText(xml,"request-id")) + } + msoLogger.debug("FH_request_id: " + execution.getVariable("FH_request_id")) + + // INFRA_ACTIVE_REQUESTS have "action" element ... mandatory + // ACTIVE_REQUEST have "request-action" ... mandatory + if (utils.nodeExists(xml, "request-action")) { + execution.setVariable("FH_request_action",utils.getNodeText(xml,"request-action")) + } else if (utils.nodeExists(xml, "action")) { + execution.setVariable("FH_request_action",utils.getNodeText(xml,"action")) + } + + + //Check source for the incoming request type + //For INFRA_ACTIVE_REQUESTS payload source IS optional + //For ACTIVE_REQUESTS payload source is NOT optional + def source = "" + if (utils.nodeExists(xml, "source")) { + execution.setVariable("FH_source",utils.getNodeText(xml,"source")) + } + + //Check if ErrorCode node exists. If yes, initialize it from request xml, if no, it will stay with defaulf value already set in initializeProcessVariables() method above. + def errorCode = "" + if (utils.nodeExists(xml, "ErrorCode")) { + errorCode = utils.getNodeText(xml,"ErrorCode") + if(errorCode != null && !errorCode.isEmpty()) { + execution.setVariable("FH_ErrorCode", errorCode) + } + } + msoLogger.debug("FH_ErrorCode: " + errorCode) + + //Check if ErrorMessage node exists. If yes, initialize it from request xml, if no, it will stay with defaulf value already set in initializeProcessVariables() method above. + def errorMessage = "" + if (utils.nodeExists(xml, "ErrorMessage")) { + errorCode = utils.getNodeText(xml,"ErrorMessage") + if(errorCode != null && !errorCode.isEmpty()) { + errorCode = errorCode + execution.setVariable("FH_ErrorMessage", errorCode) + } + } + + //Check for Parameter List + if (utils.nodeExists(xml, "parameter-list")) { + def parameterList = utils.getNodeXml(xml, "parameter-list", false) + execution.setVariable("FH_parameterList", parameterList) + } + + msoLogger.trace("--> " + execution.getVariable("")) + msoLogger.debug("FH_request_id-OK --> " + execution.getVariable("FH_request_id-Ok")) + + // set the DHV/Service Instantiation values if specified in the request + execution.setVariable("FH_is_srv_inst_req", String.valueOf("true".equals(utils.getNodeText(xml, "is-srv-inst-req")))) + msoLogger.trace("--> " + execution.getVariable("")) + execution.setVariable("FH_is_json_content", String.valueOf("JSON".equals(utils.getNodeText(xml, "resp-content-type")))) + msoLogger.trace("--> " + execution.getVariable("")) + execution.setVariable("FH_service_inst_id", utils.getNodeText(xml, "service-instance-id")) + msoLogger.trace("--> " + execution.getVariable("")) + execution.setVariable("FH_start_time", utils.getNodeText(xml, "start-time")) + msoLogger.trace("--> " + execution.getVariable("")) + // this variable is used by the camunda flow to set the Content-Type for the async response + if (execution.getVariable("FH_is_srv_inst_req").equals("true") && + execution.getVariable("FH_is_json_content").equals("true")) { + execution.setVariable("FH_content_type", "application/json") + } else { + execution.setVariable("FH_content_type", "text/xml") + } + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in" + method) + } + + msoLogger.debug("OUTOF --> Initialize Variables Fallout Handler #########"); + } + + public String updateRequestPayload (DelegateExecution execution){ + def method = getClass().getSimpleName() + '.updateRequestPayload(' +'execution=' + execution.getId() +')' + msoLogger.trace('Entered ' + method) + + try { + String payload = """ + <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.onap.so/requestsdb"> + <soapenv:Header/> + <soapenv:Body> + <req:updateRequest> + <requestId>${MsoUtils.xmlEscape(execution.getVariable("FH_request_id"))}</requestId> + <lastModifiedBy>BPEL</lastModifiedBy> + <finalErrorMessage>${MsoUtils.xmlEscape(execution.getVariable("FH_ErrorMessage"))}</finalErrorMessage> + <finalErrorCode>${MsoUtils.xmlEscape(execution.getVariable("FH_ErrorCode"))}</finalErrorCode> + <status>FAILED</status> + <responseStatus>${MsoUtils.xmlEscape(execution.getVariable("FH_NOTIFY_STATUS"))}</responseStatus> + </req:updateRequest> + </soapenv:Body> + </soapenv:Envelope> + """ + + msoLogger.debug("updateRequestPayload: " + payload) + execution.setVariable("FH_updateRequestPayload", payload) + return execution.getVariable("FH_updateRequestPayload") + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method) + } + } + + public String updateRequestInfraPayload (DelegateExecution execution){ + def method = getClass().getSimpleName() + '.updateRequestInfraPayload(' +'execution=' + execution.getId() +')' + msoLogger.trace('Entered ' + method) + + try { + String payload = """ + <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.onap.so/requestsdb"> + <soapenv:Header/> + <soapenv:Body> + <req:updateInfraRequest> + <requestId>${MsoUtils.xmlEscape(execution.getVariable("FH_request_id"))}</requestId> + <lastModifiedBy>BPEL</lastModifiedBy> + <statusMessage>${MsoUtils.xmlEscape(execution.getVariable("FH_ErrorMessage"))}</statusMessage> + <requestStatus>FAILED</requestStatus> + <progress>100</progress> + </req:updateInfraRequest> + </soapenv:Body> + </soapenv:Envelope> + """ + + execution.setVariable("FH_updateRequestInfraPayload", payload) + msoLogger.debug("updateRequestInfraPayload: " + payload) + return execution.getVariable("FH_updateRequestInfraPayload") + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method) + } + } + + public String updateRequestGammaPayload (DelegateExecution execution){ + def method = getClass().getSimpleName() + '.updateRequestGammaPayload(' +'execution=' + execution.getId() +')' + msoLogger.trace('Entered ' + method) + + try { + String payload = """ + <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="${UrnPropertiesReader.getVariable("mso.default.adapter.namespace", execution)}/requestsdb"> + <soapenv:Header/> + <soapenv:Body> + <req:updateRequest> + <requestId>${MsoUtils.xmlEscape(execution.getVariable("FH_request_id"))}</requestId> + <lastModifiedBy>BPEL</lastModifiedBy> + <finalErrorMessage>${MsoUtils.xmlEscape(execution.getVariable("FH_ErrorMessage"))}</finalErrorMessage> + <finalErrorCode>${MsoUtils.xmlEscape(execution.getVariable("FH_ErrorCode"))}</finalErrorCode> + <status>FAILED</status> + </req:updateRequest> + </soapenv:Body> + </soapenv:Envelope> + """ + + execution.setVariable("FH_updateRequestGammaPayload", payload) + msoLogger.debug("updateRequestGammaPayload: " + payload) + return execution.getVariable("FH_updateRequestGammaPayload") + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method) + } + } + + public String updateResponseStatusPayload (DelegateExecution execution){ + def method = getClass().getSimpleName() + '.updateResponseStatusPayload(' +'execution=' + execution.getId() +')' + msoLogger.trace('Entered ' + method) + + try { + String payload = """ + <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.onap.so/requestsdb"> + <soapenv:Header/> + <soapenv:Body> + <req:updateResponseStatus> + <requestId>${MsoUtils.xmlEscape(execution.getVariable("FH_request_id"))}</requestId> + <lastModifiedBy>BPEL</lastModifiedBy> + <responseStatus>SENDING_FINAL_NOTIFY</responseStatus> + </req:updateResponseStatus> + </soapenv:Body> + </soapenv:Envelope> + """ + + execution.setVariable("FH_updateResponseStatusPayload", payload) + msoLogger.debug("updateResponseStatusPayload: " + payload) + return execution.getVariable("FH_updateResponseStatusPayload") + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method) + } + } + + public void buildDBWorkflowException(DelegateExecution execution, String responseCodeVariable) { + def method = getClass().getSimpleName() + '.buildDBWorkflowException(' + + 'execution=' + execution.getId() + + ', responseCodeVariable=' + responseCodeVariable + ')' + msoLogger.trace('Entered ' + method) + + try { + def responseCode = execution.getVariable(responseCodeVariable) + // If the HTTP response code was null, it means a connection fault occurred (a java exception) + def errorMessage = responseCode == null ? "Could not connect to DB Adapter" : "DB Adapter returned ${responseCode} response" + def errorCode = responseCode == null ? 7000 : 7020 + // exceptionUtil.buildWorkflowException(execution, errorCode, errorMessage) + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method) + } + } + + /** + * Used to create a workflow response in success and failure cases. + */ + public void postProcessResponse (DelegateExecution execution) { + def method = getClass().getSimpleName() + '.postProcessResponse(' +'execution=' + execution.getId() +')' + msoLogger.trace('Entered ' + method) + + try { + Boolean success = (Boolean) execution.getVariable("FH_success") + String out = success ? "Fallout Handler Succeeded" : "Fallout Handler Failed"; + + def falloutHandlerResponse = """ + <workflow:FalloutHandlerResponse xmlns:workflow="http://org.onap/so/workflow/schema/v1"> + <workflow:out>${MsoUtils.xmlEscape(out)}</workflow:out> + </workflow:FalloutHandlerResponse> + """ + + falloutHandlerResponse = utils.formatXml(falloutHandlerResponse) + msoLogger.debug("FalloutHandler Response: " + falloutHandlerResponse); + + execution.setVariable("FalloutHandlerResponse", falloutHandlerResponse) + execution.setVariable("WorkflowResponse", falloutHandlerResponse) + execution.setVariable("FH_ResponseCode", success ? "200" : "500") + setSuccessIndicator(execution, success) + + msoLogger.debug("FalloutHandlerResponse =\n" + falloutHandlerResponse) + } catch (Exception e) { + // Do NOT throw WorkflowException! + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + } + } }
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenerateVfModuleName.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy index 95c258f2a4..5cdcd0d5bf 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenerateVfModuleName.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy @@ -1,170 +1,173 @@ -/*-
- * ============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.common.scripts
-import java.io.Serializable;
-
-import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.springframework.web.util.UriUtils
-
-import org.openecomp.mso.bpmn.core.json.JsonUtils
-import org.openecomp.mso.bpmn.core.WorkflowException
-import org.openecomp.mso.rest.APIResponse;
-import org.openecomp.mso.rest.RESTClient
-import org.openecomp.mso.rest.RESTConfig
-
-public class GenerateVfModuleName extends AbstractServiceTaskProcessor{
-
- def Prefix="GVFMN_"
- ExceptionUtil exceptionUtil = new ExceptionUtil()
-
-
-
- public void preProcessRequest(DelegateExecution execution) {
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
-
- try {
- def vnfId = execution.getVariable("vnfId")
- utils.log("DEBUG", "vnfId is " + vnfId, isDebugEnabled)
- def vnfName = execution.getVariable("vnfName")
- utils.log("DEBUG", "vnfName is " + vnfName, isDebugEnabled)
- def vfModuleLabel = execution.getVariable("vfModuleLabel")
- utils.log("DEBUG", "vfModuleLabel is " + vfModuleLabel, isDebugEnabled)
- def personaModelId = execution.getVariable("personaModelId")
- utils.log("DEBUG", "personaModelId is " + personaModelId, isDebugEnabled)
- execution.setVariable("GVFMN_vfModuleXml", "")
- }catch(BpmnError b){
- throw b
- }catch(Exception e){
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error encountered in initVariables method!")
- }
- }
-
-
- public void queryAAI(DelegateExecution execution) {
- def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled")
- def method = getClass().getSimpleName() + '.queryAAI(' +
- 'execution=' + execution.getId() +
- ')'
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- try {
- def vnfId = execution.getVariable('vnfId')
- def personaModelId = execution.getVariable('personaModelId')
-
- AaiUtil aaiUriUtil = new AaiUtil(this)
- String aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution)
- logDebug('AAI URI is: ' + aai_uri, isDebugLogEnabled)
-
- String endPoint = execution.getVariable("URN_aai_endpoint") + "${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8") + "?depth=1"
- utils.logAudit("AAI endPoint: " + endPoint)
-
- try {
- RESTConfig config = new RESTConfig(endPoint);
- def responseData = ''
- def aaiRequestId = UUID.randomUUID().toString()
- RESTClient client = new RESTClient(config).
- addHeader('X-TransactionId', aaiRequestId).
- addHeader('X-FromAppId', 'MSO').
- addHeader('Content-Type', 'application/xml').
- addHeader('Accept','application/xml');
- logDebug('sending GET to AAI endpoint \'' + endPoint + '\'', isDebugLogEnabled)
- APIResponse response = client.httpGet()
- utils.logAudit("GenerateVfModuleName - invoking httpGet() to AAI")
-
- responseData = response.getResponseBodyAsString()
- if (responseData != null) {
- logDebug("Received generic VNF data: " + responseData, isDebugLogEnabled)
-
- }
-
- utils.logAudit("GenerateVfModuleName - queryAAIVfModule Response: " + responseData)
- utils.logAudit("GenerateVfModuleName - queryAAIVfModule ResponseCode: " + response.getStatusCode())
-
- execution.setVariable('GVFMN_queryAAIVfModuleResponseCode', response.getStatusCode())
- execution.setVariable('GVFMN_queryAAIVfModuleResponse', responseData)
- logDebug('Response code:' + response.getStatusCode(), isDebugLogEnabled)
- logDebug('Response:' + System.lineSeparator() + responseData, isDebugLogEnabled)
- if (response.getStatusCode() == 200) {
- // Set the VfModuleXML
- if (responseData != null) {
- String vfModulesText = utils.getNodeXml(responseData, "vf-modules")
- if (vfModulesText == null || vfModulesText.isEmpty()) {
- logDebug("There are no VF modules in this VNF yet", isDebugLogEnabled)
- execution.setVariable("GVFMN_vfModuleXml", null)
- }
- else {
- def xmlVfModules= new XmlSlurper().parseText(vfModulesText)
- def vfModules = xmlVfModules.'**'.findAll {it.name() == "vf-module"}
- int vfModulesSize = 0
- if (vfModules != null) {
- vfModulesSize = vfModules.size()
- }
- String matchingVfModules = "<vfModules>"
- for (i in 0..vfModulesSize-1) {
- def vfModuleXml = groovy.xml.XmlUtil.serialize(vfModules[i])
- def personaModelIdFromAAI = utils.getNodeText(vfModuleXml, "model-invariant-id")
- if (!personaModelIdFromAAI) {
- // check old attribute name
- personaModelIdFromAAI = utils.getNodeText(vfModuleXml, "persona-model-id")
- }
- if (personaModelIdFromAAI != null && personaModelIdFromAAI.equals(personaModelId)) {
- matchingVfModules = matchingVfModules + utils.removeXmlPreamble(vfModuleXml)
- }
- }
- matchingVfModules = matchingVfModules + "</vfModules>"
- logDebug("Matching VF Modules: " + matchingVfModules, isDebugLogEnabled)
- execution.setVariable("GVFMN_vfModuleXml", matchingVfModules)
- }
- }
- }
- } catch (Exception ex) {
- ex.printStackTrace()
- logDebug('Exception occurred while executing AAI GET:' + ex.getMessage(),isDebugLogEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'AAI GET Failed:' + ex.getMessage())
- }
- logDebug('Exited ' + method, isDebugLogEnabled)
- } catch (BpmnError e) {
- throw e;
- } catch (Exception e) {
- logError('Caught exception in ' + method, e)
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAI(): ' + e.getMessage())
- }
-
- }
-
- public void generateName (DelegateExecution execution) {
- def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled")
- def method = getClass().getSimpleName() + '.generateName() ' +
- 'execution=' + execution.getId() +
- ')'
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- String vfModuleXml = execution.getVariable("GVFMN_vfModuleXml")
-
- String moduleIndex = utils.getLowestUnusedIndex(vfModuleXml)
- logDebug("moduleIndex is: " + moduleIndex, isDebugLogEnabled)
- def vnfName = execution.getVariable("vnfName")
- def vfModuleLabel = execution.getVariable("vfModuleLabel")
- def vfModuleName = vnfName + "_" + vfModuleLabel + "_" + moduleIndex
- logDebug("vfModuleName is: " + vfModuleName, isDebugLogEnabled)
- execution.setVariable("vfModuleName", vfModuleName)
- }
-}
+/*- + * ============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.common.scripts + +import org.onap.so.bpmn.core.UrnPropertiesReader + +import java.io.Serializable; + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.springframework.web.util.UriUtils + +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.rest.APIResponse; +import org.onap.so.rest.RESTClient +import org.onap.so.rest.RESTConfig +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + +public class GenerateVfModuleName extends AbstractServiceTaskProcessor{ + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, GenerateVfModuleName.class); + + def Prefix="GVFMN_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + + + + public void preProcessRequest(DelegateExecution execution) { + try { + def vnfId = execution.getVariable("vnfId") + msoLogger.debug("vnfId is " + vnfId) + def vnfName = execution.getVariable("vnfName") + msoLogger.debug("vnfName is " + vnfName) + def vfModuleLabel = execution.getVariable("vfModuleLabel") + msoLogger.debug("vfModuleLabel is " + vfModuleLabel) + def personaModelId = execution.getVariable("personaModelId") + msoLogger.debug("personaModelId is " + personaModelId) + execution.setVariable("GVFMN_vfModuleXml", "") + }catch(BpmnError b){ + throw b + }catch(Exception e){ + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error encountered in initVariables method!") + } + } + + + public void queryAAI(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.queryAAI(' + + 'execution=' + execution.getId() + + ')' + msoLogger.trace('Entered ' + method) + + try { + def vnfId = execution.getVariable('vnfId') + def personaModelId = execution.getVariable('personaModelId') + + AaiUtil aaiUriUtil = new AaiUtil(this) + String aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution) + msoLogger.debug('AAI URI is: ' + aai_uri) + + String endPoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + "${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8") + "?depth=1" + msoLogger.debug("AAI endPoint: " + endPoint) + + try { + RESTConfig config = new RESTConfig(endPoint); + def responseData = '' + def aaiRequestId = UUID.randomUUID().toString() + RESTClient client = new RESTClient(config). + addHeader('X-TransactionId', aaiRequestId). + addHeader('X-FromAppId', 'MSO'). + addHeader('Content-Type', 'application/xml'). + addHeader('Accept','application/xml'); + msoLogger.debug('sending GET to AAI endpoint \'' + endPoint + '\'') + APIResponse response = client.httpGet() + msoLogger.debug("GenerateVfModuleName - invoking httpGet() to AAI") + + responseData = response.getResponseBodyAsString() + if (responseData != null) { + msoLogger.debug("Received generic VNF data: " + responseData) + + } + + msoLogger.debug("GenerateVfModuleName - queryAAIVfModule Response: " + responseData) + msoLogger.debug("GenerateVfModuleName - queryAAIVfModule ResponseCode: " + response.getStatusCode()) + + execution.setVariable('GVFMN_queryAAIVfModuleResponseCode', response.getStatusCode()) + execution.setVariable('GVFMN_queryAAIVfModuleResponse', responseData) + msoLogger.debug('Response code:' + response.getStatusCode()) + msoLogger.debug('Response:' + System.lineSeparator() + responseData) + if (response.getStatusCode() == 200) { + // Set the VfModuleXML + if (responseData != null) { + String vfModulesText = utils.getNodeXml(responseData, "vf-modules") + if (vfModulesText == null || vfModulesText.isEmpty()) { + msoLogger.debug("There are no VF modules in this VNF yet") + execution.setVariable("GVFMN_vfModuleXml", null) + } + else { + def xmlVfModules= new XmlSlurper().parseText(vfModulesText) + def vfModules = xmlVfModules.'**'.findAll {it.name() == "vf-module"} + int vfModulesSize = 0 + if (vfModules != null) { + vfModulesSize = vfModules.size() + } + String matchingVfModules = "<vfModules>" + for (i in 0..vfModulesSize-1) { + def vfModuleXml = groovy.xml.XmlUtil.serialize(vfModules[i]) + def personaModelIdFromAAI = utils.getNodeText(vfModuleXml, "model-invariant-id") + if (!personaModelIdFromAAI) { + // check old attribute name + personaModelIdFromAAI = utils.getNodeText(vfModuleXml, "persona-model-id") + } + if (personaModelIdFromAAI != null && personaModelIdFromAAI.equals(personaModelId)) { + matchingVfModules = matchingVfModules + utils.removeXmlPreamble(vfModuleXml) + } + } + matchingVfModules = matchingVfModules + "</vfModules>" + msoLogger.debug("Matching VF Modules: " + matchingVfModules) + execution.setVariable("GVFMN_vfModuleXml", matchingVfModules) + } + } + } + } catch (Exception ex) { + ex.printStackTrace() + msoLogger.debug('Exception occurred while executing AAI GET:' + ex.getMessage()) + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'AAI GET Failed:' + ex.getMessage()) + } + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAI(): ' + e.getMessage()) + } + + } + + public void generateName (DelegateExecution execution) { + def method = getClass().getSimpleName() + '.generateName() ' + + 'execution=' + execution.getId() + + ')' + msoLogger.trace('Entered ' + method) + + String vfModuleXml = execution.getVariable("GVFMN_vfModuleXml") + + String moduleIndex = utils.getLowestUnusedIndex(vfModuleXml) + msoLogger.debug("moduleIndex is: " + moduleIndex) + def vnfName = execution.getVariable("vnfName") + def vfModuleLabel = execution.getVariable("vfModuleLabel") + def vfModuleName = vnfName + "_" + vfModuleLabel + "_" + moduleIndex + msoLogger.debug("vfModuleName is: " + vfModuleName) + execution.setVariable("vfModuleName", vfModuleName) + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericGetService.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenericGetService.groovy index 3b380a9164..857df16772 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericGetService.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenericGetService.groovy @@ -1,471 +1,470 @@ -/*-
- * ============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.common.scripts
-
-import org.apache.commons.lang3.StringEscapeUtils
-import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.openecomp.mso.rest.APIResponse
-import org.springframework.web.util.UriUtils
-
-import static org.apache.commons.lang3.StringUtils.isBlank
-
-
-/**
- * This class supports the GenericGetService Sub Flow.
- * This Generic sub flow can be used by any flow for accomplishing
- * the goal of getting a Service-Instance or Service-Subscription (from AAI).
- * The calling flow must set the GENGS_type variable as "service-instance"
- * or "service-subscription".
- *
- * When using to Get a Service-Instance:
- * If the global-customer-id and service-type are not provided
- * this flow executes a query to get the service- Url using the
- * Service Id or Name (whichever is provided).
- *
- * When using to Get a Service-Subscription:
- * The global-customer-id and service-type must be
- * provided.
- *
- * Upon successful completion of this sub flow the
- * GENGS_SuccessIndicator will be true and the query response payload
- * will be set to GENGS_service. An MSOWorkflowException will
- * be thrown upon unsuccessful completion or if an error occurs
- * at any time during this sub flow. Please map variables
- * to the corresponding variable names below.
- *
- * Note - If this sub flow receives a Not Found (404) response
- * from AAI at any time this will be considered an acceptable
- * successful response however the GENGS_FoundIndicator
- * will be set to false. This variable will allow the calling flow
- * to distinguish between the two Success scenarios,
- * "Success where service- is found" and
- * "Success where service- is NOT found".
- *
- *
- * Variable Mapping Below:
- *
- * In Mapping Variables:
- * For Allotted-Resource:
- * @param - GENGS_allottedResourceId
- * @param - GENGS_type
- * @param (Optional) - GENGS_serviceInstanceId
- * @param (Optional) - GENGS_serviceType
- * @param (Optional) - GENGS_globalCustomerId
- *
- * For Service-Instance:
- * @param - GENGS_serviceInstanceId or @param - GENGS_serviceInstanceName
- * @param - GENGS_type
- * @param (Optional) - GENGS_serviceType
- * @param (Optional) - GENGS_globalCustomerId
- *
- * For Service-Subscription:
- * @param - GENGS_type
- * @param - GENGS_serviceType
- * @param - GENGS_globalCustomerId
- *
- *
- * Out Mapping Variables:
- * @param - GENGS_service
- * @param - GENGS_FoundIndicator
- * @param - WorkflowException
- */
-class GenericGetService extends AbstractServiceTaskProcessor{
-
- String Prefix = "GENGS_"
- ExceptionUtil exceptionUtil = new ExceptionUtil()
-
- /**
- * This method validates the incoming variables and
- * determines the subsequent event based on which
- * variables the calling flow provided.
- *
- * @param - execution
- *
- */
- public void preProcessRequest(DelegateExecution execution) {
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- execution.setVariable("prefix",Prefix)
- utils.log("DEBUG", " *** STARTED GenericGetService PreProcessRequest Process*** ", isDebugEnabled)
-
- execution.setVariable("GENGS_obtainObjectsUrl", false)
- execution.setVariable("GENGS_obtainServiceInstanceUrlByName", false)
- execution.setVariable("GENGS_SuccessIndicator", false)
- execution.setVariable("GENGS_FoundIndicator", false)
- execution.setVariable("GENGS_resourceLink", null)
- execution.setVariable("GENGS_siResourceLink", null)
-
- try{
- // Get Variables
- String allottedResourceId = execution.getVariable("GENGS_allottedResourceId")
- String serviceInstanceId = execution.getVariable("GENGS_serviceInstanceId")
- String serviceInstanceName = execution.getVariable("GENGS_serviceInstanceName")
- String serviceType = execution.getVariable("GENGS_serviceType")
- String globalCustomerId = execution.getVariable("GENGS_globalCustomerId")
- String type = execution.getVariable("GENGS_type")
-
- if(type != null){
- utils.log("DEBUG", "Incoming GENGS_type is: " + type, isDebugEnabled)
- if(type.equalsIgnoreCase("allotted-resource")){
- if(isBlank(allottedResourceId)){
- utils.log("DEBUG", "Incoming allottedResourceId is null. Allotted Resource Id is required to Get an allotted-resource.", isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming allottedResourceId is null. Allotted Resource Id is required to Get an allotted-resource.")
- }else{
- utils.log("DEBUG", "Incoming Allotted Resource Id is: " + allottedResourceId, isDebugEnabled)
- if(isBlank(globalCustomerId) || isBlank(serviceType) || isBlank(serviceInstanceId)){
- execution.setVariable("GENGS_obtainObjectsUrl", true)
- }else{
- utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled)
- utils.log("DEBUG", "Incoming Service Type is: " + serviceType, isDebugEnabled)
- utils.log("DEBUG", "Incoming Global Customer Id is: " + globalCustomerId, isDebugEnabled)
- }
- }
- }else if(type.equalsIgnoreCase("service-instance")){
- if(isBlank(serviceInstanceId) && isBlank(serviceInstanceName)){
- utils.log("DEBUG", "Incoming serviceInstanceId and serviceInstanceName are null. ServiceInstanceId or ServiceInstanceName is required to Get a service-instance.", isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming serviceInstanceId and serviceInstanceName are null. ServiceInstanceId or ServiceInstanceName is required to Get a service-instance.")
- }else{
- utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled)
- utils.log("DEBUG", "Incoming Service Instance Name is: " + serviceInstanceName, isDebugEnabled)
- if(isBlank(globalCustomerId) || isBlank(serviceType)){
- execution.setVariable("GENGS_obtainObjectsUrl", true)
- if(isBlank(serviceInstanceId)){
- execution.setVariable("GENGS_obtainServiceInstanceUrlByName", true)
- }
- }else{
- utils.log("DEBUG", "Incoming Global Customer Id is: " + globalCustomerId, isDebugEnabled)
- utils.log("DEBUG", "Incoming Service Type is: " + serviceType, isDebugEnabled)
- }
- }
- }else if(type.equalsIgnoreCase("service-subscription")){
- if(isBlank(serviceType) || isBlank(globalCustomerId)){
- utils.log("DEBUG", "Incoming ServiceType or GlobalCustomerId is null. These variables are required to Get a service-subscription.", isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming ServiceType or GlobalCustomerId is null. These variables are required to Get a service-subscription.")
- }else{
- utils.log("DEBUG", "Incoming Service Type is: " + serviceType, isDebugEnabled)
- utils.log("DEBUG", "Incoming Global Customer Id is: " + globalCustomerId, isDebugEnabled)
- }
- }else{
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Type is Invalid. Please Specify Type as service-instance or service-subscription")
- }
- }else{
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Incoming GENGS_type is null. Variable is Required.")
- }
-
- }catch(BpmnError b){
- utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled)
- throw b
- }catch(Exception e){
- utils.log("DEBUG", "Internal Error encountered within GenericGetService PreProcessRequest method!" + e, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in GenericGetService PreProcessRequest")
-
- }
- utils.log("DEBUG", "*** COMPLETED GenericGetService PreProcessRequest Process ***", isDebugEnabled)
- }
-
- /**
- * This method obtains the Url to the provided service instance
- * using the Service Instance Id.
- *
- * @param - execution
- */
- public void obtainServiceInstanceUrlById(DelegateExecution execution){
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- execution.setVariable("prefix",Prefix)
- utils.log("DEBUG", " *** STARTED GenericGetService ObtainServiceInstanceUrlById Process*** ", isDebugEnabled)
- try {
- AaiUtil aaiUriUtil = new AaiUtil(this)
- String aai_uri = aaiUriUtil.getSearchNodesQueryEndpoint(execution)
- String aai_endpoint = execution.getVariable("URN_aai_endpoint")
-
- String type = execution.getVariable("GENGS_type")
- String path = ""
- if(type.equalsIgnoreCase("service-instance")){
- String serviceInstanceId = execution.getVariable("GENGS_serviceInstanceId")
- utils.log("DEBUG", " Querying Node for Service-Instance URL by using Service-Instance Id: " + serviceInstanceId, isDebugEnabled)
- path = "${aai_uri}?search-node-type=service-instance&filter=service-instance-id:EQUALS:${serviceInstanceId}"
- utils.logAudit("Service Instance Node Query Url is: " + path)
- utils.log("DEBUG", "Service Instance Node Query Url is: " + path, isDebugEnabled)
- }else if(type.equalsIgnoreCase("allotted-resource")){
- String allottedResourceId = execution.getVariable("GENGS_allottedResourceId")
- utils.log("DEBUG", " Querying Node for Service-Instance URL by using Allotted Resource Id: " + allottedResourceId, isDebugEnabled)
- path = "${aai_uri}?search-node-type=allotted-resource&filter=id:EQUALS:${allottedResourceId}"
- utils.logAudit("Allotted Resource Node Query Url is: " + path)
- utils.log("DEBUG", "Allotted Resource Node Query Url is: " + path, isDebugEnabled)
- }
-
- //String url = "${aai_endpoint}${path}" host name needs to be removed from property
- String url = "${path}"
- execution.setVariable("GENGS_genericQueryPath", url)
-
- APIResponse response = aaiUriUtil.executeAAIGetCall(execution, url)
- int responseCode = response.getStatusCode()
- execution.setVariable("GENGS_genericQueryResponseCode", responseCode)
- utils.log("DEBUG", " GET Service Instance response code is: " + responseCode, isDebugEnabled)
- utils.logAudit("GenericGetService AAI GET Response Code: " + responseCode)
-
- String aaiResponse = response.getResponseBodyAsString()
- execution.setVariable("GENGS_obtainSIUrlResponseBeforeUnescaping", aaiResponse)
- utils.log("DEBUG", "GenericGetService AAI Response before unescaping: " + aaiResponse, isDebugEnabled)
- aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse)
- execution.setVariable("GENGS_genericQueryResponse", aaiResponse)
- utils.logAudit("GenericGetService AAI Response: " + aaiResponse)
- utils.log("DEBUG", "GenericGetService AAI Response: " + aaiResponse, isDebugEnabled)
-
- //Process Response
- if(responseCode == 200){
- utils.log("DEBUG", "Generic Query Received a Good Response Code", isDebugEnabled)
- execution.setVariable("GENGS_SuccessIndicator", true)
- if(utils.nodeExists(aaiResponse, "result-data")){
- utils.log("DEBUG", "Generic Query Response Does Contain Data" , isDebugEnabled)
- execution.setVariable("GENGS_FoundIndicator", true)
- String resourceLink = utils.getNodeText1(aaiResponse, "resource-link")
- execution.setVariable("GENGS_resourceLink", resourceLink)
- execution.setVariable("GENGS_siResourceLink", resourceLink)
- }else{
- utils.log("DEBUG", "Generic Query Response Does NOT Contains Data" , isDebugEnabled)
- execution.setVariable("WorkflowResponse", " ") //for junits
- }
- }else if(responseCode == 404){
- utils.log("DEBUG", "Generic Query Received a Not Found (404) Response", isDebugEnabled)
- execution.setVariable("GENGS_SuccessIndicator", true)
- execution.setVariable("WorkflowResponse", " ") //for junits
- }else{
- utils.log("DEBUG", "Generic Query Received a BAD REST Response: \n" + aaiResponse, isDebugEnabled)
- exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode)
- throw new BpmnError("MSOWorkflowException")
- }
- }catch(BpmnError b){
- utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled)
- throw b
- }catch(Exception e){
- utils.log("ERROR", " Error encountered within GenericGetService ObtainServiceInstanceUrlById method!" + e, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During ObtainServiceInstanceUrlById")
- }
- utils.log("DEBUG", " *** COMPLETED GenericGetService ObtainServiceInstanceUrlById Process*** ", isDebugEnabled)
- }
-
- /**
- * This method obtains the Url to the provided service instance
- * using the Service Instance Name.
- *
- * @param - execution
- */
- public void obtainServiceInstanceUrlByName(DelegateExecution execution){
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- execution.setVariable("prefix",Prefix)
- utils.log("DEBUG", " *** STARTED GenericGetService ObtainServiceInstanceUrlByName Process*** ", isDebugEnabled)
- try {
- String serviceInstanceName = execution.getVariable("GENGS_serviceInstanceName")
- utils.log("DEBUG", " Querying Node for Service-Instance URL by using Service-Instance Name " + serviceInstanceName, isDebugEnabled)
-
- AaiUtil aaiUriUtil = new AaiUtil(this)
- String aai_uri = aaiUriUtil.getSearchNodesQueryEndpoint(execution)
- String aai_endpoint = execution.getVariable("URN_aai_endpoint")
- String path = "${aai_uri}?search-node-type=service-instance&filter=service-instance-name:EQUALS:${serviceInstanceName}"
-
- //String url = "${aai_endpoint}${path}" host name needs to be removed from property
- String url = "${path}"
- execution.setVariable("GENGS_obtainSIUrlPath", url)
-
- utils.logAudit("GenericGetService AAI Endpoint: " + aai_endpoint)
- APIResponse response = aaiUriUtil.executeAAIGetCall(execution, url)
- int responseCode = response.getStatusCode()
- execution.setVariable("GENGS_obtainSIUrlResponseCode", responseCode)
- utils.log("DEBUG", " GET Service Instance response code is: " + responseCode, isDebugEnabled)
- utils.logAudit("GenericGetService AAI Response Code: " + responseCode)
-
- String aaiResponse = response.getResponseBodyAsString()
- aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse)
- execution.setVariable("GENGS_obtainSIUrlResponse", aaiResponse)
- utils.logAudit("GenericGetService AAI Response: " + aaiResponse)
- //Process Response
- if(responseCode == 200){
- utils.log("DEBUG", " Query for Service Instance Url Received a Good Response Code", isDebugEnabled)
- execution.setVariable("GENGS_SuccessIndicator", true)
- String globalCustomerId = execution.getVariable("GENGS_globalCustomerId")
- boolean nodeExists = isBlank(globalCustomerId) ? utils.nodeExists(aaiResponse, "result-data") : hasCustomerServiceInstance(aaiResponse, globalCustomerId)
- if(nodeExists){
- utils.log("DEBUG", "Query for Service Instance Url Response Does Contain Data" , isDebugEnabled)
- execution.setVariable("GENGS_FoundIndicator", true)
- String resourceLink = utils.getNodeText1(aaiResponse, "resource-link")
- execution.setVariable("GENGS_resourceLink", resourceLink)
- execution.setVariable("GENGS_siResourceLink", resourceLink)
- }else{
- utils.log("DEBUG", "Query for Service Instance Url Response Does NOT Contains Data" , isDebugEnabled)
- execution.setVariable("WorkflowResponse", " ") //for junits
- }
- }else if(responseCode == 404){
- utils.log("DEBUG", " Query for Service Instance Received a Not Found (404) Response", isDebugEnabled)
- execution.setVariable("GENGS_SuccessIndicator", true)
- execution.setVariable("WorkflowResponse", " ") //for junits
- }else{
- utils.log("DEBUG", "Query for Service Instance Received a BAD REST Response: \n" + aaiResponse, isDebugEnabled)
- exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode)
- throw new BpmnError("MSOWorkflowException")
- }
- }catch(BpmnError b){
- utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled)
- throw b
- }catch(Exception e){
- utils.log("ERROR", " Error encountered within GenericGetService ObtainServiceInstanceUrlByName method!" + e, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During ObtainServiceInstanceUrlByName")
- }
- utils.log("DEBUG", " *** COMPLETED GenericGetService ObtainServiceInstanceUrlByName Process*** ", isDebugEnabled)
- }
-
-
- /**
- * This method executes a GET call to AAI to obtain the
- * service-instance or service-subscription
- *
- * @param - execution
- */
- public void getServiceObject(DelegateExecution execution){
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- execution.setVariable("prefix",Prefix)
- utils.log("DEBUG", " *** STARTED GenericGetService GetServiceObject Process*** ", isDebugEnabled)
- try {
- String type = execution.getVariable("GENGS_type")
- AaiUtil aaiUriUtil = new AaiUtil(this)
- String aai_endpoint = execution.getVariable("URN_aai_endpoint")
- String serviceEndpoint = ""
-
- utils.logAudit("GenericGetService getServiceObject AAI Endpoint: " + aai_endpoint)
- if(type.equalsIgnoreCase("service-instance")){
- String siResourceLink = execution.getVariable("GENGS_resourceLink")
- if(isBlank(siResourceLink)){
- String serviceInstanceId = execution.getVariable("GENGS_serviceInstanceId")
- utils.log("DEBUG", " Incoming GENGS_serviceInstanceId is: " + serviceInstanceId, isDebugEnabled)
- String serviceType = execution.getVariable("GENGS_serviceType")
- utils.log("DEBUG", " Incoming GENGS_serviceType is: " + serviceType, isDebugEnabled)
- String globalCustomerId = execution.getVariable("GENGS_globalCustomerId")
- utils.log("DEBUG", "Incoming Global Customer Id is: " + globalCustomerId, isDebugEnabled)
-
- String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution)
- logDebug('AAI URI is: ' + aai_uri, isDebugEnabled)
- serviceEndpoint = "${aai_uri}/" + UriUtils.encode(globalCustomerId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + UriUtils.encode(serviceInstanceId,"UTF-8")
- }else{
- utils.log("DEBUG", "Incoming Service Instance Url is: " + siResourceLink, isDebugEnabled)
- String[] split = siResourceLink.split("/aai/")
- serviceEndpoint = "/aai/" + split[1]
- }
- }else if(type.equalsIgnoreCase("allotted-resource")){
- String siResourceLink = execution.getVariable("GENGS_resourceLink")
- if(isBlank(siResourceLink)){
- String allottedResourceId = execution.getVariable("GENGS_allottedResourceId")
- utils.log("DEBUG", " Incoming GENGS_allottedResourceId is: " + allottedResourceId, isDebugEnabled)
- String serviceInstanceId = execution.getVariable("GENGS_serviceInstanceId")
- utils.log("DEBUG", " Incoming GENGS_serviceInstanceId is: " + serviceInstanceId, isDebugEnabled)
- String serviceType = execution.getVariable("GENGS_serviceType")
- utils.log("DEBUG", " Incoming GENGS_serviceType is: " + serviceType, isDebugEnabled)
- String globalCustomerId = execution.getVariable("GENGS_globalCustomerId")
- utils.log("DEBUG", "Incoming Global Customer Id is: " + globalCustomerId, isDebugEnabled)
-
- String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution)
- logDebug('AAI URI is: ' + aai_uri, isDebugEnabled)
- serviceEndpoint = "${aai_uri}/" + UriUtils.encode(globalCustomerId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + UriUtils.encode(serviceInstanceId,"UTF-8") + "/allotted-resources/allotted-resource/" + UriUtils.encode(allottedResourceId,"UTF-8")
- }else{
- utils.log("DEBUG", "Incoming Allotted-Resource Url is: " + siResourceLink, isDebugEnabled)
- String[] split = siResourceLink.split("/aai/")
- serviceEndpoint = "/aai/" + split[1]
- }
- }else if(type.equalsIgnoreCase("service-subscription")){
- String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution)
- String globalCustomerId = execution.getVariable("GENGS_globalCustomerId")
- String serviceType = execution.getVariable("GENGS_serviceType")
- serviceEndpoint = "${aai_uri}/" + UriUtils.encode(globalCustomerId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8")
- }
-
- String serviceUrl = "${aai_endpoint}" + serviceEndpoint
-
- execution.setVariable("GENGS_getServiceUrl", serviceUrl)
- utils.log("DEBUG", "GET Service AAI Path is: \n" + serviceUrl, isDebugEnabled)
-
- APIResponse response = aaiUriUtil.executeAAIGetCall(execution, serviceUrl)
- int responseCode = response.getStatusCode()
- execution.setVariable("GENGS_getServiceResponseCode", responseCode)
- utils.log("DEBUG", " GET Service response code is: " + responseCode, isDebugEnabled)
- utils.logAudit("GenericGetService AAI Response Code: " + responseCode)
-
- String aaiResponse = response.getResponseBodyAsString()
- aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse)
- execution.setVariable("GENGS_getServiceResponse", aaiResponse)
- utils.logAudit("GenericGetService AAI Response: " + aaiResponse)
- aaiResponse = aaiResponse.replaceAll("&", "&")
- //Process Response
- if(responseCode == 200 || responseCode == 202){
- utils.log("DEBUG", "GET Service Received a Good Response Code", isDebugEnabled)
- if(utils.nodeExists(aaiResponse, "service-instance") || utils.nodeExists(aaiResponse, "service-subscription")){
- utils.log("DEBUG", "GET Service Response Contains a service-instance" , isDebugEnabled)
- execution.setVariable("GENGS_FoundIndicator", true)
- execution.setVariable("GENGS_service", aaiResponse)
- execution.setVariable("WorkflowResponse", aaiResponse)
-
- }else{
- utils.log("DEBUG", "GET Service Response Does NOT Contain Data" , isDebugEnabled)
- }
- }else if(responseCode == 404){
- utils.log("DEBUG", "GET Service Received a Not Found (404) Response", isDebugEnabled)
- execution.setVariable("WorkflowResponse", " ") //for junits
- }
- else{
- utils.log("DEBUG", " GET Service Received a Bad Response: \n" + aaiResponse, isDebugEnabled)
- exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode)
- throw new BpmnError("MSOWorkflowException")
- }
- }catch(BpmnError b){
- utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled)
- throw b
- }catch(Exception e){
- utils.log("DEBUG", " Error encountered within GenericGetService GetServiceObject method!" + e, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During GenericGetService")
- }
- utils.log("DEBUG", " *** COMPLETED GenericGetService GetServiceObject Process*** ", isDebugEnabled)
- }
-
- /**
- * An utility method which check whether a service(by name) is already present within a globalCustomerId or not.
- * @param jsonResponse raw response received from AAI by searching ServiceInstance by Name.
- * @param globalCustomerId
- * @return {@code true} if globalCustomerId is found at 6th position within "resource-link", {@code false} in any other cases.
- */
- public boolean hasCustomerServiceInstance(String aaiResponse, final String globalCustomerId) {
- if (isBlank(aaiResponse)) {
- return false
- }
- aaiResponse = utils.removeXmlNamespaces(aaiResponse)
- ArrayList<String> linksArray = utils.getMultNodeObjects(aaiResponse, "resource-link")
- if (linksArray == null || linksArray.size() == 0) {
- return false
- }
- for (String resourceLink : linksArray) {
- int custStart = resourceLink.indexOf("customer/")
- int custEnd = resourceLink.indexOf("/service-subscriptions/")
- String receivedCustomerId = resourceLink.substring(custStart + 9, custEnd)
- if (globalCustomerId.equals(receivedCustomerId)) {
- return true
- }
- }
- return false
- }
-
+/*- + * ============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.common.scripts + +import org.onap.so.bpmn.core.UrnPropertiesReader + +import org.apache.commons.lang3.StringEscapeUtils +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.rest.APIResponse +import org.springframework.web.util.UriUtils +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + +import static org.apache.commons.lang3.StringUtils.isBlank + + + +/** + * This class supports the GenericGetService Sub Flow. + * This Generic sub flow can be used by any flow for accomplishing + * the goal of getting a Service-Instance or Service-Subscription (from AAI). + * The calling flow must set the GENGS_type variable as "service-instance" + * or "service-subscription". + * + * When using to Get a Service-Instance: + * If the global-customer-id and service-type are not provided + * this flow executes a query to get the service- Url using the + * Service Id or Name (whichever is provided). + * + * When using to Get a Service-Subscription: + * The global-customer-id and service-type must be + * provided. + * + * Upon successful completion of this sub flow the + * GENGS_SuccessIndicator will be true and the query response payload + * will be set to GENGS_service. An MSOWorkflowException will + * be thrown upon unsuccessful completion or if an error occurs + * at any time during this sub flow. Please map variables + * to the corresponding variable names below. + * + * Note - If this sub flow receives a Not Found (404) response + * from AAI at any time this will be considered an acceptable + * successful response however the GENGS_FoundIndicator + * will be set to false. This variable will allow the calling flow + * to distinguish between the two Success scenarios, + * "Success where service- is found" and + * "Success where service- is NOT found". + * + * + * Variable Mapping Below: + * + * In Mapping Variables: + * For Allotted-Resource: + * @param - GENGS_allottedResourceId + * @param - GENGS_type + * @param (Optional) - GENGS_serviceInstanceId + * @param (Optional) - GENGS_serviceType + * @param (Optional) - GENGS_globalCustomerId + * + * For Service-Instance: + * @param - GENGS_serviceInstanceId or @param - GENGS_serviceInstanceName + * @param - GENGS_type + * @param (Optional) - GENGS_serviceType + * @param (Optional) - GENGS_globalCustomerId + * + * For Service-Subscription: + * @param - GENGS_type + * @param - GENGS_serviceType + * @param - GENGS_globalCustomerId + * + * + * Out Mapping Variables: + * @param - GENGS_service + * @param - GENGS_FoundIndicator + * @param - WorkflowException + */ +class GenericGetService extends AbstractServiceTaskProcessor{ + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, GenericGetService.class); + + + String Prefix = "GENGS_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + + /** + * This method validates the incoming variables and + * determines the subsequent event based on which + * variables the calling flow provided. + * + * @param - execution + * + */ + public void preProcessRequest(DelegateExecution execution) { + execution.setVariable("prefix",Prefix) + msoLogger.trace("STARTED GenericGetService PreProcessRequest Process") + + execution.setVariable("GENGS_obtainObjectsUrl", false) + execution.setVariable("GENGS_obtainServiceInstanceUrlByName", false) + execution.setVariable("GENGS_SuccessIndicator", false) + execution.setVariable("GENGS_FoundIndicator", false) + execution.setVariable("GENGS_resourceLink", null) + execution.setVariable("GENGS_siResourceLink", null) + + try{ + // Get Variables + String allottedResourceId = execution.getVariable("GENGS_allottedResourceId") + String serviceInstanceId = execution.getVariable("GENGS_serviceInstanceId") + String serviceInstanceName = execution.getVariable("GENGS_serviceInstanceName") + String serviceType = execution.getVariable("GENGS_serviceType") + String globalCustomerId = execution.getVariable("GENGS_globalCustomerId") + String type = execution.getVariable("GENGS_type") + + if(type != null){ + msoLogger.debug("Incoming GENGS_type is: " + type) + if(type.equalsIgnoreCase("allotted-resource")){ + if(isBlank(allottedResourceId)){ + msoLogger.debug("Incoming allottedResourceId is null. Allotted Resource Id is required to Get an allotted-resource.") + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming allottedResourceId is null. Allotted Resource Id is required to Get an allotted-resource.") + }else{ + msoLogger.debug("Incoming Allotted Resource Id is: " + allottedResourceId) + if(isBlank(globalCustomerId) || isBlank(serviceType) || isBlank(serviceInstanceId)){ + execution.setVariable("GENGS_obtainObjectsUrl", true) + }else{ + msoLogger.debug("Incoming Service Instance Id is: " + serviceInstanceId) + msoLogger.debug("Incoming Service Type is: " + serviceType) + msoLogger.debug("Incoming Global Customer Id is: " + globalCustomerId) + } + } + }else if(type.equalsIgnoreCase("service-instance")){ + if(isBlank(serviceInstanceId) && isBlank(serviceInstanceName)){ + msoLogger.debug("Incoming serviceInstanceId and serviceInstanceName are null. ServiceInstanceId or ServiceInstanceName is required to Get a service-instance.") + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming serviceInstanceId and serviceInstanceName are null. ServiceInstanceId or ServiceInstanceName is required to Get a service-instance.") + }else{ + msoLogger.debug("Incoming Service Instance Id is: " + serviceInstanceId) + msoLogger.debug("Incoming Service Instance Name is: " + serviceInstanceName) + if(isBlank(globalCustomerId) || isBlank(serviceType)){ + execution.setVariable("GENGS_obtainObjectsUrl", true) + if(isBlank(serviceInstanceId)){ + execution.setVariable("GENGS_obtainServiceInstanceUrlByName", true) + } + }else{ + msoLogger.debug("Incoming Global Customer Id is: " + globalCustomerId) + msoLogger.debug("Incoming Service Type is: " + serviceType) + } + } + }else if(type.equalsIgnoreCase("service-subscription")){ + if(isBlank(serviceType) || isBlank(globalCustomerId)){ + msoLogger.debug("Incoming ServiceType or GlobalCustomerId is null. These variables are required to Get a service-subscription.") + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming ServiceType or GlobalCustomerId is null. These variables are required to Get a service-subscription.") + }else{ + msoLogger.debug("Incoming Service Type is: " + serviceType) + msoLogger.debug("Incoming Global Customer Id is: " + globalCustomerId) + } + }else{ + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Type is Invalid. Please Specify Type as service-instance or service-subscription") + } + }else{ + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Incoming GENGS_type is null. Variable is Required.") + } + + }catch(BpmnError b){ + msoLogger.debug("Rethrowing MSOWorkflowException") + throw b + }catch(Exception e){ + msoLogger.debug("Internal Error encountered within GenericGetService PreProcessRequest method!" + e) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in GenericGetService PreProcessRequest") + + } + msoLogger.trace("COMPLETED GenericGetService PreProcessRequest Process ") + } + + /** + * This method obtains the Url to the provided service instance + * using the Service Instance Id. + * + * @param - execution + */ + public void obtainServiceInstanceUrlById(DelegateExecution execution){ + execution.setVariable("prefix",Prefix) + msoLogger.trace("STARTED GenericGetService ObtainServiceInstanceUrlById Process") + try { + AaiUtil aaiUriUtil = new AaiUtil(this) + String aai_uri = aaiUriUtil.getSearchNodesQueryEndpoint(execution) + String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + + String type = execution.getVariable("GENGS_type") + String path = "" + if(type.equalsIgnoreCase("service-instance")){ + String serviceInstanceId = execution.getVariable("GENGS_serviceInstanceId") + msoLogger.debug(" Querying Node for Service-Instance URL by using Service-Instance Id: " + serviceInstanceId) + path = "${aai_uri}?search-node-type=service-instance&filter=service-instance-id:EQUALS:${serviceInstanceId}" + msoLogger.debug("Service Instance Node Query Url is: " + path) + msoLogger.debug("Service Instance Node Query Url is: " + path) + }else if(type.equalsIgnoreCase("allotted-resource")){ + String allottedResourceId = execution.getVariable("GENGS_allottedResourceId") + msoLogger.debug(" Querying Node for Service-Instance URL by using Allotted Resource Id: " + allottedResourceId) + path = "${aai_uri}?search-node-type=allotted-resource&filter=id:EQUALS:${allottedResourceId}" + msoLogger.debug("Allotted Resource Node Query Url is: " + path) + msoLogger.debug("Allotted Resource Node Query Url is: " + path) + } + + //String url = "${aai_endpoint}${path}" host name needs to be removed from property + String url = "${path}" + execution.setVariable("GENGS_genericQueryPath", url) + + APIResponse response = aaiUriUtil.executeAAIGetCall(execution, url) + int responseCode = response.getStatusCode() + execution.setVariable("GENGS_genericQueryResponseCode", responseCode) + msoLogger.debug(" GET Service Instance response code is: " + responseCode) + msoLogger.debug("GenericGetService AAI GET Response Code: " + responseCode) + + String aaiResponse = response.getResponseBodyAsString() + execution.setVariable("GENGS_obtainSIUrlResponseBeforeUnescaping", aaiResponse) + msoLogger.debug("GenericGetService AAI Response before unescaping: " + aaiResponse) + execution.setVariable("GENGS_genericQueryResponse", aaiResponse) + msoLogger.debug("GenericGetService AAI Response: " + aaiResponse) + msoLogger.debug("GenericGetService AAI Response: " + aaiResponse) + + //Process Response + if(responseCode == 200){ + msoLogger.debug("Generic Query Received a Good Response Code") + execution.setVariable("GENGS_SuccessIndicator", true) + if(utils.nodeExists(aaiResponse, "result-data")){ + msoLogger.debug("Generic Query Response Does Contain Data" ) + execution.setVariable("GENGS_FoundIndicator", true) + String resourceLink = utils.getNodeText(aaiResponse, "resource-link") + execution.setVariable("GENGS_resourceLink", resourceLink) + execution.setVariable("GENGS_siResourceLink", resourceLink) + }else{ + msoLogger.debug("Generic Query Response Does NOT Contains Data" ) + execution.setVariable("WorkflowResponse", " ") //for junits + } + }else if(responseCode == 404){ + msoLogger.debug("Generic Query Received a Not Found (404) Response") + execution.setVariable("GENGS_SuccessIndicator", true) + execution.setVariable("WorkflowResponse", " ") //for junits + }else{ + msoLogger.debug("Generic Query Received a BAD REST Response: \n" + aaiResponse) + exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) + throw new BpmnError("MSOWorkflowException") + } + }catch(BpmnError b){ + msoLogger.debug("Rethrowing MSOWorkflowException") + throw b + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Error encountered within GenericGetService ObtainServiceInstanceUrlById method!" + e, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During ObtainServiceInstanceUrlById") + } + msoLogger.trace("COMPLETED GenericGetService ObtainServiceInstanceUrlById Process") + } + + /** + * This method obtains the Url to the provided service instance + * using the Service Instance Name. + * + * @param - execution + */ + public void obtainServiceInstanceUrlByName(DelegateExecution execution){ + execution.setVariable("prefix",Prefix) + msoLogger.trace("STARTED GenericGetService ObtainServiceInstanceUrlByName Process") + try { + String serviceInstanceName = execution.getVariable("GENGS_serviceInstanceName") + msoLogger.debug(" Querying Node for Service-Instance URL by using Service-Instance Name " + serviceInstanceName) + + AaiUtil aaiUriUtil = new AaiUtil(this) + String aai_uri = aaiUriUtil.getSearchNodesQueryEndpoint(execution) + String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + String path = "${aai_uri}?search-node-type=service-instance&filter=service-instance-name:EQUALS:${serviceInstanceName}" + + //String url = "${aai_endpoint}${path}" host name needs to be removed from property + String url = "${path}" + execution.setVariable("GENGS_obtainSIUrlPath", url) + + msoLogger.debug("GenericGetService AAI Endpoint: " + aai_endpoint) + APIResponse response = aaiUriUtil.executeAAIGetCall(execution, url) + int responseCode = response.getStatusCode() + execution.setVariable("GENGS_obtainSIUrlResponseCode", responseCode) + msoLogger.debug(" GET Service Instance response code is: " + responseCode) + msoLogger.debug("GenericGetService AAI Response Code: " + responseCode) + + String aaiResponse = response.getResponseBodyAsString() + execution.setVariable("GENGS_obtainSIUrlResponse", aaiResponse) + msoLogger.debug("GenericGetService AAI Response: " + aaiResponse) + //Process Response + if(responseCode == 200){ + msoLogger.debug(" Query for Service Instance Url Received a Good Response Code") + execution.setVariable("GENGS_SuccessIndicator", true) + String globalCustomerId = execution.getVariable("GENGS_globalCustomerId") + boolean nodeExists = isBlank(globalCustomerId) ? utils.nodeExists(aaiResponse, "result-data") : hasCustomerServiceInstance(aaiResponse, globalCustomerId) + if(nodeExists){ + msoLogger.debug("Query for Service Instance Url Response Does Contain Data" ) + execution.setVariable("GENGS_FoundIndicator", true) + String resourceLink = utils.getNodeText(aaiResponse, "resource-link") + execution.setVariable("GENGS_resourceLink", resourceLink) + execution.setVariable("GENGS_siResourceLink", resourceLink) + }else{ + msoLogger.debug("Query for Service Instance Url Response Does NOT Contains Data" ) + execution.setVariable("WorkflowResponse", " ") //for junits + } + }else if(responseCode == 404){ + msoLogger.debug(" Query for Service Instance Received a Not Found (404) Response") + execution.setVariable("GENGS_SuccessIndicator", true) + execution.setVariable("WorkflowResponse", " ") //for junits + }else{ + msoLogger.debug("Query for Service Instance Received a BAD REST Response: \n" + aaiResponse) + exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) + throw new BpmnError("MSOWorkflowException") + } + }catch(BpmnError b){ + msoLogger.debug("Rethrowing MSOWorkflowException") + throw b + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Error encountered within GenericGetService ObtainServiceInstanceUrlByName method!" + e, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During ObtainServiceInstanceUrlByName") + } + msoLogger.trace("COMPLETED GenericGetService ObtainServiceInstanceUrlByName Process") + } + + + /** + * This method executes a GET call to AAI to obtain the + * service-instance or service-subscription + * + * @param - execution + */ + public void getServiceObject(DelegateExecution execution){ + execution.setVariable("prefix",Prefix) + msoLogger.trace("STARTED GenericGetService GetServiceObject Process") + try { + String type = execution.getVariable("GENGS_type") + AaiUtil aaiUriUtil = new AaiUtil(this) + String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + String serviceEndpoint = "" + + msoLogger.debug("GenericGetService getServiceObject AAI Endpoint: " + aai_endpoint) + if(type.equalsIgnoreCase("service-instance")){ + String siResourceLink = execution.getVariable("GENGS_resourceLink") + if(isBlank(siResourceLink)){ + String serviceInstanceId = execution.getVariable("GENGS_serviceInstanceId") + msoLogger.debug(" Incoming GENGS_serviceInstanceId is: " + serviceInstanceId) + String serviceType = execution.getVariable("GENGS_serviceType") + msoLogger.debug(" Incoming GENGS_serviceType is: " + serviceType) + String globalCustomerId = execution.getVariable("GENGS_globalCustomerId") + msoLogger.debug("Incoming Global Customer Id is: " + globalCustomerId) + + String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) + msoLogger.debug('AAI URI is: ' + aai_uri) + serviceEndpoint = "${aai_uri}/" + UriUtils.encode(globalCustomerId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + UriUtils.encode(serviceInstanceId,"UTF-8") + }else{ + msoLogger.debug("Incoming Service Instance Url is: " + siResourceLink) + String[] split = siResourceLink.split("/aai/") + serviceEndpoint = "/aai/" + split[1] + } + }else if(type.equalsIgnoreCase("allotted-resource")){ + String siResourceLink = execution.getVariable("GENGS_resourceLink") + if(isBlank(siResourceLink)){ + String allottedResourceId = execution.getVariable("GENGS_allottedResourceId") + msoLogger.debug(" Incoming GENGS_allottedResourceId is: " + allottedResourceId) + String serviceInstanceId = execution.getVariable("GENGS_serviceInstanceId") + msoLogger.debug(" Incoming GENGS_serviceInstanceId is: " + serviceInstanceId) + String serviceType = execution.getVariable("GENGS_serviceType") + msoLogger.debug(" Incoming GENGS_serviceType is: " + serviceType) + String globalCustomerId = execution.getVariable("GENGS_globalCustomerId") + msoLogger.debug("Incoming Global Customer Id is: " + globalCustomerId) + + String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) + msoLogger.debug('AAI URI is: ' + aai_uri) + serviceEndpoint = "${aai_uri}/" + UriUtils.encode(globalCustomerId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + UriUtils.encode(serviceInstanceId,"UTF-8") + "/allotted-resources/allotted-resource/" + UriUtils.encode(allottedResourceId,"UTF-8") + }else{ + msoLogger.debug("Incoming Allotted-Resource Url is: " + siResourceLink) + String[] split = siResourceLink.split("/aai/") + serviceEndpoint = "/aai/" + split[1] + } + }else if(type.equalsIgnoreCase("service-subscription")){ + String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) + String globalCustomerId = execution.getVariable("GENGS_globalCustomerId") + String serviceType = execution.getVariable("GENGS_serviceType") + serviceEndpoint = "${aai_uri}/" + UriUtils.encode(globalCustomerId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + } + + String serviceUrl = "${aai_endpoint}" + serviceEndpoint + + execution.setVariable("GENGS_getServiceUrl", serviceUrl) + msoLogger.debug("GET Service AAI Path is: \n" + serviceUrl) + + APIResponse response = aaiUriUtil.executeAAIGetCall(execution, serviceUrl) + int responseCode = response.getStatusCode() + execution.setVariable("GENGS_getServiceResponseCode", responseCode) + msoLogger.debug(" GET Service response code is: " + responseCode) + msoLogger.debug("GenericGetService AAI Response Code: " + responseCode) + + String aaiResponse = response.getResponseBodyAsString() + execution.setVariable("GENGS_getServiceResponse", aaiResponse) + msoLogger.debug("GenericGetService AAI Response: " + aaiResponse) + //Process Response + if(responseCode == 200 || responseCode == 202){ + msoLogger.debug("GET Service Received a Good Response Code") + if(utils.nodeExists(aaiResponse, "service-instance") || utils.nodeExists(aaiResponse, "service-subscription")){ + msoLogger.debug("GET Service Response Contains a service-instance" ) + execution.setVariable("GENGS_FoundIndicator", true) + execution.setVariable("GENGS_service", aaiResponse) + execution.setVariable("WorkflowResponse", aaiResponse) + + }else{ + msoLogger.debug("GET Service Response Does NOT Contain Data" ) + } + }else if(responseCode == 404){ + msoLogger.debug("GET Service Received a Not Found (404) Response") + execution.setVariable("WorkflowResponse", " ") //for junits + } + else{ + msoLogger.debug(" GET Service Received a Bad Response: \n" + aaiResponse) + exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) + throw new BpmnError("MSOWorkflowException") + } + }catch(BpmnError b){ + msoLogger.debug("Rethrowing MSOWorkflowException") + throw b + }catch(Exception e){ + msoLogger.debug(" Error encountered within GenericGetService GetServiceObject method!" + e) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During GenericGetService") + } + msoLogger.trace("COMPLETED GenericGetService GetServiceObject Process") + } + + /** + * An utility method which check whether a service(by name) is already present within a globalCustomerId or not. + * @param jsonResponse raw response received from AAI by searching ServiceInstance by Name. + * @param globalCustomerId + * @return {@code true} if globalCustomerId is found at 6th position within "resource-link", {@code false} in any other cases. + */ + public boolean hasCustomerServiceInstance(String aaiResponse, final String globalCustomerId) { + if (isBlank(aaiResponse)) { + return false + } + aaiResponse = utils.removeXmlNamespaces(aaiResponse) + ArrayList<String> linksArray = utils.getMultNodeObjects(aaiResponse, "resource-link") + if (linksArray == null || linksArray.size() == 0) { + return false + } + for (String resourceLink : linksArray) { + int custStart = resourceLink.indexOf("customer/") + int custEnd = resourceLink.indexOf("/service-subscriptions/") + String receivedCustomerId = resourceLink.substring(custStart + 9, custEnd) + if (globalCustomerId.equals(receivedCustomerId)) { + return true + } + } + return false + } + }
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericGetVnf.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenericGetVnf.groovy index 1e181a6ee9..01d8e9b8d5 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericGetVnf.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenericGetVnf.groovy @@ -1,273 +1,275 @@ -/*-
- * ============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.common.scripts
-
-import static org.openecomp.mso.bpmn.common.scripts.GenericUtils.*;
-
-import org.apache.commons.lang3.*
-import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.openecomp.mso.rest.APIResponse
-import org.springframework.web.util.UriUtils
-
-
-/**
- * TODO: Support getting vnf type = vpe
- *
- * This class supports the GenericGetVnf Sub Flow.
- * This Generic sub flow can be used by any flow for accomplishing
- * the goal of getting a Vnf Object (from AAI). The flow currently
- * supports the querying of 2 types of Vnfs, generic-vnf and vce. The
- * type must be provided by the calling flow and the type should
- * be mapped to the variable GENGV_type. The type should either be
- * "generic-vnf" or "vce". If the Vnf Id is not provided by the calling
- * flow then this sub flow will execute the query to get the
- * Vnf using the Vnf Name. Therefore, the calling flow must provide
- * either the Vnf Id or Vnf Name.
- *
- * Upon successful completion of this sub flow the
- * GENGV_SuccessIndicator will be true and the query response payload
- * will be set to GENGV_vnf. An MSOWorkflowException will
- * be thrown upon unsuccessful completion or if an error occurs
- * at any time during this sub flow. Please map variables
- * to the corresponding variable names below.
- *
- * Note - if this sub flow receives a Not Found (404) response
- * from AAI at any time this will be considered an acceptable
- * successful response however the GENGV_FoundIndicator
- * set to false. This will allow the calling flow to distinguish
- * between the two success scenarios, "Success where Vnf is found"
- * and "Success where Vnf is NOT found".
- *
- *
- * Variable Mapping Below
- *
- * In Mapping Variables:
- * @param - GENGV_vnfId or @param - GENGV_vnfName
- * @param - GENGV_type
- *
- * Out Mapping Variables:
- * @param - GENGV_vnf
- * @param - GENGV_SuccessIndicator
- * @param - GENGV_FoundIndicator
- * @param - WorkflowException
- *
- *
- */
-class GenericGetVnf extends AbstractServiceTaskProcessor{
-
- String Prefix = "GENGV_"
- ExceptionUtil exceptionUtil = new ExceptionUtil()
-
- /**
- * This method validates the incoming variables and
- * determines the subsequent event based on which
- * variables the calling flow provided.
- *
- * @param - execution
- */
- public void preProcessRequest(DelegateExecution execution) {
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- execution.setVariable("prefix",Prefix)
- utils.log("DEBUG", " *** STARTED GenericGetVnf PreProcessRequest Process*** ", isDebugEnabled)
-
- execution.setVariable("GENGV_getVnfByName", false)
- execution.setVariable("GENGV_SuccessIndicator", false)
- execution.setVariable("GENGV_FoundIndicator", false)
-
- try{
- // Get Variables
- String vnfId = execution.getVariable("GENGV_vnfId")
- utils.log("DEBUG", "Incoming Vnf Id is: " + vnfId, isDebugEnabled)
- String vnfName = execution.getVariable("GENGV_vnfName")
- utils.log("DEBUG", "Incoming Vnf Name is: " + vnfName, isDebugEnabled)
-
- if(isBlank(vnfId) && isBlank(vnfName)){
- utils.log("DEBUG", "Incoming Vnf Name and Vnf Id are null. At least one is required!", isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Vnf Name and Vnf Id are null. At least one is required.")
- }else{
- if(isBlank(vnfId)){
- execution.setVariable("GENGV_getVnfByName", true)
- }
- }
-
- }catch(BpmnError b){
- utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled)
- throw b
- }catch(Exception e){
- utils.log("DEBUG", " Error encountered within GenericGetVnf PreProcessRequest method!" + e, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in GenericGetVnf PreProcessRequest")
-
- }
- utils.log("DEBUG", "*** COMPLETED GenericGetVnf PreProcessRequest Process ***", isDebugEnabled)
- }
-
- /**
- * This method executes a GET call to AAI to obtain the
- * Vnf using the Vnf Name
- *
- * @param - execution
- */
- public void getVnfByName(DelegateExecution execution){
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- execution.setVariable("prefix",Prefix)
- utils.log("DEBUG", " *** STARTED GenericGetVnf GetVnfByName Process*** ", isDebugEnabled)
- try {
- String vnfName = execution.getVariable("GENGV_vnfName")
- utils.log("DEBUG", "Getting Vnf by Vnf Name: " + vnfName, isDebugEnabled)
- String type = execution.getVariable("GENGV_type")
- utils.log("DEBUG", "Type of Vnf Getting is: " + type, isDebugEnabled)
-
- String aai_endpoint = execution.getVariable("URN_aai_endpoint")
- AaiUtil aaiUriUtil = new AaiUtil(this)
-
- //Determine Type of Vnf Querying For.
- def aai_uri = ""
- if(type.equals("generic-vnf")){
- aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution)
- }else if(type.equals("vce")){
- aai_uri = aaiUriUtil.getNetworkVceUri(execution)
- }else{
- utils.log("DEBUG", "Invalid Incoming GENGV_type", isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Invalid Incoming GENGV_type")
- }
-
- String getVnfPath = "${aai_endpoint}${aai_uri}?vnf-name=" + UriUtils.encode(vnfName, "UTF-8") + "&depth=1"
-
- execution.setVariable("GENGV_getVnfPath", getVnfPath)
- utils.logAudit("Get Vnf Url is: " + getVnfPath)
-
- APIResponse response = aaiUriUtil.executeAAIGetCall(execution, getVnfPath)
- int responseCode = response.getStatusCode()
- execution.setVariable("GENGV_getVnfResponseCode", responseCode)
- utils.log("DEBUG", " GET Vnf response code is: " + responseCode, isDebugEnabled)
-
- String aaiResponse = response.getResponseBodyAsString()
- aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse)
- execution.setVariable("GENGV_getVnfResponse", aaiResponse)
-
- //Process Response
- if(responseCode == 200){
- utils.log("DEBUG", "GET Vnf Received a Good Response", isDebugEnabled)
- if(utils.nodeExists(aaiResponse, type)){
- utils.log("DEBUG", "GET Vnf Response Contains a Vnf", isDebugEnabled)
- execution.setVariable("GENGV_FoundIndicator", true)
- execution.setVariable("GENGV_vnf", aaiResponse)
- execution.setVariable("WorkflowResponse", aaiResponse)
- }else{
- utils.log("DEBUG", "GET Vnf Response Does NOT Contain a Vnf", isDebugEnabled)
- }
-
- }else if(responseCode == 404){
- utils.log("DEBUG", "GET Vnf Received a Not Found (404) Response", isDebugEnabled)
- }else{
- utils.log("DEBUG", "GET Vnf Received a Bad Response: \n" + aaiResponse, isDebugEnabled)
- exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode)
- throw new BpmnError("MSOWorkflowException")
- }
- }catch(BpmnError b){
- utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled)
- throw b
- }catch(Exception e){
- utils.log("ERROR", " Error encountered within GenericGetVnf GetVnfByName method!" + e, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During GetVnfByName")
- }
- utils.log("DEBUG", " *** COMPLETED GenericGetVnf GetVnfByName Process*** ", isDebugEnabled)
- }
-
- /**
- * This method executes a GET call to AAI to obtain the
- * Vnf using the Vnf Id
- *
- * @param - execution
- */
- public void getVnfById(DelegateExecution execution){
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- execution.setVariable("prefix",Prefix)
- utils.log("DEBUG", " *** STARTED GenericGetVnf GetVnfById Process*** ", isDebugEnabled)
- try {
- String vnfId = execution.getVariable("GENGV_vnfId")
- utils.log("DEBUG", "Getting Vnf by Vnf Id: " + vnfId, isDebugEnabled)
- String type = execution.getVariable("GENGV_type")
- utils.log("DEBUG", "Type of Vnf Getting is: " + type, isDebugEnabled)
-
- String aai_endpoint = execution.getVariable("URN_aai_endpoint")
- AaiUtil aaiUriUtil = new AaiUtil(this)
-
- //Determine Type of Vnf Querying For.
- def aai_uri = ""
- if(type.equals("generic-vnf")){
- aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution)
- }else if(type.equals("vce")){
- aai_uri = aaiUriUtil.getNetworkVceUri(execution)
- }else if(type.equals("vpe")){
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, "GenericGetVnf does not yet support getting type of vnf = vpe")
- }else{
- utils.log("DEBUG", "Invalid Incoming GENGV_type", isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Invalid Incoming GENGV_type")
- }
- utils.log("DEBUG", "Using AAI Uri: " + aai_uri, isDebugEnabled)
-
- String getVnfPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8") + "?depth=1"
- utils.log("DEBUG", "GET Vnf Endpoint is: " + getVnfPath, isDebugEnabled)
-
- execution.setVariable("GENGV_getVnfPath", getVnfPath)
- utils.logAudit("Get Vnf Url is: " + getVnfPath)
-
- APIResponse response = aaiUriUtil.executeAAIGetCall(execution, getVnfPath)
- int responseCode = response.getStatusCode()
- execution.setVariable("GENGV_getVnfResponseCode", responseCode)
- utils.log("DEBUG", " GET Vnf response code is: " + responseCode, isDebugEnabled)
-
- String aaiResponse = response.getResponseBodyAsString()
- aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse)
- execution.setVariable("GENGV_getVnfResponse", aaiResponse)
-
- //Process Response
- if(responseCode == 200){
- utils.log("DEBUG", "GET Vnf Received a Good Response", isDebugEnabled)
- if(utils.nodeExists(aaiResponse, type)){
- utils.log("DEBUG", "GET Vnf Response Contains a Vnf", isDebugEnabled)
- execution.setVariable("GENGV_FoundIndicator", true)
- execution.setVariable("GENGV_vnf", aaiResponse)
- execution.setVariable("WorkflowResponse", aaiResponse)
- }else{
- utils.log("DEBUG", "GET Vnf Response Does NOT Contain a Vnf", isDebugEnabled)
- }
-
- }else if(responseCode == 404){
- utils.log("DEBUG", "GET Vnf Received a Not Found (404) Response", isDebugEnabled)
- }else{
- utils.log("DEBUG", "GET Vnf Received a BAD REST Response: \n" + aaiResponse, isDebugEnabled)
- exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode)
- throw new BpmnError("MSOWorkflowException")
- }
- }catch(BpmnError b){
- utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled)
- throw b
- }catch(Exception e){
- utils.log("ERROR", " Error encountered within GenericGetVnf GetVnfById method!" + e, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During GetVnfById")
- }
- utils.log("DEBUG", " *** COMPLETED GenericGetVnf GetVnfById Process*** ", isDebugEnabled)
- }
-
-}
+/*- + * ============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.common.scripts + +import org.onap.so.bpmn.core.UrnPropertiesReader +import static org.onap.so.bpmn.common.scripts.GenericUtils.*; + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.rest.APIResponse +import org.springframework.web.util.UriUtils +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + + + + +/** + * TODO: Support getting vnf type = vpe + * + * This class supports the GenericGetVnf Sub Flow. + * This Generic sub flow can be used by any flow for accomplishing + * the goal of getting a Vnf Object (from AAI). The flow currently + * supports the querying of 2 types of Vnfs, generic-vnf and vce. The + * type must be provided by the calling flow and the type should + * be mapped to the variable GENGV_type. The type should either be + * "generic-vnf" or "vce". If the Vnf Id is not provided by the calling + * flow then this sub flow will execute the query to get the + * Vnf using the Vnf Name. Therefore, the calling flow must provide + * either the Vnf Id or Vnf Name. + * + * Upon successful completion of this sub flow the + * GENGV_SuccessIndicator will be true and the query response payload + * will be set to GENGV_vnf. An MSOWorkflowException will + * be thrown upon unsuccessful completion or if an error occurs + * at any time during this sub flow. Please map variables + * to the corresponding variable names below. + * + * Note - if this sub flow receives a Not Found (404) response + * from AAI at any time this will be considered an acceptable + * successful response however the GENGV_FoundIndicator + * set to false. This will allow the calling flow to distinguish + * between the two success scenarios, "Success where Vnf is found" + * and "Success where Vnf is NOT found". + * + * + * Variable Mapping Below + * + * In Mapping Variables: + * @param - GENGV_vnfId or @param - GENGV_vnfName + * @param - GENGV_type + * + * Out Mapping Variables: + * @param - GENGV_vnf + * @param - GENGV_SuccessIndicator + * @param - GENGV_FoundIndicator + * @param - WorkflowException + * + * + */ +class GenericGetVnf extends AbstractServiceTaskProcessor{ + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, GenericGetVnf.class); + + + String Prefix = "GENGV_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + + /** + * This method validates the incoming variables and + * determines the subsequent event based on which + * variables the calling flow provided. + * + * @param - execution + */ + public void preProcessRequest(DelegateExecution execution) { + execution.setVariable("prefix",Prefix) + msoLogger.trace("STARTED GenericGetVnf PreProcessRequest Process") + + execution.setVariable("GENGV_getVnfByName", false) + execution.setVariable("GENGV_SuccessIndicator", false) + execution.setVariable("GENGV_FoundIndicator", false) + + try{ + // Get Variables + String vnfId = execution.getVariable("GENGV_vnfId") + msoLogger.debug("Incoming Vnf Id is: " + vnfId) + String vnfName = execution.getVariable("GENGV_vnfName") + msoLogger.debug("Incoming Vnf Name is: " + vnfName) + + if(isBlank(vnfId) && isBlank(vnfName)){ + msoLogger.debug("Incoming Vnf Name and Vnf Id are null. At least one is required!") + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Vnf Name and Vnf Id are null. At least one is required.") + }else{ + if(isBlank(vnfId)){ + execution.setVariable("GENGV_getVnfByName", true) + } + } + + }catch(BpmnError b){ + msoLogger.debug("Rethrowing MSOWorkflowException") + throw b + }catch(Exception e){ + msoLogger.debug(" Error encountered within GenericGetVnf PreProcessRequest method!" + e) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in GenericGetVnf PreProcessRequest") + + } + msoLogger.trace("COMPLETED GenericGetVnf PreProcessRequest Process ") + } + + /** + * This method executes a GET call to AAI to obtain the + * Vnf using the Vnf Name + * + * @param - execution + */ + public void getVnfByName(DelegateExecution execution){ + execution.setVariable("prefix",Prefix) + msoLogger.trace("STARTED GenericGetVnf GetVnfByName Process") + try { + String vnfName = execution.getVariable("GENGV_vnfName") + msoLogger.debug("Getting Vnf by Vnf Name: " + vnfName) + String type = execution.getVariable("GENGV_type") + msoLogger.debug("Type of Vnf Getting is: " + type) + + String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + AaiUtil aaiUriUtil = new AaiUtil(this) + + //Determine Type of Vnf Querying For. + def aai_uri = "" + if(type.equals("generic-vnf")){ + aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution) + }else if(type.equals("vce")){ + aai_uri = aaiUriUtil.getNetworkVceUri(execution) + }else{ + msoLogger.debug("Invalid Incoming GENGV_type") + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Invalid Incoming GENGV_type") + } + + String getVnfPath = "${aai_endpoint}${aai_uri}?vnf-name=" + UriUtils.encode(vnfName, "UTF-8") + "&depth=1" + + execution.setVariable("GENGV_getVnfPath", getVnfPath) + msoLogger.debug("Get Vnf Url is: " + getVnfPath) + + APIResponse response = aaiUriUtil.executeAAIGetCall(execution, getVnfPath) + int responseCode = response.getStatusCode() + execution.setVariable("GENGV_getVnfResponseCode", responseCode) + msoLogger.debug(" GET Vnf response code is: " + responseCode) + + String aaiResponse = response.getResponseBodyAsString() + execution.setVariable("GENGV_getVnfResponse", aaiResponse) + + //Process Response + if(responseCode == 200){ + msoLogger.debug("GET Vnf Received a Good Response") + if(utils.nodeExists(aaiResponse, type)){ + msoLogger.debug("GET Vnf Response Contains a Vnf") + execution.setVariable("GENGV_FoundIndicator", true) + execution.setVariable("GENGV_vnf", aaiResponse) + execution.setVariable("WorkflowResponse", aaiResponse) + }else{ + msoLogger.debug("GET Vnf Response Does NOT Contain a Vnf") + } + + }else if(responseCode == 404){ + msoLogger.debug("GET Vnf Received a Not Found (404) Response") + }else{ + msoLogger.debug("GET Vnf Received a Bad Response: \n" + aaiResponse) + exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) + throw new BpmnError("MSOWorkflowException") + } + }catch(BpmnError b){ + msoLogger.debug("Rethrowing MSOWorkflowException") + throw b + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Error encountered within GenericGetVnf GetVnfByName method!" + e, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During GetVnfByName") + } + msoLogger.trace("COMPLETED GenericGetVnf GetVnfByName Process") + } + + /** + * This method executes a GET call to AAI to obtain the + * Vnf using the Vnf Id + * + * @param - execution + */ + public void getVnfById(DelegateExecution execution){ + execution.setVariable("prefix",Prefix) + msoLogger.trace("STARTED GenericGetVnf GetVnfById Process") + try { + String vnfId = execution.getVariable("GENGV_vnfId") + msoLogger.debug("Getting Vnf by Vnf Id: " + vnfId) + String type = execution.getVariable("GENGV_type") + msoLogger.debug("Type of Vnf Getting is: " + type) + + String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + AaiUtil aaiUriUtil = new AaiUtil(this) + + //Determine Type of Vnf Querying For. + def aai_uri = "" + if(type.equals("generic-vnf")){ + aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution) + }else if(type.equals("vce")){ + aai_uri = aaiUriUtil.getNetworkVceUri(execution) + }else if(type.equals("vpe")){ + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "GenericGetVnf does not yet support getting type of vnf = vpe") + }else{ + msoLogger.debug("Invalid Incoming GENGV_type") + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Invalid Incoming GENGV_type") + } + msoLogger.debug("Using AAI Uri: " + aai_uri) + + String getVnfPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8") + "?depth=1" + msoLogger.debug("GET Vnf Endpoint is: " + getVnfPath) + + execution.setVariable("GENGV_getVnfPath", getVnfPath) + msoLogger.debug("Get Vnf Url is: " + getVnfPath) + + APIResponse response = aaiUriUtil.executeAAIGetCall(execution, getVnfPath) + int responseCode = response.getStatusCode() + execution.setVariable("GENGV_getVnfResponseCode", responseCode) + msoLogger.debug(" GET Vnf response code is: " + responseCode) + + String aaiResponse = response.getResponseBodyAsString() + execution.setVariable("GENGV_getVnfResponse", aaiResponse) + + //Process Response + if(responseCode == 200){ + msoLogger.debug("GET Vnf Received a Good Response") + if(utils.nodeExists(aaiResponse, type)){ + msoLogger.debug("GET Vnf Response Contains a Vnf") + execution.setVariable("GENGV_FoundIndicator", true) + execution.setVariable("GENGV_vnf", aaiResponse) + execution.setVariable("WorkflowResponse", aaiResponse) + }else{ + msoLogger.debug("GET Vnf Response Does NOT Contain a Vnf") + } + + }else if(responseCode == 404){ + msoLogger.debug("GET Vnf Received a Not Found (404) Response") + }else{ + msoLogger.debug("GET Vnf Received a BAD REST Response: \n" + aaiResponse) + exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) + throw new BpmnError("MSOWorkflowException") + } + }catch(BpmnError b){ + msoLogger.debug("Rethrowing MSOWorkflowException") + throw b + }catch(Exception e){ + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Error encountered within GenericGetVnf GetVnfById method!" + e, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During GetVnfById") + } + msoLogger.trace("COMPLETED GenericGetVnf GetVnfById Process") + } + +} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenericNotificationService.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenericNotificationService.groovy new file mode 100644 index 0000000000..591e76e491 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenericNotificationService.groovy @@ -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.common.scripts + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.json.JsonUtils +import java.text.SimpleDateFormat +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + + + +public class GenericNotificationService extends AbstractServiceTaskProcessor { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, GenericNotificationService.class); + + + + + ExceptionUtil exceptionUtil = new ExceptionUtil() + + public void preProcessRequest (DelegateExecution execution) { + + } + +} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericPutService.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenericPutService.groovy index d1b733aecb..d41134be91 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericPutService.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenericPutService.groovy @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,7 +17,10 @@ * limitations under the License. * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.common.scripts + +package org.onap.so.bpmn.common.scripts + +import org.onap.so.bpmn.core.UrnPropertiesReader import static org.apache.commons.lang3.StringUtils.*; @@ -26,14 +29,18 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; import org.apache.commons.codec.binary.Base64 import org.apache.commons.lang3.* -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.rest.APIResponse; -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.rest.APIResponse; +import org.onap.so.rest.RESTClient +import org.onap.so.rest.RESTConfig import java.net.URLEncoder; import org.springframework.web.util.UriUtils +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + + /** * This class supports the GenericPutService Sub Flow. @@ -72,6 +79,8 @@ import org.springframework.web.util.UriUtils class GenericPutService extends AbstractServiceTaskProcessor{ + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, GenericPutService.class); + String Prefix = "GENPS_" ExceptionUtil exceptionUtil = new ExceptionUtil() @@ -79,16 +88,15 @@ class GenericPutService extends AbstractServiceTaskProcessor{ public void preProcessRequest(DelegateExecution execution) { execution.setVariable("isDebugLogEnabled","true") - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) - utils.log("DEBUG", " *** STARTED GenericPutService PreProcessRequest Process*** ", isDebugEnabled) + msoLogger.trace("STARTED GenericPutService PreProcessRequest Process") execution.setVariable("GENPS_SuccessIndicator", false) try{ // Get Variables String requestId = execution.getVariable("GENPS_requestId") - utils.log("DEBUG", "Incoming GENPS_requestId is: " + requestId, isDebugEnabled) + msoLogger.debug("Incoming GENPS_requestId is: " + requestId) String globalSubscriberId = execution.getVariable("GENPS_globalSubscriberId") String serviceInstanceId = execution.getVariable("GENPS_serviceInstanceId") @@ -98,53 +106,53 @@ class GenericPutService extends AbstractServiceTaskProcessor{ String type = execution.getVariable("GENPS_type") if(type != null){ - utils.log("DEBUG", "Incoming GENPS_type is: " + type, isDebugEnabled) + msoLogger.debug("Incoming GENPS_type is: " + type) if(type.equalsIgnoreCase("service-instance")){ if(isBlank(globalSubscriberId) || isBlank(serviceType) || isBlank(serviceInstanceId)){ - utils.log("DEBUG", "Incoming Required Variable is missing or null!", isDebugEnabled) + msoLogger.debug("Incoming Required Variable is missing or null!") exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Required Variable is Missing or Null!") }else{ - utils.log("DEBUG", "Incoming Global Subscriber Id is: " + globalSubscriberId, isDebugEnabled) - utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled) - utils.log("DEBUG", "Incoming Service Type is: " + serviceType, isDebugEnabled) + msoLogger.debug("Incoming Global Subscriber Id is: " + globalSubscriberId) + msoLogger.debug("Incoming Service Instance Id is: " + serviceInstanceId) + msoLogger.debug("Incoming Service Type is: " + serviceType) } }else if(type.equalsIgnoreCase("service-subscription")){ if(isBlank(serviceType) || isBlank(globalSubscriberId)){ - utils.log("DEBUG", "Incoming ServiceType or GlobalSubscriberId is null. These variables are required to create a service-subscription.", isDebugEnabled) + msoLogger.debug("Incoming ServiceType or GlobalSubscriberId is null. These variables are required to create a service-subscription.") exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming ServiceType or GlobalCustomerId is null. These variables are required to Get a service-subscription.") }else{ - utils.log("DEBUG", "Incoming Service Type is: " + serviceType, isDebugEnabled) - utils.log("DEBUG", "Incoming Global Subscriber Id is: " + globalSubscriberId, isDebugEnabled) + msoLogger.debug("Incoming Service Type is: " + serviceType) + msoLogger.debug("Incoming Global Subscriber Id is: " + globalSubscriberId) } }else if(type.equalsIgnoreCase("allotted-resource")){ if(isBlank(globalSubscriberId) || isBlank(serviceType) || isBlank(serviceInstanceId) || isBlank(allottedResourceId)){ - utils.log("DEBUG", "Incoming Global Subscriber Id is: " + globalSubscriberId, isDebugEnabled) - utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled) - utils.log("DEBUG", "Incoming Service Type is: " + serviceType, isDebugEnabled) - utils.log("DEBUG", "Incoming Allotted Resource Id is: " + allottedResourceId, isDebugEnabled) - utils.log("DEBUG", "Incoming Required Variable is missing or null!", isDebugEnabled) + msoLogger.debug("Incoming Global Subscriber Id is: " + globalSubscriberId) + msoLogger.debug("Incoming Service Instance Id is: " + serviceInstanceId) + msoLogger.debug("Incoming Service Type is: " + serviceType) + msoLogger.debug("Incoming Allotted Resource Id is: " + allottedResourceId) + msoLogger.debug("Incoming Required Variable is missing or null!") exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Required Variable is Missing or Null!") }else{ - utils.log("DEBUG", "Incoming Global Subscriber Id is: " + globalSubscriberId, isDebugEnabled) - utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled) - utils.log("DEBUG", "Incoming Service Type is: " + serviceType, isDebugEnabled) - utils.log("DEBUG", "Incoming Allotted Resource Id is: " + allottedResourceId, isDebugEnabled) + msoLogger.debug("Incoming Global Subscriber Id is: " + globalSubscriberId) + msoLogger.debug("Incoming Service Instance Id is: " + serviceInstanceId) + msoLogger.debug("Incoming Service Type is: " + serviceType) + msoLogger.debug("Incoming Allotted Resource Id is: " + allottedResourceId) } }else if(type.equalsIgnoreCase("tunnel-xconnect")){ if(isBlank(globalSubscriberId) || isBlank(serviceType) || isBlank(serviceInstanceId) || isBlank(allottedResourceId) || isBlank(tunnelXconnectId)){ - utils.log("DEBUG", "Incoming Global Subscriber Id is: " + globalSubscriberId, isDebugEnabled) - utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled) - utils.log("DEBUG", "Incoming Service Type is: " + serviceType, isDebugEnabled) - utils.log("DEBUG", "Incoming Allotted Resource Id is: " + allottedResourceId, isDebugEnabled) - utils.log("DEBUG", "Incoming Tunnel Xconnect Id is: " + tunnelXconnectId, isDebugEnabled) - utils.log("DEBUG", "Incoming Required Variable is missing or null!", isDebugEnabled) + msoLogger.debug("Incoming Global Subscriber Id is: " + globalSubscriberId) + msoLogger.debug("Incoming Service Instance Id is: " + serviceInstanceId) + msoLogger.debug("Incoming Service Type is: " + serviceType) + msoLogger.debug("Incoming Allotted Resource Id is: " + allottedResourceId) + msoLogger.debug("Incoming Tunnel Xconnect Id is: " + tunnelXconnectId) + msoLogger.debug("Incoming Required Variable is missing or null!") exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Required Variable is Missing or Null!") }else{ - utils.log("DEBUG", "Incoming Global Subscriber Id is: " + globalSubscriberId, isDebugEnabled) - utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled) - utils.log("DEBUG", "Incoming Service Type is: " + serviceType, isDebugEnabled) - utils.log("DEBUG", "Incoming Allotted Resource Id is: " + allottedResourceId, isDebugEnabled) - utils.log("DEBUG", "Incoming Tunnel Xconnect Id is: " + tunnelXconnectId, isDebugEnabled) + msoLogger.debug("Incoming Global Subscriber Id is: " + globalSubscriberId) + msoLogger.debug("Incoming Service Instance Id is: " + serviceInstanceId) + msoLogger.debug("Incoming Service Type is: " + serviceType) + msoLogger.debug("Incoming Allotted Resource Id is: " + allottedResourceId) + msoLogger.debug("Incoming Tunnel Xconnect Id is: " + tunnelXconnectId) } }else{ exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Type is Invalid. Please Specify Type as service-instance or service-subscription") @@ -154,14 +162,14 @@ class GenericPutService extends AbstractServiceTaskProcessor{ } }catch(BpmnError b){ - utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled) + msoLogger.debug("Rethrowing MSOWorkflowException") throw b }catch(Exception e){ - utils.log("ERROR", " Error encountered within GenericPutService PreProcessRequest method!" + e, isDebugEnabled) + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Error encountered within GenericPutService PreProcessRequest method!" + e, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in GenericPutService PreProcessRequest") } - utils.log("DEBUG", "*** COMPLETED GenericPutService PreProcessRequest Process ***", isDebugEnabled) + msoLogger.trace("COMPLETED GenericPutService PreProcessRequest Process ") } @@ -173,36 +181,35 @@ class GenericPutService extends AbstractServiceTaskProcessor{ * */ public void putServiceInstance(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) - utils.log("DEBUG", " *** STARTED GenericPutService PutServiceInstance method*** ", isDebugEnabled) + msoLogger.trace("STARTED GenericPutService PutServiceInstance method") try { String type = execution.getVariable("GENPS_type") AaiUtil aaiUriUtil = new AaiUtil(this) String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) - logDebug('AAI URI is: ' + aai_uri, isDebugEnabled) + msoLogger.debug('AAI URI is: ' + aai_uri) String namespace = aaiUriUtil.getNamespaceFromUri(execution, aai_uri) - logDebug('AAI namespace is: ' + namespace, isDebugEnabled) + msoLogger.debug('AAI namespace is: ' + namespace) - String aai_endpoint = execution.getVariable("URN_aai_endpoint") + String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) String serviceAaiPath = "" String payload = execution.getVariable("GENPS_payload") execution.setVariable("GENPS_payload", payload) - utils.log("DEBUG", "Incoming GENPS_payload is: " + payload, isDebugEnabled) - utils.logAudit(payload) + msoLogger.debug("Incoming GENPS_payload is: " + payload) + msoLogger.debug(payload) String serviceType = execution.getVariable("GENPS_serviceType") - utils.log("DEBUG", " Incoming GENPS_serviceType is: " + serviceType, isDebugEnabled) + msoLogger.debug(" Incoming GENPS_serviceType is: " + serviceType) String globalSubscriberId = execution.getVariable("GENPS_globalSubscriberId") - utils.log("DEBUG", "Incoming Global Subscriber Id is: " + globalSubscriberId, isDebugEnabled) + msoLogger.debug("Incoming Global Subscriber Id is: " + globalSubscriberId) // This IF clause is if we need to create a new Service Instance if(type.equalsIgnoreCase("service-instance")){ String serviceInstanceId = execution.getVariable("GENPS_serviceInstanceId") - utils.log("DEBUG", " Incoming GENPS_serviceInstanceId is: " + serviceInstanceId, isDebugEnabled) + msoLogger.debug(" Incoming GENPS_serviceInstanceId is: " + serviceInstanceId) // serviceAaiPath = "${aai_endpoint}${aai_uri}/" + URLEncoder.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + URLEncoder.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + URLEncoder.encode(serviceInstanceId,"UTF-8") serviceAaiPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + UriUtils.encode(serviceInstanceId,"UTF-8") @@ -214,63 +221,62 @@ class GenericPutService extends AbstractServiceTaskProcessor{ }else if(type.equalsIgnoreCase("allotted-resource")){ String serviceInstanceId = execution.getVariable("GENPS_serviceInstanceId") - utils.log("DEBUG", " Incoming GENPS_serviceInstanceId is: " + serviceInstanceId, isDebugEnabled) + msoLogger.debug(" Incoming GENPS_serviceInstanceId is: " + serviceInstanceId) String allottedResourceId = execution.getVariable("GENPS_allottedResourceId") - utils.log("DEBUG", " Incoming GENPS_allottedResourceId is: " + allottedResourceId, isDebugEnabled) + msoLogger.debug(" Incoming GENPS_allottedResourceId is: " + allottedResourceId) // serviceAaiPath = "${aai_endpoint}${aai_uri}/" + URLEncoder.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + URLEncoder.encode(serviceType,"UTF-8") serviceAaiPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + UriUtils.encode(serviceInstanceId,"UTF-8") + "/allotted-resources/allotted-resource/" + UriUtils.encode(allottedResourceId,"UTF-8") }else if(type.equalsIgnoreCase("tunnel-xconnect")){ String serviceInstanceId = execution.getVariable("GENPS_serviceInstanceId") - utils.log("DEBUG", " Incoming GENPS_serviceInstanceId is: " + serviceInstanceId, isDebugEnabled) + msoLogger.debug(" Incoming GENPS_serviceInstanceId is: " + serviceInstanceId) String allottedResourceId = execution.getVariable("GENPS_allottedResourceId") - utils.log("DEBUG", " Incoming GENPS_allottedResourceId is: " + allottedResourceId, isDebugEnabled) + msoLogger.debug(" Incoming GENPS_allottedResourceId is: " + allottedResourceId) String tunnelXconnectId = execution.getVariable("GENPS_tunnelXconnectId") - utils.log("DEBUG", " Incoming GENPS_tunnelXconnectId is: " + tunnelXconnectId, isDebugEnabled) + msoLogger.debug(" Incoming GENPS_tunnelXconnectId is: " + tunnelXconnectId) // serviceAaiPath = "${aai_endpoint}${aai_uri}/" + URLEncoder.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + URLEncoder.encode(serviceType,"UTF-8") serviceAaiPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + UriUtils.encode(serviceInstanceId,"UTF-8") + "/allotted-resources/allotted-resource/" + UriUtils.encode(allottedResourceId,"UTF-8") + "/tunnel-xconnects/tunnel-xconnect/" + UriUtils.encode(tunnelXconnectId,"UTF-8") } String resourceVersion = execution.getVariable("GENPS_serviceResourceVersion") - utils.log("DEBUG", "Incoming Resource Version is: " + resourceVersion, isDebugEnabled) + msoLogger.debug("Incoming Resource Version is: " + resourceVersion) if(resourceVersion !=null){ serviceAaiPath = serviceAaiPath +'?resource-version=' + UriUtils.encode(resourceVersion,"UTF-8") } execution.setVariable("GENPS_putServiceInstanceAaiPath", serviceAaiPath) - utils.log("DEBUG", "PUT Service Instance AAI Path is: " + "\n" + serviceAaiPath, isDebugEnabled) + msoLogger.debug("PUT Service Instance AAI Path is: " + "\n" + serviceAaiPath) APIResponse response = aaiUriUtil.executeAAIPutCall(execution, serviceAaiPath, payload) int responseCode = response.getStatusCode() execution.setVariable("GENPS_putServiceInstanceResponseCode", responseCode) - utils.log("DEBUG", " Put Service Instance response code is: " + responseCode, isDebugEnabled) + msoLogger.debug(" Put Service Instance response code is: " + responseCode) String aaiResponse = response.getResponseBodyAsString() - aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse) execution.setVariable("GENPS_putServiceInstanceResponse", aaiResponse) //Process Response if(responseCode == 200 || responseCode == 201 || responseCode == 202 ) //200 OK 201 CREATED 202 ACCEPTED { - utils.log("DEBUG", "PUT Service Instance Received a Good Response", isDebugEnabled) + msoLogger.debug("PUT Service Instance Received a Good Response") execution.setVariable("GENPS_SuccessIndicator", true) } else{ - utils.log("DEBUG", "Put Generic Service Instance Received a Bad Response Code. Response Code is: " + responseCode, isDebugEnabled) + msoLogger.debug("Put Generic Service Instance Received a Bad Response Code. Response Code is: " + responseCode) exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) throw new BpmnError("MSOWorkflowException") } }catch(BpmnError b){ - utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled) + msoLogger.debug("Rethrowing MSOWorkflowException") throw b }catch(Exception e){ - utils.log("ERROR", " Error encountered within GenericPutService PutServiceInstance method!" + e, isDebugEnabled) + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Error encountered within GenericPutService PutServiceInstance method!" + e, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During Put Service Instance") } - utils.log("DEBUG", " *** COMPLETED GenericPutService PutServiceInstance Process*** ", isDebugEnabled) + msoLogger.trace("COMPLETED GenericPutService PutServiceInstance Process") } } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenericUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenericUtils.groovy new file mode 100644 index 0000000000..cc261a2750 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenericUtils.groovy @@ -0,0 +1,40 @@ +/*- + * ============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.common.scripts + +import org.apache.commons.lang3.StringUtils; + +class GenericUtils extends StringUtils{ + + @Override + public static boolean isBlank(final CharSequence cs) { + int strLen; + if (cs == null || (strLen = cs.length()) == 0 || cs.equals("null")) { + return true; + } + for (int i = 0; i < strLen; i++) { + if (!Character.isWhitespace(cs.charAt(i))) { + return false; + } + } + return true; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ManualHandling.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ManualHandling.groovy index e79071f1e9..820364b1f7 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ManualHandling.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ManualHandling.groovy @@ -1,345 +1,343 @@ -/*-
- * ============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.common.scripts;
-
-import static org.apache.commons.lang3.StringUtils.*;
-
-import java.time.chrono.AbstractChronology
-import java.util.List
-import java.text.SimpleDateFormat
-import java.util.Date
-
-import org.apache.commons.lang3.*
-import org.camunda.bpm.engine.TaskService
-import org.camunda.bpm.engine.task.Task
-import org.camunda.bpm.engine.task.TaskQuery
-import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.delegate.DelegateTask
-import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.json.JSONObject;
-import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor
-import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil
-import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition
-import org.openecomp.mso.bpmn.core.json.JsonUtils
-import org.openecomp.mso.client.ruby.*
-
-
-
-/**
- * This groovy class supports the <class>ManualHandling.bpmn</class> process.
- *
- * @author
- *
- * Inputs:
- * @param - msoRequestId
- * @param - isDebugLogEnabled
- * @param - serviceType
- * @param - vnfType
- * @param - requestorId
- * @param - currentActivity
- * @param - workStep
- * @param - failedActivity
- * @param - errorCode
- * @param - errorText
- * @param - validResponses
- * @param - vnfName
- *
- * Outputs:
- * @param - WorkflowException
- * @param - taskId
- *
- */
-public class ManualHandling extends AbstractServiceTaskProcessor {
-
- String Prefix="MH_"
- ExceptionUtil exceptionUtil = new ExceptionUtil()
-
- JsonUtils jsonUtils = new JsonUtils()
-
- public void preProcessRequest (DelegateExecution execution) {
- def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled")
- String msg = ""
- utils.log("DEBUG"," ***** preProcessRequest of ManualHandling *****", isDebugLogEnabled)
-
- try {
- execution.setVariable("prefix", Prefix)
- setBasicDBAuthHeader(execution, isDebugLogEnabled)
- // check for required input
- String requestId = execution.getVariable("msoRequestId")
- utils.log("DEBUG", "msoRequestId is: " + requestId, isDebugLogEnabled)
- def serviceType = execution.getVariable("serviceType")
- utils.log("DEBUG", "serviceType is: " + serviceType, isDebugLogEnabled)
- def vnfType = execution.getVariable("vnfType")
- utils.log("DEBUG", "vnftype is: " + vnfType, isDebugLogEnabled)
- def currentActivity = execution.getVariable("currentActivity")
- utils.log("DEBUG", "currentActivity is: " + currentActivity, isDebugLogEnabled)
- def workStep = execution.getVariable("workStep")
- utils.log("DEBUG", "workStep is: " + workStep, isDebugLogEnabled)
- def failedActivity = execution.getVariable("failedActivity")
- utils.log("DEBUG", "failedActivity is: " + failedActivity, isDebugLogEnabled)
- def errorCode = execution.getVariable("errorCode")
- utils.log("DEBUG", "errorCode is: " + errorCode, isDebugLogEnabled)
- def errorText = execution.getVariable("errorText")
- utils.log("DEBUG", "errorText is: " + errorText, isDebugLogEnabled)
- def requestorId = execution.getVariable("requestorId")
- utils.log("DEBUG", "requestorId is: " + requestorId, isDebugLogEnabled)
- def validResponses = execution.getVariable("validResponses")
- utils.log("DEBUG", "validResponses is: " + validResponses, isDebugLogEnabled)
-
- } catch (BpmnError e) {
- throw e;
- } catch (Exception ex){
- msg = "Exception in preProcessRequest " + ex.getMessage()
- utils.log("DEBUG", msg, isDebugLogEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
- }
- utils.log("DEBUG"," ***** Exit preProcessRequest of RainyDayHandler *****", isDebugLogEnabled)
- }
-
- public void createManualTask (DelegateExecution execution) {
- def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled")
- String msg = ""
- utils.log("DEBUG"," ***** createManualTask of ManualHandling *****", isDebugLogEnabled)
-
- try {
- String taskId = UUID.randomUUID()
- execution.setVariable('taskId', taskId)
- String type = "fallout"
- String nfRole = execution.getVariable("vnfType")
- String subscriptionServiceType = execution.getVariable("serviceType")
- String originalRequestId = execution.getVariable("msoRequestId")
- String originalRequestorId = execution.getVariable("requestorId")
- String errorSource = execution.getVariable("failedActivity")
- String errorCode = execution.getVariable("errorCode")
- String errorMessage = execution.getVariable("errorText")
- String buildingBlockName = execution.getVariable("currentActivity")
- String buildingBlockStep = execution.getVariable("workStep")
- String validResponses = execution.getVariable("validResponses")
-
- utils.log("DEBUG", "Before creating task", isDebugLogEnabled)
-
- Map<String, String> taskVariables = new HashMap<String, String>()
- taskVariables.put("type", type)
- taskVariables.put("nfRole", nfRole)
- taskVariables.put("subscriptionServiceType", subscriptionServiceType)
- taskVariables.put("originalRequestId", originalRequestId)
- taskVariables.put("originalRequestorId", originalRequestorId)
- taskVariables.put("errorSource", errorSource)
- taskVariables.put("errorCode", errorCode)
- taskVariables.put("errorMessage", errorMessage)
- taskVariables.put("buildingBlockName", buildingBlockName)
- taskVariables.put("buildingBlockStep", buildingBlockStep)
- taskVariables.put("validResponses", validResponses)
-
- TaskService taskService = execution.getProcessEngineServices().getTaskService()
- Task manualTask = taskService.newTask(taskId)
- taskService.saveTask(manualTask)
- taskService.setVariables(taskId, taskVariables)
- utils.log("DEBUG", "successfully created task: "+ taskId, isDebugLogEnabled)
-
- } catch (BpmnError e) {
- utils.log("DEBUG", "BPMN exception: " + e.errorMessage, isDebugLogEnabled)
- throw e;
- } catch (Exception ex){
- msg = "Exception in createManualTask " + ex.getMessage()
- utils.log("DEBUG", msg, isDebugLogEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
- }
- utils.log("DEBUG"," ***** Exit createManualTask of ManualHandling *****", isDebugLogEnabled)
- }
-
- public void setTaskVariables (DelegateTask task) {
-
- DelegateExecution execution = task.getExecution()
-
- def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled")
- String msg = ""
- utils.log("DEBUG"," ***** setTaskVariables of ManualHandling *****", isDebugLogEnabled)
- String taskId = task.getId()
- utils.log("DEBUG", "taskId is: " + taskId, isDebugLogEnabled)
-
- try {
- execution.setVariable('taskId', taskId)
- String type = "fallout"
- String nfRole = execution.getVariable("vnfType")
- String subscriptionServiceType = execution.getVariable("serviceType")
- String originalRequestId = execution.getVariable("msoRequestId")
- String originalRequestorId = execution.getVariable("requestorId")
- String errorSource = execution.getVariable("failedActivity")
- String errorCode = execution.getVariable("errorCode")
- String errorMessage = execution.getVariable("errorText")
- String buildingBlockName = execution.getVariable("currentActivity")
- String buildingBlockStep = execution.getVariable("workStep")
- String validResponses = execution.getVariable("validResponses")
-
- utils.log("DEBUG", "Before creating task", isDebugLogEnabled)
-
- Map<String, String> taskVariables = new HashMap<String, String>()
- taskVariables.put("type", type)
- taskVariables.put("nfRole", nfRole)
- taskVariables.put("subscriptionServiceType", subscriptionServiceType)
- taskVariables.put("originalRequestId", originalRequestId)
- taskVariables.put("originalRequestorId", originalRequestorId)
- taskVariables.put("errorSource", errorSource)
- taskVariables.put("errorCode", errorCode)
- taskVariables.put("errorMessage", errorMessage)
- taskVariables.put("buildingBlockName", buildingBlockName)
- taskVariables.put("buildingBlockStep", buildingBlockStep)
- taskVariables.put("validResponses", validResponses)
- TaskService taskService = execution.getProcessEngineServices().getTaskService()
-
-
- taskService.setVariables(taskId, taskVariables)
- utils.log("DEBUG", "successfully created task: "+ taskId, isDebugLogEnabled)
-
- } catch (BpmnError e) {
- utils.log("DEBUG", "BPMN exception: " + e.errorMessage, isDebugLogEnabled)
- throw e;
- } catch (Exception ex){
- msg = "Exception in createManualTask " + ex.getMessage()
- utils.log("DEBUG", msg, isDebugLogEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
- }
- utils.log("DEBUG"," ***** Exit createManualTask of ManualHandling *****", isDebugLogEnabled)
- }
-
- public void completeTask (DelegateTask task) {
-
- DelegateExecution execution = task.getExecution()
-
- def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled")
- String msg = ""
- utils.log("DEBUG"," ***** completeTask of ManualHandling *****", isDebugLogEnabled)
- String taskId = task.getId()
- utils.log("DEBUG", "taskId is: " + taskId, isDebugLogEnabled)
-
- try {
- TaskService taskService = execution.getProcessEngineServices().getTaskService()
-
- Map<String, String> taskVariables = taskService.getVariables(taskId)
- String responseValue = taskVariables.get("responseValue")
-
- utils.log("DEBUG", "Received responseValue on completion: "+ responseValue, isDebugLogEnabled)
- // Have to set the first letter of the response to upper case
- String responseValueForRainyDay = responseValue.substring(0, 1).toUpperCase() + responseValue.substring(1)
- utils.log("DEBUG", "ResponseValue to RainyDayHandler: "+ responseValueForRainyDay, isDebugLogEnabled)
- execution.setVariable("responseValue", responseValueForRainyDay)
-
- } catch (BpmnError e) {
- utils.log("DEBUG", "BPMN exception: " + e.errorMessage, isDebugLogEnabled)
- throw e;
- } catch (Exception ex){
- msg = "Exception in createManualTask " + ex.getMessage()
- utils.log("DEBUG", msg, isDebugLogEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
- }
- utils.log("DEBUG"," ***** Exit completeTask of ManualHandling *****", isDebugLogEnabled)
- }
-
- public void prepareRequestsDBStatusUpdate (DelegateExecution execution, String requestStatus){
-
- def method = getClass().getSimpleName() + '.prepareRequestsDBStatusUpdate(' +'execution=' + execution.getId() +')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- utils.log("DEBUG"," ***** prepareRequestsDBStatusUpdate of ManualHandling *****", isDebugLogEnabled)
- try {
- def requestId = execution.getVariable("msoRequestId")
- String payload = """
- <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.openecomp.mso/requestsdb">
- <soapenv:Header/>
- <soapenv:Body>
- <req:updateInfraRequest>
- <requestId>${requestId}</requestId>
- <lastModifiedBy>ManualHandling</lastModifiedBy>
- <requestStatus>${requestStatus}</requestStatus>
- </req:updateInfraRequest>
- </soapenv:Body>
- </soapenv:Envelope>
- """
-
- execution.setVariable("setUpdateDBstatusPayload", payload)
- utils.log("DEBUG", "Outgoing Update Mso Request Payload is: " + payload, isDebugLogEnabled)
- utils.logAudit("setUpdateDBstatusPayload: " + payload)
-
- } catch (BpmnError e) {
- throw e;
- } catch (Exception e) {
- logError('Caught exception in ' + method, e)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method)
- }
-
- utils.log("DEBUG"," ***** Exit prepareRequestsDBStatusUpdate of ManualHandling *****", isDebugLogEnabled)
- }
-
- public void createAOTSTicket (DelegateExecution execution) {
- def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled")
- String msg = ""
- utils.log("DEBUG"," ***** createAOTSTicket of ManualHandling *****", isDebugLogEnabled)
-
- // This method will not be throwing an exception, but rather log the error
-
- try {
- execution.setVariable("prefix", Prefix)
- setBasicDBAuthHeader(execution, isDebugLogEnabled)
- // check for required input
- String requestId = execution.getVariable("msoRequestId")
- utils.log("DEBUG", "requestId is: " + requestId, isDebugLogEnabled)
- def currentActivity = execution.getVariable("currentActivity")
- utils.log("DEBUG", "currentActivity is: " + currentActivity, isDebugLogEnabled)
- def workStep = execution.getVariable("workStep")
- utils.log("DEBUG", "workStep is: " + workStep, isDebugLogEnabled)
- def failedActivity = execution.getVariable("failedActivity")
- utils.log("DEBUG", "failedActivity is: " + failedActivity, isDebugLogEnabled)
- def errorCode = execution.getVariable("errorCode")
- utils.log("DEBUG", "errorCode is: " + errorCode, isDebugLogEnabled)
- def errorText = execution.getVariable("errorText")
- utils.log("DEBUG", "errorText is: " + errorText, isDebugLogEnabled)
- def vnfName = execution.getVariable("vnfName")
- utils.log("DEBUG", "vnfName is: " + vnfName, isDebugLogEnabled)
-
- String rubyRequestId = UUID.randomUUID()
- utils.log("DEBUG", "rubyRequestId: " + rubyRequestId, isDebugLogEnabled)
- String sourceName = vnfName
- utils.log("DEBUG", "sourceName: " + sourceName, isDebugLogEnabled)
- String reason = "VID Workflow failed at " + failedActivity + " " + workStep + " call with error " + errorCode
- utils.log("DEBUG", "reason: " + reason, isDebugLogEnabled)
- String workflowId = requestId
- utils.log("DEBUG", "workflowId: " + workflowId, isDebugLogEnabled)
- String notification = "Request originated from VID | Workflow fallout on " + vnfName + " | Workflow step failure: " + workStep + " failed | VID workflow ID: " + workflowId
- utils.log("DEBUG", "notification: " + notification, isDebugLogEnabled)
-
- utils.log("DEBUG", "Creating AOTS Ticket request")
-
- RubyClient rubyClient = new RubyClient()
- rubyClient.rubyCreateTicketCheckRequest(rubyRequestId, sourceName, reason, workflowId, notification)
-
- } catch (BpmnError e) {
- msg = "BPMN error in createAOTSTicket " + ex.getMessage()
- utils.log("ERROR", msg, isDebugLogEnabled)
- } catch (Exception ex){
- msg = "Exception in createAOTSTicket " + ex.getMessage()
- utils.log("ERROR", msg, isDebugLogEnabled)
- }
- utils.log("DEBUG"," ***** Exit createAOTSTicket of ManualHandling *****", isDebugLogEnabled)
- }
-
-
-
-}
+/*- + * ============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.common.scripts; + +import static org.apache.commons.lang3.StringUtils.*; + +import java.time.chrono.AbstractChronology +import java.util.List +import java.text.SimpleDateFormat +import java.util.Date + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.TaskService +import org.camunda.bpm.engine.task.Task +import org.camunda.bpm.engine.task.TaskQuery +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateTask +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.json.JSONObject; +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.core.domain.ServiceDecomposition +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.client.ruby.* +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + + + + + +/** + * This groovy class supports the <class>ManualHandling.bpmn</class> process. + * + * @author + * + * Inputs: + * @param - msoRequestId + * @param - isDebugLogEnabled + * @param - serviceType + * @param - vnfType + * @param - requestorId + * @param - currentActivity + * @param - workStep + * @param - failedActivity + * @param - errorCode + * @param - errorText + * @param - validResponses + * @param - vnfName + * + * Outputs: + * @param - WorkflowException + * @param - taskId + * + */ +public class ManualHandling extends AbstractServiceTaskProcessor { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ManualHandling.class); + + + String Prefix="MH_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + + JsonUtils jsonUtils = new JsonUtils() + + public void preProcessRequest (DelegateExecution execution) { + String msg = "" + msoLogger.trace("preProcessRequest of ManualHandling ") + + try { + execution.setVariable("prefix", Prefix) + setBasicDBAuthHeader(execution, execution.getVariable('isDebugLogEnabled')) + // check for required input + String requestId = execution.getVariable("msoRequestId") + msoLogger.debug("msoRequestId is: " + requestId) + def serviceType = execution.getVariable("serviceType") + msoLogger.debug("serviceType is: " + serviceType) + def vnfType = execution.getVariable("vnfType") + msoLogger.debug("vnftype is: " + vnfType) + def currentActivity = execution.getVariable("currentActivity") + msoLogger.debug("currentActivity is: " + currentActivity) + def workStep = execution.getVariable("workStep") + msoLogger.debug("workStep is: " + workStep) + def failedActivity = execution.getVariable("failedActivity") + msoLogger.debug("failedActivity is: " + failedActivity) + def errorCode = execution.getVariable("errorCode") + msoLogger.debug("errorCode is: " + errorCode) + def errorText = execution.getVariable("errorText") + msoLogger.debug("errorText is: " + errorText) + def requestorId = execution.getVariable("requestorId") + msoLogger.debug("requestorId is: " + requestorId) + def validResponses = execution.getVariable("validResponses") + msoLogger.debug("validResponses is: " + validResponses) + + } catch (BpmnError e) { + throw e; + } catch (Exception ex){ + msg = "Exception in preProcessRequest " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit preProcessRequest of RainyDayHandler ") + } + + public void createManualTask (DelegateExecution execution) { + String msg = "" + msoLogger.trace("createManualTask of ManualHandling ") + + try { + String taskId = UUID.randomUUID() + execution.setVariable('taskId', taskId) + String type = "fallout" + String nfRole = execution.getVariable("vnfType") + String subscriptionServiceType = execution.getVariable("serviceType") + String originalRequestId = execution.getVariable("msoRequestId") + String originalRequestorId = execution.getVariable("requestorId") + String errorSource = execution.getVariable("failedActivity") + String errorCode = execution.getVariable("errorCode") + String errorMessage = execution.getVariable("errorText") + String buildingBlockName = execution.getVariable("currentActivity") + String buildingBlockStep = execution.getVariable("workStep") + String validResponses = execution.getVariable("validResponses") + + msoLogger.debug("Before creating task") + + Map<String, String> taskVariables = new HashMap<String, String>() + taskVariables.put("type", type) + taskVariables.put("nfRole", nfRole) + taskVariables.put("subscriptionServiceType", subscriptionServiceType) + taskVariables.put("originalRequestId", originalRequestId) + taskVariables.put("originalRequestorId", originalRequestorId) + taskVariables.put("errorSource", errorSource) + taskVariables.put("errorCode", errorCode) + taskVariables.put("errorMessage", errorMessage) + taskVariables.put("buildingBlockName", buildingBlockName) + taskVariables.put("buildingBlockStep", buildingBlockStep) + taskVariables.put("validResponses", validResponses) + + TaskService taskService = execution.getProcessEngineServices().getTaskService() + Task manualTask = taskService.newTask(taskId) + taskService.saveTask(manualTask) + taskService.setVariables(taskId, taskVariables) + msoLogger.debug("successfully created task: "+ taskId) + } catch (BpmnError e) { + msoLogger.debug("BPMN exception: " + e.errorMessage) + throw e; + } catch (Exception ex){ + msg = "Exception in createManualTask " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit createManualTask of ManualHandling ") + } + + public void setTaskVariables (DelegateTask task) { + + DelegateExecution execution = task.getExecution() + + String msg = "" + msoLogger.trace("setTaskVariables of ManualHandling ") + String taskId = task.getId() + msoLogger.debug("taskId is: " + taskId) + + try { + execution.setVariable('taskId', taskId) + String type = "fallout" + String nfRole = execution.getVariable("vnfType") + String subscriptionServiceType = execution.getVariable("serviceType") + String originalRequestId = execution.getVariable("msoRequestId") + String originalRequestorId = execution.getVariable("requestorId") + String errorSource = execution.getVariable("failedActivity") + String errorCode = execution.getVariable("errorCode") + String errorMessage = execution.getVariable("errorText") + String buildingBlockName = execution.getVariable("currentActivity") + String buildingBlockStep = execution.getVariable("workStep") + String validResponses = execution.getVariable("validResponses") + + msoLogger.debug("Before creating task") + + Map<String, String> taskVariables = new HashMap<String, String>() + taskVariables.put("type", type) + taskVariables.put("nfRole", nfRole) + taskVariables.put("subscriptionServiceType", subscriptionServiceType) + taskVariables.put("originalRequestId", originalRequestId) + taskVariables.put("originalRequestorId", originalRequestorId) + taskVariables.put("errorSource", errorSource) + taskVariables.put("errorCode", errorCode) + taskVariables.put("errorMessage", errorMessage) + taskVariables.put("buildingBlockName", buildingBlockName) + taskVariables.put("buildingBlockStep", buildingBlockStep) + taskVariables.put("validResponses", validResponses) + TaskService taskService = execution.getProcessEngineServices().getTaskService() + + + taskService.setVariables(taskId, taskVariables) + msoLogger.debug("successfully created task: "+ taskId) + } catch (BpmnError e) { + msoLogger.debug("BPMN exception: " + e.errorMessage) + throw e; + } catch (Exception ex){ + msg = "Exception in createManualTask " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit createManualTask of ManualHandling ") + } + + public void completeTask (DelegateTask task) { + + DelegateExecution execution = task.getExecution() + + String msg = "" + msoLogger.trace("completeTask of ManualHandling ") + String taskId = task.getId() + msoLogger.debug("taskId is: " + taskId) + + try { + TaskService taskService = execution.getProcessEngineServices().getTaskService() + + Map<String, String> taskVariables = taskService.getVariables(taskId) + String responseValue = taskVariables.get("responseValue") + + msoLogger.debug("Received responseValue on completion: "+ responseValue) + // Have to set the first letter of the response to upper case + String responseValueForRainyDay = responseValue.substring(0, 1).toUpperCase() + responseValue.substring(1) + msoLogger.debug("ResponseValue to RainyDayHandler: "+ responseValueForRainyDay) + execution.setVariable("responseValue", responseValueForRainyDay) + + } catch (BpmnError e) { + msoLogger.debug("BPMN exception: " + e.errorMessage) + throw e; + } catch (Exception ex){ + msg = "Exception in createManualTask " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit completeTask of ManualHandling ") + } + + public void prepareRequestsDBStatusUpdate (DelegateExecution execution, String requestStatus){ + + def method = getClass().getSimpleName() + '.prepareRequestsDBStatusUpdate(' +'execution=' + execution.getId() +')' + msoLogger.trace("prepareRequestsDBStatusUpdate of ManualHandling ") + try { + def requestId = execution.getVariable("msoRequestId") + String payload = """ + <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.onap.so/requestsdb"> + <soapenv:Header/> + <soapenv:Body> + <req:updateInfraRequest> + <requestId>${MsoUtils.xmlEscape(requestId)}</requestId> + <lastModifiedBy>ManualHandling</lastModifiedBy> + <requestStatus>${MsoUtils.xmlEscape(requestStatus)}</requestStatus> + </req:updateInfraRequest> + </soapenv:Body> + </soapenv:Envelope> + """ + + execution.setVariable("setUpdateDBstatusPayload", payload) + msoLogger.debug("Outgoing Update Mso Request Payload is: " + payload) + msoLogger.debug("setUpdateDBstatusPayload: " + payload) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method) + } + + msoLogger.trace("Exit prepareRequestsDBStatusUpdate of ManualHandling ") + } + + public void createAOTSTicket (DelegateExecution execution) { + String msg = "" + msoLogger.trace("createAOTSTicket of ManualHandling ") + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + // This method will not be throwing an exception, but rather log the error + + try { + execution.setVariable("prefix", Prefix) + setBasicDBAuthHeader(execution,isDebugLogEnabled) + // check for required input + String requestId = execution.getVariable("msoRequestId") + msoLogger.debug("requestId is: " + requestId) + def currentActivity = execution.getVariable("currentActivity") + msoLogger.debug("currentActivity is: " + currentActivity) + def workStep = execution.getVariable("workStep") + msoLogger.debug("workStep is: " + workStep) + def failedActivity = execution.getVariable("failedActivity") + msoLogger.debug("failedActivity is: " + failedActivity) + def errorCode = execution.getVariable("errorCode") + msoLogger.debug("errorCode is: " + errorCode) + def errorText = execution.getVariable("errorText") + msoLogger.debug("errorText is: " + errorText) + def vnfName = execution.getVariable("vnfName") + msoLogger.debug("vnfName is: " + vnfName) + + String rubyRequestId = UUID.randomUUID() + msoLogger.debug("rubyRequestId: " + rubyRequestId) + String sourceName = vnfName + msoLogger.debug("sourceName: " + sourceName) + String reason = "VID Workflow failed at " + failedActivity + " " + workStep + " call with error " + errorCode + msoLogger.debug("reason: " + reason) + String workflowId = requestId + msoLogger.debug("workflowId: " + workflowId) + String notification = "Request originated from VID | Workflow fallout on " + vnfName + " | Workflow step failure: " + workStep + " failed | VID workflow ID: " + workflowId + msoLogger.debug("notification: " + notification) + + msoLogger.debug("Creating AOTS Ticket request") + + RubyClient rubyClient = new RubyClient() + rubyClient.rubyCreateTicketCheckRequest(rubyRequestId, sourceName, reason, workflowId, notification) + + } catch (BpmnError e) { + msg = "BPMN error in createAOTSTicket " + ex.getMessage() + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + } catch (Exception ex){ + msg = "Exception in createAOTSTicket " + ex.getMessage() + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + } + msoLogger.trace("Exit createAOTSTicket of ManualHandling ") + } + + + +} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/MsoUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy index 719aeb837f..f9ddd0d430 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/MsoUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy @@ -1,1016 +1,999 @@ -/*-
- * ============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.common.scripts
-
-import groovy.xml.XmlUtil
-
-import java.text.SimpleDateFormat
-
-import org.apache.commons.codec.binary.Base64
-import org.openecomp.mso.bpmn.core.BPMNLogger
-import org.openecomp.mso.bpmn.core.xml.XmlTool
-import org.openecomp.mso.logger.MessageEnum
-import org.openecomp.mso.logger.MsoLogger
-import org.openecomp.mso.utils.CryptoUtils
-import org.slf4j.MDC
-import org.w3c.dom.Element
-
-class MsoUtils {
- def initializeEndPoints(execution){
- // use this placeholder to initialize end points, if called independently, this need to be set
- execution.setVariable("AAIEndPoint","http://localhost:28080/SoapUIMocks")
- }
-
- /**
- * Use getNodeText1 Instead!
- */
- @Deprecated
- def getNodeText(xmlInput,element){
- def rtn=null
- if(xmlInput!=null){
- def xml= new XmlSlurper().parseText(xmlInput)
- rtn= xml.'**'.find{node->node.name()==element}.text()
- }
- return rtn
- }
- def getMultNodes(xmlInput, element){
- def nodes=null
- if(xmlInput!=null){
- def xml= new XmlSlurper().parseText(xmlInput)
- nodes = xml.'**'.findAll{ node-> node.name() == element }*.text()
- }
- return nodes
- }
- /**
- * Note: this uses XmlParser instead of XmlSlurper, thus it is not as
- * efficient because it instantiates the whole DOM tree.
- * @param xmlInput
- * @param element
- * @return a list of Nodes, or {@code null} if <i>xmlInput</i> is {@code null}
- */
- def getMultNodeObjects(xmlInput, element){
- def nodes=null
- if(xmlInput!=null){
- def xml= new XmlParser().parseText(xmlInput)
- nodes = xml.'**'.findAll{ node-> node.name() == element }
- }
- return nodes
- }
- def getNodeText1(xmlInput,element){
- def rtn=null
- if(xmlInput!=null){
- def xml= new XmlSlurper().parseText(xmlInput)
- rtn= xml.'**'.find{node->node.name()==element}
- if (rtn != null){
- rtn=rtn.text()
- }
- }
- return rtn
- }
- def getNodeXml(xmlInput,element){
- return getNodeXml(xmlInput, element, true)
- }
- def getNodeXml(xmlInput,element,incPreamble){
- def fxml= new XmlSlurper().parseText(xmlInput)
- def nodeToSerialize = fxml.'**'.find {it.name() == element}
- if(nodeToSerialize==null){
- return ""
- }
- def nodeAsText = XmlUtil.serialize(nodeToSerialize)
- if (!incPreamble) {
- nodeAsText = removeXmlPreamble(nodeAsText)
- }
- return nodeAsText
- }
- def nodeExists(xmlInput,element){
- try {
- def fxml= new XmlSlurper().parseText(xmlInput)
- def nodeToSerialize = fxml.'**'.find {it.name() == element}
- return nodeToSerialize!=null
- } catch(Exception e) {
- return false
- }
- }
-
-
- /***** Utilities when using XmlParser *****/
-
- /**
- * Convert a Node into a String by deserializing it and formatting it.
- *
- * @param node Node to be converted.
- * @return the Node as a String.
- */
- def String nodeToString(Node node) {
- def String nodeAsString = groovy.xml.XmlUtil.serialize(node)
- nodeAsString = removeXmlPreamble(nodeAsString)
- return formatXml(nodeAsString)
- }
-
- /**
- * Get the specified child Node of the specified parent. If there are
- * multiple children of the same name, only the first one is returned.
- * If there are no children with the specified name, 'null' is returned.
- *
- * @param parent Parent Node in which to find a child.
- * @param childNodeName Name of the child Node to get.
- * @return the (first) child Node with the specified name or 'null'
- * if a child Node with the specified name does not exist.
- */
- def Node getChildNode(Node parent, String childNodeName) {
- def NodeList nodeList = getIdenticalChildren(parent, childNodeName)
- if (nodeList.size() == 0) {
- return null
- } else {
- return nodeList.get(0)
- }
- }
-
- /**
- * Get the textual value of the specified child Node of the specified parent.
- * If there are no children with the specified name, 'null' is returned.
- *
- * @param parent Parent Node in which to find a child.
- * @param childNodeName Name of the child Node whose value to get.
- * @return the textual value of child Node with the specified name or 'null'
- * if a child Node with the specified name does not exist.
- */
- def String getChildNodeText(Node parent, String childNodeName) {
- def Node childNode = getChildNode(parent, childNodeName)
- if (childNode == null) {
- return null
- } else {
- return childNode.text()
- }
- }
-
- /**
- * Get all of the child nodes from the specified parent that have the
- * specified name. The returned NodeList could be empty.
- *
- * @param parent Parent Node in which to find children.
- * @param childNodeName Name of the children to get.
- * @return a NodeList of all the children from the parent with the specified
- * name. The list could be empty.
- */
- def NodeList getIdenticalChildren(Node parent, String childNodeName) {
- return (NodeList) parent.get(childNodeName)
- }
-
- /***** End of Utilities when using XmlParser *****/
-
-
- /** these are covered under the common function above**/
- def getSubscriberName(xmlInput,element){
- def rtn=null
- if(xmlInput!=null){
- def xml= new XmlSlurper().parseText(xmlInput)
- rtn= xml.'**'.find{node->node.name()==element}.text()
- }
- return rtn
- }
- def getTenantInformation(xmlInput,element){
- def xml= new XmlSlurper().parseText(xmlInput)
- def nodeToSerialize = xml.'**'.find {it.name() == 'service-information'}
- def nodeAsText = XmlUtil.serialize(nodeToSerialize)
- return nodeAsText
- }
- def getServiceInstanceId(xmlInput,element){
- def xml= new XmlSlurper().parseText(xmlInput)
- return ( xml.'**'.find{node->node.name()==element}.text() )
- }
- //for aai tenant url
- def searchResourceLink(xmlInput, resourceType){
- def fxml= new XmlSlurper().parseText(xmlInput)
- def element = fxml.'**'.find {it.'resource-type' == resourceType}
- return (element == null) ? null : element.'resource-link'.text()
- }
-
- def searchMetaData(xmlInput, searchName, searchValue){
- def fxml= new XmlSlurper().parseText(xmlInput)
- def ret = fxml.'**'.find {it.metaname.text() == searchName && it.metaval.text() == searchValue}
- if(ret != null){
- return ret.parent().parent()
- }
- return ret
- }
-
- def searchMetaDataNode(fxml, searchName, searchValue){
- def ret = fxml.'**'.find {it.metaname.text() == searchName && it.metaval.text() == searchValue}
- if(ret != null){
- return ret.parent().parent()
- }
- return ret
- }
-
- // for Trinity L3 add/delete bonding
- def getPBGFList(isDebugLogEnabled, xmlInput){
- xmlInput = xmlInput.replaceAll("&", "&")
- xmlInput = xmlInput.replaceAll("<", "<")
- xmlInput = xmlInput.replaceAll(">", ">")
- log("DEBUG", "getPBGFList: xmlInput " + xmlInput,isDebugLogEnabled)
- ArrayList myNodes = new ArrayList()
- if(nodeExists(xmlInput,"nbnc-response-information")){
- def respInfo=getNodeXml(xmlInput,"nbnc-response-information", false)
- if(respInfo!=null){
- def fxml= new XmlSlurper().parseText(respInfo)
- fxml.'virtual-datacenter-list'.each { vdc ->
- //we only want to add two BGF per VDC, BGF1 and BGF2
- def routerList = vdc.'router-list'.first()
- routerList.each{ myList ->
- def physNodes = myList.'**'.findAll {it.'border-element-tangibility'.text() =~ /PHYSICAL/}
- def nodeToAdd
- physNodes.each{
- if(nodeToAdd==null){
- nodeToAdd = it
- }else{
- def beid = nodeToAdd.'border-element-id'.text() +
- " " + nodeToAdd.'border-element-type'.text() +
- " and " +
- it.'border-element-id'.text() +
- " " + it.'border-element-type'.text()
- def mytag = nodeToAdd.'border-element-id'
- mytag[0].replaceBody(beid)
- }
- }
- def mytag = nodeToAdd.'vlan-id'
- def ind = mytag.text().indexOf('.')
- if(ind >= 0){
- def vlan = mytag.text().substring(0,ind)
- mytag[0].replaceBody(vlan)
- }
- myNodes.add(XmlUtil.serialize(nodeToAdd))
- }
-
- }
- }
-
- return myNodes
- }else{
- return null
- }
- }
-
- def getPBGFList(xmlInput){
- getPBGFList("false", xmlInput)
- }
-
- def String decodeXML(xml) {
- def String decodedXml = xml.replaceAll("&", "&")
- decodedXml = decodedXml.replaceAll("<", "<")
- decodedXml = decodedXml.replaceAll(">", ">")
- }
-
- def getMetaVal(node, name){
- try{
- return node.'**'.find {it.metaname.text() == name}.metaval.text()
- }catch(Exception e){
- return null
- }
- }
- def getRelationshipVal(node, name){
- try{
- return node.'**'.find {it.'relationship-key'.text() == name}.'relationship-value'.text()
- }catch(Exception e){
- return null
- }
- }
-
-
- def log(logmode,logtxt,isDebugLogEnabled="false"){
- MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
- if ("INFO"==logmode) {
- msoLogger.info(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, logtxt, "BPMN", MsoLogger.getServiceName());
- } else if ("WARN"==logmode) {
- // to see the warning text displayed in the log entry, the text must also be passed as arg0 (2nd argument) to invoke the correct MsoLogger warn() method
- msoLogger.warn (MessageEnum.BPMN_GENERAL_WARNING, logtxt, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, logtxt);
- } else if ("ERROR"==logmode) {
- // to see the error text displayed in the log entry, the text must also be passed as arg0 (2nd argument) to invoke the correct MsoLogger error() method
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, logtxt, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, logtxt);
-
- } else {
- BPMNLogger.debug(isDebugLogEnabled, logtxt);
- }
- }
-
- def logContext(requestId, serviceInstanceId){
- MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
- msoLogger.setLogContext(requestId, serviceInstanceId);
- }
-
- def logMetrics(elapsedTime, logtxt){
- MsoLogger metricsLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
-
- metricsLogger.recordMetricEvent (elapsedTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- logtxt, "BPMN", MsoLogger.getServiceName(), null);
- }
-
- def logAudit(logtxt){
- MsoLogger auditLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
- long startTime = System.currentTimeMillis();
-
- auditLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, logtxt);
- }
-
- // headers: header - name-value
- def getHeaderNameValue(xmlInput, nameAttribute){
- def rtn=null
- if(xmlInput!=null){
- def xml= new XmlSlurper().parseText(xmlInput)
- rtn= xml.'**'.find {header->header.'@name'.text() == nameAttribute}.'@value'
- }
- return rtn
- }
-
- /**
- * Gets the children of the specified element.
- */
- public String getChildNodes(xmlInput, element) {
- def xml= new XmlSlurper().parseText(xmlInput)
- def thisElement = xml.'**'.find {it.name() == element}
- StringBuilder out = new StringBuilder()
- if (thisElement != null) {
- thisElement.children().each() {
- String nodeAsText = removeXmlPreamble(XmlUtil.serialize(it))
- if (out.length() > 0) {
- out.append(System.lineSeparator())
- }
- out.append(nodeAsText)
- }
- }
- return out.toString();
- }
-
- /**
- * Encodes a value so it can be used inside an XML text element.
- * @param s the string to encode
- * @return the encoded string
- */
- public String xmlEncode(Object value) {
- return XmlTool.encode(value)
- }
-
- /**
- * Encodes a value so it can be used inside an XML attribute.
- * @param s the string to encode
- * @return the encoded string
- */
- public String xmlEncodeAttr(Object value) {
- return XmlTool.encodeAttr(value)
- }
-
- /**
- * Decodes XML entities in a string value
- * @param value a value with embedded XML entities
- * @return the decoded string
- */
- public String xmlDecode(Object value) {
- return XmlTool.decode(value)
- }
-
- /**
- * Removes the preamble, if present, from an XML document.
- * Also, for historical reasons, this also trims leading and trailing
- * whitespace from the resulting document. TODO: remove the trimming
- * and fix unit tests that depend on EXACT xml format.
- * @param xml the XML document
- * @return a possibly modified document
- */
- public String removeXmlPreamble(def xml) {
- if (xml == null) {
- return null
- }
-
- return XmlTool.removePreamble(xml).trim()
- }
-
- /**
- * Removes namespaces and namespace declarations from an XML document.
- * @param xml the XML document
- * @return a possibly modified document
- */
- public String removeXmlNamespaces(def xml) {
- return XmlTool.removeNamespaces(xml);
- }
-
- /**
- * Use formatXml instead. Note: this method inserts an XML preamble.
- */
- @Deprecated
- def formatXML(xmlInput) {
- def parseXml = null
- def formatXml = null
- if (xmlInput !=null) {
- parseXml = new XmlParser().parseText(xmlInput)
- formatXml = XmlUtil.serialize(parseXml)
- }
- }
-
- /**
- * Reformats an XML document. The result will not contain an XML preamble
- * or a trailing newline.
- * @param xml the XML document
- * @return a reformatted document
- */
- public String formatXml(def xml) {
- return XmlTool.normalize(xml);
- }
-
- // build single elements
- def buildElements(xmlInput, elementList, parentName) {
- String var = ""
- def xmlBuild = ""
- if (parentName != "") {
- xmlBuild += "<tns2:"+parentName+">"
- }
- if (xmlInput != null) {
- for (element in elementList) {
- def xml= new XmlSlurper().parseText(xmlInput)
- var = xml.'**'.find {it.name() == element}
- if (var != null) {
- xmlBuild += "<tns2:"+element+">"+var.toString()+"</tns2:"+element+">"
- }
- }
- }
- if (parentName != "") {
- xmlBuild += "</tns2:"+parentName+">"
- }
- return xmlBuild
- }
-
- // build the Unbounded elements
- def buildElementsUnbounded(xmlInput, elementList, parentName) {
- def varParents = ""
- def var = ""
- def xmlBuildUnbounded = ""
- if (xmlInput != null) {
- def xml= new XmlSlurper().parseText(xmlInput)
- varParents = xml.'**'.findAll {it.name() == parentName}
- //println " Unbounded ${parentName} - varParent.Size() - " + varParents.size()
- for (i in 0..varParents.size()-1) {
- if (parentName != "") {
- xmlBuildUnbounded += "<tns2:"+parentName+">"
- }
- for (element in elementList) {
- var = varParents[i].'*'.find {it.name() == element}
- if (var != null) {
- xmlBuildUnbounded += "<tns2:"+element+">"+var.toString()+"</tns2:"+element+">"
- //println " i = " + i + ", element: " + element + " = " + var.toString()
- }
- }
- if (parentName != "") {
- xmlBuildUnbounded += "</tns2:"+parentName+">"
- }
- }
- }
- return xmlBuildUnbounded
- }
-
- // Build l2-homing-information
- def buildL2HomingInformation(xmlInput) {
- def elementsL2HomingList = ["evc-name", "topology", "preferred-aic-clli"]
- def rebuildL2Home = ''
- if (xmlInput != null) {
- rebuildL2Home = buildElements(xmlInput, elementsL2HomingList, "l2-homing-information")
- }
- return rebuildL2Home
- }
-
- // Build internet-evc-access-information
- def buildInternetEvcAccessInformation(xmlInput) {
- def elementsInternetEvcAccessInformationList = ["internet-evc-speed-value", "internet-evc-speed-units", "ip-version"]
- def rebuildInternetEvcAccess = ''
- if (xmlInput != null) {
- rebuildInternetEvcAccess = buildElements(xmlInput, elementsInternetEvcAccessInformationList, "internet-evc-access-information")
- }
- return rebuildInternetEvcAccess
- }
-
- // Build ucpe-vms-service-information
- def buildUcpeVmsServiceInformation(xmlInput) {
- def rebuildUcpeVmsServiceInformation = ''
- if (xmlInput != null) {
- def ucpeVmsServiceInformation = getNodeXml(xmlInput, "ucpe-vms-service-information").drop(38).trim()
- rebuildUcpeVmsServiceInformation = "<tns2:ucpe-vms-service-information>"
- // transport-service-information
- rebuildUcpeVmsServiceInformation += "<tns2:transport-service-information>"
- def transportServiceInformation = getNodeXml(ucpeVmsServiceInformation, "transport-service-information").drop(38).trim()
- def elementsTransportServiceInformationList = ["transport-service-type"]
- rebuildUcpeVmsServiceInformation += buildElements(transportServiceInformation, elementsTransportServiceInformationList, "")
- try { // optional
- def accessCircuitInfoList = ["access-circuit-id", "dual-mode"]
- rebuildUcpeVmsServiceInformation += buildElementsUnbounded(transportServiceInformation, accessCircuitInfoList, "access-circuit-info")
- } catch (Exception e) {
- log("ERROR", " Optional - Exception ACCESS-CIRCUIT-INFO - 'access-circuit-info' ")
- }
- rebuildUcpeVmsServiceInformation += "</tns2:transport-service-information>"
- // ucpe-information
- def elementsUcpeInformationList = ["ucpe-host-name", "ucpe-activation-code", "out-of-band-management-modem" ]
- rebuildUcpeVmsServiceInformation += buildElements(ucpeVmsServiceInformation, elementsUcpeInformationList, "ucpe-information")
- // vnf-list
- rebuildUcpeVmsServiceInformation += "<tns2:vnf-list>"
- def vnfListList = ["vnf-instance-id", "vnf-sequence-number", "vnf-type", "vnf-vendor", "vnf-model", "vnf-id", "prov-status", "operational-state", "orchestration-status", "equipment-role" ]
- rebuildUcpeVmsServiceInformation += buildElementsUnbounded(ucpeVmsServiceInformation, vnfListList, "vnf-information")
- rebuildUcpeVmsServiceInformation += "</tns2:vnf-list>"
- rebuildUcpeVmsServiceInformation += "</tns2:ucpe-vms-service-information>"
- }
- log("DEBUG", " rebuildUcpeVmsServiceInformation - " + rebuildUcpeVmsServiceInformation)
- return rebuildUcpeVmsServiceInformation
- }
-
- // Build internet-service-change-details
- def buildInternetServiceChangeDetails(xmlInput) {
- def rebuildInternetServiceChangeDetails = ""
- if (xmlInput != null) {
- try { // optional
- def internetServiceChangeDetails = getNodeXml(xmlInput, "internet-service-change-details").drop(38).trim()
- rebuildInternetServiceChangeDetails = "<tns:internet-service-change-details>"
- rebuildInternetServiceChangeDetails += buildElements(internetServiceChangeDetails, ["internet-evc-speed-value"], "")
- rebuildInternetServiceChangeDetails += buildElements(internetServiceChangeDetails, ["internet-evc-speed-units"], "")
- try { // optional
- def tProvidedV4LanPublicPrefixesChangesList = ["request-index", "v4-next-hop-address", "v4-lan-public-prefix", "v4-lan-public-prefix-length"]
- rebuildInternetServiceChangeDetails += buildElementsUnbounded(internetServiceChangeDetails, tProvidedV4LanPublicPrefixesChangesList, "t-provided-v4-lan-public-prefixes")
- } catch (Exception e) {
- log("ERROR"," Optional - Exception in INTERNET-SERVICE-CHANGE-DETAILS 't-provided-v4-lan-public-prefixes ")
- }
- try { // optional
- def tProvidedV6LanPublicPrefixesChangesList = ["request-index", "v6-next-hop-address", "v6-lan-public-prefix", "v6-lan-public-prefix-length"]
- rebuildInternetServiceChangeDetails += buildElementsUnbounded(internetServiceChangeDetails, tProvidedV6LanPublicPrefixesChangesList, "t-provided-v6-lan-public-prefixes")
- } catch (Exception e) {
- log("ERROR"," Optional - Exception INTERNET-SERVICE-CHANGE-DETAILS 't-provided-v6-lan-public-prefixes ")
- }
- rebuildInternetServiceChangeDetails += "</tns:internet-service-change-details>"
- } catch (Exception e) {
- log("ERROR", " Optional - Exception INTERNET-SERVICE-CHANGE-DETAILS 'internet-service-change-details' ")
- }
- }
- return rebuildInternetServiceChangeDetails
- }
-
- // Build vr-lan
- def buildVrLan(xmlInput) {
-
- def rebuildVrLan = ''
- if (xmlInput != null) {
-
- rebuildVrLan = "<tns2:vr-lan>"
- def vrLan = getNodeXml(xmlInput, "vr-lan").drop(38).trim()
- rebuildVrLan += buildElements(vrLan, ["routing-protocol"], "")
-
- // vr-lan-interface
- def rebuildVrLanInterface = "<tns2:vr-lan-interface>"
- def vrLanInterface = getNodeXml(vrLan, "vr-lan-interface").drop(38).trim()
- rebuildVrLanInterface += buildVrLanInterfacePartial(vrLanInterface)
-
- // dhcp
- def dhcp = getNodeXml(vrLan, "dhcp").drop(38).trim()
- def rebuildDhcp = buildDhcp(dhcp)
- rebuildVrLanInterface += rebuildDhcp
-
- // pat
- def pat = getNodeXml(vrLan, "pat").drop(38).trim()
- def rebuildPat = buildPat(pat)
- rebuildVrLanInterface += rebuildPat
-
- // nat
- def rebuildNat = ""
- try { // optional
- def nat = getNodeXml(vrLan, "nat").drop(38).trim()
- rebuildNat = buildNat(nat)
- } catch (Exception e) {
- log("ERROR", " Optional - Exception 'nat' ")
- }
- rebuildVrLanInterface += rebuildNat
-
- // firewall-lite
- def firewallLite = getNodeXml(vrLan, "firewall-lite").drop(38).trim()
- def rebuildFirewallLite = buildFirewallLite(firewallLite)
- rebuildVrLanInterface += rebuildFirewallLite
-
- // static-routes
- def rebuildStaticRoutes = ""
- try { // optional
- def staticRoutes = getNodeXml(vrLan, "static-routes").drop(38).trim()
- rebuildStaticRoutes = buildStaticRoutes(staticRoutes)
- } catch (Exception e) {
- log("ERROR", " Optional - Exception 'static-routes' ")
- }
- rebuildVrLanInterface += rebuildStaticRoutes
-
- rebuildVrLan += rebuildVrLanInterface
- rebuildVrLan += "</tns2:vr-lan-interface>"
- rebuildVrLan += "</tns2:vr-lan>"
-
- }
- log("DEBUG", " rebuildVrLan - " + rebuildVrLan)
- return rebuildVrLan
- }
-
- // Build vr-lan-interface
- def buildVrLanInterfacePartial(xmlInput) {
- def rebuildingVrLanInterface = ''
- if (xmlInput != null) {
- def vrLanInterfaceList = ["vr-designation", "v4-vr-lan-prefix", "v4-vr-lan-address", "v4-vr-lan-prefix-length", "v6-vr-lan-prefix", "v6-vr-lan-address", "v6-vr-lan-prefix-length", "v4-vce-loopback-address", "v6-vce-wan-address"]
- rebuildingVrLanInterface += buildElements(xmlInput, vrLanInterfaceList, "")
- rebuildingVrLanInterface += "<tns2:v4-public-lan-prefixes>"
- try { // optional
- def tProvidedV4LanPublicPrefixes = getNodeXml(xmlInput, "v4-public-lan-prefixes").drop(38).trim()
- def tProvidedV4LanPublicPrefixesList = ["request-index", "v4-next-hop-address", "v4-lan-public-prefix", "v4-lan-public-prefix-length" ]
- rebuildingVrLanInterface += buildElementsUnbounded(xmlInput, tProvidedV4LanPublicPrefixesList, "t-provided-v4-lan-public-prefixes")
- } catch (Exception ex) {
- log("ERROR", " Optional - Exception VR-LAN INTERFACE 'v4-public-lan-prefixes' ")
- }
- rebuildingVrLanInterface += "</tns2:v4-public-lan-prefixes>"
- rebuildingVrLanInterface += "<tns2:v6-public-lan-prefixes>"
- try { // optional
- def tProvidedV6LanPublicPrefixes = getNodeXml(xmlInput, "v6-public-lan-prefixes").drop(38).trim()
- def tProvidedV6LanPublicPrefixesList = ["request-index", "v6-next-hop-address", "v6-lan-public-prefix", "v6-lan-public-prefix-length" ]
- rebuildingVrLanInterface += buildElementsUnbounded(xmlInput, tProvidedV6LanPublicPrefixesList, "t-provided-v6-lan-public-prefixes")
- } catch (Exception e) {
- log("ERROR", " Optional - Exception VR-LAN INTERFACE 'v6-public-lan-prefixes' ")
- }
- rebuildingVrLanInterface += "</tns2:v6-public-lan-prefixes>"
- }
- log("DEBUG", " rebuildingVrLanInterface - " + rebuildingVrLanInterface)
- return rebuildingVrLanInterface
- }
-
- // Build dhcp
- def buildDhcp(xmlInput) {
- def rebuildingDhcp = ''
- if (xmlInput != null) {
- def dhcpData = new XmlSlurper().parseText(xmlInput)
- rebuildingDhcp = "<tns2:dhcp>"
- def dhcpList1 = ["v4-dhcp-server-enabled", "v6-dhcp-server-enabled", "use-v4-default-pool", "v4-dhcp-default-pool-prefix", "v4-dhcp-default-pool-prefix-length"]
- rebuildingDhcp += buildElements(xmlInput, dhcpList1, "")
- try { // optional
- def excludedV4DhcpAddressesFromDefaultPoolList = ["excluded-v4-address"]
- rebuildingDhcp += buildElementsUnbounded(xmlInput, excludedV4DhcpAddressesFromDefaultPoolList, "excluded-v4-dhcp-addresses-from-default-pool")
- } catch (Exception e) {
- log("ERROR", " Optional - Exception DHCP 'excluded-v4-dhcp-addresses-from-default-pool' ")
- }
- try { // optional
- def v4DhcpPools = dhcpData.'**'.findAll {it.name() == "v4-dhcp-pools"}
- def v4DhcpPoolsSize = v4DhcpPools.size()
- // println " v4DhcpPoolsSize = " + v4DhcpPools.size()
- for (i in 0..v4DhcpPoolsSize-1) {
- def v4DhcpPool = v4DhcpPools[i]
- def v4DhcpPoolXml = XmlUtil.serialize(v4DhcpPool)
- rebuildingDhcp += "<tns2:v4-dhcp-pools>"
- def v4DhcpPoolsList1 = ["v4-dhcp-pool-prefix", "v4-dhcp-pool-prefix-length" ]
- rebuildingDhcp += buildElements(v4DhcpPoolXml, v4DhcpPoolsList1, "")
- try { // optional
- def excludedV4AddressesList = ["excluded-v4-address"]
- rebuildingDhcp += buildElementsUnbounded(v4DhcpPoolXml, excludedV4AddressesList, "excluded-v4-addresses")
- } catch (Exception e) {
- log("ERROR", " Optional - Exception DHCP 'excluded-v4-addresses' ")
- }
- def v4DhcpPoolsList2 = ["v4-dhcp-relay-gateway-address", "v4-dhcp-relay-next-hop-address"]
- rebuildingDhcp += buildElements(v4DhcpPoolXml, v4DhcpPoolsList2, "")
- rebuildingDhcp += "</tns2:v4-dhcp-pools>"
- }
- } catch (Exception e) {
- log("ERROR"," Optional - Exception DHCP 'v4-dhcp-pools' ")
- }
- def dhcpList2 = ["use-v6-default-pool", "v6-dhcp-default-pool-prefix", "v6-dhcp-default-pool-prefix-length"]
- rebuildingDhcp += buildElements(xmlInput, dhcpList2, "")
- try { // optional
- def excludedV6DhcpAddressesFromDdefaultPoolList = ["excluded-v6-address"]
- rebuildingDhcp += buildElementsUnbounded(xmlInput, excludedV6DhcpAddressesFromDdefaultPoolList, "excluded-v6-dhcp-addresses-from-default-pool")
- } catch (Exception e) {
- log("ERROR", " Optional - Exception DHCP 'excluded-v6-dhcp-addresses-from-default-pool' ")
- }
- try { // optional
- def v6DhcpPools = dhcpData.'**'.findAll {it.name() == "v6-dhcp-pools"}
- def v6DhcpPoolsSize = v6DhcpPools.size()
- //println " v6DhcpPoolsSize = " + v6DhcpPools.size()
- for (i in 0..v6DhcpPoolsSize-1) {
- def v6DhcpPool = v6DhcpPools[i]
- def v6DhcpPoolXml = XmlUtil.serialize(v6DhcpPool)
- rebuildingDhcp += "<tns2:v6-dhcp-pools>"
- def v6DhcpPoolsList1 = ["v6-dhcp-pool-prefix", "v6-dhcp-pool-prefix-length"]
- rebuildingDhcp += buildElements(v6DhcpPoolXml, v6DhcpPoolsList1, "")
- try { // optional
- def excludedV6AddressesList = ["excluded-v6-address"]
- rebuildingDhcp += buildElementsUnbounded(v6DhcpPoolXml, excludedV6AddressesList, "excluded-v6-addresses")
- } catch (Exception e) {
- log("ERROR", " Optional - Exception DHCP 'excluded-v6-addresses' ")
- }
- def v6DhcpPoolsList2 = ["v6-dhcp-relay-gateway-address", "v6-dhcp-relay-next-hop-address"]
- rebuildingDhcp += buildElements(v6DhcpPoolXml, v6DhcpPoolsList2, "")
- rebuildingDhcp += "</tns2:v6-dhcp-pools>"
- }
- } catch (Exception e) {
- log("ERROR", " Optional - Exception DHCP 'v6-dhcp-pools' ")
- }
- rebuildingDhcp += "</tns2:dhcp>"
- }
- log("DEBUG", " rebuildingDhcp - " + rebuildingDhcp)
- return rebuildingDhcp
- }
-
- // Build pat
- def buildPat(xmlInput) {
- def rebuildingPat = ''
- if (xmlInput != null) {
- rebuildingPat = "<tns2:pat>"
- def patList = ["v4-pat-enabled", "use-v4-default-pool", "v4-pat-default-pool-prefix", "v4-pat-default-pool-prefix-length"]
- rebuildingPat += buildElements(xmlInput, patList, "")
- try { // optional
- def v4PatPools = getNodeXml(xmlInput, "v4-pat-pools").drop(38).trim()
- def v4PatPoolsList = ["v4-pat-pool-prefix", "v4-pat-pool-prefix-length", "v4-pat-pool-next-hop-address"]
- rebuildingPat += buildElementsUnbounded(xmlInput, v4PatPoolsList, "v4-pat-pools")
- } catch (Exception e) {
- log("ERROR", " Optional - Exception 'v4-pat-pool-next-hop-address' ")
- }
- rebuildingPat += "</tns2:pat>"
- }
- log("DEBUG", " rebuildingPat - " + rebuildingPat)
- return rebuildingPat
- }
-
- // Build nat
- def buildNat(xmlInput) {
- def rebuildingNat = ''
- if (xmlInput != null) {
- rebuildingNat = "<tns2:nat>"
- rebuildingNat += buildElements(xmlInput, ["v4-nat-enabled"], "")
- try { // optional
- def v4NatMappingEntries = getNodeXml(xmlInput, "v4-nat-mapping-entries").drop(38).trim()
- def v4NatMappingEntriesList = ["v4-nat-internal", "v4-nat-next-hop-address", "v4-nat-external"]
- rebuildingNat += buildElementsUnbounded(xmlInput, v4NatMappingEntriesList, "v4-nat-mapping-entries")
- } catch (Exception e) {
- log("ERROR", " Optional - Exception 'v4-nat-external' ")
- }
- rebuildingNat += "</tns2:nat>"
- }
- log("DEBUG", " rebuildingNat - " + rebuildingNat)
- return rebuildingNat
- }
-
- // Build firewall-lite
- def buildFirewallLite(xmlInput) {
- def rebuildingFirewallLite = ''
-
- if (xmlInput != null) {
-
- def firewallLiteData = new XmlSlurper().parseText(xmlInput)
- rebuildingFirewallLite = "<tns2:firewall-lite>"
- def firewallLiteList = ["stateful-firewall-lite-v4-enabled", "stateful-firewall-lite-v6-enabled"]
- rebuildingFirewallLite += buildElements(xmlInput, firewallLiteList, "")
-
- try { // optional
- def v4FirewallPacketFilters = firewallLiteData.'**'.findAll {it.name() == "v4-firewall-packet-filters"}
- def v4FirewallPacketFiltersSize = v4FirewallPacketFilters.size()
- //println " v4FirewallPacketFiltersSize = " + v4FirewallPacketFilters.size()
- for (i in 0..v4FirewallPacketFiltersSize-1) {
- def v4FirewallPacketFilter = v4FirewallPacketFilters[i]
- def v4FirewallPacketFilterXml = XmlUtil.serialize(v4FirewallPacketFilter)
- rebuildingFirewallLite += "<tns2:v4-firewall-packet-filters>"
- def v4FirewallPacketFiltersList = ["v4-firewall-prefix", "v4-firewall-prefix-length", "allow-icmp-ping"]
- rebuildingFirewallLite += buildElements(v4FirewallPacketFilterXml, v4FirewallPacketFiltersList, "")
- try { // optional
- def udpPortsList = ["port-number"]
- rebuildingFirewallLite += buildElementsUnbounded(v4FirewallPacketFilterXml, udpPortsList, "udp-ports")
- } catch (Exception e) {
- log("ERROR", " Optional - Exception FIREWALL-LITE v4 'udp-ports' ")
- }
- try { // optional
- def tcpPortsList = ["port-number"]
- rebuildingFirewallLite += buildElementsUnbounded(v4FirewallPacketFilterXml, tcpPortsList, "tcp-ports")
- } catch (Exception e) {
- log("ERROR", " Optional - Exception FIREWALL-LITE v4 'tcp-ports' ")
- }
- rebuildingFirewallLite += "</tns2:v4-firewall-packet-filters>"
- }
- } catch (Exception e) {
- log("ERROR", " Optional - Exception FIREWALL-LITE 'v4-firewall-packet-filters' ")
- }
-
- try { // optional
- def v6FirewallPacketFilters = firewallLiteData.'**'.findAll {it.name() == "v6-firewall-packet-filters"}
- def v6FirewallPacketFiltersSize = v6FirewallPacketFilters.size()
- //println " v6FirewallPacketFiltersSize = " + v6FirewallPacketFilters.size()
- for (i in 0..v6FirewallPacketFiltersSize-1) {
- def v6FirewallPacketFilter = v6FirewallPacketFilters[i]
- def v6FirewallPacketFilterXml = XmlUtil.serialize(v6FirewallPacketFilter)
- rebuildingFirewallLite += "<tns2:v6-firewall-packet-filters>"
- def v6FirewallPacketFiltersList = ["v6-firewall-prefix", "v6-firewall-prefix-length", "allow-icmp-ping"]
- rebuildingFirewallLite += buildElements(v6FirewallPacketFilterXml, v6FirewallPacketFiltersList, "")
- try { // optional
- def udpPortsList = ["port-number"]
- rebuildingFirewallLite += buildElementsUnbounded(v6FirewallPacketFilterXml, udpPortsList, "udp-ports")
- } catch (Exception e) {
- log("ERROR", " Optional - Exception FIREWALL-LITE v6 'udp-ports' ")
- }
- try { // optional
- def tcpPortsList = ["port-number"]
- rebuildingFirewallLite += buildElementsUnbounded(v6FirewallPacketFilterXml, tcpPortsList, "tcp-ports")
- } catch (Exception e) {
- log("ERROR", " Optional - Exception FIREWALL-LITE v6 'tcp-ports' ")
- }
- rebuildingFirewallLite += "</tns2:v6-firewall-packet-filters>"
- }
- } catch (Exception e) {
- log("ERROR", " Optional - Exception FIREWALL-LITE 'v6-firewall-packet-filters' ")
- }
- rebuildingFirewallLite+= "</tns2:firewall-lite>"
- }
- log("DEBUG", " rebuildingFirewallLite - " + rebuildingFirewallLite)
- return rebuildingFirewallLite
- }
-
- def buildStaticRoutes(xmlInput) {
- def rebuildingStaticRoutes = ''
- if (xmlInput != null) {
- rebuildingStaticRoutes = "<tns2:static-routes>"
- def v4StaticRouteslist = ["v4-static-route-prefix","v4-static-route-prefix-length", "v4-next-hop-address"]
- rebuildingStaticRoutes += buildElementsUnbounded(xmlInput, v4StaticRouteslist, "v4-static-routes")
- def v6StaticRouteslist = ["v6-static-route-prefix","v6-static-route-prefix-length", "v6-next-hop-address"]
- rebuildingStaticRoutes += buildElementsUnbounded(xmlInput, v6StaticRouteslist, "v6-static-routes")
- rebuildingStaticRoutes += "</tns2:static-routes>"
- }
- log("DEBUG", " rebuildingStaticRoutes - " + rebuildingStaticRoutes)
- return rebuildingStaticRoutes
- }
-
- public String generateCurrentTimeInUtc(){
- final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
- sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
- final String utcTime = sdf.format(new Date());
- return utcTime;
- }
-
- public String generateCurrentTimeInGMT(){
- final SimpleDateFormat sdf = new SimpleDateFormat("E, d MMM yyyy h:m:s z");
- sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
- final String utcTime = sdf.format(new Date());
- return utcTime;
- }
-
-
- /**
- * @param encryptedAuth: encrypted credentials from urn properties
- * @param msoKey: key to use to decrypt from urn properties
- * @return base 64 encoded basic auth credentials
- */
- def getBasicAuth(encryptedAuth, msoKey){
- if ((encryptedAuth == null || encryptedAuth.isEmpty()) || (msoKey == null || msoKey.isEmpty()))
- return null
- try {
- def auth = decrypt(encryptedAuth, msoKey)
- byte[] encoded = Base64.encodeBase64(auth.getBytes())
- String encodedString = new String(encoded)
- encodedString = "Basic " + encodedString
- return encodedString
- } catch (Exception ex) {
- log("ERROR", "Unable to encode basic auth")
- throw ex
- }
- }
-
- def encrypt(toEncrypt, msokey){
- try {
- String result = CryptoUtils.encrypt(toEncrypt, msokey);
- return result
- }
- catch (Exception e) {
- log("ERROR", "Failed to encrypt credentials")
- }
- }
-
- def decrypt(toDecrypt, msokey){
- try {
- String result = CryptoUtils.decrypt(toDecrypt, msokey);
- return result
- }
- catch (Exception e) {
- log("ERROR", "Failed to decrypt credentials")
- throw e
- }
- }
-
- /**
- * Return URL with qualified host name (if any) or urn mapping
- * @param String url from urn mapping
- * @return String url with qualified host name
- */
- public String getQualifiedHostNameForCallback(String urnCallbackUrl) {
- def callbackUrlToUse = urnCallbackUrl
- try{
- //swap host name with qualified host name from the jboss properties
- def qualifiedHostName = System.getProperty("jboss.qualified.host.name")
- if(qualifiedHostName!=null){
- log("DEBUG", "qualifiedHostName:\n" + qualifiedHostName)
- callbackUrlToUse = callbackUrlToUse.replaceAll("(http://)(.*)(:28080*)", {orig, first, torepl, last -> "${first}${qualifiedHostName}${last}"})
- }
- }catch(Exception e){
- log("DEBUG", "unable to grab qualified host name, using what's in urn properties for callbackurl. Exception was: " + e.printStackTrace())
- }
- return callbackUrlToUse
-
- }
-
- /**
- * Retrieves text context of the element if the element exists, returns empty string otherwise
- * @param com.sun.org.apache.xerces.internal.dom.DeferredElementNSImpl element to parse
- * param String tagName tagName
- * @return String text content of the element
- */
- public String getElementText(Element element, String tagName) {
- String text = ""
- org.w3c.dom.NodeList nodeList = element.getElementsByTagNameNS("*", tagName)
- if (nodeList != null && nodeList.length > 0) {
- text = nodeList.item(0).getTextContent()
- }
- return text
- }
-
- /**
- *
- * Find the lowest unused module-index value in a given xml
- */
- public String getLowestUnusedIndex(String xml) {
- if (xml == null || xml.isEmpty()) {
- return "0"
- }
- def moduleIndexList = getMultNodes(xml, "module-index")
- if (moduleIndexList == null || moduleIndexList.size() == 0) {
- return "0"
- }
- def sortedModuleIndexList = moduleIndexList.sort { a, b -> a.compareTo b }
-
- for (i in 0..sortedModuleIndexList.size()-1) {
- if (Integer.parseInt(sortedModuleIndexList[i]) != i) {
- return i.toString()
- }
- }
- return sortedModuleIndexList.size().toString()
- }
- /**
- * This utility checks if there is transaction id already present in MDC.
- * If found, it returns same else creates new, sets in MDC for future use before returning
- * @return String RequestId in UUID format.
- */
- public String getRequestID()
- {
- String requestId = MDC.get("RequestId")
- if(requestId == null || requestId.isEmpty())
- {
- requestId = java.util.UUID.randomUUID()
- MDC.put("RequestId",requestId)
- log("DEBUG","MsoUtils - Created new RequestId: " + requestId)
- }
- else
- {
- log("DEBUG","MsoUtils - Using existing RequestId: " + requestId)
- }
-
- return requestId
- }
-
- /**
- * Remove all the empty nodes and attributes from the within the given node
- * @param node
- * @return true if all empty nodes and attributes were removed.
- */
- public boolean cleanNode( Node node ) {
- node.attributes().with { a ->
- a.findAll { !it.value }.each { a.remove( it.key ) }
- }
- node.children().with { kids ->
- kids.findAll { it instanceof Node ? !cleanNode( it ) : false }
- .each { kids.remove( it ) }
- }
- node.attributes() || node.children() || node.text()
- }
-
- /**
- *
- * @param xml
- * @return String representation of xml after removing the empty nodes and attributes
- */
- public String cleanNode(String xmlString) {
- def xml = new XmlParser(false, false).parseText(xmlString)
- cleanNode(xml)
- return XmlUtil.serialize(xml)
- }
-}
+/*- + * ============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.common.scripts + +import java.text.SimpleDateFormat + +import org.apache.commons.codec.binary.Base64 +import org.apache.commons.lang3.StringEscapeUtils +import org.onap.so.bpmn.core.BPMNLogger +import org.onap.so.bpmn.core.xml.XmlTool +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger +import org.onap.so.utils.CryptoUtils +import org.slf4j.MDC +import org.w3c.dom.Element + +import groovy.util.slurpersupport.NodeChild +import groovy.xml.XmlUtil + +class MsoUtils { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, MsoUtils.class); + + def initializeEndPoints(execution){ + // use this placeholder to initialize end points, if called independently, this need to be set + execution.setVariable("AAIEndPoint","http://localhost:28080/SoapUIMocks") + } + + /** + * Returns the unescaped contents of element + * + * @param xmlInput + * @param element + * @return + */ + def getNodeText(xmlInput,element){ + def rtn=null + if(xmlInput!=null){ + def xml= new XmlSlurper().parseText(xmlInput) + rtn= xml.'**'.find{node->node.name()==element} + if (rtn != null){ + rtn=rtn.text() + } + } + return rtn + } + def getMultNodes(xmlInput, element){ + def nodes=null + if(xmlInput!=null){ + def xml= new XmlSlurper().parseText(xmlInput) + nodes = xml.'**'.findAll{ node-> node.name() == element }*.text() + } + return nodes + } + /** + * Note: this uses XmlParser instead of XmlSlurper, thus it is not as + * efficient because it instantiates the whole DOM tree. + * @param xmlInput + * @param element + * @return a list of Nodes, or {@code null} if <i>xmlInput</i> is {@code null} + */ + def getMultNodeObjects(xmlInput, element){ + def nodes=null + if(xmlInput!=null){ + def xml= new XmlParser().parseText(xmlInput) + nodes = xml.'**'.findAll{ node-> node.name() == element } + } + return nodes + } + + def getNodeXml(xmlInput,element){ + return getNodeXml(xmlInput, element, true) + } + def getNodeXml(xmlInput,element,incPreamble){ + def fxml= new XmlSlurper().parseText(xmlInput) + NodeChild nodeToSerialize = fxml.'**'.find {it.name() == element} + if(nodeToSerialize==null){ + return "" + } + def nodeAsText = XmlUtil.serialize(nodeToSerialize) + if (!incPreamble) { + nodeAsText = removeXmlPreamble(nodeAsText) + } + + return unescapeNodeContents(nodeToSerialize, nodeAsText) + } + + def unescapeNodeContents(NodeChild node, String text) { + if (!node.childNodes().hasNext()) { + return StringEscapeUtils.unescapeXml(text) + } else { + return text + } + } + + def nodeExists(xmlInput,element){ + try { + def fxml= new XmlSlurper().parseText(xmlInput) + def nodeToSerialize = fxml.'**'.find {it.name() == element} + return nodeToSerialize!=null + } catch(Exception e) { + return false + } + } + + + /***** Utilities when using XmlParser *****/ + + /** + * Convert a Node into a String by deserializing it and formatting it. + * + * @param node Node to be converted. + * @return the Node as a String. + */ + def String nodeToString(Node node) { + def String nodeAsString = groovy.xml.XmlUtil.serialize(node) + nodeAsString = removeXmlPreamble(nodeAsString) + return formatXml(nodeAsString) + } + + /** + * Get the specified child Node of the specified parent. If there are + * multiple children of the same name, only the first one is returned. + * If there are no children with the specified name, 'null' is returned. + * + * @param parent Parent Node in which to find a child. + * @param childNodeName Name of the child Node to get. + * @return the (first) child Node with the specified name or 'null' + * if a child Node with the specified name does not exist. + */ + def Node getChildNode(Node parent, String childNodeName) { + def NodeList nodeList = getIdenticalChildren(parent, childNodeName) + if (nodeList.size() == 0) { + return null + } else { + return nodeList.get(0) + } + } + + /** + * Get the textual value of the specified child Node of the specified parent. + * If there are no children with the specified name, 'null' is returned. + * + * @param parent Parent Node in which to find a child. + * @param childNodeName Name of the child Node whose value to get. + * @return the textual value of child Node with the specified name or 'null' + * if a child Node with the specified name does not exist. + */ + def String getChildNodeText(Node parent, String childNodeName) { + def Node childNode = getChildNode(parent, childNodeName) + if (childNode == null) { + return null + } else { + return childNode.text() + } + } + + /** + * Get all of the child nodes from the specified parent that have the + * specified name. The returned NodeList could be empty. + * + * @param parent Parent Node in which to find children. + * @param childNodeName Name of the children to get. + * @return a NodeList of all the children from the parent with the specified + * name. The list could be empty. + */ + def NodeList getIdenticalChildren(Node parent, String childNodeName) { + return (NodeList) parent.get(childNodeName) + } + + /***** End of Utilities when using XmlParser *****/ + + + /** these are covered under the common function above**/ + def getSubscriberName(xmlInput,element){ + def rtn=null + if(xmlInput!=null){ + def xml= new XmlSlurper().parseText(xmlInput) + rtn= xml.'**'.find{node->node.name()==element}.text() + } + return rtn + } + def getTenantInformation(xmlInput,element){ + def xml= new XmlSlurper().parseText(xmlInput) + def nodeToSerialize = xml.'**'.find {it.name() == 'service-information'} + def nodeAsText = XmlUtil.serialize(nodeToSerialize) + return nodeAsText + } + def getServiceInstanceId(xmlInput,element){ + def xml= new XmlSlurper().parseText(xmlInput) + return ( xml.'**'.find{node->node.name()==element}.text() ) + } + //for aai tenant url + def searchResourceLink(xmlInput, resourceType){ + def fxml= new XmlSlurper().parseText(xmlInput) + def element = fxml.'**'.find {it.'resource-type' == resourceType} + return (element == null) ? null : element.'resource-link'.text() + } + + def searchMetaData(xmlInput, searchName, searchValue){ + def fxml= new XmlSlurper().parseText(xmlInput) + def ret = fxml.'**'.find {it.metaname.text() == searchName && it.metaval.text() == searchValue} + if(ret != null){ + return ret.parent().parent() + } + return ret + } + + def searchMetaDataNode(fxml, searchName, searchValue){ + def ret = fxml.'**'.find {it.metaname.text() == searchName && it.metaval.text() == searchValue} + if(ret != null){ + return ret.parent().parent() + } + return ret + } + + // for Trinity L3 add/delete bonding + def getPBGFList(isDebugLogEnabled, xmlInput){ + log("DEBUG", "getPBGFList: xmlInput " + xmlInput,isDebugLogEnabled) + ArrayList myNodes = new ArrayList() + if(nodeExists(xmlInput,"nbnc-response-information")){ + def respInfo=getNodeXml(xmlInput,"nbnc-response-information", false) + if(respInfo!=null){ + def fxml= new XmlSlurper().parseText(respInfo) + fxml.'virtual-datacenter-list'.each { vdc -> + //we only want to add two BGF per VDC, BGF1 and BGF2 + def routerList = vdc.'router-list'.first() + routerList.each{ myList -> + def physNodes = myList.'**'.findAll {it.'border-element-tangibility'.text() =~ /PHYSICAL/} + def nodeToAdd + physNodes.each{ + if(nodeToAdd==null){ + nodeToAdd = it + }else{ + def beid = nodeToAdd.'border-element-id'.text() + + " " + nodeToAdd.'border-element-type'.text() + + " and " + + it.'border-element-id'.text() + + " " + it.'border-element-type'.text() + def mytag = nodeToAdd.'border-element-id' + mytag[0].replaceBody(beid) + } + } + def mytag = nodeToAdd.'vlan-id' + def ind = mytag.text().indexOf('.') + if(ind >= 0){ + def vlan = mytag.text().substring(0,ind) + mytag[0].replaceBody(vlan) + } + myNodes.add(XmlUtil.serialize(nodeToAdd)) + } + + } + } + + return myNodes + }else{ + return null + } + } + + def getPBGFList(xmlInput){ + getPBGFList("false", xmlInput) + } + + def getMetaVal(node, name){ + try{ + return node.'**'.find {it.metaname.text() == name}.metaval.text() + }catch(Exception e){ + return null + } + } + def getRelationshipVal(node, name){ + try{ + return node.'**'.find {it.'relationship-key'.text() == name}.'relationship-value'.text() + }catch(Exception e){ + return null + } + } + + + def log(logmode,logtxt,isDebugLogEnabled="false"){ + if ("INFO"==logmode) { + msoLogger.info(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, logtxt, "BPMN", MsoLogger.getServiceName()); + } else if ("WARN"==logmode) { + // to see the warning text displayed in the log entry, the text must also be passed as arg0 (2nd argument) to invoke the correct MsoLogger warn() method + msoLogger.warn (MessageEnum.BPMN_GENERAL_WARNING, logtxt, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, logtxt); + } else if ("ERROR"==logmode) { + // to see the error text displayed in the log entry, the text must also be passed as arg0 (2nd argument) to invoke the correct MsoLogger error() method + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, logtxt, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, logtxt); + + } else { + BPMNLogger.debug(isDebugLogEnabled, logtxt); + } + } + + def logContext(requestId, serviceInstanceId){ + msoLogger.setLogContext(requestId, serviceInstanceId); + } + + def logMetrics(elapsedTime, logtxt){ + + msoLogger.recordMetricEvent (elapsedTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, + logtxt, "BPMN", MsoLogger.getServiceName(), null); + } + + def logAudit(logtxt){ + long startTime = System.currentTimeMillis(); + + msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, logtxt); + } + + // headers: header - name-value + def getHeaderNameValue(xmlInput, nameAttribute){ + def rtn=null + if(xmlInput!=null){ + def xml= new XmlSlurper().parseText(xmlInput) + rtn= xml.'**'.find {header->header.'@name'.text() == nameAttribute}.'@value' + } + return rtn + } + + /** + * Gets the children of the specified element. + */ + public String getChildNodes(xmlInput, element) { + def xml= new XmlSlurper().parseText(xmlInput) + def thisElement = xml.'**'.find {it.name() == element} + StringBuilder out = new StringBuilder() + if (thisElement != null) { + thisElement.children().each() { + String nodeAsText = removeXmlPreamble(XmlUtil.serialize(it)) + if (out.length() > 0) { + out.append(System.lineSeparator()) + } + out.append(nodeAsText) + } + } + return out.toString(); + } + + /** + * Encodes a value so it can be used inside an XML text element. + * + * <b>Will double encode</b> + * @param s the string to encode + * @return the encoded string + */ + public static String xmlEscape(Object value) { + return XmlTool.encode(value) + } + + /** + * Removes the preamble, if present, from an XML document. + * Also, for historical reasons, this also trims leading and trailing + * whitespace from the resulting document. TODO: remove the trimming + * and fix unit tests that depend on EXACT xml format. + * @param xml the XML document + * @return a possibly modified document + */ + public String removeXmlPreamble(def xml) { + if (xml == null) { + return null + } + + return XmlTool.removePreamble(xml).trim() + } + + /** + * Removes namespaces and namespace declarations from an XML document. + * @param xml the XML document + * @return a possibly modified document + */ + public String removeXmlNamespaces(def xml) { + return XmlTool.removeNamespaces(xml); + } + + /** + * Use formatXml instead. Note: this method inserts an XML preamble. + */ + @Deprecated + def formatXML(xmlInput) { + def parseXml = null + def formatXml = null + if (xmlInput !=null) { + parseXml = new XmlParser().parseText(xmlInput) + formatXml = XmlUtil.serialize(parseXml) + } + } + + /** + * Reformats an XML document. The result will not contain an XML preamble + * or a trailing newline. + * @param xml the XML document + * @return a reformatted document + */ + public String formatXml(def xml) { + return XmlTool.normalize(xml); + } + + // build single elements + def buildElements(xmlInput, elementList, parentName) { + String var = "" + def xmlBuild = "" + if (parentName != "") { + xmlBuild += "<tns2:"+parentName+">" + } + if (xmlInput != null) { + for (element in elementList) { + def xml= new XmlSlurper().parseText(xmlInput) + var = xml.'**'.find {it.name() == element} + if (var != null) { + xmlBuild += "<tns2:"+element+">"+var.toString()+"</tns2:"+element+">" + } + } + } + if (parentName != "") { + xmlBuild += "</tns2:"+parentName+">" + } + return xmlBuild + } + + // build the Unbounded elements + def buildElementsUnbounded(xmlInput, elementList, parentName) { + def varParents = "" + def var = "" + def xmlBuildUnbounded = "" + if (xmlInput != null) { + def xml= new XmlSlurper().parseText(xmlInput) + varParents = xml.'**'.findAll {it.name() == parentName} + //println " Unbounded ${parentName} - varParent.Size() - " + varParents.size() + for (i in 0..varParents.size()-1) { + if (parentName != "") { + xmlBuildUnbounded += "<tns2:"+parentName+">" + } + for (element in elementList) { + var = varParents[i].'*'.find {it.name() == element} + if (var != null) { + xmlBuildUnbounded += "<tns2:"+element+">"+var.toString()+"</tns2:"+element+">" + //println " i = " + i + ", element: " + element + " = " + var.toString() + } + } + if (parentName != "") { + xmlBuildUnbounded += "</tns2:"+parentName+">" + } + } + } + return xmlBuildUnbounded + } + + // Build l2-homing-information + def buildL2HomingInformation(xmlInput) { + def elementsL2HomingList = ["evc-name", "topology", "preferred-aic-clli","aic-version"] + def rebuildL2Home = '' + if (xmlInput != null) { + rebuildL2Home = buildElements(xmlInput, elementsL2HomingList, "l2-homing-information") + } + return rebuildL2Home + } + + // Build internet-evc-access-information + def buildInternetEvcAccessInformation(xmlInput) { + def elementsInternetEvcAccessInformationList = ["internet-evc-speed-value", "internet-evc-speed-units", "ip-version"] + def rebuildInternetEvcAccess = '' + if (xmlInput != null) { + rebuildInternetEvcAccess = buildElements(xmlInput, elementsInternetEvcAccessInformationList, "internet-evc-access-information") + } + return rebuildInternetEvcAccess + } + + // Build ucpe-vms-service-information + def buildUcpeVmsServiceInformation(xmlInput) { + def rebuildUcpeVmsServiceInformation = '' + if (xmlInput != null) { + def ucpeVmsServiceInformation = getNodeXml(xmlInput, "ucpe-vms-service-information").drop(38).trim() + rebuildUcpeVmsServiceInformation = "<tns2:ucpe-vms-service-information>" + // transport-service-information + rebuildUcpeVmsServiceInformation += "<tns2:transport-service-information>" + def transportServiceInformation = getNodeXml(ucpeVmsServiceInformation, "transport-service-information").drop(38).trim() + def elementsTransportServiceInformationList = ["transport-service-type"] + rebuildUcpeVmsServiceInformation += buildElements(transportServiceInformation, elementsTransportServiceInformationList, "") + try { // optional + def accessCircuitInfoList = ["access-circuit-id", "dual-mode"] + rebuildUcpeVmsServiceInformation += buildElementsUnbounded(transportServiceInformation, accessCircuitInfoList, "access-circuit-info") + } catch (Exception e) { + log("ERROR", " Optional - Exception ACCESS-CIRCUIT-INFO - 'access-circuit-info' ") + } + rebuildUcpeVmsServiceInformation += "</tns2:transport-service-information>" + // ucpe-information + def elementsUcpeInformationList = ["ucpe-host-name", "ucpe-activation-code", "out-of-band-management-modem" ] + rebuildUcpeVmsServiceInformation += buildElements(ucpeVmsServiceInformation, elementsUcpeInformationList, "ucpe-information") + // vnf-list + rebuildUcpeVmsServiceInformation += "<tns2:vnf-list>" + def vnfListList = ["vnf-instance-id", "vnf-sequence-number", "vnf-type", "vnf-vendor", "vnf-model", "vnf-id", "prov-status", "operational-state", "orchestration-status", "equipment-role" ] + rebuildUcpeVmsServiceInformation += buildElementsUnbounded(ucpeVmsServiceInformation, vnfListList, "vnf-information") + rebuildUcpeVmsServiceInformation += "</tns2:vnf-list>" + rebuildUcpeVmsServiceInformation += "</tns2:ucpe-vms-service-information>" + } + log("DEBUG", " rebuildUcpeVmsServiceInformation - " + rebuildUcpeVmsServiceInformation) + return rebuildUcpeVmsServiceInformation + } + + // Build internet-service-change-details + def buildInternetServiceChangeDetails(xmlInput) { + def rebuildInternetServiceChangeDetails = "" + if (xmlInput != null) { + try { // optional + def internetServiceChangeDetails = getNodeXml(xmlInput, "internet-service-change-details").drop(38).trim() + rebuildInternetServiceChangeDetails = "<tns:internet-service-change-details>" + rebuildInternetServiceChangeDetails += buildElements(internetServiceChangeDetails, ["internet-evc-speed-value"], "") + rebuildInternetServiceChangeDetails += buildElements(internetServiceChangeDetails, ["internet-evc-speed-units"], "") + rebuildInternetServiceChangeDetails += buildElements(internetServiceChangeDetails, ["v4-vr-lan-address"], "") + rebuildInternetServiceChangeDetails += buildElements(internetServiceChangeDetails, ["v4-vr-lan-prefix-length"], "") + try { // optional + def tProvidedV4LanPublicPrefixesChangesList = ["request-index", "v4-next-hop-address", "v4-lan-public-prefix", "v4-lan-public-prefix-length"] + rebuildInternetServiceChangeDetails += buildElementsUnbounded(internetServiceChangeDetails, tProvidedV4LanPublicPrefixesChangesList, "t-provided-v4-lan-public-prefixes") + } catch (Exception e) { + log("ERROR"," Optional - Exception in INTERNET-SERVICE-CHANGE-DETAILS 't-provided-v4-lan-public-prefixes ") + } + try { // optional + def tProvidedV6LanPublicPrefixesChangesList = ["request-index", "v6-next-hop-address", "v6-lan-public-prefix", "v6-lan-public-prefix-length"] + rebuildInternetServiceChangeDetails += buildElementsUnbounded(internetServiceChangeDetails, tProvidedV6LanPublicPrefixesChangesList, "t-provided-v6-lan-public-prefixes") + } catch (Exception e) { + log("ERROR"," Optional - Exception INTERNET-SERVICE-CHANGE-DETAILS 't-provided-v6-lan-public-prefixes ") + } + rebuildInternetServiceChangeDetails += "</tns:internet-service-change-details>" + } catch (Exception e) { + log("ERROR", " Optional - Exception INTERNET-SERVICE-CHANGE-DETAILS 'internet-service-change-details' ") + } + } + return rebuildInternetServiceChangeDetails + } + + // Build vr-lan + def buildVrLan(xmlInput) { + + def rebuildVrLan = '' + if (xmlInput != null) { + + rebuildVrLan = "<tns2:vr-lan>" + def vrLan = getNodeXml(xmlInput, "vr-lan").drop(38).trim() + rebuildVrLan += buildElements(vrLan, ["routing-protocol"], "") + + // vr-lan-interface + def rebuildVrLanInterface = "<tns2:vr-lan-interface>" + def vrLanInterface = getNodeXml(vrLan, "vr-lan-interface").drop(38).trim() + rebuildVrLanInterface += buildVrLanInterfacePartial(vrLanInterface) + + // dhcp + def dhcp = getNodeXml(vrLan, "dhcp").drop(38).trim() + def rebuildDhcp = buildDhcp(dhcp) + rebuildVrLanInterface += rebuildDhcp + + // pat + def pat = getNodeXml(vrLan, "pat").drop(38).trim() + def rebuildPat = buildPat(pat) + rebuildVrLanInterface += rebuildPat + + // nat + def rebuildNat = "" + try { // optional + def nat = getNodeXml(vrLan, "nat").drop(38).trim() + rebuildNat = buildNat(nat) + } catch (Exception e) { + log("ERROR", " Optional - Exception 'nat' ") + } + rebuildVrLanInterface += rebuildNat + + // firewall-lite + def firewallLite = getNodeXml(vrLan, "firewall-lite").drop(38).trim() + def rebuildFirewallLite = buildFirewallLite(firewallLite) + rebuildVrLanInterface += rebuildFirewallLite + + // static-routes + def rebuildStaticRoutes = "" + try { // optional + def staticRoutes = getNodeXml(vrLan, "static-routes").drop(38).trim() + rebuildStaticRoutes = buildStaticRoutes(staticRoutes) + } catch (Exception e) { + log("ERROR", " Optional - Exception 'static-routes' ") + } + rebuildVrLanInterface += rebuildStaticRoutes + + rebuildVrLan += rebuildVrLanInterface + rebuildVrLan += "</tns2:vr-lan-interface>" + rebuildVrLan += "</tns2:vr-lan>" + + } + log("DEBUG", " rebuildVrLan - " + rebuildVrLan) + return rebuildVrLan + } + + // Build vr-lan-interface + def buildVrLanInterfacePartial(xmlInput) { + def rebuildingVrLanInterface = '' + if (xmlInput != null) { + def vrLanInterfaceList = ["vr-designation", "v4-vr-lan-prefix", "v4-vr-lan-address", "v4-vr-lan-prefix-length", "v6-vr-lan-prefix", "v6-vr-lan-address", "v6-vr-lan-prefix-length", "v4-vce-loopback-address", "v6-vce-wan-address"] + rebuildingVrLanInterface += buildElements(xmlInput, vrLanInterfaceList, "") + rebuildingVrLanInterface += "<tns2:v4-public-lan-prefixes>" + try { // optional + def tProvidedV4LanPublicPrefixes = getNodeXml(xmlInput, "v4-public-lan-prefixes").drop(38).trim() + def tProvidedV4LanPublicPrefixesList = ["request-index", "v4-next-hop-address", "v4-lan-public-prefix", "v4-lan-public-prefix-length" ] + rebuildingVrLanInterface += buildElementsUnbounded(xmlInput, tProvidedV4LanPublicPrefixesList, "t-provided-v4-lan-public-prefixes") + } catch (Exception ex) { + log("ERROR", " Optional - Exception VR-LAN INTERFACE 'v4-public-lan-prefixes' ") + } + rebuildingVrLanInterface += "</tns2:v4-public-lan-prefixes>" + rebuildingVrLanInterface += "<tns2:v6-public-lan-prefixes>" + try { // optional + def tProvidedV6LanPublicPrefixes = getNodeXml(xmlInput, "v6-public-lan-prefixes").drop(38).trim() + def tProvidedV6LanPublicPrefixesList = ["request-index", "v6-next-hop-address", "v6-lan-public-prefix", "v6-lan-public-prefix-length" ] + rebuildingVrLanInterface += buildElementsUnbounded(xmlInput, tProvidedV6LanPublicPrefixesList, "t-provided-v6-lan-public-prefixes") + } catch (Exception e) { + log("ERROR", " Optional - Exception VR-LAN INTERFACE 'v6-public-lan-prefixes' ") + } + rebuildingVrLanInterface += "</tns2:v6-public-lan-prefixes>" + } + log("DEBUG", " rebuildingVrLanInterface - " + rebuildingVrLanInterface) + return rebuildingVrLanInterface + } + + // Build dhcp + def buildDhcp(xmlInput) { + def rebuildingDhcp = '' + if (xmlInput != null) { + def dhcpData = new XmlSlurper().parseText(xmlInput) + rebuildingDhcp = "<tns2:dhcp>" + def dhcpList1 = ["v4-dhcp-server-enabled", "v6-dhcp-server-enabled", "use-v4-default-pool", "v4-dhcp-default-pool-prefix", "v4-dhcp-default-pool-prefix-length"] + rebuildingDhcp += buildElements(xmlInput, dhcpList1, "") + try { // optional + def excludedV4DhcpAddressesFromDefaultPoolList = ["excluded-v4-address"] + rebuildingDhcp += buildElementsUnbounded(xmlInput, excludedV4DhcpAddressesFromDefaultPoolList, "excluded-v4-dhcp-addresses-from-default-pool") + } catch (Exception e) { + log("ERROR", " Optional - Exception DHCP 'excluded-v4-dhcp-addresses-from-default-pool' ") + } + try { // optional + def v4DhcpPools = dhcpData.'**'.findAll {it.name() == "v4-dhcp-pools"} + def v4DhcpPoolsSize = v4DhcpPools.size() + // println " v4DhcpPoolsSize = " + v4DhcpPools.size() + for (i in 0..v4DhcpPoolsSize-1) { + def v4DhcpPool = v4DhcpPools[i] + def v4DhcpPoolXml = XmlUtil.serialize(v4DhcpPool) + rebuildingDhcp += "<tns2:v4-dhcp-pools>" + def v4DhcpPoolsList1 = ["v4-dhcp-pool-prefix", "v4-dhcp-pool-prefix-length" ] + rebuildingDhcp += buildElements(v4DhcpPoolXml, v4DhcpPoolsList1, "") + try { // optional + def excludedV4AddressesList = ["excluded-v4-address"] + rebuildingDhcp += buildElementsUnbounded(v4DhcpPoolXml, excludedV4AddressesList, "excluded-v4-addresses") + } catch (Exception e) { + log("ERROR", " Optional - Exception DHCP 'excluded-v4-addresses' ") + } + def v4DhcpPoolsList2 = ["v4-dhcp-relay-gateway-address", "v4-dhcp-relay-next-hop-address"] + rebuildingDhcp += buildElements(v4DhcpPoolXml, v4DhcpPoolsList2, "") + rebuildingDhcp += "</tns2:v4-dhcp-pools>" + } + } catch (Exception e) { + log("ERROR"," Optional - Exception DHCP 'v4-dhcp-pools' ") + } + def dhcpList2 = ["use-v6-default-pool", "v6-dhcp-default-pool-prefix", "v6-dhcp-default-pool-prefix-length"] + rebuildingDhcp += buildElements(xmlInput, dhcpList2, "") + try { // optional + def excludedV6DhcpAddressesFromDdefaultPoolList = ["excluded-v6-address"] + rebuildingDhcp += buildElementsUnbounded(xmlInput, excludedV6DhcpAddressesFromDdefaultPoolList, "excluded-v6-dhcp-addresses-from-default-pool") + } catch (Exception e) { + log("ERROR", " Optional - Exception DHCP 'excluded-v6-dhcp-addresses-from-default-pool' ") + } + try { // optional + def v6DhcpPools = dhcpData.'**'.findAll {it.name() == "v6-dhcp-pools"} + def v6DhcpPoolsSize = v6DhcpPools.size() + //println " v6DhcpPoolsSize = " + v6DhcpPools.size() + for (i in 0..v6DhcpPoolsSize-1) { + def v6DhcpPool = v6DhcpPools[i] + def v6DhcpPoolXml = XmlUtil.serialize(v6DhcpPool) + rebuildingDhcp += "<tns2:v6-dhcp-pools>" + def v6DhcpPoolsList1 = ["v6-dhcp-pool-prefix", "v6-dhcp-pool-prefix-length"] + rebuildingDhcp += buildElements(v6DhcpPoolXml, v6DhcpPoolsList1, "") + try { // optional + def excludedV6AddressesList = ["excluded-v6-address"] + rebuildingDhcp += buildElementsUnbounded(v6DhcpPoolXml, excludedV6AddressesList, "excluded-v6-addresses") + } catch (Exception e) { + log("ERROR", " Optional - Exception DHCP 'excluded-v6-addresses' ") + } + def v6DhcpPoolsList2 = ["v6-dhcp-relay-gateway-address", "v6-dhcp-relay-next-hop-address"] + rebuildingDhcp += buildElements(v6DhcpPoolXml, v6DhcpPoolsList2, "") + rebuildingDhcp += "</tns2:v6-dhcp-pools>" + } + } catch (Exception e) { + log("ERROR", " Optional - Exception DHCP 'v6-dhcp-pools' ") + } + rebuildingDhcp += "</tns2:dhcp>" + } + log("DEBUG", " rebuildingDhcp - " + rebuildingDhcp) + return rebuildingDhcp + } + + // Build pat + def buildPat(xmlInput) { + def rebuildingPat = '' + if (xmlInput != null) { + rebuildingPat = "<tns2:pat>" + def patList = ["v4-pat-enabled", "use-v4-default-pool", "v4-pat-default-pool-prefix", "v4-pat-default-pool-prefix-length"] + rebuildingPat += buildElements(xmlInput, patList, "") + try { // optional + def v4PatPools = getNodeXml(xmlInput, "v4-pat-pools").drop(38).trim() + def v4PatPoolsList = ["v4-pat-pool-prefix", "v4-pat-pool-prefix-length", "v4-pat-pool-next-hop-address"] + rebuildingPat += buildElementsUnbounded(xmlInput, v4PatPoolsList, "v4-pat-pools") + } catch (Exception e) { + log("ERROR", " Optional - Exception 'v4-pat-pool-next-hop-address' ") + } + rebuildingPat += "</tns2:pat>" + } + log("DEBUG", " rebuildingPat - " + rebuildingPat) + return rebuildingPat + } + + // Build nat + def buildNat(xmlInput) { + def rebuildingNat = '' + if (xmlInput != null) { + rebuildingNat = "<tns2:nat>" + rebuildingNat += buildElements(xmlInput, ["v4-nat-enabled"], "") + try { // optional + def v4NatMappingEntries = getNodeXml(xmlInput, "v4-nat-mapping-entries").drop(38).trim() + def v4NatMappingEntriesList = ["v4-nat-internal", "v4-nat-next-hop-address", "v4-nat-external"] + rebuildingNat += buildElementsUnbounded(xmlInput, v4NatMappingEntriesList, "v4-nat-mapping-entries") + } catch (Exception e) { + log("ERROR", " Optional - Exception 'v4-nat-external' ") + } + rebuildingNat += "</tns2:nat>" + } + log("DEBUG", " rebuildingNat - " + rebuildingNat) + return rebuildingNat + } + + // Build firewall-lite + def buildFirewallLite(xmlInput) { + def rebuildingFirewallLite = '' + + if (xmlInput != null) { + + def firewallLiteData = new XmlSlurper().parseText(xmlInput) + rebuildingFirewallLite = "<tns2:firewall-lite>" + def firewallLiteList = ["stateful-firewall-lite-v4-enabled", "stateful-firewall-lite-v6-enabled"] + rebuildingFirewallLite += buildElements(xmlInput, firewallLiteList, "") + + try { // optional + def v4FirewallPacketFilters = firewallLiteData.'**'.findAll {it.name() == "v4-firewall-packet-filters"} + def v4FirewallPacketFiltersSize = v4FirewallPacketFilters.size() + //println " v4FirewallPacketFiltersSize = " + v4FirewallPacketFilters.size() + for (i in 0..v4FirewallPacketFiltersSize-1) { + def v4FirewallPacketFilter = v4FirewallPacketFilters[i] + def v4FirewallPacketFilterXml = XmlUtil.serialize(v4FirewallPacketFilter) + rebuildingFirewallLite += "<tns2:v4-firewall-packet-filters>" + def v4FirewallPacketFiltersList = ["v4-firewall-prefix", "v4-firewall-prefix-length", "allow-icmp-ping"] + rebuildingFirewallLite += buildElements(v4FirewallPacketFilterXml, v4FirewallPacketFiltersList, "") + try { // optional + def udpPortsList = ["port-number"] + rebuildingFirewallLite += buildElementsUnbounded(v4FirewallPacketFilterXml, udpPortsList, "udp-ports") + } catch (Exception e) { + log("ERROR", " Optional - Exception FIREWALL-LITE v4 'udp-ports' ") + } + try { // optional + def tcpPortsList = ["port-number"] + rebuildingFirewallLite += buildElementsUnbounded(v4FirewallPacketFilterXml, tcpPortsList, "tcp-ports") + } catch (Exception e) { + log("ERROR", " Optional - Exception FIREWALL-LITE v4 'tcp-ports' ") + } + rebuildingFirewallLite += "</tns2:v4-firewall-packet-filters>" + } + } catch (Exception e) { + log("ERROR", " Optional - Exception FIREWALL-LITE 'v4-firewall-packet-filters' ") + } + + try { // optional + def v6FirewallPacketFilters = firewallLiteData.'**'.findAll {it.name() == "v6-firewall-packet-filters"} + def v6FirewallPacketFiltersSize = v6FirewallPacketFilters.size() + //println " v6FirewallPacketFiltersSize = " + v6FirewallPacketFilters.size() + for (i in 0..v6FirewallPacketFiltersSize-1) { + def v6FirewallPacketFilter = v6FirewallPacketFilters[i] + def v6FirewallPacketFilterXml = XmlUtil.serialize(v6FirewallPacketFilter) + rebuildingFirewallLite += "<tns2:v6-firewall-packet-filters>" + def v6FirewallPacketFiltersList = ["v6-firewall-prefix", "v6-firewall-prefix-length", "allow-icmp-ping"] + rebuildingFirewallLite += buildElements(v6FirewallPacketFilterXml, v6FirewallPacketFiltersList, "") + try { // optional + def udpPortsList = ["port-number"] + rebuildingFirewallLite += buildElementsUnbounded(v6FirewallPacketFilterXml, udpPortsList, "udp-ports") + } catch (Exception e) { + log("ERROR", " Optional - Exception FIREWALL-LITE v6 'udp-ports' ") + } + try { // optional + def tcpPortsList = ["port-number"] + rebuildingFirewallLite += buildElementsUnbounded(v6FirewallPacketFilterXml, tcpPortsList, "tcp-ports") + } catch (Exception e) { + log("ERROR", " Optional - Exception FIREWALL-LITE v6 'tcp-ports' ") + } + rebuildingFirewallLite += "</tns2:v6-firewall-packet-filters>" + } + } catch (Exception e) { + log("ERROR", " Optional - Exception FIREWALL-LITE 'v6-firewall-packet-filters' ") + } + rebuildingFirewallLite+= "</tns2:firewall-lite>" + } + log("DEBUG", " rebuildingFirewallLite - " + rebuildingFirewallLite) + return rebuildingFirewallLite + } + + def buildStaticRoutes(xmlInput) { + def rebuildingStaticRoutes = '' + if (xmlInput != null) { + rebuildingStaticRoutes = "<tns2:static-routes>" + def v4StaticRouteslist = ["v4-static-route-prefix","v4-static-route-prefix-length", "v4-next-hop-address"] + rebuildingStaticRoutes += buildElementsUnbounded(xmlInput, v4StaticRouteslist, "v4-static-routes") + def v6StaticRouteslist = ["v6-static-route-prefix","v6-static-route-prefix-length", "v6-next-hop-address"] + rebuildingStaticRoutes += buildElementsUnbounded(xmlInput, v6StaticRouteslist, "v6-static-routes") + rebuildingStaticRoutes += "</tns2:static-routes>" + } + log("DEBUG", " rebuildingStaticRoutes - " + rebuildingStaticRoutes) + return rebuildingStaticRoutes + } + + public String generateCurrentTimeInUtc(){ + final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); + sdf.setTimeZone(TimeZone.getTimeZone("UTC")); + final String utcTime = sdf.format(new Date()); + return utcTime; + } + + public String generateCurrentTimeInGMT(){ + final SimpleDateFormat sdf = new SimpleDateFormat("E, d MMM yyyy h:m:s z"); + sdf.setTimeZone(TimeZone.getTimeZone("GMT")); + final String utcTime = sdf.format(new Date()); + return utcTime; + } + + + /** + * @param encryptedAuth: encrypted credentials from urn properties + * @param msoKey: key to use to decrypt from urn properties + * @return base 64 encoded basic auth credentials + */ + def getBasicAuth(encryptedAuth, msoKey){ + if ((encryptedAuth == null || encryptedAuth.isEmpty()) || (msoKey == null || msoKey.isEmpty())) + return null + try { + def auth = decrypt(encryptedAuth, msoKey) + byte[] encoded = Base64.encodeBase64(auth.getBytes()) + String encodedString = new String(encoded) + encodedString = "Basic " + encodedString + return encodedString + } catch (Exception ex) { + log("ERROR", "Unable to encode basic auth") + throw ex + } + } + + def encrypt(toEncrypt, msokey){ + try { + String result = CryptoUtils.encrypt(toEncrypt, msokey); + return result + } + catch (Exception e) { + log("ERROR", "Failed to encrypt credentials") + } + } + + def decrypt(toDecrypt, msokey){ + try { + String result = CryptoUtils.decrypt(toDecrypt, msokey); + return result + } + catch (Exception e) { + log("ERROR", "Failed to decrypt credentials") + throw e + } + } + + /** + * Return URL with qualified host name (if any) or urn mapping + * @param String url from urn mapping + * @return String url with qualified host name + */ + public String getQualifiedHostNameForCallback(String urnCallbackUrl) { + def callbackUrlToUse = urnCallbackUrl + try{ + //swap host name with qualified host name from the jboss properties + def qualifiedHostName = System.getProperty("jboss.qualified.host.name") + if(qualifiedHostName!=null){ + log("DEBUG", "qualifiedHostName:\n" + qualifiedHostName) + callbackUrlToUse = callbackUrlToUse.replaceAll("(http://)(.*)(:28080*)", {orig, first, torepl, last -> "${first}${qualifiedHostName}${last}"}) + } + }catch(Exception e){ + log("DEBUG", "unable to grab qualified host name, using what's in urn properties for callbackurl. Exception was: " + e.printStackTrace()) + } + return callbackUrlToUse + + } + + /** + * Retrieves text context of the element if the element exists, returns empty string otherwise + * @param com.sun.org.apache.xerces.internal.dom.DeferredElementNSImpl element to parse + * param String tagName tagName + * @return String text content of the element + */ + public String getElementText(Element element, String tagName) { + String text = "" + org.w3c.dom.NodeList nodeList = element.getElementsByTagNameNS("*", tagName) + if (nodeList != null && nodeList.length > 0) { + text = nodeList.item(0).getTextContent() + } + return text + } + + /** + * + * Find the lowest unused module-index value in a given xml + */ + public String getLowestUnusedIndex(String xml) { + if (xml == null || xml.isEmpty()) { + return "0" + } + def moduleIndexList = getMultNodes(xml, "module-index") + if (moduleIndexList == null || moduleIndexList.size() == 0) { + return "0" + } + def sortedModuleIndexList = moduleIndexList.sort { a, b -> a.compareTo b } + + for (i in 0..sortedModuleIndexList.size()-1) { + if (Integer.parseInt(sortedModuleIndexList[i]) != i) { + return i.toString() + } + } + return sortedModuleIndexList.size().toString() + } + /** + * This utility checks if there is transaction id already present in MDC. + * If found, it returns same else creates new, sets in MDC for future use before returning + * @return String RequestId in UUID format. + */ + public String getRequestID() + { + String requestId = MDC.get("RequestId") + if(requestId == null || requestId.isEmpty()) + { + requestId = java.util.UUID.randomUUID() + MDC.put("RequestId",requestId) + log("DEBUG","MsoUtils - Created new RequestId: " + requestId) + } + else + { + log("DEBUG","MsoUtils - Using existing RequestId: " + requestId) + } + + return requestId + } + + /** + * Remove all the empty nodes and attributes from the within the given node + * @param node + * @return true if all empty nodes and attributes were removed. + */ + public boolean cleanNode( Node node ) { + node.attributes().with { a -> + a.findAll { !it.value }.each { a.remove( it.key ) } + } + node.children().with { kids -> + kids.findAll { it instanceof Node ? !cleanNode( it ) : false } + .each { kids.remove( it ) } + } + node.attributes() || node.children() || node.text() + } + + /** + * + * @param xml + * @return String representation of xml after removing the empty nodes and attributes + */ + public String cleanNode(String xmlString) { + def xml = new XmlParser(false, false).parseText(xmlString) + cleanNode(xml) + return XmlUtil.serialize(xml) + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/NetworkUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/NetworkUtils.groovy index f6b36546aa..2e5499c158 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/NetworkUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/NetworkUtils.groovy @@ -1,1573 +1,1581 @@ -/*-
- * ============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.common.scripts;
-
-import org.apache.commons.lang3.*
-
-import groovy.xml.XmlUtil
-
-import javax.xml.parsers.DocumentBuilder
-import javax.xml.parsers.DocumentBuilderFactory
-import javax.xml.transform.Transformer
-import javax.xml.transform.TransformerFactory
-import javax.xml.transform.TransformerException
-import javax.xml.transform.dom.DOMSource
-import javax.xml.transform.stream.StreamResult
-
-import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.w3c.dom.Document
-import org.w3c.dom.Element
-
-import org.w3c.dom.NamedNodeMap
-import org.w3c.dom.Node
-import org.w3c.dom.NodeList;
-import org.xml.sax.InputSource
-
-import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor;
-import org.w3c.dom.Document
-import org.w3c.dom.Element
-import org.w3c.dom.NamedNodeMap
-import org.w3c.dom.Node
-import org.w3c.dom.NodeList;
-import org.xml.sax.InputSource
-
-
-/**
- * This groovy class supports the any Network processes that need the methods defined here.
- */
-class NetworkUtils {
-
- public MsoUtils utils = new MsoUtils()
- private AbstractServiceTaskProcessor taskProcessor
-
- public NetworkUtils(AbstractServiceTaskProcessor taskProcessor) {
- this.taskProcessor = taskProcessor
- }
-
- /**
- * This method returns the string for Network request
- * V2 for Contrail 3.x will populate cloud-region data in same cloudSiteId filed
- * Network adapter will handle it properly
- * @param requestId either 'request-id' or 'mso-request-id'
- * @param requestInput the request in the process
- * @param queryIdResponse the response of REST AAI query by Id
- * @param routeCollection the collection
- * @param policyFqdns the policy
- * @param tableCollection the collection
- * @param cloudRegionId the cloud-region-region
- * @return String request
- */
- def CreateNetworkRequestV2(execution, requestId, messageId, requestInput, queryIdResponse, routeCollection, policyFqdns, tableCollection, cloudRegionId, backoutOnFailure, source) {
- String createNetworkRequest = null
- if(requestInput!=null && queryIdResponse!=null) {
- String serviceInstanceId = ""
- String sharedValue = ""
- String externalValue = ""
-
- if (source == "VID") {
- sharedValue = utils.getNodeText1(queryIdResponse, "is-shared-network") != null ? utils.getNodeText1(queryIdResponse, "is-shared-network") : "false"
- externalValue = utils.getNodeText1(queryIdResponse, "is-external-network") != null ? utils.getNodeText1(queryIdResponse, "is-external-network") : "false"
- serviceInstanceId = utils.getNodeText1(requestInput, "service-instance-id")
-
- } else { // source = 'PORTAL'
- sharedValue = getParameterValue(requestInput, "shared")
- externalValue = getParameterValue(requestInput, "external")
- serviceInstanceId = utils.getNodeText1(requestInput, "service-instance-id") != null ? utils.getNodeText1(requestInput, "service-instance-id") : ""
- }
-
- String networkParams = ""
- if (utils.nodeExists(requestInput, "network-params")) {
- String netParams = utils.getNodeXml(requestInput, "network-params", false).replace("tag0:","").replace(":tag0","")
- networkParams = buildParams(netParams)
- }
-
- String failIfExists = "false"
- // requestInput
- String cloudRegion = cloudRegionId
- String tenantId = utils.getNodeText1(requestInput, "tenant-id")
-
- String networkType = ""
- String modelCustomizationUuid = ""
- if (utils.nodeExists(requestInput, "networkModelInfo")) {
- String networkModelInfo = utils.getNodeXml(requestInput, "networkModelInfo", false).replace("tag0:","").replace(":tag0","")
- networkType = utils.getNodeText1(networkModelInfo, "modelName")
- modelCustomizationUuid = utils.getNodeText1(networkModelInfo, "modelCustomizationUuid")
- } else {
- networkType = utils.getNodeText1(queryIdResponse, "network-type")
- modelCustomizationUuid = utils.getNodeText1(requestInput, "modelCustomizationId")
- }
-
- // queryIdResponse
- String networkName = utils.getNodeText1(queryIdResponse, "network-name")
- String networkId = utils.getNodeText1(queryIdResponse, "network-id")
- String networkTechnology = utils.getNodeText1(queryIdResponse, "network-technology")
-
- // contrailNetwork - networkTechnology = 'Contrail' vs. 'AIC_SR_IOV')
- String contrailNetwork = ""
- if (networkTechnology.contains('Contrail') || networkTechnology.contains('contrail') || networkTechnology.contains('CONTRAIL')) {
- contrailNetwork = """<contrailNetwork>
- <shared>${sharedValue}</shared>
- <external>${externalValue}</external>
- ${routeCollection}
- ${policyFqdns}
- ${tableCollection}
- </contrailNetwork>"""
- networkTechnology = "CONTRAIL" // replace
- }
-
- // rebuild subnets
- String subnets = ""
- if (utils.nodeExists(queryIdResponse, "subnets")) {
- def subnetsGroup = utils.getNodeXml(queryIdResponse, "subnets", false)
- subnets = buildSubnets(subnetsGroup)
- }
-
- String physicalNetworkName = ""
- physicalNetworkName = utils.getNodeText1(queryIdResponse, "physical-network-name")
-
- String vlansCollection = buildVlans(queryIdResponse)
-
- String notificationUrl = "" //TODO - is this coming from URN? What variable/value to use?
- //String notificationUrl = execution.getVariable("URN_?????") //TODO - is this coming from URN? What variable/value to use?
-
- createNetworkRequest = """
- <createNetworkRequest>
- <cloudSiteId>${cloudRegion}</cloudSiteId>
- <tenantId>${tenantId}</tenantId>
- <networkId>${networkId}</networkId>
- <networkName>${networkName}</networkName>
- <networkType>${networkType}</networkType>
- <modelCustomizationUuid>${modelCustomizationUuid}</modelCustomizationUuid>
- <networkTechnology>${networkTechnology}</networkTechnology>
- <providerVlanNetwork>
- <physicalNetworkName>${physicalNetworkName}</physicalNetworkName >
- ${vlansCollection}
- </providerVlanNetwork>
- ${contrailNetwork}
- ${subnets}
- <skipAAI>true</skipAAI>
- <backout>${backoutOnFailure}</backout>
- <failIfExists>${failIfExists}</failIfExists>
- ${networkParams}
- <msoRequest>
- <requestId>${requestId}</requestId>
- <serviceInstanceId>${serviceInstanceId}</serviceInstanceId>
- </msoRequest>
- <messageId>${messageId}</messageId>
- <notificationUrl>${notificationUrl}</notificationUrl>
- </createNetworkRequest>
- """.trim()
- }
- return createNetworkRequest
-
- }
-
- /**
- * This method returns the string for Network request
- * V2 for Contrail 3.x will populate cloud-region data in same cloudSiteId filed
- * Network adapter will handle it properly
- * @param requestId either 'request-id' or 'mso-request-id'
- * @param requestInput the request in the process
- * @param queryIdResponse the response of REST AAI query by Id
- * @param routeCollection the collection
- * @param policyFqdns the policy
- * @param cloudRegionId the cloud-region-region
- * @return String request
- */
- def UpdateNetworkRequestV2(execution, requestId, messageId, requestInput, queryIdResponse, routeCollection, policyFqdns, tableCollection, cloudRegionId, backoutOnFailure, source) {
- String updateNetworkRequest = null
- if(requestInput!=null && queryIdResponse!=null) {
- String serviceInstanceId = ""
- String sharedValue = ""
- String externalValue = ""
-
- if (source == "VID") {
- sharedValue = utils.getNodeText1(queryIdResponse, "is-shared-network") != null ? utils.getNodeText1(queryIdResponse, "is-shared-network") : "false"
- externalValue = utils.getNodeText1(queryIdResponse, "is-external-network") != null ? utils.getNodeText1(queryIdResponse, "is-external-network") : "false"
- serviceInstanceId = utils.getNodeText1(requestInput, "service-instance-id")
-
- } else { // source = 'PORTAL'
- sharedValue = getParameterValue(requestInput, "shared")
- externalValue = getParameterValue(requestInput, "external")
- serviceInstanceId = utils.getNodeText1(requestInput, "service-instance-id") != null ? utils.getNodeText1(requestInput, "service-instance-id") : ""
- }
-
- String failIfExists = "false"
- // requestInput
- String cloudRegion = cloudRegionId
- String tenantId = utils.getNodeText1(requestInput, "tenant-id")
-
- // queryIdResponse
- String networkName = utils.getNodeText1(queryIdResponse, "network-name")
- String networkId = utils.getNodeText1(queryIdResponse, "network-id")
-
- String networkType = ""
- String modelCustomizationUuid = ""
- if (utils.nodeExists(requestInput, "networkModelInfo")) {
- String networkModelInfo = utils.getNodeXml(requestInput, "networkModelInfo", false).replace("tag0:","").replace(":tag0","")
- networkType = utils.getNodeText1(networkModelInfo, "modelName")
- modelCustomizationUuid = utils.getNodeText1(networkModelInfo, "modelCustomizationUuid")
- } else {
- networkType = utils.getNodeText1(queryIdResponse, "network-type")
- modelCustomizationUuid = utils.getNodeText1(requestInput, "modelCustomizationId")
- }
-
- // rebuild subnets
- String subnets = ""
- if (utils.nodeExists(queryIdResponse, "subnets")) {
- def subnetsGroup = utils.getNodeXml(queryIdResponse, "subnets", false)
- subnets = buildSubnets(subnetsGroup)
- }
-
- String networkParams = ""
- if (utils.nodeExists(requestInput, "network-params")) {
- String netParams = utils.getNodeXml(requestInput, "network-params", false).replace("tag0:","").replace(":tag0","")
- networkParams = buildParams(netParams)
- }
-
- String networkStackId = utils.getNodeText1(queryIdResponse, "heat-stack-id")
- if (networkStackId == 'null' || networkStackId == "" || networkStackId == null) {
- networkStackId = "force_update"
- }
-
- String physicalNetworkName = utils.getNodeText1(queryIdResponse, "physical-network-name")
- String vlansCollection = buildVlans(queryIdResponse)
-
- updateNetworkRequest =
- """<updateNetworkRequest>
- <cloudSiteId>${cloudRegion}</cloudSiteId>
- <tenantId>${tenantId}</tenantId>
- <networkId>${networkId}</networkId>
- <networkStackId>${networkStackId}</networkStackId>
- <networkName>${networkName}</networkName>
- <networkType>${networkType}</networkType>
- <modelCustomizationUuid>${modelCustomizationUuid}</modelCustomizationUuid>
- <networkTypeVersion/>
- <networkTechnology>CONTRAIL</networkTechnology>
- <providerVlanNetwork>
- <physicalNetworkName>${physicalNetworkName}</physicalNetworkName>
- ${vlansCollection}
- </providerVlanNetwork>
- <contrailNetwork>
- <shared>${sharedValue}</shared>
- <external>${externalValue}</external>
- ${routeCollection}
- ${policyFqdns}
- ${tableCollection}
- </contrailNetwork>
- ${subnets}
- <skipAAI>true</skipAAI>
- <backout>${backoutOnFailure}</backout>
- <failIfExists>${failIfExists}</failIfExists>
- ${networkParams}
-
- <msoRequest>
- <requestId>${requestId}</requestId>
- <serviceInstanceId>${serviceInstanceId}</serviceInstanceId>
- </msoRequest>
- <messageId>${messageId}</messageId>
- <notificationUrl></notificationUrl>
- </updateNetworkRequest>""".trim()
-
- }
- return updateNetworkRequest
-
- }
-
- /**
- * This method returns the string for Create Volume Request payload
- * @param groupId the volume-group-id
- * @param volumeName the volume-group-name
- * @param vnfType the vnf-type
- * @param tenantId the value of relationship-key 'tenant.tenant-id'
- * @return String request payload
- */
- def String CreateNetworkVolumeRequest(groupId, volumeName, vnfType, tenantId) {
-
- String requestPayload =
- """<volume-group xmlns="http://org.openecomp.mso/v6">
- <volume-group-id>${groupId}</volume-group-id>
- <volume-group-name>${volumeName}</volume-group-name>
- <heat-stack-id></heat-stack-id>
- <vnf-type>${vnfType}</vnf-type>
- <orchestration-status>Pending</orchestration-status>
- <relationship-list>
- <relationship>
- <related-to>tenant</related-to>
- <relationship-data>
- <relationship-key>tenant.tenant-id</relationship-key>
- <relationship-value>${tenantId}</relationship-value>
- </relationship-data>
- </relationship>
- </relationship-list>
- </volume-group>"""
-
- return requestPayload
- }
-
- def String createCloudRegionVolumeRequest(groupId, volumeName, vnfType, tenantId, cloudRegion, namespace, modelCustomizationId) {
-
- String requestPayload =
- """<volume-group xmlns="${namespace}">
- <volume-group-id>${groupId}</volume-group-id>
- <volume-group-name>${volumeName}</volume-group-name>
- <heat-stack-id></heat-stack-id>
- <vnf-type>${vnfType}</vnf-type>
- <orchestration-status>Pending</orchestration-status>
- <vf-module-model-customization-id>${modelCustomizationId}</vf-module-model-customization-id>
- <relationship-list>
- <relationship>
- <related-to>tenant</related-to>
- <relationship-data>
- <relationship-key>tenant.tenant-id</relationship-key>
- <relationship-value>${tenantId}</relationship-value>
- </relationship-data>
- <relationship-data>
- <relationship-key>cloud-region.cloud-owner</relationship-key>
- <relationship-value>att-aic</relationship-value>
- </relationship-data>
- <relationship-data>
- <relationship-key>cloud-region.cloud-region-id</relationship-key>
- <relationship-value>${cloudRegion}</relationship-value>
- </relationship-data>
- </relationship>
- </relationship-list>
- </volume-group>"""
-
- return requestPayload
- }
-
- def String createCloudRegionVolumeRequest(groupId, volumeName, vnfType, vnfId, tenantId, cloudRegion, namespace, modelCustomizationId) {
-
- String requestPayload =
- """<volume-group xmlns="${namespace}">
- <volume-group-id>${groupId}</volume-group-id>
- <volume-group-name>${volumeName}</volume-group-name>
- <heat-stack-id></heat-stack-id>
- <vnf-type>${vnfType}</vnf-type>
- <orchestration-status>Pending</orchestration-status>
- <vf-module-model-customization-id>${modelCustomizationId}</vf-module-model-customization-id>
- <relationship-list>
- <relationship>
- <related-to>generic-vnf</related-to>
- <relationship-data>
- <relationship-key>generic-vnf.vnf-id</relationship-key>
- <relationship-value>${vnfId}</relationship-value>
- </relationship-data>
- </relationship>
- <relationship>
- <related-to>tenant</related-to>
- <relationship-data>
- <relationship-key>tenant.tenant-id</relationship-key>
- <relationship-value>${tenantId}</relationship-value>
- </relationship-data>
- <relationship-data>
- <relationship-key>cloud-region.cloud-owner</relationship-key>
- <relationship-value>att-aic</relationship-value>
- </relationship-data>
- <relationship-data>
- <relationship-key>cloud-region.cloud-region-id</relationship-key>
- <relationship-value>${cloudRegion}</relationship-value>
- </relationship-data>
- </relationship>
- </relationship-list>
- </volume-group>"""
-
- return requestPayload
- }
-
-
- /**
- * This method returns the string for Update Volume Request payload
- * @param requeryAAIVolGrpNameResponse the response of query volume group name (in AAI)
- * @param heatStackId the value of heat stack id
- * @return String request payload
- */
- def String updateCloudRegionVolumeRequest(requeryAAIVolGrpNameResponse, heatStackId, namespace, modelCustomizationId) {
- String requestPayload = ""
- if (requeryAAIVolGrpNameResponse != null) {
- def groupId = utils.getNodeText(requeryAAIVolGrpNameResponse, "volume-group-id")
- def volumeName = utils.getNodeText(requeryAAIVolGrpNameResponse, "volume-group-name")
- def vnfType = utils.getNodeText(requeryAAIVolGrpNameResponse, "vnf-type")
- def resourceVersion = utils.getNodeText(requeryAAIVolGrpNameResponse, "resource-version")
- def relationshipList = ""
- if (utils.nodeExists(requeryAAIVolGrpNameResponse, "relationship")) {
- relationshipList = rebuildRelationship(requeryAAIVolGrpNameResponse)
- }
-
- requestPayload =
- """<volume-group xmlns="${namespace}">
- <volume-group-id>${groupId}</volume-group-id>
- <volume-group-name>${volumeName}</volume-group-name>
- <heat-stack-id>${heatStackId}</heat-stack-id>
- <vnf-type>${vnfType}</vnf-type>
- <orchestration-status>Active</orchestration-status>
- <resource-version>${resourceVersion}</resource-version>
- <vf-module-model-customization-id>${modelCustomizationId}</vf-module-model-customization-id>
- ${relationshipList}
- </volume-group>"""
- }
-
- return requestPayload
- }
-
-
- /**
- * This method returns the string for Update Volume Request payload
- * @param requeryAAIVolGrpNameResponse the response of query volume group name (in AAI)
- * @param heatStackId the value of heat stack id
- * @return String request payload
- */
- def String UpdateNetworkVolumeRequest(requeryAAIVolGrpNameResponse, heatStackId) {
- String requestPayload = ""
- if (requeryAAIVolGrpNameResponse != null) {
- def groupId = utils.getNodeText(requeryAAIVolGrpNameResponse, "volume-group-id")
- def volumeName = utils.getNodeText(requeryAAIVolGrpNameResponse, "volume-group-name")
- def vnfType = utils.getNodeText(requeryAAIVolGrpNameResponse, "vnf-type")
- def resourceVersion = utils.getNodeText(requeryAAIVolGrpNameResponse, "resource-version")
- def relationshipList = ""
- if (utils.nodeExists(requeryAAIVolGrpNameResponse, "relationship")) {
- relationshipList = rebuildRelationship(requeryAAIVolGrpNameResponse)
- }
-
- requestPayload =
- """<volume-group xmlns="http://org.openecomp.mso/v6">
- <volume-group-id>${groupId}</volume-group-id>
- <volume-group-name>${volumeName}</volume-group-name>
- <heat-stack-id>${heatStackId}</heat-stack-id>
- <vnf-type>${vnfType}</vnf-type>
- <orchestration-status>Active</orchestration-status>
- <resource-version>${resourceVersion}</resource-version>
- ${relationshipList}
- </volume-group>"""
- }
-
- return requestPayload
- }
-
- /**
- * This method returns the string for Create Contrail Network payload
- * @param requeryIdAAIResponse the response from AAI query by id
- * @param createNetworkResponse the response of create network
- * @return String contrailNetworkCreatedUpdate
- */
- def ContrailNetworkCreatedUpdate(requeryIdAAIResponse, createNetworkResponse, schemaVersion) {
-
- String contrailNetworkCreatedUpdate = ""
- if(requeryIdAAIResponse!=null && createNetworkResponse!=null) {
-
- def l3Network = utils.getNodeXml(requeryIdAAIResponse, "l3-network", false).replace("tag0:","").replace(":tag0","")
- def createNetworkContrailResponse = ""
- if (utils.nodeExists(createNetworkResponse, 'createNetworkResponse')) {
- createNetworkContrailResponse = utils.getNodeXml(createNetworkResponse, "createNetworkResponse", false).replace("tag0:","").replace(":tag0","")
- } else {
- createNetworkContrailResponse = utils.getNodeXml(createNetworkResponse, "updateNetworkContrailResponse", false).replace("tag0:","").replace(":tag0","")
- }
-
- // rebuild network
- def networkList = ["network-id", "network-name", "network-type", "network-role", "network-technology", "neutron-network-id", "is-bound-to-vpn", "service-id", "network-role-instance", "resource-version", "resource-model-uuid", "orchestration-status", "heat-stack-id", "mso-catalog-key", "contrail-network-fqdn",
- "physical-network-name", "is-provider-network", "is-shared-network", "is-external-network"]
- String rebuildNetworkElements = buildNetworkElements(l3Network, createNetworkContrailResponse, networkList)
-
- // rebuild 'subnets'
- def rebuildSubnetList = ""
- if (utils.nodeExists(requeryIdAAIResponse, 'subnet')) {
- rebuildSubnetList = buildSubnets(requeryIdAAIResponse, createNetworkResponse)
- }
-
- // rebuild 'segmentation-assignments'
- def rebuildSegmentationAssignments = ""
- if (utils.nodeExists(requeryIdAAIResponse, 'segmentation-assignments')) {
- List elementList = ["segmentation-id", "resource-version"]
- if (utils.nodeExists(requeryIdAAIResponse, 'segmentation-assignment')) { // new tag
- rebuildSegmentationAssignments = buildXMLElements(requeryIdAAIResponse, "segmentation-assignments", "segmentation-assignment", elementList)
- } else {
- rebuildSegmentationAssignments = buildXMLElements(requeryIdAAIResponse, "", "segmentation-assignments", elementList)
- }
- }
-
- // rebuild 'ctag-assignments' / rebuildCtagAssignments
- def rebuildCtagAssignmentsList = ""
- if (utils.nodeExists(requeryIdAAIResponse, 'ctag-assignment')) {
- rebuildCtagAssignmentsList = rebuildCtagAssignments(requeryIdAAIResponse)
- }
-
- // rebuild 'relationship'
- def relationshipList = ""
- if (utils.nodeExists(requeryIdAAIResponse, 'relationship-list')) {
- String rootRelationshipData = getFirstNodeXml(requeryIdAAIResponse, "relationship-list").drop(38).trim().replace("tag0:","").replace(":tag0","")
- if (utils.nodeExists(rootRelationshipData, 'relationship')) {
- relationshipList = rebuildRelationship(rootRelationshipData)
- }
- }
-
- //Check for optional contrail network fqdn within CreateNetworkResponse
- String contrailNetworkFQDN
- if(utils.nodeExists(createNetworkResponse, "contrail-network-fqdn")){
- contrailNetworkFQDN = utils.getNodeXml(createNetworkResponse, "contrail-network-fqdn")
- contrailNetworkFQDN = utils.removeXmlNamespaces(contrailNetworkFQDN)
- contrailNetworkFQDN = utils.removeXmlPreamble(contrailNetworkFQDN)
- }else{
- contrailNetworkFQDN = ""
- }
-
- contrailNetworkCreatedUpdate =
- """<l3-network xmlns="${schemaVersion}">
- ${rebuildNetworkElements}
- ${rebuildSubnetList}
- ${rebuildSegmentationAssignments}
- ${rebuildCtagAssignmentsList}
- ${relationshipList}
- ${contrailNetworkFQDN}
- </l3-network>""".trim()
-
- }
- return contrailNetworkCreatedUpdate
- }
-
-
-
- /**
- * This method returns the value for the name paramName.
- * Ex: <network-params>
- * <param name="shared">1</param>
- * <param name="external">0</external>
- * </network-params>
- *
- * @param xmlInput the XML document
- * @param paramName the param name (ex: 'shared')
- * @return a param value for 'shared' (ex: '1')
- */
- def getParameterValue(xmlInput, paramName) {
- def rtn=""
- if(xmlInput!=null){
- def xml= new XmlSlurper().parseText(xmlInput)
- rtn= xml.'**'.find {param->param.'@name'.text() == paramName}
- }
- if (rtn==null) {
- return ""
- } else {
- return rtn
- }
- }
-
- /**
- * This method returns the name of param if found/match with paramName.
- * Ex: <network-params>
- * <param name="shared">1</param>
- * <param name="external">0</external>
- * </network-params>
- *
- * @param xmlInput the XML document
- * @param paramName the param name (ex: 'shared', )
- * @return a param name for 'shared' (ex: 'shared' if found)
- */
- def getParameterName(xmlInput, paramName) {
- def rtn=""
- if(xmlInput!=null){
- def xml= new XmlSlurper().parseText(xmlInput)
- try {
- rtn= xml.'**'.find {param->param.'@name' == paramName}.'@name'
- } catch (Exception ex) {
- rtn=""
- }
- }
- if (rtn==null || rtn=="") {
- return ""
- } else {
- return rtn
- }
- }
-
- /**
- * This method returns the networkParams xml string.
- * Ex: input:
- * <network-params>
- * <param name="shared">1</param>
- * <param name="external">0</external>
- * </network-params>
- *
- * Sample result:
- * <networkParams>
- * <shared>1</shared>
- * <external>0</external>
- * </networkParams>
- *
- */
-
- def buildParams(networkParams) {
- def build = ""
- def netParams = new XmlParser().parseText(networkParams)
- try {
- def paramsList = netParams.'**'.findAll {param->param.'@name'}.'@name'
- if (paramsList.size() > 0) {
- build += "<networkParams>"
- for (i in 0..paramsList.size()-1) {
- def name = netParams.'**'.find {param->param.'@name' == paramsList[i]}.'@name'
- def value= netParams.'**'.find {param->param.'@name' == paramsList[i]}.text()
- build += "<${name}>${value}</${name}>"
- }
- build += "</networkParams>"
- }
-
- } catch (Exception ex) {
- println ' buildParams error - ' + ex.getMessage()
- build = ""
- }
- return build
- }
-
- def getVlans(xmlInput) {
- def rtn = ""
- if (xmlInput!=null) {
- def vlansList = getListWithElements(xmlInput, 'vlans')
- def vlansListSize = vlansList.size()
- if (vlansListSize > 0) {
- for (i in 0..vlansListSize-1) {
- rtn += '<vlans>'+vlansList[i]+'</vlans>'
- }
- }
- }
- return rtn
-
-
- }
-
- /**
- * This method returns the uri value for the vpn bindings.
- * Return the a list of value of vpn binding in the <related-link> string.
- * Ex.
- * <relationship-list>
- * <relationship>
- * <related-to>vpn-binding</related-to>
- * <related-link>https://aai-app-e2e.test.openecomp.com:8443/aai/v6/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/</related-link>
- * <relationship-data>
- * <relationship-key>vpn-binding.vpn-id</relationship-key>
- * <relationship-value>85f015d0-2e32-4c30-96d2-87a1a27f8017</relationship-value>
- * </relationship-data>
- * </relationship>
- * <relationship>
- * <related-to>vpn-binding</related-to>
- * <related-link>https://aai-ext1.test.openecomp.com:8443/aai/v6/network/vpn-bindings/vpn-binding/24a4b507-853a-4a38-99aa-05fcc54be24d/</related-link>
- * <relationship-data>
- * <relationship-key>vpn-binding.vpn-id</relationship-key>
- * <relationship-value>24a4b507-853a-4a38-99aa-05fcc54be24d</relationship-value>
- * </relationship-data>
- * <related-to-property>
- * <property-key>vpn-binding.vpn-name</property-key>
- * <property-value>oam_protected_net_6_MTN5_msotest1</property-value>
- * </related-to-property>
- * </relationship>
- * @param xmlInput the XML document
- * @return a list of vpn binding values
- * ex: ['aai/v6/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/', 'aai/v6/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/']
- *
- **/
- def getVnfBindingObject(xmlInput) {
- //def rtn = null
- List rtn = []
- if (xmlInput!=null) {
- def relationshipList = getListWithElements(xmlInput, 'relationship')
- def relationshipListSize = relationshipList.size()
- if (relationshipListSize > 0) {
- for (i in 0..relationshipListSize-1) {
- def relationshipXml = XmlUtil.serialize(relationshipList[i])
- if (utils.getNodeText(relationshipXml, 'related-to') == "vpn-binding") {
- def relatedLink = utils.getNodeText(relationshipXml, 'related-link')
- if (relatedLink != null || relatedLink != "") {
- rtn.add(relatedLink.substring(relatedLink.indexOf("/aai/"), relatedLink.length()))
- }
- }
- }
- }
- }
- return rtn
- }
- /**
- * similar to VNF bindings method
- * @param xmlInput the XML document
- * @return a list of network policy values
- * ex: ['aai/v$/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg', 'aai/v$/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg']
- *
- **/
- def getNetworkPolicyObject(xmlInput) {
- //def rtn = null
- List rtn = []
- if (xmlInput!=null) {
- def relationshipList = getListWithElements(xmlInput, 'relationship')
- def relationshipListSize = relationshipList.size()
- if (relationshipListSize > 0) {
- for (i in 0..relationshipListSize-1) {
- def relationshipXml = XmlUtil.serialize(relationshipList[i])
- if (utils.getNodeText(relationshipXml, 'related-to') == "network-policy") {
- def relatedLink = utils.getNodeText(relationshipXml, 'related-link')
- if (relatedLink != null || relatedLink != "") {
- rtn.add(relatedLink.substring(relatedLink.indexOf("/aai/"), relatedLink.length()))
- }
- }
- }
- }
- }
- return rtn
- }
-
- /**
- * similar to network policymethod
- * @param xmlInput the XML document
- * @return a list of network policy values
- * ex: ['aai/v$/network/route-table-references/route-table-reference/refFQDN1', 'aai/v$/network/route-table-references/route-table-reference/refFQDN2']
- *
- **/
- def getNetworkTableRefObject(xmlInput) {
- //def rtn = null
- List rtn = []
- if (xmlInput!=null) {
- def relationshipList = getListWithElements(xmlInput, 'relationship')
- def relationshipListSize = relationshipList.size()
- if (relationshipListSize > 0) {
- for (i in 0..relationshipListSize-1) {
- def relationshipXml = XmlUtil.serialize(relationshipList[i])
- if (utils.getNodeText(relationshipXml, 'related-to') == "route-table-reference") {
- def relatedLink = utils.getNodeText1(relationshipXml, 'related-link')
- if (relatedLink != null || relatedLink != "") {
- rtn.add(relatedLink.substring(relatedLink.indexOf("/aai/"), relatedLink.length()))
- }
- }
- }
- }
- }
- return rtn
- }
-
- /**
- * similar to network policymethod
- * @param xmlInput the XML document
- * @return a list of IDs for related VNF instances
- *
- **/
- def getRelatedVnfIdList(xmlInput) {
- //def rtn = null
- List rtn = []
- if (xmlInput!=null) {
- def relationshipList = getListWithElements(xmlInput, 'relationship')
- def relationshipListSize = relationshipList.size()
- if (relationshipListSize > 0) {
- for (i in 0..relationshipListSize-1) {
- def relationshipXml = XmlUtil.serialize(relationshipList[i])
- if (utils.getNodeText(relationshipXml, 'related-to') == "generic-vnf") {
- def relatedLink = utils.getNodeText1(relationshipXml, 'related-link')
- if (relatedLink != null || relatedLink != "") {
- if (relatedLink.substring(relatedLink.indexOf("/generic-vnf/")+13, relatedLink.length()).contains('/')) {
- rtn.add(relatedLink.substring(relatedLink.indexOf("/generic-vnf/")+13, relatedLink.length()-1))
- } else {
- rtn.add(relatedLink.substring(relatedLink.indexOf("/generic-vnf/")+13, relatedLink.length()))
- }
- }
- }
- }
- }
- }
- return rtn
- }
-
- /**
- * similar to network policymethod
- * @param xmlInput the XML document
- * @return a list of IDs for related Network instances
- *
- **/
- def getRelatedNetworkIdList(xmlInput) {
- //def rtn = null
- List rtn = []
- if (xmlInput!=null) {
- def relationshipList = getListWithElements(xmlInput, 'relationship')
- def relationshipListSize = relationshipList.size()
- if (relationshipListSize > 0) {
- for (i in 0..relationshipListSize-1) {
- def relationshipXml = XmlUtil.serialize(relationshipList[i])
- if (utils.getNodeText(relationshipXml, 'related-to') == "l3-network") {
- def relatedLink = utils.getNodeText1(relationshipXml, 'related-link')
- if (relatedLink != null || relatedLink != "") {
- if (relatedLink.substring(relatedLink.indexOf("/l3-network/")+12, relatedLink.length()).contains('/')) {
- rtn.add(relatedLink.substring(relatedLink.indexOf("/l3-network/")+12, relatedLink.length()-1))
- } else {
- rtn.add(relatedLink.substring(relatedLink.indexOf("/l3-network/")+12, relatedLink.length()))
- }
- }
- }
- }
- }
- }
- return rtn
- }
-
- def isVfRelationshipExist(xmlInput) {
- Boolean rtn = false
- if (xmlInput!=null) {
- def relationshipList = getListWithElements(xmlInput, 'relationship')
- def relationshipListSize = relationshipList.size()
- if (relationshipListSize > 0) {
- for (i in 0..relationshipListSize-1) {
- def relationshipXml = XmlUtil.serialize(relationshipList[i])
- if (utils.getNodeText(relationshipXml, 'related-to') == "vf-module") {
- rtn = true
- }
- }
- }
- }
- return rtn
-
- }
-
- def getCloudRegion(xmlInput) {
- String lcpCloudRegion = ""
- if (xmlInput!=null) {
- def relationshipList = getListWithElements(xmlInput, 'relationship')
- def relationshipListSize = relationshipList.size()
- if (relationshipListSize > 0) {
- for (i in 0..relationshipListSize-1) {
- def relationshipXml = XmlUtil.serialize(relationshipList[i])
- if (utils.getNodeText(relationshipXml, 'related-to') == "cloud-region") {
- def relatedLink = utils.getNodeText1(relationshipXml, 'related-link')
- if (relatedLink != null || relatedLink != "") {
- lcpCloudRegion = relatedLink.substring(relatedLink.indexOf("/att-aic/")+9, relatedLink.length())
- if (lcpCloudRegion.contains('/')) {
- lcpCloudRegion = relatedLink.substring(relatedLink.indexOf("/att-aic/")+9, relatedLink.length()-1)
- }
- }
- }
- }
- }
- }
- return lcpCloudRegion
- }
-
- def getTenantId(xmlInput) {
- String tenantId = ""
- if (xmlInput!=null) {
- def relationshipList = getListWithElements(xmlInput, 'relationship')
- def relationshipListSize = relationshipList.size()
- if (relationshipListSize > 0) {
- for (i in 0..relationshipListSize-1) {
- def relationshipXml = XmlUtil.serialize(relationshipList[i])
- if (utils.getNodeText(relationshipXml, 'related-to') == "tenant") {
- def relatedLink = utils.getNodeText1(relationshipXml, 'related-link')
- if (relatedLink != null || relatedLink != "") {
- tenantId = relatedLink.substring(relatedLink.indexOf("/tenant/")+8, relatedLink.length())
- if (tenantId.contains('/')) {
- tenantId = relatedLink.substring(relatedLink.indexOf("/tenant/")+8, relatedLink.length()-1)
- }
- }
- }
- }
- }
- }
- return tenantId
- }
-
- def isInstanceValueMatch(linkResource, globalSubscriberId, serviceType) {
- Boolean rtn = false
- try {
- String globalSubscriberIdLink = linkResource.substring(linkResource.indexOf("/customer/")+10, linkResource.indexOf("/service-subscriptions"))
- String serviceTypeLink = linkResource.substring(linkResource.indexOf("/service-subscription/")+22, linkResource.indexOf("/service-instances"))
- if (globalSubscriberIdLink == globalSubscriberId) {
- rtn = true
- } else {
- if (serviceTypeLink == serviceType) {
- rtn = true
- }
- }
-
- } catch (Exception ex) {
- println 'Exception - ' + ex.getMessage()
- return false
- }
- return rtn
- }
-
- def getListWithElements(xmlInput, groupName) {
- def rtn = ""
- if (xmlInput != null) {
- def relationshipData = new XmlSlurper().parseText(xmlInput)
- rtn = relationshipData.'**'.findAll {it.name() == groupName}
- }
- return rtn
-
- }
-
- // build network single elements
- def buildNetworkElements(l3Network, createNetworkContrailResponse, networkList) {
- def replaceNetworkId = ""
- def replaceNeutronNetworkId = ""
- def replaceContrailNetworkFqdn = ""
- if (l3Network != null && createNetworkContrailResponse != null) {
- if (utils.nodeExists(l3Network, 'heat-stack-id')) {
- replaceNetworkId = utils.getNodeText(l3Network, 'heat-stack-id')
- } else {
- if (utils.nodeExists(createNetworkContrailResponse, 'networkStackId')) {
- replaceNetworkId = utils.getNodeText(createNetworkContrailResponse, 'networkStackId')
- }
- }
- if (utils.nodeExists(l3Network, 'neutron-network-id')) {
- replaceNeutronNetworkId = utils.getNodeText(l3Network, 'neutron-network-id')
- } else {
- if (utils.nodeExists(createNetworkContrailResponse, 'neutronNetworkId')) {
- replaceNeutronNetworkId = utils.getNodeText(createNetworkContrailResponse, 'neutronNetworkId')
- }
- }
- if (utils.nodeExists(l3Network, 'contrail-network-fqdn')) {
- replaceContrailNetworkFqdn = utils.getNodeText(l3Network, 'contrail-network-fqdn')
- } else {
- if (utils.nodeExists(createNetworkContrailResponse, 'networkFqdn')) {
- replaceContrailNetworkFqdn = utils.getNodeText(createNetworkContrailResponse, 'networkFqdn')
- }
- }
- }
-
- String var = ""
- def xmlNetwork = ""
- if (l3Network != null) {
- for (element in networkList) {
- def xml= new XmlSlurper().parseText(l3Network)
- var = xml.'**'.find {it.name() == element}
- if (var == null) {
- if (element=="orchestration-status") {
- if (var.toString() == 'pending-create' || var.toString() == 'PendingCreate') {
- xmlNetwork += "<"+element+">"+"Created"+"</"+element+">"
- } else { //pending-update or PendingUpdate
- xmlNetwork += "<"+element+">"+"Active"+"</"+element+">"
- }
- }
- if (element=="heat-stack-id") {
- if (replaceNetworkId != "") {
- xmlNetwork += "<"+element+">"+replaceNetworkId+"</"+element+">"
- }
- }
- if (element=="neutron-network-id") {
- if (replaceNeutronNetworkId != "") {
- xmlNetwork += "<"+element+">"+replaceNeutronNetworkId+"</"+element+">"
- }
- }
- if (element=="contrail-network-fqdn") {
- if (replaceContrailNetworkFqdn != "") {
- xmlNetwork += "<"+element+">"+replaceContrailNetworkFqdn+"</"+element+">"
- }
- }
-
- } else {
- if (element=="orchestration-status") {
- if (element=="orchestration-status") {
- if (var.toString() == 'pending-create' || var.toString() == 'PendingCreate') {
- xmlNetwork += "<"+element+">"+"Created"+"</"+element+">"
- } else { //pending-update or PendingUpdate
- xmlNetwork += "<"+element+">"+"Active"+"</"+element+">"
- }
- }
- } else {
- xmlNetwork += "<"+element+">"+var.toString()+"</"+element+">"
- }
- }
- }
- }
- return xmlNetwork
- }
-
- def buildSubnets(requeryIdAAIResponse, createNetworkResponse) {
- def rebuildingSubnets = ""
- if (requeryIdAAIResponse != null && utils.nodeExists(requeryIdAAIResponse, 'subnets')) {
- def subnetIdMapValue = ""
- def subnetsGroup = utils.getNodeXml(requeryIdAAIResponse, "subnets", false)
- def subnetsData = new XmlSlurper().parseText(subnetsGroup)
- rebuildingSubnets += "<subnets>"
- try {
- def subnets = subnetsData.'**'.findAll {it.name() == "subnet"}
- def subnetsSize = subnets.size()
- for (i in 0..subnetsSize-1) {
- def subnet = subnets[i]
- def subnetXml = XmlUtil.serialize(subnet)
- def orchestrationStatus = utils.getNodeText1(subnetXml, "orchestration-status")
- if (orchestrationStatus == "PendingDelete" || orchestrationStatus == "pending-delete") {
- // skip, do not include in processing, remove!!!
- } else {
- def subnetList = ["subnet-id", "neutron-subnet-id", "gateway-address", "network-start-address", "cidr-mask", "ip-version", "orchestration-status", "dhcp-enabled", "dhcp-start", "dhcp-end", "resource-version", "subnet-name", "ip-assignment-direction", "host-routes"]
- rebuildingSubnets += buildSubNetworkElements(subnetXml, createNetworkResponse, subnetList, "subnet")
- }
- }
- if (utils.nodeExists(subnetsData, 'relationship')) {
- rebuildingSubnets = rebuildRelationship(requeryIdAAIResponse)
- }
-
- } catch (Exception ex) {
- // error
- } finally {
- rebuildingSubnets += "</subnets>"
- }
- }
- return rebuildingSubnets
- }
-
- def buildSubnets(queryIdResponse) {
- def rebuildingSubnets = ""
- def subnetsData = new XmlSlurper().parseText(queryIdResponse)
- //rebuildingSubnets += "<subnets>"
- try {
- def subnets = subnetsData.'**'.findAll {it.name() == "subnet"}
- def subnetsSize = subnets.size()
- for (i in 0..subnetsSize-1) {
- def subnet = subnets[i]
- def subnetXml = XmlUtil.serialize(subnet)
- def orchestrationStatus = utils.getNodeText1(subnetXml, "orchestration-status")
- if (orchestrationStatus == "pending-delete" || orchestrationStatus == "PendingDelete") {
- // skip, do not include in processing, remove!!!
- } else {
- def subnetList = ["dhcp-start", "dhcp-end", "network-start-address", "cidr-mask", "dhcp-enabled", "gateway-address", "ip-version", "subnet-id", "subnet-name", "ip-assignment-direction", "host-routes"]
- rebuildingSubnets += buildSubNetworkElements(subnetXml, subnetList, "subnets")
- //rebuildingSubnets += buildSubNetworkElements(subnetXml, subnetList, "")
- }
- }
- } catch (Exception ex) {
- //
- } finally {
- //rebuildingSubnets += "</subnets>"
- }
- return rebuildingSubnets
- }
-
-
- // build subnet sub-network single elements
- def buildSubNetworkElements(subnetXml, createNetworkResponse, elementList, parentName) {
- String var = ""
- def xmlBuild = ""
- if (parentName != "") {
- xmlBuild += "<"+parentName+">"
- }
- if (subnetXml != null) {
- for (element in elementList) {
- def xml= new XmlSlurper().parseText(subnetXml)
- var = xml.'**'.find {it.name() == element}
- if (var != null) {
- if (element=="orchestration-status") {
- if(var.toString() == 'pending-create' || var.toString() == 'PendingCreate') {
- xmlBuild += "<"+element+">"+"Created"+"</"+element+">"
- } else { // pending-update or PendingUpdate'
- xmlBuild += "<"+element+">"+"Active"+"</"+element+">"
- }
- } else { // "subnet-id", "neutron-subnet-id"
- if (element=="subnet-id") {
- if (utils.nodeExists(createNetworkResponse, "subnetMap")) {
- xmlBuild += "<"+element+">"+var.toString()+"</"+element+">"
- String neutronSubnetId = extractNeutSubId(createNetworkResponse, var.toString())
- xmlBuild += "<neutron-subnet-id>"+neutronSubnetId+"</neutron-subnet-id>"
- }
- } else {
- if (element=="neutron-subnet-id") {
- // skip
- } else {
- if (element=="host-routes") {
- if (subnetXml.contains("host-routes")) {
- List elementRoute = ["host-route-id", "route-prefix", "next-hop", "next-hop-type", "resource-version"]
- xmlBuild += buildXMLElements(subnetXml, "host-routes", "host-route", elementRoute)
- }
- } else {
- xmlBuild += "<"+element+">"+var.toString()+"</"+element+">"
- }
- }
- }
- }
- }
- }
-
- }
- if (parentName != "") {
- xmlBuild += "</"+parentName+">"
- }
- return xmlBuild
- }
-
- // build subnet sub-network single elements
- def buildSubNetworkElements(subnetXml, elementList, parentName) {
- def var = ""
- def xmlBuild = ""
- if (parentName != "") {
- xmlBuild += "<"+parentName+">"
- }
- if (subnetXml != null) {
- def networkStartAddress = ""
- for (element in elementList) {
- def xml= new XmlSlurper().parseText(subnetXml)
- var = xml.'**'.find {it.name() == element}
- if (element == "dhcp-start") {
- xmlBuild += "<allocationPools>"
- if (var.toString() == 'null') {
- xmlBuild += "<start>"+""+"</start>"
- } else {
- xmlBuild += "<start>"+var.toString()+"</start>"
- }
- }
- if (element == "dhcp-end") {
- if (var.toString() == 'null') {
- xmlBuild += "<end>"+""+"</end>"
- } else {
- xmlBuild += "<end>"+var.toString()+"</end>"
- }
- xmlBuild += "</allocationPools>"
- }
- if (element == "network-start-address" || element == "cidr-mask") {
- if (element == "network-start-address") {
- networkStartAddress = var.toString()
- }
- if (element == "cidr-mask") {
- xmlBuild += "<cidr>"+networkStartAddress+"/"+var.toString()+"</cidr>"
- }
- }
- if (element == "dhcp-enabled") {
- xmlBuild += "<enableDHCP>"+var.toString()+"</enableDHCP>"
- }
- if (element == "gateway-address") {
- xmlBuild += "<gatewayIp>"+var.toString()+"</gatewayIp>"
- }
- if (element == "ip-version") {
- String ipVersion = getIpvVersion(var.toString())
- xmlBuild += "<ipVersion>"+ipVersion+"</ipVersion>"
- }
- if (element == "subnet-id") {
- xmlBuild += "<subnetId>"+var.toString()+"</subnetId>"
- }
- if ((element == "subnet-name") && (var != null)) {
- xmlBuild += "<subnetName>"+var.toString()+"</subnetName>"
- }
- if ((element == "ip-assignment-direction") && (var != null)) {
- xmlBuild += "<addrFromStart>"+var.toString()+"</addrFromStart>"
- }
- if (element == "host-routes") {
- def routes = ""
- if (subnetXml.contains("host-routes")) {
- routes = buildHostRoutes(subnetXml)
- }
- xmlBuild += routes
- }
-
- }
- }
- if (parentName != "") {
- xmlBuild += "</"+parentName+">"
- }
- return xmlBuild
- }
-
- // rebuild host-routes
- def buildHostRoutes(subnetXml) {
- List routeElementList = ["host-route-id", "route-prefix", "next-hop", "next-hop-type", "resource-version"]
- def hostRoutes = buildXMLElements(subnetXml, "host-routes", "host-route", routeElementList)
- def buildHostRoutes = ""
- def var = ""
- if (hostRoutes!=null) {
- def routesData = new XmlSlurper().parseText(hostRoutes)
- def routes = routesData.'**'.findAll {it.name() == "host-route"}
- def routesSize = routes.size()
- for (i in 0..routesSize-1) {
- buildHostRoutes += "<hostRoutes>"
- def route = routes[i]
- def routeXml = XmlUtil.serialize(route)
- List elementList = ["route-prefix", "next-hop"]
- for (element in elementList) {
- def xml= new XmlSlurper().parseText(routeXml)
- var = xml.'**'.find {it.name() == element}
- if (element == "route-prefix") {
- buildHostRoutes += "<prefix>"+var.toString()+"</prefix>"
- }
- if (element == "next-hop") {
- buildHostRoutes += "<nextHop>"+var.toString()+"</nextHop>"
- }
- }
- buildHostRoutes += "</hostRoutes>"
- }
- }
- return buildHostRoutes
-
- }
-
- // rebuild ctag-assignments
- def rebuildCtagAssignments(xmlInput) {
- def rebuildingCtagAssignments = ""
- if (xmlInput!=null) {
- def ctagAssignmentsData = new XmlSlurper().parseText(xmlInput)
- rebuildingCtagAssignments += "<ctag-assignments>"
- def ctagAssignments = ctagAssignmentsData.'**'.findAll {it.name() == "ctag-assignment"}
- def ctagAssignmentsSize = ctagAssignments.size()
- for (i in 0..ctagAssignmentsSize-1) {
- def ctagAssignment = ctagAssignments[i]
- def ctagAssignmentXml = XmlUtil.serialize(ctagAssignment)
- rebuildingCtagAssignments += "<ctag-assignment>"
- List elementList = ["vlan-id-inner", "resource-version"]
- rebuildingCtagAssignments += buildXMLElements(ctagAssignmentXml, "" , "", elementList)
- if (utils.nodeExists(ctagAssignmentXml, 'relationship')) {
- rebuildingCtagAssignments += rebuildRelationship(ctagAssignmentXml)
- }
- rebuildingCtagAssignments += "</ctag-assignment>"
- }
- rebuildingCtagAssignments += "</ctag-assignments>"
- }
- return rebuildingCtagAssignments
- }
-
- // rebuild 'relationship-list'
- def rebuildRelationship(xmlInput) {
- def rebuildingSubnets = ""
- if (xmlInput!=null) {
- def subnetsData = new XmlSlurper().parseText(xmlInput)
- rebuildingSubnets += "<relationship-list>"
- def relationships = subnetsData.'**'.findAll {it.name() == "relationship"}
- def relationshipsSize = relationships.size()
- for (i in 0..relationshipsSize-1) {
- def relationship = relationships[i]
- def relationshipXml = XmlUtil.serialize(relationship)
- rebuildingSubnets += "<relationship>"
- def relationshipList = ["related-to", "related-link"]
- rebuildingSubnets += buildSubNetworkElements(relationshipXml, "", relationshipList, "")
- if (utils.nodeExists(relationshipXml, 'relationship-data')) {
- def relationshipDataXmlData = new XmlSlurper().parseText(relationshipXml)
- def relationshipsData = relationshipDataXmlData.'**'.findAll {it.name() == "relationship-data"}
- def relationshipsDataSize = relationshipsData.size()
- for (j in 0..relationshipsDataSize-1) {
- def relationshipData = relationshipsData[j]
- def relationshipDataXml = XmlUtil.serialize(relationshipData)
- def relationshipDataList = ["relationship-key", "relationship-value"]
- rebuildingSubnets += buildXMLElements(relationshipDataXml, "", "relationship-data", relationshipDataList)
- }
- }
- if (utils.nodeExists(relationshipXml, 'related-to-property')) {
- def relationshipDataXmlData = new XmlSlurper().parseText(relationshipXml)
- def relationshipsData = relationshipDataXmlData.'**'.findAll {it.name() == "related-to-property"}
- def relationshipsDataSize = relationshipsData.size()
- for (j in 0..relationshipsDataSize-1) {
- def relationshipData = relationshipsData[j]
- def relationshipDataXml = XmlUtil.serialize(relationshipData)
- def relationshipDataList = ["property-key", "property-value"]
- rebuildingSubnets += buildXMLElements(relationshipDataXml, "", "related-to-property", relationshipDataList)
- }
- }
-
- rebuildingSubnets += "</relationship>"
- }
- rebuildingSubnets += "</relationship-list>"
- }
- return rebuildingSubnets
- }
-
- def buildVlans(queryIdResponse) {
- def rebuildingSubnets = "<vlans>"
- def subnetsData = new XmlSlurper().parseText(queryIdResponse)
-
- try {
- def subnets = subnetsData.'**'.findAll {it.name() == "segmentation-assignments"}
- def subnetsSize = subnets.size()
- for (i in 0..subnetsSize-1) {
- def subnet = subnets[i]
- def subnetXml = XmlUtil.serialize(subnet)
-
- String vlan = utils.getNodeText1(subnetXml, "segmentation-id")
- if (i>0){
- rebuildingSubnets += ","
- }
- rebuildingSubnets += vlan
- }
- } catch (Exception ex) {
- //
- } finally {
- //rebuildingSubnets += "</subnets>"
- rebuildingSubnets += "</vlans>"
- }
- return rebuildingSubnets
- }
-
- /* Utility code to rebuild xml/elements in a list:
- * rebuild xml with 1) unbounded groups of elements; or
- * 2) one group of elements; or
- * 3) just one or more elements (in a list as argument)
- * @param xmlInput the XML document
- * @param parentName the parent name (ex: 'inputs')
- * @param childrenName the chilrendName (ex: 'entry' as unbounded/occurs>1)
- * @param elementList the element list of children (ex: 'key', 'value')
- * @return a string of rebuild xml
- *
- * Ex 1: xmlInput:
- * <ws:inputs>
- * <ws:entry>
- * <ws:key>name</ws:key>
- * <ws:value>Edward</ws:value>
- * </ws:entry>
- * <ws:entry>
- * <ws:key>age</ws:key>
- * <ws:value>30</ws:value>
- * </ws:entry>
- * <ws:entry>
- * <ws:key>age</ws:key>
- * <ws:value>30</ws:value>
- * </ws:entry>
- * <ws:/inputs>
- * Usage:
- * List elementList = ["key", "value"]
- * String rebuild = buildXMLElements(xmlInput, "inputs", "entry", elementList)
- *
- * Ex 2: xmlInput // no parent tag
- * <ws:sdnc-request-header>
- * <ws:svc-request-id>fec8ec88-151a-45c9-ad60-8233e0fc8ff2</ws:svc-request-id>
- * <ws:svc-notification-url>https://msojra.mtsnj.aic.cip.openecomp.com:8443/adapters/rest/SDNCNotify</ws:svc-notification-url>
- * <ws:svc-action>assign</ws:svc-action>
- * </ws:sdnc-request-header>
- * Usage:
- * List elementList = ["svc-request-id", "svc-notification-url", "svc-action"]
- * String rebuild = buildXMLElements(xmlInput, "" , "sdnc-request-header", elementList) // no parent tag
- *
- * Ex 3: xmlInput // elements one after another (with no parent & children tag)
- * <ws:test-id>myTestid</ws:test-id>
- * <ws:test-user>myUser</ws:test-user>
- * Usage:
- * List elementList = ["test-id", "test-user"]
- * String rebuild = buildXMLElements(xmlInput, "" , "", elementList)
- *
- */
- def buildXMLElements(xmlInput, parentName, childrenName, elementList) {
- def varChildren = ""
- def var = ""
- def xmlBuildUnbounded = ""
- if (parentName!="") {xmlBuildUnbounded += "<"+parentName+">" +'\n'}
- if (xmlInput != null) {
- def xml= new XmlSlurper().parseText(xmlInput)
- if (childrenName!="") {
- varChildren = xml.'**'.findAll {it.name() == childrenName}
- for (i in 0..varChildren.size()-1) {
- xmlBuildUnbounded += "<"+childrenName+">" +'\n'
- for (element in elementList) {
- var = varChildren[i].'*'.find {it.name() == element}
- if (var != null) {
- xmlBuildUnbounded += "<"+element+">"+var.toString()+"</"+element+">" +'\n'
- }
- }
- xmlBuildUnbounded += "</"+childrenName+">" +'\n'
- }
- } else {
- for (element in elementList) {
- var = xml.'*'.find {it.name() == element}
- if (var != null) {
- xmlBuildUnbounded += "<"+element+">"+var.toString()+"</"+element+">" +'\n'
- }
- }
- }
-
- }
- if (parentName!="") {xmlBuildUnbounded += "</"+parentName+">" +'\n'}
- return xmlBuildUnbounded
- }
-
- def getFirstNodeXml(xmlInput, element){
- def nodeAsText = ""
- def nodeToSerialize = ""
- if (xmlInput != null) {
- def fxml= new XmlSlurper().parseText(xmlInput)
- if (utils.nodeExists(xmlInput, "payload")) {
- nodeToSerialize = fxml.'payload'.'l3-network'.'*'.find {it.name() == element}
- if (nodeToSerialize!=null) {
- nodeAsText = XmlUtil.serialize(nodeToSerialize)
- } else {
- nodeAsText = ""
- }
-
- } else {
- nodeToSerialize = fxml.'*'.find {it.name() == element}
- if (nodeToSerialize!=null) {
- nodeAsText = XmlUtil.serialize(nodeToSerialize)
- } else {
- nodeAsText = ""
- }
-
- }
- }
- return nodeAsText
-
- }
-
-//TODO: This method still needs to be tested before using.
- /**
- *
- * This method is similar to the gennetwork:ContrailNetworUpdateCompletedObject
- * BPEL method. It extracts all of the required subnet information
- * for each subnet listed with an orch status equal to the one provided
- * and puts the corresponding infomation with the appropriate node for
- * updating aai. The method sets the orch status for each subnet to active
- *
- * @param subnetsXml the entire subnets xml
- * @param requestInput the request in the process
- * @param queryIdResponse the response of REST AAI query by Id
- * @param queryVpnBindingResponse the response of REST AAI query by vpn binding
- * @param routeCollection the collection of vpnBinding's 'global-route-target'
- * @return String request
- */
- public String networkUpdateSubnetInfo(String subnetsXml, String networkResponseXml){
-
- String subnets = ""
- StringBuilder sb = new StringBuilder()
- InputSource source = new InputSource(new StringReader(subnetsXml));
- DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
- docFactory.setNamespaceAware(true)
- DocumentBuilder docBuilder = docFactory.newDocumentBuilder()
- Document xml = docBuilder.parse(source)
- NodeList nodeList = xml.getElementsByTagNameNS("*", "subnet")
- for (int x = 0; x < nodeList.getLength(); x++) {
- Node node = nodeList.item(x)
- String subnet = ""
- if (node.getNodeType() == Node.ELEMENT_NODE) {
- Element eElement = (Element) node
- String subnetOrchStatus = eElement.getElementsByTagNameNS("*", "orchestration-status").item(0).getTextContent()
- if(subnetOrchStatus.equals("pending-create")){
-
- String subnetId = eElement.getElementsByTagNameNS("*", "subnet-id").item(0).getTextContent()
- def netAddress = eElement.getElementsByTagNameNS("*", "network-start-address").item(0).getTextContent()
- def mask = eElement.getElementsByTagNameNS("*", "cidr-mask").item(0).getTextContent()
- def dhcpEnabledSubnet = eElement.getElementsByTagNameNS("*", "dhcp-enabled").item(0).getTextContent()
- def gatewayAddress = eElement.getElementsByTagNameNS("*", "gateway-address").item(0).getTextContent()
- def ipVersion = eElement.getElementsByTagNameNS("*", "ip-version").item(0).getTextContent()
- def relationshipList = eElement.getElementsByTagNameNS("*", "relationship-list").item(0).getTextContent() //TODO: test this
- String neutronSubnetId = extractNeutSubId(networkResponseXml, subnetId)
- subnet =
- """<subnet>
- <subnetId>${subnetId}</subnetId>
- <neutron-subnet-id>${neutronSubnetId}</neutron-subnet-id>
- <gateway-address>${gatewayAddress}</gateway-address>
- <network-start-address>${netAddress}</network-start-address>
- <cidr-mask>${mask}</cidr-mask>
- <ip-Version>${ipVersion}</ip-Version>
- <orchestration-status>active</orchestration-status>
- <dhcp-enabled>${dhcpEnabledSubnet}</dhcp-enabled>
- <relationship-list>${relationshipList}</relationship-list>
- </subnet>"""
-
- }else if(subnetOrchStatus.equals("pending-delete")){
- StringWriter writer = new StringWriter()
- Transformer transformer = TransformerFactory.newInstance().newTransformer()
- transformer.transform(new DOMSource(node), new StreamResult(writer))
- subnet = writer.toString()
-
- }else{
- subnet = ""
- }
- }
- subnets = sb.append(subnet)
- }
-
- subnets = utils.removeXmlPreamble(subnets)
-
- String subnetsList =
- """<subnets>
- ${subnets}
- </subnets>"""
-
- return subnetsList
- }
-
-
- /**
- *
- * This method extracts the "value" node text for the the given subnet Id.
- *
- * @param String inputSource - xml that contains the subnet id key and value
- * @param String subnetId - for which you want the value of
-
- * @return String value - node text of node named value associated with the given subnet id
- */
- public String extractNeutSubId(String inputSource, String subnetId){
-
- String value = ""
- InputSource source = new InputSource(new StringReader(inputSource));
- DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
- docFactory.setNamespaceAware(true)
- DocumentBuilder docBuilder = docFactory.newDocumentBuilder()
- Document xml = docBuilder.parse(source)
- NodeList nodeList = xml.getElementsByTagNameNS("*", "entry")
- for (int x = 0; x < nodeList.getLength(); x++) {
- Node node = nodeList.item(x)
- String subnet = ""
- if (node.getNodeType() == Node.ELEMENT_NODE) {
- Element eElement = (Element) node
- String key = eElement.getElementsByTagNameNS("*", "key").item(0).getTextContent()
- if(key.equals(subnetId)){
- value = eElement.getElementsByTagNameNS("*", "value").item(0).getTextContent()
- }
- }
- }
- return value
- }
-
- public boolean isRollbackEnabled (DelegateExecution execution, String payloadXml) {
-
- def rollbackEnabled = false
- def rollbackValueSet = false
- if (utils.nodeExists(payloadXml, "backout-on-failure")) {
- String backoutValue = utils.getNodeText1(payloadXml, "backout-on-failure")
- if (backoutValue != null && !backoutValue.isEmpty()) {
- if (backoutValue.equalsIgnoreCase("false")) {
- rollbackEnabled = false
- }
- else {
- rollbackEnabled = true
- }
- rollbackValueSet = true;
- }
- }
-
- if (!rollbackValueSet) {
- if (execution.getVariable("URN_mso_rollback") != null) {
- rollbackEnabled = execution.getVariable("URN_mso_rollback").toBoolean()
- }
- }
- return rollbackEnabled
- }
-
-
- /**
- * This method extracts the version for the the given ip-version.
- *
- * @param String ipvVersion - IP protocols version (ex: ipv4 or ipv6 or 4 or 6)
- * @return String version - digit version (ex: 4 or 6)
- */
-
- public String getIpvVersion (String ipvVersion) {
-
- String version = ""
- try {
- if (ipvVersion.isNumber()) {
- version = ipvVersion
- } else {
- version = ipvVersion.substring(ipvVersion.indexOf("ipv")+3)
- if (!version.isNumber()) {
- version = ipvVersion
- }
- }
- } catch (Exception ex) {
- version = ipvVersion
- }
- return version
- }
-}
+/*- + * ============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.common.scripts; + +import org.apache.commons.lang3.* + +import groovy.xml.XmlUtil +import org.onap.so.bpmn.core.UrnPropertiesReader + +import javax.xml.parsers.DocumentBuilder +import javax.xml.parsers.DocumentBuilderFactory +import javax.xml.transform.Transformer +import javax.xml.transform.TransformerFactory +import javax.xml.transform.TransformerException +import javax.xml.transform.dom.DOMSource +import javax.xml.transform.stream.StreamResult + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.w3c.dom.Document +import org.w3c.dom.Element + +import org.w3c.dom.NamedNodeMap +import org.w3c.dom.Node +import org.w3c.dom.NodeList; +import org.xml.sax.InputSource +import org.onap.so.logger.MsoLogger + +import org.onap.so.logger.MessageEnum + + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor; +import org.w3c.dom.Document +import org.w3c.dom.Element +import org.w3c.dom.NamedNodeMap +import org.w3c.dom.Node +import org.w3c.dom.NodeList; +import org.xml.sax.InputSource + + +/** + * This groovy class supports the any Network processes that need the methods defined here. + */ +class NetworkUtils { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, NetworkUtils.class); + + + public MsoUtils utils = new MsoUtils() + private AbstractServiceTaskProcessor taskProcessor + + public NetworkUtils(AbstractServiceTaskProcessor taskProcessor) { + this.taskProcessor = taskProcessor + } + + /** + * This method returns the string for Network request + * V2 for Contrail 3.x will populate cloud-region data in same cloudSiteId filed + * Network adapter will handle it properly + * @param requestId either 'request-id' or 'mso-request-id' + * @param requestInput the request in the process + * @param queryIdResponse the response of REST AAI query by Id + * @param routeCollection the collection + * @param policyFqdns the policy + * @param tableCollection the collection + * @param cloudRegionId the cloud-region-region + * @return String request + */ + def CreateNetworkRequestV2(execution, requestId, messageId, requestInput, queryIdResponse, routeCollection, policyFqdns, tableCollection, cloudRegionId, backoutOnFailure, source) { + String createNetworkRequest = null + if(requestInput!=null && queryIdResponse!=null) { + String serviceInstanceId = "" + String sharedValue = "" + String externalValue = "" + + if (source == "VID") { + sharedValue = utils.getNodeText(queryIdResponse, "is-shared-network") != null ? utils.getNodeText(queryIdResponse, "is-shared-network") : "false" + externalValue = utils.getNodeText(queryIdResponse, "is-external-network") != null ? utils.getNodeText(queryIdResponse, "is-external-network") : "false" + serviceInstanceId = utils.getNodeText(requestInput, "service-instance-id") + + } else { // source = 'PORTAL' + sharedValue = getParameterValue(requestInput, "shared") + externalValue = getParameterValue(requestInput, "external") + serviceInstanceId = utils.getNodeText(requestInput, "service-instance-id") != null ? utils.getNodeText(requestInput, "service-instance-id") : "" + } + + String networkParams = "" + if (utils.nodeExists(requestInput, "network-params")) { + String netParams = utils.getNodeXml(requestInput, "network-params", false).replace("tag0:","").replace(":tag0","") + networkParams = buildParams(netParams) + } + + String failIfExists = "false" + // requestInput + String cloudRegion = cloudRegionId + String tenantId = utils.getNodeText(requestInput, "tenant-id") + + String networkType = "" + String modelCustomizationUuid = "" + if (utils.nodeExists(requestInput, "networkModelInfo")) { + String networkModelInfo = utils.getNodeXml(requestInput, "networkModelInfo", false).replace("tag0:","").replace(":tag0","") + networkType = utils.getNodeText(networkModelInfo, "modelName") + modelCustomizationUuid = utils.getNodeText(networkModelInfo, "modelCustomizationUuid") + } else { + networkType = utils.getNodeText(queryIdResponse, "network-type") + modelCustomizationUuid = utils.getNodeText(requestInput, "modelCustomizationId") + } + + // queryIdResponse + String networkName = utils.getNodeText(queryIdResponse, "network-name") + String networkId = utils.getNodeText(queryIdResponse, "network-id") + String networkTechnology = utils.getNodeText(queryIdResponse, "network-technology") + + // contrailNetwork - networkTechnology = 'Contrail' vs. 'AIC_SR_IOV') + String contrailNetwork = "" + if (networkTechnology.contains('Contrail') || networkTechnology.contains('contrail') || networkTechnology.contains('CONTRAIL')) { + contrailNetwork = """<contrailNetwork> + <shared>${MsoUtils.xmlEscape(sharedValue)}</shared> + <external>${MsoUtils.xmlEscape(externalValue)}</external> + ${routeCollection} + ${policyFqdns} + ${tableCollection} + </contrailNetwork>""" + networkTechnology = "CONTRAIL" // replace + } + + // rebuild subnets + String subnets = "" + if (utils.nodeExists(queryIdResponse, "subnets")) { + def subnetsGroup = utils.getNodeXml(queryIdResponse, "subnets", false) + subnets = buildSubnets(subnetsGroup) + } + + String physicalNetworkName = "" + physicalNetworkName = utils.getNodeText(queryIdResponse, "physical-network-name") + + String vlansCollection = buildVlans(queryIdResponse) + + String notificationUrl = "" //TODO - is this coming from URN? What variable/value to use? + //String notificationUrl = execution.getVariable("URN_?????") //TODO - is this coming from URN? What variable/value to use? + + createNetworkRequest = """ + <createNetworkRequest> + <cloudSiteId>${MsoUtils.xmlEscape(cloudRegion)}</cloudSiteId> + <tenantId>${MsoUtils.xmlEscape(tenantId)}</tenantId> + <networkId>${MsoUtils.xmlEscape(networkId)}</networkId> + <networkName>${MsoUtils.xmlEscape(networkName)}</networkName> + <networkType>${MsoUtils.xmlEscape(networkType)}</networkType> + <modelCustomizationUuid>${MsoUtils.xmlEscape(modelCustomizationUuid)}</modelCustomizationUuid> + <networkTechnology>${MsoUtils.xmlEscape(networkTechnology)}</networkTechnology> + <providerVlanNetwork> + <physicalNetworkName>${MsoUtils.xmlEscape(physicalNetworkName)}</physicalNetworkName > + ${vlansCollection} + </providerVlanNetwork> + ${contrailNetwork} + ${subnets} + <skipAAI>true</skipAAI> + <backout>${MsoUtils.xmlEscape(backoutOnFailure)}</backout> + <failIfExists>${MsoUtils.xmlEscape(failIfExists)}</failIfExists> + ${networkParams} + <msoRequest> + <requestId>${MsoUtils.xmlEscape(requestId)}</requestId> + <serviceInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</serviceInstanceId> + </msoRequest> + <messageId>${MsoUtils.xmlEscape(messageId)}</messageId> + <notificationUrl>${MsoUtils.xmlEscape(notificationUrl)}</notificationUrl> + </createNetworkRequest> + """.trim() + } + return createNetworkRequest + + } + + /** + * This method returns the string for Network request + * V2 for Contrail 3.x will populate cloud-region data in same cloudSiteId filed + * Network adapter will handle it properly + * @param requestId either 'request-id' or 'mso-request-id' + * @param requestInput the request in the process + * @param queryIdResponse the response of REST AAI query by Id + * @param routeCollection the collection + * @param policyFqdns the policy + * @param cloudRegionId the cloud-region-region + * @return String request + */ + def UpdateNetworkRequestV2(execution, requestId, messageId, requestInput, queryIdResponse, routeCollection, policyFqdns, tableCollection, cloudRegionId, backoutOnFailure, source) { + String updateNetworkRequest = null + if(requestInput!=null && queryIdResponse!=null) { + String serviceInstanceId = "" + String sharedValue = "" + String externalValue = "" + + if (source == "VID") { + sharedValue = utils.getNodeText(queryIdResponse, "is-shared-network") != null ? utils.getNodeText(queryIdResponse, "is-shared-network") : "false" + externalValue = utils.getNodeText(queryIdResponse, "is-external-network") != null ? utils.getNodeText(queryIdResponse, "is-external-network") : "false" + serviceInstanceId = utils.getNodeText(requestInput, "service-instance-id") + + } else { // source = 'PORTAL' + sharedValue = getParameterValue(requestInput, "shared") + externalValue = getParameterValue(requestInput, "external") + serviceInstanceId = utils.getNodeText(requestInput, "service-instance-id") != null ? utils.getNodeText(requestInput, "service-instance-id") : "" + } + + String failIfExists = "false" + // requestInput + String cloudRegion = cloudRegionId + String tenantId = utils.getNodeText(requestInput, "tenant-id") + + // queryIdResponse + String networkName = utils.getNodeText(queryIdResponse, "network-name") + String networkId = utils.getNodeText(queryIdResponse, "network-id") + + String networkType = "" + String modelCustomizationUuid = "" + if (utils.nodeExists(requestInput, "networkModelInfo")) { + String networkModelInfo = utils.getNodeXml(requestInput, "networkModelInfo", false).replace("tag0:","").replace(":tag0","") + networkType = utils.getNodeText(networkModelInfo, "modelName") + modelCustomizationUuid = utils.getNodeText(networkModelInfo, "modelCustomizationUuid") + } else { + networkType = utils.getNodeText(queryIdResponse, "network-type") + modelCustomizationUuid = utils.getNodeText(requestInput, "modelCustomizationId") + } + + // rebuild subnets + String subnets = "" + if (utils.nodeExists(queryIdResponse, "subnets")) { + def subnetsGroup = utils.getNodeXml(queryIdResponse, "subnets", false) + subnets = buildSubnets(subnetsGroup) + } + + String networkParams = "" + if (utils.nodeExists(requestInput, "network-params")) { + String netParams = utils.getNodeXml(requestInput, "network-params", false).replace("tag0:","").replace(":tag0","") + networkParams = buildParams(netParams) + } + + String networkStackId = utils.getNodeText(queryIdResponse, "heat-stack-id") + if (networkStackId == 'null' || networkStackId == "" || networkStackId == null) { + networkStackId = "force_update" + } + + String physicalNetworkName = utils.getNodeText(queryIdResponse, "physical-network-name") + String vlansCollection = buildVlans(queryIdResponse) + + updateNetworkRequest = + """<updateNetworkRequest> + <cloudSiteId>${MsoUtils.xmlEscape(cloudRegion)}</cloudSiteId> + <tenantId>${MsoUtils.xmlEscape(tenantId)}</tenantId> + <networkId>${MsoUtils.xmlEscape(networkId)}</networkId> + <networkStackId>${MsoUtils.xmlEscape(networkStackId)}</networkStackId> + <networkName>${MsoUtils.xmlEscape(networkName)}</networkName> + <networkType>${MsoUtils.xmlEscape(networkType)}</networkType> + <modelCustomizationUuid>${MsoUtils.xmlEscape(modelCustomizationUuid)}</modelCustomizationUuid> + <networkTypeVersion/> + <networkTechnology>CONTRAIL</networkTechnology> + <providerVlanNetwork> + <physicalNetworkName>${MsoUtils.xmlEscape(physicalNetworkName)}</physicalNetworkName> + ${vlansCollection} + </providerVlanNetwork> + <contrailNetwork> + <shared>${MsoUtils.xmlEscape(sharedValue)}</shared> + <external>${MsoUtils.xmlEscape(externalValue)}</external> + ${routeCollection} + ${policyFqdns} + ${tableCollection} + </contrailNetwork> + ${subnets} + <skipAAI>true</skipAAI> + <backout>${MsoUtils.xmlEscape(backoutOnFailure)}</backout> + <failIfExists>${MsoUtils.xmlEscape(failIfExists)}</failIfExists> + ${networkParams} + + <msoRequest> + <requestId>${MsoUtils.xmlEscape(requestId)}</requestId> + <serviceInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</serviceInstanceId> + </msoRequest> + <messageId>${MsoUtils.xmlEscape(messageId)}</messageId> + <notificationUrl></notificationUrl> + </updateNetworkRequest>""".trim() + + } + return updateNetworkRequest + + } + + /** + * This method returns the string for Create Volume Request payload + * @param groupId the volume-group-id + * @param volumeName the volume-group-name + * @param vnfType the vnf-type + * @param tenantId the value of relationship-key 'tenant.tenant-id' + * @return String request payload + */ + def String CreateNetworkVolumeRequest(groupId, volumeName, vnfType, tenantId) { + + String requestPayload = + """<volume-group xmlns="http://org.onap.so/v6"> + <volume-group-id>${MsoUtils.xmlEscape(groupId)}</volume-group-id> + <volume-group-name>${MsoUtils.xmlEscape(volumeName)}</volume-group-name> + <heat-stack-id></heat-stack-id> + <vnf-type>${MsoUtils.xmlEscape(vnfType)}</vnf-type> + <orchestration-status>Pending</orchestration-status> + <relationship-list> + <relationship> + <related-to>tenant</related-to> + <relationship-data> + <relationship-key>tenant.tenant-id</relationship-key> + <relationship-value>${MsoUtils.xmlEscape(tenantId)}</relationship-value> + </relationship-data> + </relationship> + </relationship-list> + </volume-group>""" + + return requestPayload + } + + def String createCloudRegionVolumeRequest(groupId, volumeName, vnfType, tenantId, cloudRegion, namespace, modelCustomizationId) { + + String requestPayload = + """<volume-group xmlns="${namespace}"> + <volume-group-id>${MsoUtils.xmlEscape(groupId)}</volume-group-id> + <volume-group-name>${MsoUtils.xmlEscape(volumeName)}</volume-group-name> + <heat-stack-id></heat-stack-id> + <vnf-type>${MsoUtils.xmlEscape(vnfType)}</vnf-type> + <orchestration-status>Pending</orchestration-status> + <vf-module-model-customization-id>${MsoUtils.xmlEscape(modelCustomizationId)}</vf-module-model-customization-id> + <relationship-list> + <relationship> + <related-to>tenant</related-to> + <relationship-data> + <relationship-key>tenant.tenant-id</relationship-key> + <relationship-value>${MsoUtils.xmlEscape(tenantId)}</relationship-value> + </relationship-data> + <relationship-data> + <relationship-key>cloud-region.cloud-owner</relationship-key> + <relationship-value>att-aic</relationship-value> + </relationship-data> + <relationship-data> + <relationship-key>cloud-region.cloud-region-id</relationship-key> + <relationship-value>${MsoUtils.xmlEscape(cloudRegion)}</relationship-value> + </relationship-data> + </relationship> + </relationship-list> + </volume-group>""" + + return requestPayload + } + + def String createCloudRegionVolumeRequest(groupId, volumeName, vnfType, vnfId, tenantId, cloudRegion, namespace, modelCustomizationId) { + + String requestPayload = + """<volume-group xmlns="${namespace}"> + <volume-group-id>${MsoUtils.xmlEscape(groupId)}</volume-group-id> + <volume-group-name>${MsoUtils.xmlEscape(volumeName)}</volume-group-name> + <heat-stack-id></heat-stack-id> + <vnf-type>${MsoUtils.xmlEscape(vnfType)}</vnf-type> + <orchestration-status>Pending</orchestration-status> + <vf-module-model-customization-id>${MsoUtils.xmlEscape(modelCustomizationId)}</vf-module-model-customization-id> + <relationship-list> + <relationship> + <related-to>generic-vnf</related-to> + <relationship-data> + <relationship-key>generic-vnf.vnf-id</relationship-key> + <relationship-value>${MsoUtils.xmlEscape(vnfId)}</relationship-value> + </relationship-data> + </relationship> + <relationship> + <related-to>tenant</related-to> + <relationship-data> + <relationship-key>tenant.tenant-id</relationship-key> + <relationship-value>${MsoUtils.xmlEscape(tenantId)}</relationship-value> + </relationship-data> + <relationship-data> + <relationship-key>cloud-region.cloud-owner</relationship-key> + <relationship-value>att-aic</relationship-value> + </relationship-data> + <relationship-data> + <relationship-key>cloud-region.cloud-region-id</relationship-key> + <relationship-value>${MsoUtils.xmlEscape(cloudRegion)}</relationship-value> + </relationship-data> + </relationship> + </relationship-list> + </volume-group>""" + + return requestPayload + } + + + /** + * This method returns the string for Update Volume Request payload + * @param requeryAAIVolGrpNameResponse the response of query volume group name (in AAI) + * @param heatStackId the value of heat stack id + * @return String request payload + */ + def String updateCloudRegionVolumeRequest(requeryAAIVolGrpNameResponse, heatStackId, namespace, modelCustomizationId) { + String requestPayload = "" + if (requeryAAIVolGrpNameResponse != null) { + def groupId = utils.getNodeText(requeryAAIVolGrpNameResponse, "volume-group-id") + def volumeName = utils.getNodeText(requeryAAIVolGrpNameResponse, "volume-group-name") + def vnfType = utils.getNodeText(requeryAAIVolGrpNameResponse, "vnf-type") + def resourceVersion = utils.getNodeText(requeryAAIVolGrpNameResponse, "resource-version") + def relationshipList = "" + if (utils.nodeExists(requeryAAIVolGrpNameResponse, "relationship")) { + relationshipList = rebuildRelationship(requeryAAIVolGrpNameResponse) + } + + requestPayload = + """<volume-group xmlns="${namespace}"> + <volume-group-id>${MsoUtils.xmlEscape(groupId)}</volume-group-id> + <volume-group-name>${MsoUtils.xmlEscape(volumeName)}</volume-group-name> + <heat-stack-id>${MsoUtils.xmlEscape(heatStackId)}</heat-stack-id> + <vnf-type>${MsoUtils.xmlEscape(vnfType)}</vnf-type> + <orchestration-status>Active</orchestration-status> + <resource-version>${MsoUtils.xmlEscape(resourceVersion)}</resource-version> + <vf-module-model-customization-id>${MsoUtils.xmlEscape(modelCustomizationId)}</vf-module-model-customization-id> + ${relationshipList} + </volume-group>""" + } + + return requestPayload + } + + + /** + * This method returns the string for Update Volume Request payload + * @param requeryAAIVolGrpNameResponse the response of query volume group name (in AAI) + * @param heatStackId the value of heat stack id + * @return String request payload + */ + def String UpdateNetworkVolumeRequest(requeryAAIVolGrpNameResponse, heatStackId) { + String requestPayload = "" + if (requeryAAIVolGrpNameResponse != null) { + def groupId = utils.getNodeText(requeryAAIVolGrpNameResponse, "volume-group-id") + def volumeName = utils.getNodeText(requeryAAIVolGrpNameResponse, "volume-group-name") + def vnfType = utils.getNodeText(requeryAAIVolGrpNameResponse, "vnf-type") + def resourceVersion = utils.getNodeText(requeryAAIVolGrpNameResponse, "resource-version") + def relationshipList = "" + if (utils.nodeExists(requeryAAIVolGrpNameResponse, "relationship")) { + relationshipList = rebuildRelationship(requeryAAIVolGrpNameResponse) + } + + requestPayload = + """<volume-group xmlns="http://org.onap.so/v6"> + <volume-group-id>${MsoUtils.xmlEscape(groupId)}</volume-group-id> + <volume-group-name>${MsoUtils.xmlEscape(volumeName)}</volume-group-name> + <heat-stack-id>${MsoUtils.xmlEscape(heatStackId)}</heat-stack-id> + <vnf-type>${MsoUtils.xmlEscape(vnfType)}</vnf-type> + <orchestration-status>Active</orchestration-status> + <resource-version>${MsoUtils.xmlEscape(resourceVersion)}</resource-version> + ${relationshipList} + </volume-group>""" + } + + return requestPayload + } + + /** + * This method returns the string for Create Contrail Network payload + * @param requeryIdAAIResponse the response from AAI query by id + * @param createNetworkResponse the response of create network + * @return String contrailNetworkCreatedUpdate + */ + def ContrailNetworkCreatedUpdate(requeryIdAAIResponse, createNetworkResponse, schemaVersion) { + + String contrailNetworkCreatedUpdate = "" + if(requeryIdAAIResponse!=null && createNetworkResponse!=null) { + + def l3Network = utils.getNodeXml(requeryIdAAIResponse, "l3-network", false).replace("tag0:","").replace(":tag0","") + def createNetworkContrailResponse = "" + if (utils.nodeExists(createNetworkResponse, 'createNetworkResponse')) { + createNetworkContrailResponse = utils.getNodeXml(createNetworkResponse, "createNetworkResponse", false).replace("tag0:","").replace(":tag0","") + } else { + createNetworkContrailResponse = utils.getNodeXml(createNetworkResponse, "updateNetworkContrailResponse", false).replace("tag0:","").replace(":tag0","") + } + + // rebuild network + def networkList = ["network-id", "network-name", "network-type", "network-role", "network-technology", "neutron-network-id", "is-bound-to-vpn", "service-id", "network-role-instance", "resource-version", "resource-model-uuid", "orchestration-status", "heat-stack-id", "mso-catalog-key", "contrail-network-fqdn", + "physical-network-name", "is-provider-network", "is-shared-network", "is-external-network"] + String rebuildNetworkElements = buildNetworkElements(l3Network, createNetworkContrailResponse, networkList) + + // rebuild 'subnets' + def rebuildSubnetList = "" + if (utils.nodeExists(requeryIdAAIResponse, 'subnet')) { + rebuildSubnetList = buildSubnets(requeryIdAAIResponse, createNetworkResponse) + } + + // rebuild 'segmentation-assignments' + def rebuildSegmentationAssignments = "" + if (utils.nodeExists(requeryIdAAIResponse, 'segmentation-assignments')) { + List elementList = ["segmentation-id", "resource-version"] + if (utils.nodeExists(requeryIdAAIResponse, 'segmentation-assignment')) { // new tag + rebuildSegmentationAssignments = buildXMLElements(requeryIdAAIResponse, "segmentation-assignments", "segmentation-assignment", elementList) + } else { + rebuildSegmentationAssignments = buildXMLElements(requeryIdAAIResponse, "", "segmentation-assignments", elementList) + } + } + + // rebuild 'ctag-assignments' / rebuildCtagAssignments + def rebuildCtagAssignmentsList = "" + if (utils.nodeExists(requeryIdAAIResponse, 'ctag-assignment')) { + rebuildCtagAssignmentsList = rebuildCtagAssignments(requeryIdAAIResponse) + } + + // rebuild 'relationship' + def relationshipList = "" + if (utils.nodeExists(requeryIdAAIResponse, 'relationship-list')) { + String rootRelationshipData = getFirstNodeXml(requeryIdAAIResponse, "relationship-list").drop(38).trim().replace("tag0:","").replace(":tag0","") + if (utils.nodeExists(rootRelationshipData, 'relationship')) { + relationshipList = rebuildRelationship(rootRelationshipData) + } + } + + //Check for optional contrail network fqdn within CreateNetworkResponse + String contrailNetworkFQDN + if(utils.nodeExists(createNetworkResponse, "contrail-network-fqdn")){ + contrailNetworkFQDN = utils.getNodeXml(createNetworkResponse, "contrail-network-fqdn") + contrailNetworkFQDN = utils.removeXmlNamespaces(contrailNetworkFQDN) + contrailNetworkFQDN = utils.removeXmlPreamble(contrailNetworkFQDN) + }else{ + contrailNetworkFQDN = "" + } + + contrailNetworkCreatedUpdate = + """<l3-network xmlns="${schemaVersion}"> + ${rebuildNetworkElements} + ${rebuildSubnetList} + ${rebuildSegmentationAssignments} + ${rebuildCtagAssignmentsList} + ${relationshipList} + ${contrailNetworkFQDN} + </l3-network>""".trim() + + } + return contrailNetworkCreatedUpdate + } + + + + /** + * This method returns the value for the name paramName. + * Ex: <network-params> + * <param name="shared">1</param> + * <param name="external">0</external> + * </network-params> + * + * @param xmlInput the XML document + * @param paramName the param name (ex: 'shared') + * @return a param value for 'shared' (ex: '1') + */ + def getParameterValue(xmlInput, paramName) { + def rtn="" + if(xmlInput!=null){ + def xml= new XmlSlurper().parseText(xmlInput) + rtn= xml.'**'.find {param->param.'@name'.text() == paramName} + } + if (rtn==null) { + return "" + } else { + return rtn + } + } + + /** + * This method returns the name of param if found/match with paramName. + * Ex: <network-params> + * <param name="shared">1</param> + * <param name="external">0</external> + * </network-params> + * + * @param xmlInput the XML document + * @param paramName the param name (ex: 'shared', ) + * @return a param name for 'shared' (ex: 'shared' if found) + */ + def getParameterName(xmlInput, paramName) { + def rtn="" + if(xmlInput!=null){ + def xml= new XmlSlurper().parseText(xmlInput) + try { + rtn= xml.'**'.find {param->param.'@name' == paramName}.'@name' + } catch (Exception ex) { + rtn="" + } + } + if (rtn==null || rtn=="") { + return "" + } else { + return rtn + } + } + + /** + * This method returns the networkParams xml string. + * Ex: input: + * <network-params> + * <param name="shared">1</param> + * <param name="external">0</external> + * </network-params> + * + * Sample result: + * <networkParams> + * <shared>1</shared> + * <external>0</external> + * </networkParams> + * + */ + + def buildParams(networkParams) { + def build = "" + def netParams = new XmlParser().parseText(networkParams) + try { + def paramsList = netParams.'**'.findAll {param->param.'@name'}.'@name' + if (paramsList.size() > 0) { + build += "<networkParams>" + for (i in 0..paramsList.size()-1) { + def name = netParams.'**'.find {param->param.'@name' == paramsList[i]}.'@name' + def value= netParams.'**'.find {param->param.'@name' == paramsList[i]}.text() + build += "<${name}>${MsoUtils.xmlEscape(value)}</${name}>" + } + build += "</networkParams>" + } + + } catch (Exception ex) { + println ' buildParams error - ' + ex.getMessage() + build = "" + } + return build + } + + def getVlans(xmlInput) { + def rtn = "" + if (xmlInput!=null) { + def vlansList = getListWithElements(xmlInput, 'vlans') + def vlansListSize = vlansList.size() + if (vlansListSize > 0) { + for (i in 0..vlansListSize-1) { + rtn += '<vlans>'+vlansList[i]+'</vlans>' + } + } + } + return rtn + + + } + + /** + * This method returns the uri value for the vpn bindings. + * Return the a list of value of vpn binding in the <related-link> string. + * Ex. + * <relationship-list> + * <relationship> + * <related-to>vpn-binding</related-to> + * <related-link>https://aai-app-e2e.test.openecomp.com:8443/aai/v6/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/</related-link> + * <relationship-data> + * <relationship-key>vpn-binding.vpn-id</relationship-key> + * <relationship-value>85f015d0-2e32-4c30-96d2-87a1a27f8017</relationship-value> + * </relationship-data> + * </relationship> + * <relationship> + * <related-to>vpn-binding</related-to> + * <related-link>https://aai-ext1.test.openecomp.com:8443/aai/v6/network/vpn-bindings/vpn-binding/24a4b507-853a-4a38-99aa-05fcc54be24d/</related-link> + * <relationship-data> + * <relationship-key>vpn-binding.vpn-id</relationship-key> + * <relationship-value>24a4b507-853a-4a38-99aa-05fcc54be24d</relationship-value> + * </relationship-data> + * <related-to-property> + * <property-key>vpn-binding.vpn-name</property-key> + * <property-value>oam_protected_net_6_MTN5_msotest1</property-value> + * </related-to-property> + * </relationship> + * @param xmlInput the XML document + * @return a list of vpn binding values + * ex: ['aai/v6/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/', 'aai/v6/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/'] + * + **/ + def getVnfBindingObject(xmlInput) { + //def rtn = null + List rtn = [] + if (xmlInput!=null) { + def relationshipList = getListWithElements(xmlInput, 'relationship') + def relationshipListSize = relationshipList.size() + if (relationshipListSize > 0) { + for (i in 0..relationshipListSize-1) { + def relationshipXml = XmlUtil.serialize(relationshipList[i]) + if (utils.getNodeText(relationshipXml, 'related-to') == "vpn-binding") { + def relatedLink = utils.getNodeText(relationshipXml, 'related-link') + if (relatedLink != null || relatedLink != "") { + rtn.add(relatedLink.substring(relatedLink.indexOf("/aai/"), relatedLink.length())) + } + } + } + } + } + return rtn + } + /** + * similar to VNF bindings method + * @param xmlInput the XML document + * @return a list of network policy values + * ex: ['aai/v$/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg', 'aai/v$/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg'] + * + **/ + def getNetworkPolicyObject(xmlInput) { + //def rtn = null + List rtn = [] + if (xmlInput!=null) { + def relationshipList = getListWithElements(xmlInput, 'relationship') + def relationshipListSize = relationshipList.size() + if (relationshipListSize > 0) { + for (i in 0..relationshipListSize-1) { + def relationshipXml = XmlUtil.serialize(relationshipList[i]) + if (utils.getNodeText(relationshipXml, 'related-to') == "network-policy") { + def relatedLink = utils.getNodeText(relationshipXml, 'related-link') + if (relatedLink != null || relatedLink != "") { + rtn.add(relatedLink.substring(relatedLink.indexOf("/aai/"), relatedLink.length())) + } + } + } + } + } + return rtn + } + + /** + * similar to network policymethod + * @param xmlInput the XML document + * @return a list of network policy values + * ex: ['aai/v$/network/route-table-references/route-table-reference/refFQDN1', 'aai/v$/network/route-table-references/route-table-reference/refFQDN2'] + * + **/ + def getNetworkTableRefObject(xmlInput) { + //def rtn = null + List rtn = [] + if (xmlInput!=null) { + def relationshipList = getListWithElements(xmlInput, 'relationship') + def relationshipListSize = relationshipList.size() + if (relationshipListSize > 0) { + for (i in 0..relationshipListSize-1) { + def relationshipXml = XmlUtil.serialize(relationshipList[i]) + if (utils.getNodeText(relationshipXml, 'related-to') == "route-table-reference") { + def relatedLink = utils.getNodeText(relationshipXml, 'related-link') + if (relatedLink != null || relatedLink != "") { + rtn.add(relatedLink.substring(relatedLink.indexOf("/aai/"), relatedLink.length())) + } + } + } + } + } + return rtn + } + + /** + * similar to network policymethod + * @param xmlInput the XML document + * @return a list of IDs for related VNF instances + * + **/ + def getRelatedVnfIdList(xmlInput) { + //def rtn = null + List rtn = [] + if (xmlInput!=null) { + def relationshipList = getListWithElements(xmlInput, 'relationship') + def relationshipListSize = relationshipList.size() + if (relationshipListSize > 0) { + for (i in 0..relationshipListSize-1) { + def relationshipXml = XmlUtil.serialize(relationshipList[i]) + if (utils.getNodeText(relationshipXml, 'related-to') == "generic-vnf") { + def relatedLink = utils.getNodeText(relationshipXml, 'related-link') + if (relatedLink != null || relatedLink != "") { + if (relatedLink.substring(relatedLink.indexOf("/generic-vnf/")+13, relatedLink.length()).contains('/')) { + rtn.add(relatedLink.substring(relatedLink.indexOf("/generic-vnf/")+13, relatedLink.length()-1)) + } else { + rtn.add(relatedLink.substring(relatedLink.indexOf("/generic-vnf/")+13, relatedLink.length())) + } + } + } + } + } + } + return rtn + } + + /** + * similar to network policymethod + * @param xmlInput the XML document + * @return a list of IDs for related Network instances + * + **/ + def getRelatedNetworkIdList(xmlInput) { + //def rtn = null + List rtn = [] + if (xmlInput!=null) { + def relationshipList = getListWithElements(xmlInput, 'relationship') + def relationshipListSize = relationshipList.size() + if (relationshipListSize > 0) { + for (i in 0..relationshipListSize-1) { + def relationshipXml = XmlUtil.serialize(relationshipList[i]) + if (utils.getNodeText(relationshipXml, 'related-to') == "l3-network") { + def relatedLink = utils.getNodeText(relationshipXml, 'related-link') + if (relatedLink != null || relatedLink != "") { + if (relatedLink.substring(relatedLink.indexOf("/l3-network/")+12, relatedLink.length()).contains('/')) { + rtn.add(relatedLink.substring(relatedLink.indexOf("/l3-network/")+12, relatedLink.length()-1)) + } else { + rtn.add(relatedLink.substring(relatedLink.indexOf("/l3-network/")+12, relatedLink.length())) + } + } + } + } + } + } + return rtn + } + + def isVfRelationshipExist(xmlInput) { + Boolean rtn = false + if (xmlInput!=null) { + def relationshipList = getListWithElements(xmlInput, 'relationship') + def relationshipListSize = relationshipList.size() + if (relationshipListSize > 0) { + for (i in 0..relationshipListSize-1) { + def relationshipXml = XmlUtil.serialize(relationshipList[i]) + if (utils.getNodeText(relationshipXml, 'related-to') == "vf-module") { + rtn = true + } + } + } + } + return rtn + + } + + def getCloudRegion(xmlInput) { + String lcpCloudRegion = "" + if (xmlInput!=null) { + def relationshipList = getListWithElements(xmlInput, 'relationship') + def relationshipListSize = relationshipList.size() + if (relationshipListSize > 0) { + for (i in 0..relationshipListSize-1) { + def relationshipXml = XmlUtil.serialize(relationshipList[i]) + if (utils.getNodeText(relationshipXml, 'related-to') == "cloud-region") { + def relatedLink = utils.getNodeText(relationshipXml, 'related-link') + if (relatedLink != null || relatedLink != "") { + lcpCloudRegion = relatedLink.substring(relatedLink.indexOf("/att-aic/")+9, relatedLink.length()) + if (lcpCloudRegion.contains('/')) { + lcpCloudRegion = relatedLink.substring(relatedLink.indexOf("/att-aic/")+9, relatedLink.length()-1) + } + } + } + } + } + } + return lcpCloudRegion + } + + def getTenantId(xmlInput) { + String tenantId = "" + if (xmlInput!=null) { + def relationshipList = getListWithElements(xmlInput, 'relationship') + def relationshipListSize = relationshipList.size() + if (relationshipListSize > 0) { + for (i in 0..relationshipListSize-1) { + def relationshipXml = XmlUtil.serialize(relationshipList[i]) + if (utils.getNodeText(relationshipXml, 'related-to') == "tenant") { + def relatedLink = utils.getNodeText(relationshipXml, 'related-link') + if (relatedLink != null || relatedLink != "") { + tenantId = relatedLink.substring(relatedLink.indexOf("/tenant/")+8, relatedLink.length()) + if (tenantId.contains('/')) { + tenantId = relatedLink.substring(relatedLink.indexOf("/tenant/")+8, relatedLink.length()-1) + } + } + } + } + } + } + return tenantId + } + + def isInstanceValueMatch(linkResource, globalSubscriberId, serviceType) { + Boolean rtn = false + try { + String globalSubscriberIdLink = linkResource.substring(linkResource.indexOf("/customer/")+10, linkResource.indexOf("/service-subscriptions")) + String serviceTypeLink = linkResource.substring(linkResource.indexOf("/service-subscription/")+22, linkResource.indexOf("/service-instances")) + if (globalSubscriberIdLink == globalSubscriberId) { + rtn = true + } else { + if (serviceTypeLink == serviceType) { + rtn = true + } + } + + } catch (Exception ex) { + println 'Exception - ' + ex.getMessage() + return false + } + return rtn + } + + def getListWithElements(xmlInput, groupName) { + def rtn = "" + if (xmlInput != null) { + def relationshipData = new XmlSlurper().parseText(xmlInput) + rtn = relationshipData.'**'.findAll {it.name() == groupName} + } + return rtn + + } + + // build network single elements + def buildNetworkElements(l3Network, createNetworkContrailResponse, networkList) { + def replaceNetworkId = "" + def replaceNeutronNetworkId = "" + def replaceContrailNetworkFqdn = "" + if (l3Network != null && createNetworkContrailResponse != null) { + if (utils.nodeExists(l3Network, 'heat-stack-id')) { + replaceNetworkId = utils.getNodeText(l3Network, 'heat-stack-id') + } else { + if (utils.nodeExists(createNetworkContrailResponse, 'networkStackId')) { + replaceNetworkId = utils.getNodeText(createNetworkContrailResponse, 'networkStackId') + } + } + if (utils.nodeExists(l3Network, 'neutron-network-id')) { + replaceNeutronNetworkId = utils.getNodeText(l3Network, 'neutron-network-id') + } else { + if (utils.nodeExists(createNetworkContrailResponse, 'neutronNetworkId')) { + replaceNeutronNetworkId = utils.getNodeText(createNetworkContrailResponse, 'neutronNetworkId') + } + } + if (utils.nodeExists(l3Network, 'contrail-network-fqdn')) { + replaceContrailNetworkFqdn = utils.getNodeText(l3Network, 'contrail-network-fqdn') + } else { + if (utils.nodeExists(createNetworkContrailResponse, 'networkFqdn')) { + replaceContrailNetworkFqdn = utils.getNodeText(createNetworkContrailResponse, 'networkFqdn') + } + } + } + + String var = "" + def xmlNetwork = "" + if (l3Network != null) { + for (element in networkList) { + def xml= new XmlSlurper().parseText(l3Network) + var = xml.'**'.find {it.name() == element} + if (var == null) { + if (element=="orchestration-status") { + if (var.toString() == 'pending-create' || var.toString() == 'PendingCreate') { + xmlNetwork += "<"+element+">"+"Created"+"</"+element+">" + } else { //pending-update or PendingUpdate + xmlNetwork += "<"+element+">"+"Active"+"</"+element+">" + } + } + if (element=="heat-stack-id") { + if (replaceNetworkId != "") { + xmlNetwork += "<"+element+">"+replaceNetworkId+"</"+element+">" + } + } + if (element=="neutron-network-id") { + if (replaceNeutronNetworkId != "") { + xmlNetwork += "<"+element+">"+replaceNeutronNetworkId+"</"+element+">" + } + } + if (element=="contrail-network-fqdn") { + if (replaceContrailNetworkFqdn != "") { + xmlNetwork += "<"+element+">"+replaceContrailNetworkFqdn+"</"+element+">" + } + } + + } else { + if (element=="orchestration-status") { + if (element=="orchestration-status") { + if (var.toString() == 'pending-create' || var.toString() == 'PendingCreate') { + xmlNetwork += "<"+element+">"+"Created"+"</"+element+">" + } else { //pending-update or PendingUpdate + xmlNetwork += "<"+element+">"+"Active"+"</"+element+">" + } + } + } else { + xmlNetwork += "<"+element+">"+var.toString()+"</"+element+">" + } + } + } + } + return xmlNetwork + } + + def buildSubnets(requeryIdAAIResponse, createNetworkResponse) { + def rebuildingSubnets = "" + if (requeryIdAAIResponse != null && utils.nodeExists(requeryIdAAIResponse, 'subnets')) { + def subnetIdMapValue = "" + def subnetsGroup = utils.getNodeXml(requeryIdAAIResponse, "subnets", false) + def subnetsData = new XmlSlurper().parseText(subnetsGroup) + rebuildingSubnets += "<subnets>" + try { + def subnets = subnetsData.'**'.findAll {it.name() == "subnet"} + def subnetsSize = subnets.size() + for (i in 0..subnetsSize-1) { + def subnet = subnets[i] + def subnetXml = XmlUtil.serialize(subnet) + def orchestrationStatus = utils.getNodeText(subnetXml, "orchestration-status") + if (orchestrationStatus == "PendingDelete" || orchestrationStatus == "pending-delete") { + // skip, do not include in processing, remove!!! + } else { + def subnetList = ["subnet-id", "neutron-subnet-id", "gateway-address", "network-start-address", "cidr-mask", "ip-version", "orchestration-status", "dhcp-enabled", "dhcp-start", "dhcp-end", "subnet-role", "resource-version", "subnet-name", "ip-assignment-direction", "host-routes"] + rebuildingSubnets += buildSubNetworkElements(subnetXml, createNetworkResponse, subnetList, "subnet") + } + } + if (utils.nodeExists(subnetsData, 'relationship')) { + rebuildingSubnets = rebuildRelationship(requeryIdAAIResponse) + } + + } catch (Exception ex) { + // error + } finally { + rebuildingSubnets += "</subnets>" + } + } + return rebuildingSubnets + } + + def buildSubnets(queryIdResponse) { + def rebuildingSubnets = "" + def subnetsData = new XmlSlurper().parseText(queryIdResponse) + //rebuildingSubnets += "<subnets>" + try { + def subnets = subnetsData.'**'.findAll {it.name() == "subnet"} + def subnetsSize = subnets.size() + for (i in 0..subnetsSize-1) { + def subnet = subnets[i] + def subnetXml = XmlUtil.serialize(subnet) + def orchestrationStatus = utils.getNodeText(subnetXml, "orchestration-status") + if (orchestrationStatus == "pending-delete" || orchestrationStatus == "PendingDelete") { + // skip, do not include in processing, remove!!! + } else { + def subnetList = ["dhcp-start", "dhcp-end", "network-start-address", "cidr-mask", "dhcp-enabled", "gateway-address", "ip-version", "subnet-id", "subnet-name", "ip-assignment-direction", "host-routes"] + rebuildingSubnets += buildSubNetworkElements(subnetXml, subnetList, "subnets") + //rebuildingSubnets += buildSubNetworkElements(subnetXml, subnetList, "") + } + } + } catch (Exception ex) { + // + } finally { + //rebuildingSubnets += "</subnets>" + } + return rebuildingSubnets + } + + + // build subnet sub-network single elements + def buildSubNetworkElements(subnetXml, createNetworkResponse, elementList, parentName) { + String var = "" + def xmlBuild = "" + if (parentName != "") { + xmlBuild += "<"+parentName+">" + } + if (subnetXml != null) { + for (element in elementList) { + def xml= new XmlSlurper().parseText(subnetXml) + var = xml.'**'.find {it.name() == element} + if (var != null) { + if (element=="orchestration-status") { + if(var.toString() == 'pending-create' || var.toString() == 'PendingCreate') { + xmlBuild += "<"+element+">"+"Created"+"</"+element+">" + } else { // pending-update or PendingUpdate' + xmlBuild += "<"+element+">"+"Active"+"</"+element+">" + } + } else { // "subnet-id", "neutron-subnet-id" + if (element=="subnet-id") { + if (utils.nodeExists(createNetworkResponse, "subnetMap")) { + xmlBuild += "<"+element+">"+var.toString()+"</"+element+">" + String neutronSubnetId = extractNeutSubId(createNetworkResponse, var.toString()) + xmlBuild += "<neutron-subnet-id>"+neutronSubnetId+"</neutron-subnet-id>" + } + } else { + if (element=="neutron-subnet-id") { + // skip + } else { + if (element=="host-routes") { + if (subnetXml.contains("host-routes")) { + List elementRoute = ["host-route-id", "route-prefix", "next-hop", "next-hop-type", "resource-version"] + xmlBuild += buildXMLElements(subnetXml, "host-routes", "host-route", elementRoute) + } + } else { + xmlBuild += "<"+element+">"+var.toString()+"</"+element+">" + } + } + } + } + } + } + + } + if (parentName != "") { + xmlBuild += "</"+parentName+">" + } + return xmlBuild + } + + // build subnet sub-network single elements + def buildSubNetworkElements(subnetXml, elementList, parentName) { + def var = "" + def xmlBuild = "" + if (parentName != "") { + xmlBuild += "<"+parentName+">" + } + if (subnetXml != null) { + def networkStartAddress = "" + for (element in elementList) { + def xml= new XmlSlurper().parseText(subnetXml) + var = xml.'**'.find {it.name() == element} + if (element == "dhcp-start") { + xmlBuild += "<allocationPools>" + if (var.toString() == 'null') { + xmlBuild += "<start>"+""+"</start>" + } else { + xmlBuild += "<start>"+var.toString()+"</start>" + } + } + if (element == "dhcp-end") { + if (var.toString() == 'null') { + xmlBuild += "<end>"+""+"</end>" + } else { + xmlBuild += "<end>"+var.toString()+"</end>" + } + xmlBuild += "</allocationPools>" + } + if (element == "network-start-address" || element == "cidr-mask") { + if (element == "network-start-address") { + networkStartAddress = var.toString() + } + if (element == "cidr-mask") { + xmlBuild += "<cidr>"+networkStartAddress+"/"+var.toString()+"</cidr>" + } + } + if (element == "dhcp-enabled") { + xmlBuild += "<enableDHCP>"+var.toString()+"</enableDHCP>" + } + if (element == "gateway-address") { + xmlBuild += "<gatewayIp>"+var.toString()+"</gatewayIp>" + } + if (element == "ip-version") { + String ipVersion = getIpvVersion(var.toString()) + xmlBuild += "<ipVersion>"+ipVersion+"</ipVersion>" + } + if (element == "subnet-id") { + xmlBuild += "<subnetId>"+var.toString()+"</subnetId>" + } + if ((element == "subnet-name") && (var != null)) { + xmlBuild += "<subnetName>"+var.toString()+"</subnetName>" + } + if ((element == "ip-assignment-direction") && (var != null)) { + xmlBuild += "<addrFromStart>"+var.toString()+"</addrFromStart>" + } + if (element == "host-routes") { + def routes = "" + if (subnetXml.contains("host-routes")) { + routes = buildHostRoutes(subnetXml) + } + xmlBuild += routes + } + + } + } + if (parentName != "") { + xmlBuild += "</"+parentName+">" + } + return xmlBuild + } + + // rebuild host-routes + def buildHostRoutes(subnetXml) { + List routeElementList = ["host-route-id", "route-prefix", "next-hop", "next-hop-type", "resource-version"] + def hostRoutes = buildXMLElements(subnetXml, "host-routes", "host-route", routeElementList) + def buildHostRoutes = "" + def var = "" + if (hostRoutes!=null) { + def routesData = new XmlSlurper().parseText(hostRoutes) + def routes = routesData.'**'.findAll {it.name() == "host-route"} + def routesSize = routes.size() + for (i in 0..routesSize-1) { + buildHostRoutes += "<hostRoutes>" + def route = routes[i] + def routeXml = XmlUtil.serialize(route) + List elementList = ["route-prefix", "next-hop"] + for (element in elementList) { + def xml= new XmlSlurper().parseText(routeXml) + var = xml.'**'.find {it.name() == element} + if (element == "route-prefix") { + buildHostRoutes += "<prefix>"+var.toString()+"</prefix>" + } + if (element == "next-hop") { + buildHostRoutes += "<nextHop>"+var.toString()+"</nextHop>" + } + } + buildHostRoutes += "</hostRoutes>" + } + } + return buildHostRoutes + + } + + // rebuild ctag-assignments + def rebuildCtagAssignments(xmlInput) { + def rebuildingCtagAssignments = "" + if (xmlInput!=null) { + def ctagAssignmentsData = new XmlSlurper().parseText(xmlInput) + rebuildingCtagAssignments += "<ctag-assignments>" + def ctagAssignments = ctagAssignmentsData.'**'.findAll {it.name() == "ctag-assignment"} + def ctagAssignmentsSize = ctagAssignments.size() + for (i in 0..ctagAssignmentsSize-1) { + def ctagAssignment = ctagAssignments[i] + def ctagAssignmentXml = XmlUtil.serialize(ctagAssignment) + rebuildingCtagAssignments += "<ctag-assignment>" + List elementList = ["vlan-id-inner", "resource-version"] + rebuildingCtagAssignments += buildXMLElements(ctagAssignmentXml, "" , "", elementList) + if (utils.nodeExists(ctagAssignmentXml, 'relationship')) { + rebuildingCtagAssignments += rebuildRelationship(ctagAssignmentXml) + } + rebuildingCtagAssignments += "</ctag-assignment>" + } + rebuildingCtagAssignments += "</ctag-assignments>" + } + return rebuildingCtagAssignments + } + + // rebuild 'relationship-list' + def rebuildRelationship(xmlInput) { + def rebuildingSubnets = "" + if (xmlInput!=null) { + def subnetsData = new XmlSlurper().parseText(xmlInput) + rebuildingSubnets += "<relationship-list>" + def relationships = subnetsData.'**'.findAll {it.name() == "relationship"} + def relationshipsSize = relationships.size() + for (i in 0..relationshipsSize-1) { + def relationship = relationships[i] + def relationshipXml = XmlUtil.serialize(relationship) + rebuildingSubnets += "<relationship>" + def relationshipList = ["related-to", "related-link"] + rebuildingSubnets += buildSubNetworkElements(relationshipXml, "", relationshipList, "") + if (utils.nodeExists(relationshipXml, 'relationship-data')) { + def relationshipDataXmlData = new XmlSlurper().parseText(relationshipXml) + def relationshipsData = relationshipDataXmlData.'**'.findAll {it.name() == "relationship-data"} + def relationshipsDataSize = relationshipsData.size() + for (j in 0..relationshipsDataSize-1) { + def relationshipData = relationshipsData[j] + def relationshipDataXml = XmlUtil.serialize(relationshipData) + def relationshipDataList = ["relationship-key", "relationship-value"] + rebuildingSubnets += buildXMLElements(relationshipDataXml, "", "relationship-data", relationshipDataList) + } + } + if (utils.nodeExists(relationshipXml, 'related-to-property')) { + def relationshipDataXmlData = new XmlSlurper().parseText(relationshipXml) + def relationshipsData = relationshipDataXmlData.'**'.findAll {it.name() == "related-to-property"} + def relationshipsDataSize = relationshipsData.size() + for (j in 0..relationshipsDataSize-1) { + def relationshipData = relationshipsData[j] + def relationshipDataXml = XmlUtil.serialize(relationshipData) + def relationshipDataList = ["property-key", "property-value"] + rebuildingSubnets += buildXMLElements(relationshipDataXml, "", "related-to-property", relationshipDataList) + } + } + + rebuildingSubnets += "</relationship>" + } + rebuildingSubnets += "</relationship-list>" + } + return rebuildingSubnets + } + + def buildVlans(queryIdResponse) { + def rebuildingSubnets = "<vlans>" + def subnetsData = new XmlSlurper().parseText(queryIdResponse) + + try { + def subnets = subnetsData.'**'.findAll {it.name() == "segmentation-assignments"} + def subnetsSize = subnets.size() + for (i in 0..subnetsSize-1) { + def subnet = subnets[i] + def subnetXml = XmlUtil.serialize(subnet) + + String vlan = utils.getNodeText(subnetXml, "segmentation-id") + if (i>0){ + rebuildingSubnets += "," + } + rebuildingSubnets += vlan + } + } catch (Exception ex) { + // + } finally { + //rebuildingSubnets += "</subnets>" + rebuildingSubnets += "</vlans>" + } + return rebuildingSubnets + } + + /* Utility code to rebuild xml/elements in a list: + * rebuild xml with 1) unbounded groups of elements; or + * 2) one group of elements; or + * 3) just one or more elements (in a list as argument) + * @param xmlInput the XML document + * @param parentName the parent name (ex: 'inputs') + * @param childrenName the chilrendName (ex: 'entry' as unbounded/occurs>1) + * @param elementList the element list of children (ex: 'key', 'value') + * @return a string of rebuild xml + * + * Ex 1: xmlInput: + * <ws:inputs> + * <ws:entry> + * <ws:key>name</ws:key> + * <ws:value>Edward</ws:value> + * </ws:entry> + * <ws:entry> + * <ws:key>age</ws:key> + * <ws:value>30</ws:value> + * </ws:entry> + * <ws:entry> + * <ws:key>age</ws:key> + * <ws:value>30</ws:value> + * </ws:entry> + * <ws:/inputs> + * Usage: + * List elementList = ["key", "value"] + * String rebuild = buildXMLElements(xmlInput, "inputs", "entry", elementList) + * + * Ex 2: xmlInput // no parent tag + * <ws:sdnc-request-header> + * <ws:svc-request-id>fec8ec88-151a-45c9-ad60-8233e0fc8ff2</ws:svc-request-id> + * <ws:svc-notification-url>https://localhost:8443/adapters/rest/SDNCNotify</ws:svc-notification-url> + * <ws:svc-action>assign</ws:svc-action> + * </ws:sdnc-request-header> + * Usage: + * List elementList = ["svc-request-id", "svc-notification-url", "svc-action"] + * String rebuild = buildXMLElements(xmlInput, "" , "sdnc-request-header", elementList) // no parent tag + * + * Ex 3: xmlInput // elements one after another (with no parent & children tag) + * <ws:test-id>myTestid</ws:test-id> + * <ws:test-user>myUser</ws:test-user> + * Usage: + * List elementList = ["test-id", "test-user"] + * String rebuild = buildXMLElements(xmlInput, "" , "", elementList) + * + */ + def buildXMLElements(xmlInput, parentName, childrenName, elementList) { + def varChildren = "" + def var = "" + def xmlBuildUnbounded = "" + if (parentName!="") {xmlBuildUnbounded += "<"+parentName+">" +'\n'} + if (xmlInput != null) { + def xml= new XmlSlurper().parseText(xmlInput) + if (childrenName!="") { + varChildren = xml.'**'.findAll {it.name() == childrenName} + for (i in 0..varChildren.size()-1) { + xmlBuildUnbounded += "<"+childrenName+">" +'\n' + for (element in elementList) { + var = varChildren[i].'*'.find {it.name() == element} + if (var != null) { + xmlBuildUnbounded += "<"+element+">"+var.toString()+"</"+element+">" +'\n' + } + } + xmlBuildUnbounded += "</"+childrenName+">" +'\n' + } + } else { + for (element in elementList) { + var = xml.'*'.find {it.name() == element} + if (var != null) { + xmlBuildUnbounded += "<"+element+">"+var.toString()+"</"+element+">" +'\n' + } + } + } + + } + if (parentName!="") {xmlBuildUnbounded += "</"+parentName+">" +'\n'} + return xmlBuildUnbounded + } + + def getFirstNodeXml(xmlInput, element){ + def nodeAsText = "" + def nodeToSerialize = "" + if (xmlInput != null) { + def fxml= new XmlSlurper().parseText(xmlInput) + if (utils.nodeExists(xmlInput, "payload")) { + nodeToSerialize = fxml.'payload'.'l3-network'.'*'.find {it.name() == element} + if (nodeToSerialize!=null) { + nodeAsText = XmlUtil.serialize(nodeToSerialize) + } else { + nodeAsText = "" + } + + } else { + nodeToSerialize = fxml.'*'.find {it.name() == element} + if (nodeToSerialize!=null) { + nodeAsText = XmlUtil.serialize(nodeToSerialize) + } else { + nodeAsText = "" + } + + } + } + return nodeAsText + + } + +//TODO: This method still needs to be tested before using. + /** + * + * This method is similar to the gennetwork:ContrailNetworUpdateCompletedObject + * BPEL method. It extracts all of the required subnet information + * for each subnet listed with an orch status equal to the one provided + * and puts the corresponding infomation with the appropriate node for + * updating aai. The method sets the orch status for each subnet to active + * + * @param subnetsXml the entire subnets xml + * @param requestInput the request in the process + * @param queryIdResponse the response of REST AAI query by Id + * @param queryVpnBindingResponse the response of REST AAI query by vpn binding + * @param routeCollection the collection of vpnBinding's 'global-route-target' + * @return String request + */ + public String networkUpdateSubnetInfo(String subnetsXml, String networkResponseXml){ + + String subnets = "" + StringBuilder sb = new StringBuilder() + InputSource source = new InputSource(new StringReader(subnetsXml)); + DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); + docFactory.setNamespaceAware(true) + DocumentBuilder docBuilder = docFactory.newDocumentBuilder() + Document xml = docBuilder.parse(source) + NodeList nodeList = xml.getElementsByTagNameNS("*", "subnet") + for (int x = 0; x < nodeList.getLength(); x++) { + Node node = nodeList.item(x) + String subnet = "" + if (node.getNodeType() == Node.ELEMENT_NODE) { + Element eElement = (Element) node + String subnetOrchStatus = eElement.getElementsByTagNameNS("*", "orchestration-status").item(0).getTextContent() + if(subnetOrchStatus.equals("pending-create")){ + + String subnetId = eElement.getElementsByTagNameNS("*", "subnet-id").item(0).getTextContent() + def netAddress = eElement.getElementsByTagNameNS("*", "network-start-address").item(0).getTextContent() + def mask = eElement.getElementsByTagNameNS("*", "cidr-mask").item(0).getTextContent() + def dhcpEnabledSubnet = eElement.getElementsByTagNameNS("*", "dhcp-enabled").item(0).getTextContent() + def gatewayAddress = eElement.getElementsByTagNameNS("*", "gateway-address").item(0).getTextContent() + def ipVersion = eElement.getElementsByTagNameNS("*", "ip-version").item(0).getTextContent() + def relationshipList = eElement.getElementsByTagNameNS("*", "relationship-list").item(0).getTextContent() //TODO: test this + String neutronSubnetId = extractNeutSubId(networkResponseXml, subnetId) + subnet = + """<subnet> + <subnetId>${MsoUtils.xmlEscape(subnetId)}</subnetId> + <neutron-subnet-id>${MsoUtils.xmlEscape(neutronSubnetId)}</neutron-subnet-id> + <gateway-address>${MsoUtils.xmlEscape(gatewayAddress)}</gateway-address> + <network-start-address>${MsoUtils.xmlEscape(netAddress)}</network-start-address> + <cidr-mask>${MsoUtils.xmlEscape(mask)}</cidr-mask> + <ip-Version>${MsoUtils.xmlEscape(ipVersion)}</ip-Version> + <orchestration-status>active</orchestration-status> + <dhcp-enabled>${MsoUtils.xmlEscape(dhcpEnabledSubnet)}</dhcp-enabled> + <relationship-list>${relationshipList}</relationship-list> + </subnet>""" + + }else if(subnetOrchStatus.equals("pending-delete")){ + StringWriter writer = new StringWriter() + Transformer transformer = TransformerFactory.newInstance().newTransformer() + transformer.transform(new DOMSource(node), new StreamResult(writer)) + subnet = writer.toString() + + }else{ + subnet = "" + } + } + subnets = sb.append(subnet) + } + + subnets = utils.removeXmlPreamble(subnets) + + String subnetsList = + """<subnets> + ${subnets} + </subnets>""" + + return subnetsList + } + + + /** + * + * This method extracts the "value" node text for the the given subnet Id. + * + * @param String inputSource - xml that contains the subnet id key and value + * @param String subnetId - for which you want the value of + + * @return String value - node text of node named value associated with the given subnet id + */ + public String extractNeutSubId(String inputSource, String subnetId){ + + String value = "" + InputSource source = new InputSource(new StringReader(inputSource)); + DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); + docFactory.setNamespaceAware(true) + DocumentBuilder docBuilder = docFactory.newDocumentBuilder() + Document xml = docBuilder.parse(source) + NodeList nodeList = xml.getElementsByTagNameNS("*", "entry") + for (int x = 0; x < nodeList.getLength(); x++) { + Node node = nodeList.item(x) + String subnet = "" + if (node.getNodeType() == Node.ELEMENT_NODE) { + Element eElement = (Element) node + String key = eElement.getElementsByTagNameNS("*", "key").item(0).getTextContent() + if(key.equals(subnetId)){ + value = eElement.getElementsByTagNameNS("*", "value").item(0).getTextContent() + } + } + } + return value + } + + public boolean isRollbackEnabled (DelegateExecution execution, String payloadXml) { + + def rollbackEnabled = false + def rollbackValueSet = false + if (utils.nodeExists(payloadXml, "backout-on-failure")) { + String backoutValue = utils.getNodeText(payloadXml, "backout-on-failure") + if (backoutValue != null && !backoutValue.isEmpty()) { + if (backoutValue.equalsIgnoreCase("false")) { + rollbackEnabled = false + } + else { + rollbackEnabled = true + } + rollbackValueSet = true; + } + } + + if (!rollbackValueSet) { + + if (UrnPropertiesReader.getVariable("mso.rollback", execution) != null) { + rollbackEnabled = UrnPropertiesReader.getVariable("mso.rollback", execution).toBoolean() + } + } + return rollbackEnabled + } + + + /** + * This method extracts the version for the the given ip-version. + * + * @param String ipvVersion - IP protocols version (ex: ipv4 or ipv6 or 4 or 6) + * @return String version - digit version (ex: 4 or 6) + */ + + public String getIpvVersion (String ipvVersion) { + + String version = "" + try { + if (ipvVersion.isNumber()) { + version = ipvVersion + } else { + version = ipvVersion.substring(ipvVersion.indexOf("ipv")+3) + if (!version.isNumber()) { + version = ipvVersion + } + } + } catch (Exception ex) { + version = ipvVersion + } + return version + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/OofHoming.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy index 1b5a2ecdcb..c7fcc5c5d3 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/OofHoming.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,31 +17,32 @@ * limitations under the License. * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.common.scripts - +package org.onap.so.bpmn.common.scripts +import org.onap.so.bpmn.core.UrnPropertiesReader import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution -import org.openecomp.mso.bpmn.common.scripts.AaiUtil -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils -import org.openecomp.mso.bpmn.core.domain.CloudFlavor -import org.openecomp.mso.bpmn.core.domain.InventoryType -import org.openecomp.mso.bpmn.core.domain.Resource -import org.openecomp.mso.bpmn.core.domain.ResourceType -import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition -import org.openecomp.mso.bpmn.core.domain.Subscriber -import org.openecomp.mso.bpmn.core.domain.VnfResource -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.rest.APIResponse -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.AaiUtil +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils +import org.onap.so.bpmn.core.domain.CloudFlavor +import org.onap.so.bpmn.core.domain.InventoryType +import org.onap.so.bpmn.core.domain.Resource +import org.onap.so.bpmn.core.domain.ResourceType +import org.onap.so.bpmn.core.domain.ServiceDecomposition +import org.onap.so.bpmn.core.domain.Subscriber +import org.onap.so.bpmn.core.domain.VnfResource +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.logger.MsoLogger +import org.onap.so.rest.APIResponse +import org.onap.so.rest.RESTClient +import org.onap.so.rest.RESTConfig +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.json.JSONArray import org.json.JSONObject -import static org.openecomp.mso.bpmn.common.scripts.GenericUtils.* +import static org.onap.so.bpmn.common.scripts.GenericUtils.* /** * This class contains the scripts used @@ -51,6 +52,7 @@ import static org.openecomp.mso.bpmn.common.scripts.GenericUtils.* */ class OofHoming extends AbstractServiceTaskProcessor { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, OofHoming.class); ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() OofUtils oofUtils = new OofUtils(this) @@ -99,19 +101,23 @@ class OofHoming extends AbstractServiceTaskProcessor { if (isBlank(subscriberInfo)) { subscriber = new Subscriber("", "", "") } else { - String subId = jsonUtil.getJsonValue(subscriberInfo, "globalSubscriberId") - String subName = jsonUtil.getJsonValue(subscriberInfo, "subscriberName") - String subCommonSiteId = "" - if (jsonUtil.jsonElementExist(subscriberInfo, "subscriberCommonSiteId")) { - subCommonSiteId = jsonUtil.getJsonValue(subscriberInfo, "subscriberCommonSiteId") - } + String subId = jsonUtil.getJsonValue(subscriberInfo, "globalSubscriberId") + String subName = jsonUtil.getJsonValue(subscriberInfo, "subscriberName") + String subCommonSiteId = "" + if (jsonUtil.jsonElementExist(subscriberInfo, "subscriberCommonSiteId")) { + subCommonSiteId = jsonUtil.getJsonValue(subscriberInfo, "subscriberCommonSiteId") + } subscriber = new Subscriber(subId, subName, subCommonSiteId) } //Authentication def authHeader = "" - String basicAuth = execution.getVariable("URN_mso_oof_auth") - String msokey = execution.getVariable("URN_mso_msoKey") + String basicAuth = UrnPropertiesReader.getVariable("mso.oof.auth", execution) + String msokey = UrnPropertiesReader.getVariable("mso.msoKey", execution) + + + + String basicAuthValue = utils.encrypt(basicAuth, msokey) if (basicAuthValue != null) { utils.log("DEBUG", "Obtained BasicAuth username and password for OOF Adapter: " + basicAuthValue, @@ -132,8 +138,8 @@ class OofHoming extends AbstractServiceTaskProcessor { //Prepare Callback String timeout = execution.getVariable("timeout") - if (isBlank(timeout)) { - timeout = execution.getVariable("URN_mso_oof_timeout"); + if (isBlank(timeout)) { + timeout = UrnPropertiesReader.getVariable("mso.oof.timeout", execution); if (isBlank(timeout)) { timeout = "PT30M" } @@ -150,8 +156,8 @@ class OofHoming extends AbstractServiceTaskProcessor { execution.setVariable("oofRequest", oofRequest) utils.log("DEBUG", "OOF Request is: " + oofRequest, isDebugEnabled) - String endpoint = execution.getVariable("URN_mso_service_agnostic_oof_endpoint") - String host = execution.getVariable("URN_mso_service_agnostic_oof_host") + String endpoint = UrnPropertiesReader.getVariable("mso.oof.service.agnostic.endpoint", execution); + String host = UrnPropertiesReader.getVariable("mso.oof.service.agnostic.host", execution); String url = host + endpoint utils.log("DEBUG", "Posting to OOF Url: " + url, isDebugEnabled) @@ -163,18 +169,21 @@ class OofHoming extends AbstractServiceTaskProcessor { APIResponse response = client.httpPost(oofRequest) int responseCode = response.getStatusCode() - execution.setVariable("syncResponseCode", responseCode) logDebug("OOF sync response code is: " + responseCode, isDebugEnabled) String syncResponse = response.getResponseBodyAsString() execution.setVariable("syncResponse", syncResponse) logDebug("OOF sync response is: " + syncResponse, isDebugEnabled) + if(responseCode != 202){ + exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from OOF.") + } + utils.log("DEBUG", "*** Completed Homing Call OOF ***", isDebugEnabled) } } catch (BpmnError b) { throw b } catch (Exception e) { - utils.log("DEBUG", "Error encountered within Homing callOof method: " + e, isDebugEnabled) + msoLogger.error(e); exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in Homing callOof: " + e.getMessage()) } @@ -209,7 +218,7 @@ class OofHoming extends AbstractServiceTaskProcessor { JSONArray arrSol = arr.getJSONArray(i) for (int j = 0; j < arrSol.length(); j++) { JSONObject placement = arrSol.getJSONObject(j) - utils.log("DEBUG", "****** JSONObject is: " + placement + " *****", "true") + utils.log("DEBUG", "****** Placement Solution is: " + placement + " *****", "true") String jsonServiceResourceId = placement.getString("serviceResourceId") String jsonResourceModuleName = placement.getString("resourceModuleName") for (Resource resource : resourceList) { @@ -308,7 +317,7 @@ class OofHoming extends AbstractServiceTaskProcessor { } catch (BpmnError b) { throw b } catch (Exception e) { - utils.log("DEBUG", "Error encountered within Homing ProcessHomingSolution method: " + e, isDebugEnabled) + msoLogger.error(e); exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occurred in Homing ProcessHomingSolution") } } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/OofUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy index b61739f32c..7c5ffca4ab 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/OofUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy @@ -1,25 +1,46 @@ -package org.openecomp.mso.bpmn.common.scripts +/*- + * ============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.common.scripts import org.camunda.bpm.engine.delegate.DelegateExecution -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.common.scripts.MsoUtils -import org.openecomp.mso.bpmn.core.domain.HomingSolution -import org.openecomp.mso.bpmn.core.domain.ModelInfo -import org.openecomp.mso.bpmn.core.domain.Resource -import org.openecomp.mso.bpmn.core.domain.AllottedResource -import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition -import org.openecomp.mso.bpmn.core.domain.ServiceInstance -import org.openecomp.mso.bpmn.core.domain.Subscriber -import org.openecomp.mso.bpmn.core.domain.VnfResource -import org.openecomp.mso.bpmn.core.json.JsonUtils +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.core.domain.HomingSolution +import org.onap.so.bpmn.core.domain.ModelInfo +import org.onap.so.bpmn.core.domain.Resource +import org.onap.so.bpmn.core.domain.AllottedResource +import org.onap.so.bpmn.core.domain.ServiceDecomposition +import org.onap.so.bpmn.core.domain.ServiceInstance +import org.onap.so.bpmn.core.domain.Subscriber +import org.onap.so.bpmn.core.domain.VnfResource +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.logger.MsoLogger import java.lang.reflect.Array -import static org.openecomp.mso.bpmn.common.scripts.GenericUtils.* +import static org.onap.so.bpmn.common.scripts.GenericUtils.* class OofUtils { - + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, OofUtils.class); ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() @@ -107,16 +128,16 @@ class OofUtils { //Demands String placementDemands = "" StringBuilder sb = new StringBuilder() - List<AllottedResource> allottedResourceList = decomposition.getServiceAllottedResources() - List<VnfResource> vnfResourceList = decomposition.getServiceVnfs() + List<AllottedResource> allottedResourceList = decomposition.getAllottedResources() + List<VnfResource> vnfResourceList = decomposition.getVnfResources() - if (allottedResourceList.isEmpty() || allottedResourceList == null) { + if (allottedResourceList == null || allottedResourceList.isEmpty() ) { utils.log("DEBUG", "Allotted Resources List is empty - will try to get service VNFs instead.", isDebugEnabled) - allottedResourceList = decomposition.getServiceVnfs() + allottedResourceList = decomposition.getVnfResources() } - if (allottedResourceList.isEmpty() || allottedResourceList == null) { + if (allottedResourceList == null || allottedResourceList.isEmpty()) { utils.log("DEBUG", "Resources List is Empty", isDebugEnabled) } else { for (AllottedResource resource : allottedResourceList) { @@ -460,4 +481,4 @@ class OofUtils { if (candidatesJson != "") {candidatesJson = candidatesJson.substring(0, candidatesJson.length() - 1)} return candidatesJson } -}
\ No newline at end of file +} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy index bbdaab15e9..a6f8ff469d 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy @@ -1,375 +1,366 @@ -/*-
- * ============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.common.scripts
-
-import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.openecomp.mso.bpmn.core.WorkflowException
-import org.openecomp.mso.rest.APIResponse
-import org.openecomp.mso.rest.RESTClient
-import org.openecomp.mso.rest.RESTConfig
-import org.springframework.web.util.UriUtils
-
-public class PrepareUpdateAAIVfModule extends VfModuleBase {
-
- ExceptionUtil exceptionUtil = new ExceptionUtil()
- private MsoUtils utils = new MsoUtils()
- /**
- * Initialize the flow's variables.
- *
- * @param execution The flow's execution instance.
- */
- public void initProcessVariables(DelegateExecution execution) {
- execution.setVariable('prefix', 'PUAAIVfMod_')
- execution.setVariable('PUAAIVfMod_vnfId', null)
- execution.setVariable('PUAAIVfMod_vfModuleId', null)
- execution.setVariable('PUAAIVfMod_vnfName', null)
- execution.setVariable('PUAAIVfMod_orchestrationStatus', null)
- execution.setVariable('PUAAIVfMod_vfModule', null)
- execution.setVariable('PUAAIVfMod_vfModuleOK', false)
- execution.setVariable('PUAAIVfMod_vfModuleValidationError', null)
- execution.setVariable('PUAAIVfMod_getVnfResponseCode' ,null)
- execution.setVariable('PUAAIVfMod_getVnfResponse', '')
- execution.setVariable('PUAAIVfMod_updateVfModuleResponseCode', null)
- execution.setVariable('PUAAIVfMod_updateVfModuleResponse', '')
- execution.setVariable('PUAAIVfMod_outVfModule', null)
- }
-
- /**
- * Check for missing elements in the received request.
- *
- * @param execution The flow's execution instance.
- */
- public void preProcessRequest(DelegateExecution execution) {
- def method = getClass().getSimpleName() + '.preProcessRequest(' +
- 'execution=' + execution.getId() +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- try {
- def xml = execution.getVariable('PrepareUpdateAAIVfModuleRequest')
- logDebug('Received request xml:\n' + xml, isDebugLogEnabled)
- utils.logAudit("PrepareUpdateAAIVfModule Request : " + xml)
-
- initProcessVariables(execution)
-
- def vnfId = getRequiredNodeText(execution, xml,'vnf-id')
- execution.setVariable('PUAAIVfMod_vnfId', vnfId)
-
- def vfModuleId = getRequiredNodeText(execution, xml,'vf-module-id')
- execution.setVariable('PUAAIVfMod_vfModuleId', vfModuleId)
-
- def orchestrationStatus = getRequiredNodeText(execution, xml,'orchestration-status')
- execution.setVariable('PUAAIVfMod_orchestrationStatus', orchestrationStatus)
-
- logDebug('Exited ' + method, isDebugLogEnabled)
- } catch (BpmnError e) {
- throw e;
- } catch (Exception e) {
- logError('Caught exception in ' + method, e)
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessRequest(): ' + e.getMessage())
- }
- }
-
- /**
- * Using the received vnfId, query AAI to get the corresponding Generic VNF.
- * A 200 response is expected with the Generic VNF in the response body.
- *
- * @param execution The flow's execution instance.
- */
- public void getGenericVnf(DelegateExecution execution) {
- def method = getClass().getSimpleName() + '.getGenericVnf(' +
- 'execution=' + execution.getId() +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- try {
- def vnfId = execution.getVariable('PUAAIVfMod_vnfId')
-
- AaiUtil aaiUriUtil = new AaiUtil(this)
- def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution)
- logDebug('AAI URI is: ' + aai_uri, isDebugLogEnabled)
-
- String endPoint = execution.getVariable("URN_aai_endpoint") + "${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8") + "?depth=1"
-
- utils.logAudit("PrepareUpdateAAIVfModule: AAI endPoint : " + endPoint)
- String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey"))
- try {
- RESTConfig config = new RESTConfig(endPoint);
- def responseData = ''
- String aaiRequestId = utils.getRequestID()
- RESTClient client = new RESTClient(config).
- addHeader('X-TransactionId', aaiRequestId).
- addHeader('X-FromAppId', 'MSO').
- addHeader('Content-Type', 'application/xml').
- addHeader('Accept','application/xml');
- if (basicAuthCred != null && !"".equals(basicAuthCred)) {
- client.addAuthorizationHeader(basicAuthCred)
- }
- logDebug('sending GET to AAI endpoint \'' + endPoint + '\'', isDebugLogEnabled)
- APIResponse response = client.httpGet()
- utils.logAudit("PrepareUpdateAAIVfModule: - invoking httpGet to AAI")
-
- responseData = response.getResponseBodyAsString()
- execution.setVariable('PUAAIVfMod_getVnfResponseCode', response.getStatusCode())
- execution.setVariable('PUAAIVfMod_getVnfResponse', responseData)
-
- utils.logAudit("PrepareUpdateAAIVfModule: AAI Response : " + responseData)
- utils.logAudit("PrepareUpdateAAIVfModule: AAI ResponseCode : " + response.getStatusCode())
-
- logDebug('Response code:' + response.getStatusCode(), isDebugLogEnabled)
- logDebug('Response:' + System.lineSeparator() + responseData, isDebugLogEnabled)
- } catch (Exception ex) {
- ex.printStackTrace()
- logDebug('Exception occurred while executing AAI GET:' + ex.getMessage(), isDebugLogEnabled)
- execution.setVariable('PUAAIVfMod_getVnfResponseCode', 500)
- execution.setVariable('PUAAIVfMod_getVnfResponse', 'AAI GET Failed:' + ex.getMessage())
- }
- logDebug('Exited ' + method, isDebugLogEnabled)
- } catch (BpmnError e) {
- throw e;
- } catch (Exception e) {
- logError('Caught exception in ' + method, e)
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in getGenericVnf(): ' + e.getMessage())
- }
- }
-
- /**
- * Validate the VF Module. That is, confirm that a VF Module with the input VF Module ID
- * exists in the retrieved Generic VNF. Then, check to make sure that if that VF Module
- * is the base VF Module and it's not the only VF Module for this Generic VNF, that we're not
- * attempting to delete it.
- *
- * @param execution The flow's execution instance.
- */
- public void validateVfModule(DelegateExecution execution) {
- def method = getClass().getSimpleName() + '.validateVfModule(' +
- 'execution=' + execution.getId() +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- try {
- def genericVnf = execution.getVariable('PUAAIVfMod_getVnfResponse')
- def vnfId = execution.getVariable('PUAAIVfMod_vnfId')
- def vfModuleId = execution.getVariable('PUAAIVfMod_vfModuleId')
- def vnfName = getNodeTextForce(genericVnf, 'vnf-name')
- execution.setVariable('PUAAIVfMod_vnfName', vnfName)
- def VfModule vfModule = findVfModule(genericVnf, vfModuleId)
- if (vfModule == null) {
- def String msg = 'VF Module \'' + vfModuleId + '\' does not exist in Generic VNF \'' + vnfId + '\''
- execution.setVariable('PUAAIVfMod_vfModuleValidationError', msg)
- execution.setVariable('PUAAIVfMod_vfModuleOK', false)
- } else {
- def orchestrationStatus = execution.getVariable('PUAAIVfMod_orchestrationStatus')
- if (isDebugLogEnabled) {
- logDebug('VF Module \'' + vfModuleId + '\': isBaseVfModule=' + vfModule.isBaseVfModule() +
- ', isOnlyVfModule=' + vfModule.isOnlyVfModule() + ', new orchestration-status=' + orchestrationStatus,
- isDebugLogEnabled)
- }
- if (vfModule.isBaseVfModule() && !vfModule.isOnlyVfModule() && orchestrationStatus.equals('pending-delete')) {
- def String msg = 'Orchestration status for VF Module \'' + vfModuleId +
- '\' cannot be set to \'pending-delete\' since it is the base VF Module and it\'s not the only VF Module in Generic VNF \'' + vnfId + '\''
- execution.setVariable('PUAAIVfMod_vfModuleValidationError', msg)
- execution.setVariable('PUAAIVfMod_vfModuleOK', false)
- } else {
- execution.setVariable('PUAAIVfMod_vfModule', vfModule)
- execution.setVariable('PUAAIVfMod_vfModuleOK', true)
- }
- }
-
- logDebug('Exited ' + method, isDebugLogEnabled)
- } catch (BpmnError e) {
- throw e;
- } catch (Exception e) {
- logError('Caught exception in ' + method, e)
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in validateVfModule(): ' + e.getMessage())
- }
- }
-
- /**
- * Construct and send a PATCH request to AAI to update the VF Module.
- *
- * @param execution The flow's execution instance.
- */
- public void updateVfModule(DelegateExecution execution) {
- def method = getClass().getSimpleName() + '.updateVfModule(' +
- 'execution=' + execution.getId() +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- try {
- // Construct payload
- def VfModule vfModule = (VfModule) execution.getVariable('PUAAIVfMod_vfModule')
- def Node newVfModuleNode = vfModule.getNode().clone()
- def orchestrationStatus = execution.getVariable('PUAAIVfMod_orchestrationStatus')
- def Node orchestrationStatusNode = utils.getChildNode(newVfModuleNode, 'orchestration-status')
- if (orchestrationStatusNode == null) {
- // Node doesn't exist, this should never happen, right?
- new Node(newVfModuleNode, 'orchestration-status', orchestrationStatus)
- } else {
- // Node already exists, just give it a new value
- orchestrationStatusNode.setValue(orchestrationStatus)
- }
- def VfModule newVfModule = new VfModule(newVfModuleNode, vfModule.isOnlyVfModule())
- //def payload = utils.nodeToString(newVfModuleNode)
-
- // Construct endpoint
- def vnfId = execution.getVariable('PUAAIVfMod_vnfId')
- def vfModuleId = execution.getVariable('PUAAIVfMod_vfModuleId')
-
- def payload = """{
- "vf-module-id": "${vfModuleId}",
- "orchestration-status": "${orchestrationStatus}"
- }"""
-
- utils.logAudit("VfModule payload : " + payload)
-
- AaiUtil aaiUriUtil = new AaiUtil(this)
- def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution)
- logDebug('AAI URI is: ' + aai_uri, isDebugLogEnabled)
-
- String endPoint = execution.getVariable("URN_aai_endpoint") + "${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8") + "/vf-modules/vf-module/" + UriUtils.encode(vfModuleId, "UTF-8")
- utils.logAudit("PrepareUpdateAAIVfModule: AAI endPoint : " + endPoint)
- String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey"))
- try {
- RESTConfig config = new RESTConfig(endPoint);
- def responseData = ''
- def aaiRequestId = utils.getRequestID()
- RESTClient client = new RESTClient(config).
- addHeader('X-TransactionId', aaiRequestId).
- addHeader('X-FromAppId', 'MSO').
- addHeader('Content-Type', 'application/merge-patch+json').
- addHeader('Accept','application/json');
- if (basicAuthCred != null && !"".equals(basicAuthCred)) {
- client.addAuthorizationHeader(basicAuthCred)
- }
- logDebug('sending PATCH to AAI endpoint \'' + endPoint + '\'' + 'with payload \n' + payload, isDebugLogEnabled)
- APIResponse response = client.httpPatch(payload)
- utils.logAudit("PrepareUpdateAAIVfModule: - invoking httpPatch to AAI")
- utils.logAudit("PrepareUpdateAAIVfModule: - invoking httpPatch to AAI")
-
- responseData = response.getResponseBodyAsString()
- execution.setVariable('PUAAIVfMod_updateVfModuleResponseCode', response.getStatusCode())
- execution.setVariable('PUAAIVfMod_updateVfModuleResponse', responseData)
- logDebug('Response code:' + response.getStatusCode(), isDebugLogEnabled)
- logDebug('Response:' + System.lineSeparator() + responseData, isDebugLogEnabled)
- utils.logAudit("PrepareUpdateAAIVfModule: AAI Response : " + responseData)
- utils.logAudit("PrepareUpdateAAIVfModule: AAI ResponseCode : " + response.getStatusCode())
-
- // Set the output for this flow. The updated VfModule is an output, the generic VNF name, and for
- // backward compatibilty, the heat-stack-id is an output
- execution.setVariable('PUAAIVfMod_outVfModule', newVfModule)
- def vnfName = execution.getVariable('PUAAIVfMod_vnfName')
- logDebug('Output PUAAIVfMod_vnfName set to ' + vnfName, isDebugLogEnabled)
- // TODO: Should deprecate use of processKey+Response variable for the response. Will use "WorkflowResponse" instead
- execution.setVariable('WorkflowResponse', newVfModule)
- logDebug('Output PUAAIVfMod_outVfModule set for VF Module Id \'' + newVfModule.getElementText('vf-module-id') + '\'', isDebugLogEnabled)
- def heatStackId = newVfModule.getElementText('heat-stack-id')
- execution.setVariable('PUAAIVfMod_heatStackId', heatStackId)
- logDebug('Output PUAAIVfMod_heatStackId set to \'' + heatStackId + '\'', isDebugLogEnabled)
- } catch (Exception ex) {
- ex.printStackTrace()
- logDebug('Exception occurred while executing AAI PUT:' + ex.getMessage(), isDebugLogEnabled)
- execution.setVariable('PUAAIVfMod_updateVfModuleResponseCode', 500)
- execution.setVariable('PUAAIVfMod_updateVfModuleResponse', 'AAI PATCH Failed:' + ex.getMessage())
- }
- logDebug('Exited ' + method, isDebugLogEnabled)
- } catch (BpmnError e) {
- throw e;
- } catch (Exception e) {
- logError('Caught exception in ' + method, e)
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in updateVfModule(): ' + e.getMessage())
- }
- }
-
- /**
- * Generates a WorkflowException if the AAI query returns a response code other than 200.
- *
- * @param execution The flow's execution instance.
- */
- public void handleVnfNotFound(DelegateExecution execution) {
- def method = getClass().getSimpleName() + '.handleVnfNotFound(' +
- 'execution=' + execution.getId() +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- logError('Error occurred attempting to query AAI, Response Code ' +
- execution.getVariable('PUAAIVfMod_getVnfResponseCode') + ', Error Response ' +
- execution.getVariable('PUAAIVfMod_getVnfResponse'))
- String processKey = getProcessKey(execution);
- WorkflowException exception = new WorkflowException(processKey, 5000,
- execution.getVariable('PUAAIVfMod_getVnfResponse'))
- execution.setVariable('WorkflowException', exception)
-
- logDebug('Exited ' + method, isDebugLogEnabled)
- }
-
- /**
- * Generates a WorkflowException if the VF Module does not pass validation.
- *
- * @param execution The flow's execution instance.
- */
- public void handleVfModuleValidationError(DelegateExecution execution) {
- def method = getClass().getSimpleName() + '.handleVfModuleValidationError(' +
- 'execution=' + execution.getId() +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- def String errorMsg = 'VF Module validation error: ' + execution.getVariable('PUAAIVfMod_vfModuleValidationError')
- logError(errorMsg)
- utils.logAudit("PrepareUpdateAAIVfModule: Error Message : " + errorMsg)
-
- String processKey = getProcessKey(execution);
- WorkflowException exception = new WorkflowException(processKey, 5000, errorMsg)
- execution.setVariable('WorkflowException', exception)
-
- logDebug('Exited ' + method, isDebugLogEnabled)
- }
-
- /**
- * Generates a WorkflowException if updating a VF Module in AAI returns a response code other than 200.
- *
- * @param execution The flow's execution instance.
- */
- public void handleUpdateVfModuleFailure(DelegateExecution execution) {
- def method = getClass().getSimpleName() + '.handleUpdateVfModuleFailure(' +
- 'execution=' + execution.getId() +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- logError('Error occurred attempting to update VF Module in AAI, Response Code ' +
- execution.getVariable('PUAAIVfMod_updateVfModuleResponseCode') + ', Error Response ' +
- execution.getVariable('PUAAIVfMod_updateVfModuleResponse'))
- String processKey = getProcessKey(execution);
- WorkflowException exception = new WorkflowException(processKey, 5000,
- execution.getVariable('PUAAIVfMod_updateVfModuleResponse'))
- execution.setVariable('WorkflowException', exception)
-
- logDebug('Exited ' + method, isDebugLogEnabled)
- }
-}
+/*- + * ============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.common.scripts + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.rest.APIResponse +import org.onap.so.rest.RESTClient +import org.onap.so.rest.RESTConfig +import org.springframework.web.util.UriUtils +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + + + +public class PrepareUpdateAAIVfModule extends VfModuleBase { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, PrepareUpdateAAIVfModule.class); + + + ExceptionUtil exceptionUtil = new ExceptionUtil() + private MsoUtils utils = new MsoUtils() + /** + * Initialize the flow's variables. + * + * @param execution The flow's execution instance. + */ + public void initProcessVariables(DelegateExecution execution) { + execution.setVariable('prefix', 'PUAAIVfMod_') + execution.setVariable('PUAAIVfMod_vnfId', null) + execution.setVariable('PUAAIVfMod_vfModuleId', null) + execution.setVariable('PUAAIVfMod_vnfName', null) + execution.setVariable('PUAAIVfMod_orchestrationStatus', null) + execution.setVariable('PUAAIVfMod_vfModule', null) + execution.setVariable('PUAAIVfMod_vfModuleOK', false) + execution.setVariable('PUAAIVfMod_vfModuleValidationError', null) + execution.setVariable('PUAAIVfMod_getVnfResponseCode' ,null) + execution.setVariable('PUAAIVfMod_getVnfResponse', '') + execution.setVariable('PUAAIVfMod_updateVfModuleResponseCode', null) + execution.setVariable('PUAAIVfMod_updateVfModuleResponse', '') + execution.setVariable('PUAAIVfMod_outVfModule', null) + } + + /** + * Check for missing elements in the received request. + * + * @param execution The flow's execution instance. + */ + public void preProcessRequest(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.preProcessRequest(' + + 'execution=' + execution.getId() + + ')' + msoLogger.trace('Entered ' + method) + + try { + def xml = execution.getVariable('PrepareUpdateAAIVfModuleRequest') + msoLogger.debug('Received request xml:\n' + xml) + msoLogger.debug("PrepareUpdateAAIVfModule Request : " + xml) + + initProcessVariables(execution) + + def vnfId = getRequiredNodeText(execution, xml,'vnf-id') + execution.setVariable('PUAAIVfMod_vnfId', vnfId) + + def vfModuleId = getRequiredNodeText(execution, xml,'vf-module-id') + execution.setVariable('PUAAIVfMod_vfModuleId', vfModuleId) + + def orchestrationStatus = getRequiredNodeText(execution, xml,'orchestration-status') + execution.setVariable('PUAAIVfMod_orchestrationStatus', orchestrationStatus) + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(e) + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessRequest(): ' + e.getMessage()) + } + } + + /** + * Using the received vnfId, query AAI to get the corresponding Generic VNF. + * A 200 response is expected with the Generic VNF in the response body. + * + * @param execution The flow's execution instance. + */ + public void getGenericVnf(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.getGenericVnf(' + + 'execution=' + execution.getId() + + ')' + msoLogger.trace('Entered ' + method) + + try { + def vnfId = execution.getVariable('PUAAIVfMod_vnfId') + + AaiUtil aaiUriUtil = new AaiUtil(this) + def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution) + msoLogger.debug('AAI URI is: ' + aai_uri) + + String endPoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + "${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8") + "?depth=1" + + msoLogger.debug("PrepareUpdateAAIVfModule: AAI endPoint : " + endPoint) + String basicAuthCred = utils.getBasicAuth(UrnPropertiesReader.getVariable("aai.auth", execution),UrnPropertiesReader.getVariable("mso.msoKey", execution)) + try { + RESTConfig config = new RESTConfig(endPoint); + def responseData = '' + String aaiRequestId = utils.getRequestID() + RESTClient client = new RESTClient(config). + addHeader('X-TransactionId', aaiRequestId). + addHeader('X-FromAppId', 'MSO'). + addHeader('Content-Type', 'application/xml'). + addHeader('Accept','application/xml'); + if (basicAuthCred != null && !"".equals(basicAuthCred)) { + client.addAuthorizationHeader(basicAuthCred) + } + msoLogger.debug('sending GET to AAI endpoint \'' + endPoint + '\'') + APIResponse response = client.httpGet() + msoLogger.debug("PrepareUpdateAAIVfModule: - invoking httpGet to AAI") + + responseData = response.getResponseBodyAsString() + execution.setVariable('PUAAIVfMod_getVnfResponseCode', response.getStatusCode()) + execution.setVariable('PUAAIVfMod_getVnfResponse', responseData) + + msoLogger.debug("PrepareUpdateAAIVfModule: AAI Response : " + responseData) + msoLogger.debug("PrepareUpdateAAIVfModule: AAI ResponseCode : " + response.getStatusCode()) + + msoLogger.debug('Response code:' + response.getStatusCode()) + msoLogger.debug('Response:' + System.lineSeparator() + responseData) + } catch (Exception ex) { + msoLogger.error(ex); + msoLogger.debug('Exception occurred while executing AAI GET:' + ex.getMessage()) + execution.setVariable('PUAAIVfMod_getVnfResponseCode', 500) + execution.setVariable('PUAAIVfMod_getVnfResponse', 'AAI GET Failed:' + ex.getMessage()) + } + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(e) + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in getGenericVnf(): ' + e.getMessage()) + } + } + + /** + * Validate the VF Module. That is, confirm that a VF Module with the input VF Module ID + * exists in the retrieved Generic VNF. Then, check to make sure that if that VF Module + * is the base VF Module and it's not the only VF Module for this Generic VNF, that we're not + * attempting to delete it. + * + * @param execution The flow's execution instance. + */ + public void validateVfModule(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.validateVfModule(' + + 'execution=' + execution.getId() + + ')' + msoLogger.trace('Entered ' + method) + + try { + def genericVnf = execution.getVariable('PUAAIVfMod_getVnfResponse') + def vnfId = execution.getVariable('PUAAIVfMod_vnfId') + def vfModuleId = execution.getVariable('PUAAIVfMod_vfModuleId') + def vnfName = getNodeTextForce(genericVnf, 'vnf-name') + execution.setVariable('PUAAIVfMod_vnfName', vnfName) + def VfModule vfModule = findVfModule(genericVnf, vfModuleId) + if (vfModule == null) { + def String msg = 'VF Module \'' + vfModuleId + '\' does not exist in Generic VNF \'' + vnfId + '\'' + execution.setVariable('PUAAIVfMod_vfModuleValidationError', msg) + execution.setVariable('PUAAIVfMod_vfModuleOK', false) + } else { + def orchestrationStatus = execution.getVariable('PUAAIVfMod_orchestrationStatus') + msoLogger.debug('VF Module \'' + vfModuleId + '\': isBaseVfModule=' + vfModule.isBaseVfModule() +', isOnlyVfModule=' + vfModule.isOnlyVfModule() + ', new orchestration-status=' + orchestrationStatus) + if (vfModule.isBaseVfModule() && !vfModule.isOnlyVfModule() && orchestrationStatus.equals('pending-delete')) { + def String msg = 'Orchestration status for VF Module \'' + vfModuleId + + '\' cannot be set to \'pending-delete\' since it is the base VF Module and it\'s not the only VF Module in Generic VNF \'' + vnfId + '\'' + execution.setVariable('PUAAIVfMod_vfModuleValidationError', msg) + execution.setVariable('PUAAIVfMod_vfModuleOK', false) + } else { + execution.setVariable('PUAAIVfMod_vfModule', vfModule) + execution.setVariable('PUAAIVfMod_vfModuleOK', true) + } + } + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(e) + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in validateVfModule(): ' + e.getMessage()) + } + } + + /** + * Construct and send a PATCH request to AAI to update the VF Module. + * + * @param execution The flow's execution instance. + */ + public void updateVfModule(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.updateVfModule(' + + 'execution=' + execution.getId() + + ')' + msoLogger.trace('Entered ' + method) + + try { + // Construct payload + def VfModule vfModule = (VfModule) execution.getVariable('PUAAIVfMod_vfModule') + def Node newVfModuleNode = vfModule.getNode().clone() + def orchestrationStatus = execution.getVariable('PUAAIVfMod_orchestrationStatus') + def Node orchestrationStatusNode = utils.getChildNode(newVfModuleNode, 'orchestration-status') + if (orchestrationStatusNode == null) { + // Node doesn't exist, this should never happen, right? + new Node(newVfModuleNode, 'orchestration-status', orchestrationStatus) + } else { + // Node already exists, just give it a new value + orchestrationStatusNode.setValue(orchestrationStatus) + } + def VfModule newVfModule = new VfModule(newVfModuleNode, vfModule.isOnlyVfModule()) + //def payload = utils.nodeToString(newVfModuleNode) + + // Construct endpoint + def vnfId = execution.getVariable('PUAAIVfMod_vnfId') + def vfModuleId = execution.getVariable('PUAAIVfMod_vfModuleId') + + def payload = """{ + "vf-module-id": "${vfModuleId}", + "orchestration-status": "${orchestrationStatus}" + }""" + + msoLogger.debug("VfModule payload : " + payload) + + AaiUtil aaiUriUtil = new AaiUtil(this) + def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution) + msoLogger.debug('AAI URI is: ' + aai_uri) + + String endPoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + "${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8") + "/vf-modules/vf-module/" + UriUtils.encode(vfModuleId, "UTF-8") + msoLogger.debug("PrepareUpdateAAIVfModule: AAI endPoint : " + endPoint) + String basicAuthCred = utils.getBasicAuth(UrnPropertiesReader.getVariable("aai.auth", execution),UrnPropertiesReader.getVariable("mso.msoKey", execution)) + try { + RESTConfig config = new RESTConfig(endPoint); + def responseData = '' + def aaiRequestId = utils.getRequestID() + RESTClient client = new RESTClient(config). + addHeader('X-TransactionId', aaiRequestId). + addHeader('X-FromAppId', 'MSO'). + addHeader('Content-Type', 'application/merge-patch+json'). + addHeader('Accept','application/json'); + if (basicAuthCred != null && !"".equals(basicAuthCred)) { + client.addAuthorizationHeader(basicAuthCred) + } + msoLogger.debug('sending PATCH to AAI endpoint \'' + endPoint + '\'' + 'with payload \n' + payload) + APIResponse response = client.httpPatch(payload) + msoLogger.debug("PrepareUpdateAAIVfModule: - invoking httpPatch to AAI") + + responseData = response.getResponseBodyAsString() + execution.setVariable('PUAAIVfMod_updateVfModuleResponseCode', response.getStatusCode()) + execution.setVariable('PUAAIVfMod_updateVfModuleResponse', responseData) + msoLogger.debug('Response code:' + response.getStatusCode()) + msoLogger.debug('Response:' + System.lineSeparator() + responseData) + msoLogger.debug("PrepareUpdateAAIVfModule: AAI Response : " + responseData) + msoLogger.debug("PrepareUpdateAAIVfModule: AAI ResponseCode : " + response.getStatusCode()) + + // Set the output for this flow. The updated VfModule is an output, the generic VNF name, and for + // backward compatibilty, the heat-stack-id is an output + execution.setVariable('PUAAIVfMod_outVfModule', newVfModule) + def vnfName = execution.getVariable('PUAAIVfMod_vnfName') + msoLogger.debug('Output PUAAIVfMod_vnfName set to ' + vnfName) + // TODO: Should deprecate use of processKey+Response variable for the response. Will use "WorkflowResponse" instead + execution.setVariable('WorkflowResponse', newVfModule) + msoLogger.debug('Output PUAAIVfMod_outVfModule set for VF Module Id \'' + newVfModule.getElementText('vf-module-id') + '\'') + def heatStackId = newVfModule.getElementText('heat-stack-id') + execution.setVariable('PUAAIVfMod_heatStackId', heatStackId) + msoLogger.debug('Output PUAAIVfMod_heatStackId set to \'' + heatStackId + '\'') + } catch (Exception ex) { + ex.printStackTrace() + msoLogger.debug('Exception occurred while executing AAI PUT:' + ex.getMessage()) + execution.setVariable('PUAAIVfMod_updateVfModuleResponseCode', 500) + execution.setVariable('PUAAIVfMod_updateVfModuleResponse', 'AAI PATCH Failed:' + ex.getMessage()) + } + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(e) + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in updateVfModule(): ' + e.getMessage()) + } + } + + /** + * Generates a WorkflowException if the AAI query returns a response code other than 200. + * + * @param execution The flow's execution instance. + */ + public void handleVnfNotFound(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.handleVnfNotFound(' + + 'execution=' + execution.getId() + + ')' + msoLogger.trace('Entered ' + method) + + msoLogger.error('Error occurred attempting to query AAI, Response Code ' + execution.getVariable('PUAAIVfMod_getVnfResponseCode')); + String processKey = getProcessKey(execution); + WorkflowException exception = new WorkflowException(processKey, 5000, + execution.getVariable('PUAAIVfMod_getVnfResponse')) + execution.setVariable('WorkflowException', exception) + + msoLogger.trace('Exited ' + method) + } + + /** + * Generates a WorkflowException if the VF Module does not pass validation. + * + * @param execution The flow's execution instance. + */ + public void handleVfModuleValidationError(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.handleVfModuleValidationError(' + + 'execution=' + execution.getId() + + ')' + msoLogger.trace('Entered ' + method) + + def String errorMsg = 'VF Module validation error: ' + execution.getVariable('PUAAIVfMod_vfModuleValidationError') + msoLogger.error(errorMsg); + msoLogger.debug("PrepareUpdateAAIVfModule: Error Message : " + errorMsg) + + String processKey = getProcessKey(execution); + WorkflowException exception = new WorkflowException(processKey, 5000, errorMsg) + execution.setVariable('WorkflowException', exception) + + msoLogger.trace('Exited ' + method) + } + + /** + * Generates a WorkflowException if updating a VF Module in AAI returns a response code other than 200. + * + * @param execution The flow's execution instance. + */ + public void handleUpdateVfModuleFailure(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.handleUpdateVfModuleFailure(' + + 'execution=' + execution.getId() + + ')' + msoLogger.trace('Entered ' + method) + + msoLogger.error('Error occurred attempting to update VF Module in AAI, Response Code ' + execution.getVariable('PUAAIVfMod_updateVfModuleResponseCode')); + String processKey = getProcessKey(execution); + WorkflowException exception = new WorkflowException(processKey, 5000, + execution.getVariable('PUAAIVfMod_updateVfModuleResponse')) + execution.setVariable('WorkflowException', exception) + + msoLogger.trace('Exited ' + method) + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/RainyDayHandler.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/RainyDayHandler.groovy index 0f7de9a23e..0d66b8f51b 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/RainyDayHandler.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/RainyDayHandler.groovy @@ -1,198 +1,190 @@ -/*-
- * ============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.common.scripts;
-
-import static org.apache.commons.lang3.StringUtils.*;
-
-
-
-import org.apache.commons.lang3.*
-import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.json.JSONObject;
-import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor
-import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil
-import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition
-import org.openecomp.mso.bpmn.core.json.JsonUtils
-import org.openecomp.mso.client.policy.PolicyClient
-import org.openecomp.mso.client.policy.PolicyClientImpl
-import org.openecomp.mso.client.policy.entities.DictionaryData
-import org.openecomp.mso.client.policy.entities.PolicyDecision
-import org.openecomp.mso.client.policy.entities.Treatments
-import org.openecomp.mso.client.policy.PolicyRestClient
-
-
-import com.att.ecomp.mso.bpmn.core.domain.*
-
-import groovy.json.*
-
-/**
- * This groovy class supports the <class>RainyDayHandler.bpmn</class> process.
- *
- * @author
- *
- * Inputs:
- * @param - msoRequestId
- * @param - isDebugLogEnabled
- * @param - serviceType
- * @param - vnfType
- * @param - currentActivity
- * @param - workStep
- * @param - failedActivity
- * @param - errorCode
- * @param - errorText
- * @param - vnfName
- *
- * Outputs:
- * @param - WorkflowException
- * @param - handlingCode
- *
- */
-public class RainyDayHandler extends AbstractServiceTaskProcessor {
-
- String Prefix="RDH_"
- ExceptionUtil exceptionUtil = new ExceptionUtil()
-
- JsonUtils jsonUtils = new JsonUtils()
-
- public void preProcessRequest (DelegateExecution execution) {
- def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled")
- String msg = ""
- utils.log("DEBUG"," ***** preProcessRequest of RainyDayHandler *****", isDebugLogEnabled)
-
- try {
- execution.setVariable("prefix", Prefix)
- // check for required input
- String requestId = execution.getVariable("msoRequestId")
- utils.log("DEBUG", "msoRequestId is: " + requestId, isDebugLogEnabled)
- def serviceType = execution.getVariable("serviceType")
- utils.log("DEBUG", "serviceType is: " + serviceType, isDebugLogEnabled)
- def vnfType = execution.getVariable("vnfType")
- utils.log("DEBUG", "vnftype is: " + vnfType, isDebugLogEnabled)
- def currentActivity = execution.getVariable("currentActivity")
- utils.log("DEBUG", "currentActivity is: " + currentActivity, isDebugLogEnabled)
- def workStep = execution.getVariable("workStep")
- utils.log("DEBUG", "workStep is: " + workStep, isDebugLogEnabled)
- def failedActivity = execution.getVariable("failedActivity")
- utils.log("DEBUG", "failedActivity is: " + failedActivity, isDebugLogEnabled)
- def errorCode = execution.getVariable("errorCode")
- utils.log("DEBUG", "errorCode is: " + errorCode, isDebugLogEnabled)
- def errorText = execution.getVariable("errorText")
- utils.log("DEBUG", "errorText is: " + errorText, isDebugLogEnabled)
- String defaultPolicyDisposition = (String) execution.getVariable('URN_policy_default_disposition')
- utils.log("DEBUG", "defaultPolicyDisposition is: " + defaultPolicyDisposition, isDebugLogEnabled)
- execution.setVariable('defaultPolicyDisposition', defaultPolicyDisposition)
-
- } catch (BpmnError e) {
- throw e;
- } catch (Exception ex){
- msg = "Exception in preProcessRequest " + ex.getMessage()
- utils.log("DEBUG", msg, isDebugLogEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
- }
- utils.log("DEBUG"," ***** Exit preProcessRequest of RainyDayHandler *****", isDebugLogEnabled)
- }
-
- public void queryPolicy (DelegateExecution execution) {
- def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled")
- String msg = ""
- utils.log("DEBUG"," ***** queryPolicy of RainyDayHandler *****", isDebugLogEnabled)
-
- try {
-
- // check for input
- String serviceType = execution.getVariable("serviceType")
- String vnfType = execution.getVariable("vnfType")
-
- utils.log("DEBUG", "serviceType: " + serviceType, isDebugLogEnabled)
- utils.log("DEBUG", "vnfType: " + vnfType, isDebugLogEnabled)
-
- def errorCode = execution.getVariable("errorCode")
- def bbId = execution.getVariable("currentActivity")
- def workStep = execution.getVariable("workStep")
-
- utils.log("DEBUG", "Before querying policy", isDebugLogEnabled)
-
- String decision = 'DENY'
- String disposition = "Abort"
- String defaultAllowedTreatments = "rollback, skip, manual, abort"
-
- String defaultPolicyDisposition = (String) execution.getVariable('defaultPolicyDisposition')
- if (defaultPolicyDisposition != null) {
- utils.log("DEBUG", "Setting disposition to the configured default instead of querying Policy: " + defaultPolicyDisposition, isDebugLogEnabled)
- disposition = defaultPolicyDisposition
- utils.log("DEBUG", "Setting default allowed treatments: " + defaultAllowedTreatments, isDebugLogEnabled)
- execution.setVariable("validResponses", defaultAllowedTreatments)
- }
- else {
-
- PolicyDecision decisionObject = null
-
- try {
- PolicyClient policyClient = new PolicyClientImpl()
- utils.log("DEBUG", "Created policy client", isDebugLogEnabled)
- decisionObject = policyClient.getDecision(serviceType, vnfType, bbId, workStep, errorCode)
- utils.log("DEBUG", "Obtained decision object", isDebugLogEnabled)
- DictionaryData dictClient = policyClient.getAllowedTreatments(bbId, workStep)
- Treatments treatments = dictClient.getTreatments()
- String validResponses = treatments.getString()
- if (validResponses != null) {
- validResponses = validResponses.toLowerCase()
- }
- utils.log("DEBUG", "Obtained validResponses: " + validResponses, isDebugLogEnabled)
- execution.setVariable("validResponses", validResponses)
-
- } catch(Exception e) {
- msg = "Exception in queryPolicy " + e.getMessage()
- utils.log("DEBUG", msg, isDebugLogEnabled)
- }
-
-
- if (decisionObject != null) {
- decision = decisionObject.getDecision()
- disposition = decisionObject.getDetails()
- utils.log("DEBUG", "Obtained disposition from policy engine: " + disposition, isDebugLogEnabled)
- }
- else {
- disposition = "Abort"
- }
- if (disposition == null) {
- disposition = "Abort"
- }
- }
- execution.setVariable("handlingCode", disposition)
-
- utils.log("DEBUG", "Disposition: "+ disposition, isDebugLogEnabled)
-
- } catch (BpmnError e) {
- utils.log("DEBUG", "BPMN exception: " + e.errorMessage, isDebugLogEnabled)
- throw e;
- } catch (Exception ex){
- msg = "Exception in queryPolicy " + ex.getMessage()
- utils.log("DEBUG", msg, isDebugLogEnabled)
- //exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
- }
- utils.log("DEBUG"," ***** Exit queryPolicy of RainyDayHandler *****", isDebugLogEnabled)
- }
-
-
-
-
-}
+/*- + * ============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.common.scripts; + +import static org.apache.commons.lang3.StringUtils.*; + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.core.UrnPropertiesReader; +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.client.policy.PolicyClient +import org.onap.so.client.policy.PolicyClientImpl +import org.onap.so.client.policy.entities.DictionaryData +import org.onap.so.client.policy.entities.PolicyDecision +import org.onap.so.client.policy.entities.Treatments +import org.onap.so.logger.MsoLogger + + +/** + * This groovy class supports the <class>RainyDayHandler.bpmn</class> process. + * + * @author + * + * Inputs: + * @param - msoRequestId + * @param - isDebugLogEnabled + * @param - serviceType + * @param - vnfType + * @param - currentActivity + * @param - workStep + * @param - failedActivity + * @param - errorCode + * @param - errorText + * @param - vnfName + * + * Outputs: + * @param - WorkflowException + * @param - handlingCode + * + */ +public class RainyDayHandler extends AbstractServiceTaskProcessor { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, RainyDayHandler.class); + + + String Prefix="RDH_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + + JsonUtils jsonUtils = new JsonUtils() + + public void preProcessRequest (DelegateExecution execution) { + String msg = "" + msoLogger.trace("preProcessRequest of RainyDayHandler ") + + try { + execution.setVariable("prefix", Prefix) + // check for required input + String requestId = execution.getVariable("msoRequestId") + msoLogger.debug("msoRequestId is: " + requestId) + def serviceType = execution.getVariable("serviceType") + msoLogger.debug("serviceType is: " + serviceType) + def vnfType = execution.getVariable("vnfType") + msoLogger.debug("vnftype is: " + vnfType) + def currentActivity = execution.getVariable("currentActivity") + msoLogger.debug("currentActivity is: " + currentActivity) + def workStep = execution.getVariable("workStep") + msoLogger.debug("workStep is: " + workStep) + def failedActivity = execution.getVariable("failedActivity") + msoLogger.debug("failedActivity is: " + failedActivity) + def errorCode = execution.getVariable("errorCode") + msoLogger.debug("errorCode is: " + errorCode) + def errorText = execution.getVariable("errorText") + msoLogger.debug("errorText is: " + errorText) + String defaultPolicyDisposition = (String) UrnPropertiesReader.getVariable("policy.default.disposition",execution) + msoLogger.debug("defaultPolicyDisposition is: " + defaultPolicyDisposition) + execution.setVariable('defaultPolicyDisposition', defaultPolicyDisposition) + + } catch (BpmnError e) { + throw e; + } catch (Exception ex){ + msg = "Exception in preProcessRequest " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit preProcessRequest of RainyDayHandler ") + } + + public void queryPolicy (DelegateExecution execution) { + String msg = "" + msoLogger.trace("queryPolicy of RainyDayHandler ") + + try { + + // check for input + String serviceType = execution.getVariable("serviceType") + String vnfType = execution.getVariable("vnfType") + + msoLogger.debug("serviceType: " + serviceType) + msoLogger.debug("vnfType: " + vnfType) + + def errorCode = execution.getVariable("errorCode") + def bbId = execution.getVariable("currentActivity") + def workStep = execution.getVariable("workStep") + + msoLogger.debug("Before querying policy") + + String decision = 'DENY' + String disposition = "Abort" + String defaultAllowedTreatments = "rollback, skip, manual, abort" + + String defaultPolicyDisposition = (String) execution.getVariable('defaultPolicyDisposition') + if (defaultPolicyDisposition != null && !defaultPolicyDisposition.isEmpty()) { + msoLogger.debug("Setting disposition to the configured default instead of querying Policy: " + defaultPolicyDisposition) + disposition = defaultPolicyDisposition + msoLogger.debug("Setting default allowed treatments: " + defaultAllowedTreatments) + execution.setVariable("validResponses", defaultAllowedTreatments) + } + else { + + PolicyDecision decisionObject = null + + try { + PolicyClient policyClient = new PolicyClientImpl() + msoLogger.debug("Created policy client") + decisionObject = policyClient.getDecision(serviceType, vnfType, bbId, workStep, errorCode) + msoLogger.debug("Obtained decision object") + DictionaryData dictClient = policyClient.getAllowedTreatments(bbId, workStep) + Treatments treatments = dictClient.getTreatments() + String validResponses = treatments.getString() + if (validResponses != null) { + validResponses = validResponses.toLowerCase() + } + msoLogger.debug("Obtained validResponses: " + validResponses) + execution.setVariable("validResponses", validResponses) + + } catch(Exception e) { + msg = "Exception in queryPolicy " + e.getMessage() + msoLogger.debug(msg) + } + + + if (decisionObject != null) { + decision = decisionObject.getDecision() + disposition = decisionObject.getDetails() + msoLogger.debug("Obtained disposition from policy engine: " + disposition) + } + else { + disposition = "Abort" + } + if (disposition == null) { + disposition = "Abort" + } + } + execution.setVariable("handlingCode", disposition) + + msoLogger.debug("Disposition: "+ disposition) + + } catch (BpmnError e) { + msoLogger.debug("BPMN exception: " + e.errorMessage) + throw e; + } catch (Exception ex){ + msg = "Exception in queryPolicy " + ex.getMessage() + msoLogger.debug(msg) + //exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit queryPolicy of RainyDayHandler ") + } + + + + +} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ReceiveWorkflowMessage.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ReceiveWorkflowMessage.groovy index 1e1afb4d5d..717d0df1ba 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ReceiveWorkflowMessage.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ReceiveWorkflowMessage.groovy @@ -1,109 +1,133 @@ -package org.openecomp.mso.bpmn.common.scripts;
-
-import groovy.json.*
-
-import org.apache.commons.lang3.*
-import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor
-import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil
-
-
-class ReceiveWorkflowMessage extends AbstractServiceTaskProcessor {
-
- ExceptionUtil exceptionUtil = new ExceptionUtil()
-
- /**
- * Process the incoming variables.
- *
- * @param execution The flow's execution instance.
- */
-public void preProcessRequest (DelegateExecution execution) {
- def method = getClass().getSimpleName() + '.preProcessRequest(' +
- 'execution=' + execution.getId() +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- def prefix="RCVWFMSG_"
- execution.setVariable("prefix", prefix)
- setSuccessIndicator(execution, false)
-
- try {
-
- // Confirm that timeout value has been provided in 'RCVWFMSG_timeout'.
- def timeout = execution.getVariable('RCVWFMSG_timeout')
- logDebug('Timeout value is \'' + timeout + '\'', isDebugLogEnabled)
- if ((timeout == null) || (timeout.isEmpty())) {
- String msg = getProcessKey(execution) + ': Missing or empty input variable \'RCVWFMSG_timeout\''
- logDebug(msg, isDebugLogEnabled)
- logError(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
- }
-
- // Confirm that message type has been provided in 'RCVWFMSG_messageType'
- def messageType = execution.getVariable('RCVWFMSG_messageType')
- logDebug('Message type is \'' + messageType + '\'', isDebugLogEnabled)
- if ((messageType == null) || (messageType.isEmpty())) {
- String msg = getProcessKey(execution) + ': Missing or empty input variable \'RCVWFMSG_messageType\''
- logDebug(msg, isDebugLogEnabled)
- logError(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
- }
-
- // Confirm that correlator value has been provided in 'RCVWFMSG_correlator'
- def correlator = execution.getVariable('RCVWFMSG_correlator')
- logDebug('Correlator value is \'' + correlator + '\'', isDebugLogEnabled)
- if ((correlator == null) || (correlator.isEmpty())) {
- String msg = getProcessKey(execution) + ': Missing or empty input variable \'RCVWFMSG_correlator\''
- logDebug(msg, isDebugLogEnabled)
- logError(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
- }
- execution.setVariable(messageType + '_CORRELATOR', correlator)
-
- logDebug('Exited ' + method, isDebugLogEnabled)
- } catch (BpmnError e) {
- throw e
- } catch (Exception e) {
- String msg = 'Caught exception in ' + method + ": " + e
- logDebug(msg, isDebugLogEnabled)
- logError(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
- }
- }
-
- /**
- * Process a received message.
- *
- * @param execution The flow's execution instance.
- */
- public void processReceivedMessage(DelegateExecution execution){
- def method = getClass().getSimpleName() + '.processReceivedMessage(' +
- 'execution=' + execution.getId() +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- String messageType = null;
- String receivedMessage = null;
-
- try {
- messageType = execution.getVariable('RCVWFMSG_messageType')
- receivedMessage = execution.getVariable(messageType + '_MESSAGE')
- logDebug(getProcessKey(execution) + ": received message:\n" + receivedMessage, isDebugLogEnabled)
-
- // The received message is made available to the calling flow in WorkflowResponse
- execution.setVariable("WorkflowResponse", receivedMessage)
-
- setSuccessIndicator(execution, true)
-
- logDebug('Exited ' + method, isDebugLogEnabled)
- } catch (Exception e) {
- receivedMessage = receivedMessage == null || String.valueOf(receivedMessage).isEmpty() ? "NONE" : receivedMessage
- String msg = "Error processing received workflow message: " + receivedMessage
- logDebug(getProcessKey(execution) + ': ' + msg, isDebugLogEnabled)
- exceptionUtil.buildWorkflowException(execution, 7020, msg)
- }
- }
-}
+/*- + * ============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.common.scripts; + +import groovy.json.* + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + + + + +class ReceiveWorkflowMessage extends AbstractServiceTaskProcessor { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ReceiveWorkflowMessage.class); + + + ExceptionUtil exceptionUtil = new ExceptionUtil() + + /** + * Process the incoming variables. + * + * @param execution The flow's execution instance. + */ +public void preProcessRequest (DelegateExecution execution) { + def method = getClass().getSimpleName() + '.preProcessRequest(' + + 'execution=' + execution.getId() + + ')' + msoLogger.trace('Entered ' + method) + + def prefix="RCVWFMSG_" + execution.setVariable("prefix", prefix) + setSuccessIndicator(execution, false) + + try { + + // Confirm that timeout value has been provided in 'RCVWFMSG_timeout'. + def timeout = execution.getVariable('RCVWFMSG_timeout') + msoLogger.debug('Timeout value is \'' + timeout + '\'') + if ((timeout == null) || (timeout.isEmpty())) { + String msg = getProcessKey(execution) + ': Missing or empty input variable \'RCVWFMSG_timeout\'' + msoLogger.debug(msg) + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + + // Confirm that message type has been provided in 'RCVWFMSG_messageType' + def messageType = execution.getVariable('RCVWFMSG_messageType') + msoLogger.debug('Message type is \'' + messageType + '\'') + if ((messageType == null) || (messageType.isEmpty())) { + String msg = getProcessKey(execution) + ': Missing or empty input variable \'RCVWFMSG_messageType\'' + msoLogger.debug(msg) + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + + // Confirm that correlator value has been provided in 'RCVWFMSG_correlator' + def correlator = execution.getVariable('RCVWFMSG_correlator') + msoLogger.debug('Correlator value is \'' + correlator + '\'') + if ((correlator == null) || (correlator.isEmpty())) { + String msg = getProcessKey(execution) + ': Missing or empty input variable \'RCVWFMSG_correlator\'' + msoLogger.debug(msg) + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + execution.setVariable(messageType + '_CORRELATOR', correlator) + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e + } catch (Exception e) { + String msg = 'Caught exception in ' + method + ": " + e + msoLogger.debug(msg) + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + } + + /** + * Process a received message. + * + * @param execution The flow's execution instance. + */ + public void processReceivedMessage(DelegateExecution execution){ + def method = getClass().getSimpleName() + '.processReceivedMessage(' + + 'execution=' + execution.getId() + + ')' + msoLogger.trace('Entered ' + method) + + String messageType = null; + String receivedMessage = null; + + try { + messageType = execution.getVariable('RCVWFMSG_messageType') + receivedMessage = execution.getVariable(messageType + '_MESSAGE') + msoLogger.debug(getProcessKey(execution) + ": received message:\n" + receivedMessage) + + // The received message is made available to the calling flow in WorkflowResponse + execution.setVariable("WorkflowResponse", receivedMessage) + + setSuccessIndicator(execution, true) + + msoLogger.trace('Exited ' + method) + } catch (Exception e) { + receivedMessage = receivedMessage == null || String.valueOf(receivedMessage).isEmpty() ? "NONE" : receivedMessage + String msg = "Error processing received workflow message: " + receivedMessage + msoLogger.debug(getProcessKey(execution) + ': ' + msg) + exceptionUtil.buildWorkflowException(execution, 7020, msg) + } + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapter.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy index 44c9f3f829..852f8d75bd 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapter.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy @@ -1,335 +1,327 @@ -/*-
- * ============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.common.scripts;
-
-import java.text.SimpleDateFormat
-
-import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.openecomp.mso.bpmn.core.WorkflowException
-
-
-// SDNC Adapter Request/Response processing
-
-public class SDNCAdapter extends AbstractServiceTaskProcessor {
-
- def Prefix="SDNCA_"
- ExceptionUtil exceptionUtil = new ExceptionUtil()
-
- // Script Task: Process SDNC Workflow Request
- // Params: Workflow DelegateExecution
- // Assume: Received SDNCAdapterWorkflowRequest is in variable 'sdncAdapterWorkflowRequest'
- // Put created SDNCAdapterRequest in variable 'sdncAdapterRequest'
- public void preProcessRequest (DelegateExecution execution) {
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- try{
-
- utils.log("DEBUG", "=========== Begin PreProcess SDNCAdapterRequestScript ===========", isDebugEnabled)
- utils.log("DEBUG", "Incoming sdncAdapterWorkflowRequest:\n" + execution.getVariable("sdncAdapterWorkflowRequest"), isDebugEnabled)
-
- // Initialize some variables used throughout the flow
- execution.setVariable("prefix", Prefix)
- execution.setVariable("sdncAdapterResponse", "")
- execution.setVariable("asynchronousResponseTimeout", false)
- execution.setVariable("continueListening", false)
- execution.setVariable("SDNCA_SuccessIndicator", false)
- execution.setVariable("SDNCA_InterimNotify", false)
-
- // Authorization Info
- String basicAuthValue = execution.getVariable("URN_mso_adapters_po_auth")
- utils.log("DEBUG", "Obtained BasicAuth userid password for sdnc adapter:" + basicAuthValue, isDebugEnabled)
- try {
- def encodedString = utils.getBasicAuth(basicAuthValue, execution.getVariable("URN_mso_msoKey"))
- execution.setVariable("BasicAuthHeaderValue",encodedString)
- } catch (IOException ex) {
- utils.log("ERROR", "Unable to encode username password string")
- }
-
- // TODO Use variables instead of passing xml request - Huh?
-
- // Get original RequestHeader
- def sdncwfreq= execution.getVariable("sdncAdapterWorkflowRequest")
- def requestHeader = utils.getNodeXml(sdncwfreq, "RequestHeader")
- requestHeader = requestHeader.replace("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n", "")
- utils.log("DEBUG", "RequestHeader:\n" + requestHeader, isDebugEnabled)
-
- // Set Callback URL to use from URN Mapping or jBoss Property
- def origCallbackUrl = utils.getNodeText(requestHeader, "CallbackUrl")
- def callbackUrlToUse = execution.getVariable("URN_mso_workflow_sdncadapter_callback")
- MsoUtils msoUtil = new MsoUtils()
- def useQualifiedHostName = execution.getVariable("URN_mso_use_qualified_host")
- if((useQualifiedHostName!=null) && (useQualifiedHostName.equals("true"))){
- callbackUrlToUse = msoUtil.getQualifiedHostNameForCallback(callbackUrlToUse)
- }
- utils.log("DEBUG", "Callback URL to use:\n" + callbackUrlToUse, isDebugEnabled)
- requestHeader = requestHeader.replace(origCallbackUrl, callbackUrlToUse)
-
- // Get parameters from request header
- def sdnca_svcInstanceId = utils.getNodeText1(requestHeader, "SvcInstanceId") // optional
- utils.log("DEBUG", "SvcInstanceId: " + sdnca_svcInstanceId, isDebugEnabled)
- def sdnca_msoAction = utils.getNodeText1(requestHeader, "MsoAction") // optional
- utils.log("DEBUG", "MsoAction: " + sdnca_msoAction, isDebugEnabled)
- def sdnca_svcAction = utils.getNodeText(requestHeader, "SvcAction")
- utils.log("DEBUG", "SvcAction: " + sdnca_svcAction, isDebugEnabled)
- def sdnca_svcOperation = utils.getNodeText(requestHeader, "SvcOperation")
- utils.log("DEBUG", "SvcOperation: " + sdnca_svcOperation, isDebugEnabled)
- def sdncRequestData = utils.getChildNodes(sdncwfreq, "SDNCRequestData")
- sdncRequestData = sdncRequestData.replace("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n", "")
- sdncRequestData = sdncRequestData.replaceAll('tag0:', '').replaceAll(':tag0', '')
- utils.log("DEBUG", "SDNCRequestData:\n" + sdncRequestData, isDebugEnabled)
- def sdnca_serviceType = ""
- if (utils.nodeExists(sdncwfreq, "service-type")) {
- sdnca_serviceType = utils.getNodeText(sdncwfreq, "service-type")
- }
- utils.log("DEBUG", "service-type: " + sdnca_serviceType, isDebugEnabled)
- def serviceConfigActivate = false
- def source = ''
- if ((sdnca_svcAction == 'activate') && (sdnca_svcOperation == 'service-configuration-operation') && (sdnca_serviceType == 'uCPE-VMS')) {
- serviceConfigActivate = true
- if (utils.nodeExists(sdncwfreq, 'source')) {
- source = utils.getNodeText(sdncwfreq, 'source')
- }
- }
- execution.setVariable("serviceConfigActivate", serviceConfigActivate)
- utils.log("DEBUG", "serviceConfigActivate: " + serviceConfigActivate, isDebugEnabled)
- execution.setVariable("source", source)
- utils.log("DEBUG", "source: " + source, isDebugEnabled)
-
- //calling process should pass a generated uuid if sending multiple sdnc requests
- def requestId = utils.getNodeText(requestHeader, "RequestId")
- execution.setVariable(Prefix + "requestId", requestId)
-
- // Prepare SDNC Request to the SDNC Adapter
- String sdncAdapterRequest = """
- <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
- <SOAP-ENV:Body>
- <aetgt:SDNCAdapterRequest xmlns:aetgt="http://org.openecomp/workflow/sdnc/adapter/schema/v1" xmlns:sdncadaptersc="http://org.openecomp/workflow/sdnc/adapter/schema/v1">
- <sdncadapter:RequestHeader xmlns:sdncadapter="http://org.openecomp/workflow/sdnc/adapter/schema/v1">
- <sdncadapter:RequestId>${requestId}</sdncadapter:RequestId>"""
-
- if (sdnca_svcInstanceId != null) {
- sdncAdapterRequest += """
- <sdncadapter:SvcInstanceId>${sdnca_svcInstanceId}</sdncadapter:SvcInstanceId>"""
- }
-
- sdncAdapterRequest += """
- <sdncadapter:SvcAction>${sdnca_svcAction}</sdncadapter:SvcAction>
- <sdncadapter:SvcOperation>${sdnca_svcOperation}</sdncadapter:SvcOperation>
- <sdncadapter:CallbackUrl>${callbackUrlToUse}</sdncadapter:CallbackUrl>"""
-
- if (sdnca_msoAction != null) {
- sdncAdapterRequest += """
- <sdncadapter:MsoAction>${sdnca_msoAction}</sdncadapter:MsoAction>"""
- }
-
- sdncAdapterRequest += """
- </sdncadapter:RequestHeader>
- <sdncadaptersc:RequestData>${sdncRequestData}</sdncadaptersc:RequestData></aetgt:SDNCAdapterRequest></SOAP-ENV:Body></SOAP-ENV:Envelope>"""
-
- utils.logAudit("Outgoing SDNCAdapterRequest:\n" + sdncAdapterRequest)
- execution.setVariable("sdncAdapterRequest", sdncAdapterRequest)
-
- utils.log("DEBUG", execution.getVariable("sdncAdapterRequest"), isDebugEnabled)
- utils.log("DEBUG", execution.getVariable("URN_mso_adapters_sdnc_endpoint"), isDebugEnabled)
- }catch(Exception e){
- utils.log("DEBUG", 'Internal Error occured during PreProcess Method: ' + e, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 9999, 'Internal Error occured during PreProcess Method') // TODO: what message and error code?
- }
- utils.log("DEBUG","=========== End pre Process SDNCRequestScript ===========", isDebugEnabled)
- }
-
- public void postProcessResponse (DelegateExecution execution) {
-
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- try{
- utils.log("DEBUG","=========== Begin POSTProcess SDNCAdapter ===========", isDebugEnabled)
- utils.log("DEBUG","Incoming sdncAdapterCallbackRequest:\n" + execution.getVariable("sdncAdapterCallbackRequest"), isDebugEnabled)
-
- // Check the sdnccallback request and get the responsecode
- def sdnccallbackreq = execution.getVariable("sdncAdapterCallbackRequest")
- def callbackRequestData = ""
- def callbackHeader = ""
- utils.logAudit("SDNCAdapterCallback Request :" + sdnccallbackreq)
-
- if(sdnccallbackreq != null){
- callbackHeader = utils.getNodeXml(sdnccallbackreq, "CallbackHeader")
- callbackRequestData = utils.getNodeXml(sdnccallbackreq, "RequestData")
-
- callbackHeader = callbackHeader.replace("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n", "")
- utils.log("DEBUG","SDNCCallbackHeader is:\n" + callbackHeader, isDebugEnabled)
-
- callbackRequestData = callbackRequestData.replace("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n", "")
- utils.log("DEBUG","DECODED SDNCCallback RequestData is:\n" + callbackRequestData, isDebugEnabled)
-
- String sdncAdapterWorkflowResponse ="""
- <sdncadapterworkflow:SDNCAdapterWorkflowResponse xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1">
- <sdncadapterworkflow:response-data>
- ${callbackHeader}
- ${callbackRequestData}
- </sdncadapterworkflow:response-data>
- </sdncadapterworkflow:SDNCAdapterWorkflowResponse>"""
-
-
- utils.log("DEBUG","Outgoing sdncAdapterWorkflowResponse:\n" + sdncAdapterWorkflowResponse, isDebugEnabled)
- sdncAdapterWorkflowResponse = utils.formatXml(sdncAdapterWorkflowResponse)
- utils.logAudit("sdncAdapterWorkflowResponse :" + sdncAdapterWorkflowResponse)
- execution.setVariable("sdncAdapterResponse", sdncAdapterWorkflowResponse)
- // TODO: Should deprecate use of processKey+Response variable for the response. Will use "WorkflowResponse" instead
- execution.setVariable("WorkflowResponse", sdncAdapterWorkflowResponse)
-
- // Check final indicator to determine if we are to continue listening or not
- def String enhancedCallbackRequestData = callbackRequestData.replaceAll("&", "&")
- enhancedCallbackRequestData = enhancedCallbackRequestData.replaceAll("<", "<")
- enhancedCallbackRequestData = enhancedCallbackRequestData.replaceAll(">", ">")
- // replace the data with '&' (ex: subscriber-name= 'FOUR SEASONS HEATING & COOLING'
- enhancedCallbackRequestData = enhancedCallbackRequestData.replace("&", "&")
- utils.log("DEBUG","EnhancedCallbackRequestData:\n" + enhancedCallbackRequestData, isDebugEnabled)
- execution.setVariable("enhancedCallbackRequestData", enhancedCallbackRequestData)
- def continueListening = false
- if (utils.nodeExists(enhancedCallbackRequestData, "ack-final-indicator")) {
- if (utils.getNodeText(enhancedCallbackRequestData, "ack-final-indicator") == 'N') {
- continueListening = true
- }
- }
- execution.setVariable("continueListening", continueListening)
- utils.log("DEBUG", "Continue Listening: " + continueListening, isDebugEnabled)
- execution.setVariable("asynchronousResponseTimeout", false)
- }else{
- // Timed out waiting for asynchronous message, build error response
- exceptionUtil.buildWorkflowException(execution, 500, "SDNC Callback Timeout Error")
- execution.setVariable("asynchronousResponseTimeout", true)
- utils.log("DEBUG", "Timed out waiting for asynchronous message", isDebugEnabled)
- }
- }catch(Exception e){
- utils.log("DEBUG", 'Internal Error occured during PostProcess Method: ' + e, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 9999, 'Internal Error occured during PostProcess Method') // TODO: what message and error code?
- }
- utils.log("DEBUG","=========== End POSTProcess SDNCAdapter ===========", isDebugEnabled)
- }
-
- public void callbackResponsecheck(DelegateExecution execution){
-
- def sdnccallbackreq=execution.getVariable("sdncAdapterCallbackRequest")
- utils.logAudit("sdncAdapterCallbackRequest :" + sdnccallbackreq)
- if (sdnccallbackreq==null){
- execution.setVariable("callbackResponseReceived",false);
- }else{
- execution.setVariable("callbackResponseReceived",true);
- }
- }
-
- public void resetCallbackRequest(DelegateExecution execution) {
-
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
-
- utils.log("DEBUG","=========== Begin Reset Callback Info SDNCAdapter ===========", isDebugEnabled)
-
- // Clear sdncAdapterCallbackRequest variable
- execution.removeVariable("sdncAdapterCallbackRequest")
-
- // Determine and set SDNC Timeout Value
- def enhancedCallbackRequestData = execution.getVariable("enhancedCallbackRequestData")
- utils.logAudit("sdncAdapter - enhancedCallbackRequestData :" + enhancedCallbackRequestData)
- def interim = false
- if (enhancedCallbackRequestData != null) {
- if (utils.nodeExists(enhancedCallbackRequestData, "ack-final-indicator")) {
- if (utils.getNodeText(enhancedCallbackRequestData, "ack-final-indicator") == 'N') {
- interim = true
- }
- }
- }
- def timeoutValue = execution.getVariable("URN_mso_sdnc_timeout")
- def sdncAdapterWorkflowRequest = execution.getVariable("sdncAdapterWorkflowRequest")
- if (interim && utils.nodeExists(sdncAdapterWorkflowRequest, "InterimSDNCTimeOutValueInHours")) {
- timeoutValue = "PT" + utils.getNodeText(sdncAdapterWorkflowRequest, "InterimSDNCTimeOutValueInHours") + "H"
- } else if (utils.nodeExists(sdncAdapterWorkflowRequest, "SDNCTimeOutValueInMinutes")) {
- timeoutValue = "PT" + utils.getNodeText(sdncAdapterWorkflowRequest, "SDNCTimeOutValueInMinutes") + "M"
- }
- execution.setVariable("sdncTimeoutValue", timeoutValue)
- utils.log("DEBUG", "Setting SDNC Timeout Value to " + timeoutValue, isDebugEnabled)
-
- utils.log("DEBUG","=========== End Reset Callback Info SDNCAdapter ===========", isDebugEnabled)
- }
-
-
- public void prepareDBMessage(DelegateExecution execution) {
-
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
-
- utils.log("DEBUG","=========== Begin Prepare DB Message SDNCAdapter ===========", isDebugEnabled)
-
- // Create DB Message
- def dbRequestId = execution.getVariable("mso-request-id")
- String dbUpdateInterimStageCompletion = """
- <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
- <SOAP-ENV:Body>
- <DBAdapter:updateInterimStageCompletion xmlns:DBAdapter="http://org.openecomp.mso/requestsdb">
- <requestId>${dbRequestId}</requestId>
- <interimStageCompletion>1</interimStageCompletion>
- <lastModifiedBy>BPEL</lastModifiedBy>
- </DBAdapter:updateInterimStageCompletion>
- </SOAP-ENV:Body>
- </SOAP-ENV:Envelope>
- """
-
- execution.setVariable("dbUpdateInterimStageCompletion", dbUpdateInterimStageCompletion)
- utils.logAudit("sdncAdapter - dbUpdateInterimStageCompletion :" + dbUpdateInterimStageCompletion)
- utils.log("DEBUG","DB UpdateInterimStageCompletion:\n" + dbUpdateInterimStageCompletion, isDebugEnabled)
- utils.log("DEBUG","=========== End Prepare DB Message SDNCAdapter ===========", isDebugEnabled)
- }
-
- public String generateCurrentTimeInUtc(){
- final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
- sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
- final String utcTime = sdf.format(new Date());
- return utcTime;
- }
-
- public void toggleSuccessIndicator(DelegateExecution execution){
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- execution.setVariable("SDNCA_SuccessIndicator", true)
- utils.log("DEBUG","Setting SDNCA Success Indicator to True", isDebugEnabled)
- }
-
- public void assignError(DelegateExecution execution){
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- utils.log("DEBUG","=========== Started Assign Error ===========", isDebugEnabled)
- WorkflowException wf = execution.getVariable("WorkflowException")
- if(wf == null){
- exceptionUtil.buildWorkflowException(execution, 5000, "SDNCAdapter Encountered an Internal Error") // TODO: Not sure what message and error code we want here.....
- }else{
- execution.setVariable("WorkflowException", wf)
- }
-
- utils.log("DEBUG","Outgoing WorkflowException is: " + execution.getVariable("WorkflowException"), isDebugEnabled)
- utils.log("DEBUG","=========== End Assign Error ===========", isDebugEnabled)
- }
-
- public void setTimeout(DelegateExecution execution){
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- utils.log("DEBUG","=========== Started SetTimeout ===========", isDebugEnabled)
- utils.log("DEBUG", "Timer expired, telling correlation service to stop listening", isDebugEnabled)
- execution.setVariable("asynchronousResponseTimeout", true)
-
- utils.log("DEBUG", "Timed out branch sleeping for one second to give success branch a chance to complete if running", isDebugEnabled)
- Thread.sleep(1000)
- utils.log("DEBUG","=========== End SetTimeout ===========", isDebugEnabled)
- }
-}
+/*- + * ============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.common.scripts; +import org.onap.so.bpmn.core.UrnPropertiesReader; + +import java.text.SimpleDateFormat + +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + + + + +// SDNC Adapter Request/Response processing + +public class SDNCAdapter extends AbstractServiceTaskProcessor { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SDNCAdapter.class); + + + def Prefix="SDNCA_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + + // Script Task: Process SDNC Workflow Request + // Params: Workflow DelegateExecution + // Assume: Received SDNCAdapterWorkflowRequest is in variable 'sdncAdapterWorkflowRequest' + // Put created SDNCAdapterRequest in variable 'sdncAdapterRequest' + public void preProcessRequest (DelegateExecution execution) { + try{ + + msoLogger.trace("Begin PreProcess SDNCAdapterRequestScript ") + msoLogger.debug("Incoming sdncAdapterWorkflowRequest:\n" + execution.getVariable("sdncAdapterWorkflowRequest")) + + // Initialize some variables used throughout the flow + execution.setVariable("prefix", Prefix) + execution.setVariable("sdncAdapterResponse", "") + execution.setVariable("asynchronousResponseTimeout", false) + execution.setVariable("continueListening", false) + execution.setVariable("SDNCA_SuccessIndicator", false) + execution.setVariable("SDNCA_InterimNotify", false) + + // Authorization Info + String basicAuthValue = UrnPropertiesReader.getVariable("mso.adapters.po.auth", execution) + + try { + def encodedString = utils.getBasicAuth(basicAuthValue, UrnPropertiesReader.getVariable("mso.msoKey", execution)) + execution.setVariable("BasicAuthHeaderValue",encodedString) + } catch (IOException ex) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Unable to encode username password string", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + } + + // TODO Use variables instead of passing xml request - Huh? + + // Get original RequestHeader + def sdncwfreq= execution.getVariable("sdncAdapterWorkflowRequest") + def requestHeader = utils.getNodeXml(sdncwfreq, "RequestHeader") + requestHeader = requestHeader.replace("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n", "") + + // Set Callback URL to use from URN Mapping or jBoss Property + def origCallbackUrl = utils.getNodeText(requestHeader, "CallbackUrl") + def callbackUrlToUse = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback", execution) + MsoUtils msoUtil = new MsoUtils() + def useQualifiedHostName = UrnPropertiesReader.getVariable("mso.use.qualified.host", execution) + if((useQualifiedHostName!=null) && (useQualifiedHostName.equals("true"))){ + callbackUrlToUse = msoUtil.getQualifiedHostNameForCallback(callbackUrlToUse) + } + msoLogger.debug("Callback URL to use:\n" + callbackUrlToUse) + requestHeader = requestHeader.replace(origCallbackUrl, callbackUrlToUse) + + // Get parameters from request header + def sdnca_svcInstanceId = utils.getNodeText(requestHeader, "SvcInstanceId") // optional + msoLogger.debug("SvcInstanceId: " + sdnca_svcInstanceId) + def sdnca_msoAction = utils.getNodeText(requestHeader, "MsoAction") // optional + msoLogger.debug("MsoAction: " + sdnca_msoAction) + def sdnca_svcAction = utils.getNodeText(requestHeader, "SvcAction") + msoLogger.debug("SvcAction: " + sdnca_svcAction) + def sdnca_svcOperation = utils.getNodeText(requestHeader, "SvcOperation") + msoLogger.debug("SvcOperation: " + sdnca_svcOperation) + def sdncRequestData = utils.getChildNodes(sdncwfreq, "SDNCRequestData") + sdncRequestData = sdncRequestData.replace("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n", "") + sdncRequestData = sdncRequestData.replaceAll('tag0:', '').replaceAll(':tag0', '') + msoLogger.debug("SDNCRequestData:\n" + sdncRequestData) + def sdnca_serviceType = "" + if (utils.nodeExists(sdncwfreq, "service-type")) { + sdnca_serviceType = utils.getNodeText(sdncwfreq, "service-type") + } + msoLogger.debug("service-type: " + sdnca_serviceType) + def serviceConfigActivate = false + def source = '' + if ((sdnca_svcAction == 'activate') && (sdnca_svcOperation == 'service-configuration-operation') && (sdnca_serviceType == 'uCPE-VMS')) { + serviceConfigActivate = true + if (utils.nodeExists(sdncwfreq, 'source')) { + source = utils.getNodeText(sdncwfreq, 'source') + } + } + execution.setVariable("serviceConfigActivate", serviceConfigActivate) + msoLogger.debug("serviceConfigActivate: " + serviceConfigActivate) + execution.setVariable("source", source) + msoLogger.debug("source: " + source) + + //calling process should pass a generated uuid if sending multiple sdnc requests + def requestId = utils.getNodeText(requestHeader, "RequestId") + execution.setVariable(Prefix + "requestId", requestId) + + // Prepare SDNC Request to the SDNC Adapter + String sdncAdapterRequest = """ + <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> + <SOAP-ENV:Body> + <aetgt:SDNCAdapterRequest xmlns:aetgt="http://org.onap/workflow/sdnc/adapter/schema/v1" xmlns:sdncadaptersc="http://org.onap/workflow/sdnc/adapter/schema/v1"> + <sdncadapter:RequestHeader xmlns:sdncadapter="http://org.onap/workflow/sdnc/adapter/schema/v1"> + <sdncadapter:RequestId>${MsoUtils.xmlEscape(requestId)}</sdncadapter:RequestId>""" + + if (sdnca_svcInstanceId != null) { + sdncAdapterRequest += """ + <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(sdnca_svcInstanceId)}</sdncadapter:SvcInstanceId>""" + execution.setVariable("serviceInstanceId", sdnca_svcInstanceId) + } + + sdncAdapterRequest += """ + <sdncadapter:SvcAction>${MsoUtils.xmlEscape(sdnca_svcAction)}</sdncadapter:SvcAction> + <sdncadapter:SvcOperation>${MsoUtils.xmlEscape(sdnca_svcOperation)}</sdncadapter:SvcOperation> + <sdncadapter:CallbackUrl>${MsoUtils.xmlEscape(callbackUrlToUse)}</sdncadapter:CallbackUrl>""" + + if (sdnca_msoAction != null) { + sdncAdapterRequest += """ + <sdncadapter:MsoAction>${MsoUtils.xmlEscape(sdnca_msoAction)}</sdncadapter:MsoAction>""" + } + + sdncAdapterRequest += """ + </sdncadapter:RequestHeader> + <sdncadaptersc:RequestData> + ${sdncRequestData} + </sdncadaptersc:RequestData></aetgt:SDNCAdapterRequest></SOAP-ENV:Body></SOAP-ENV:Envelope>""" + + msoLogger.debug("Outgoing SDNCAdapterRequest:\n" + sdncAdapterRequest) + execution.setVariable("sdncAdapterRequest", sdncAdapterRequest) + + msoLogger.debug(UrnPropertiesReader.getVariable("mso.adapters.sdnc.endpoint", execution)) + }catch(Exception e){ + msoLogger.debug('Internal Error occured during PreProcess Method: ', e) + exceptionUtil.buildAndThrowWorkflowException(execution, 9999, 'Internal Error occured during PreProcess Method') // TODO: what message and error code? + } + msoLogger.trace("End pre Process SDNCRequestScript ") + } + + public void postProcessResponse (DelegateExecution execution) { + + try{ + msoLogger.trace("Begin POSTProcess SDNCAdapter ") + msoLogger.trace("Incoming sdncAdapterCallbackRequest:\n" + execution.getVariable("sdncAdapterCallbackRequest")) + + // Check the sdnccallback request and get the responsecode + def sdnccallbackreq = execution.getVariable("sdncAdapterCallbackRequest") + def callbackRequestData = "" + def callbackHeader = "" + + if(sdnccallbackreq != null){ + callbackHeader = utils.getNodeXml(sdnccallbackreq, "CallbackHeader") + callbackRequestData = utils.getNodeXml(sdnccallbackreq, "RequestData") + + callbackHeader = callbackHeader.replace("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n", "") + + callbackRequestData = callbackRequestData.replace("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n", "") + + msoLogger.trace("EnhancedCallbackRequestData:\n" + callbackRequestData) + execution.setVariable("enhancedCallbackRequestData", callbackRequestData) + + String sdncAdapterWorkflowResponse =""" + <sdncadapterworkflow:SDNCAdapterWorkflowResponse xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> + <sdncadapterworkflow:response-data> + ${callbackHeader} + ${callbackRequestData} + </sdncadapterworkflow:response-data> + </sdncadapterworkflow:SDNCAdapterWorkflowResponse>""" + + + sdncAdapterWorkflowResponse = utils.formatXml(sdncAdapterWorkflowResponse) + execution.setVariable("sdncAdapterResponse", sdncAdapterWorkflowResponse) + // TODO: Should deprecate use of processKey+Response variable for the response. Will use "WorkflowResponse" instead + execution.setVariable("WorkflowResponse", sdncAdapterWorkflowResponse) + + // Check final indicator to determine if we are to continue listening or not + def continueListening = false + if (utils.nodeExists(callbackRequestData, "ack-final-indicator")) { + if (utils.getNodeText(callbackRequestData, "ack-final-indicator") == 'N') { + continueListening = true + } + } + execution.setVariable("continueListening", continueListening) + msoLogger.debug("Continue Listening: " + continueListening) + execution.setVariable("asynchronousResponseTimeout", false) + }else{ + // Timed out waiting for asynchronous message, build error response + exceptionUtil.buildWorkflowException(execution, 500, "SDNC Callback Timeout Error") + execution.setVariable("asynchronousResponseTimeout", true) + msoLogger.debug("Timed out waiting for asynchronous message") + } + }catch(Exception e){ + msoLogger.debug('Internal Error occured during PostProcess Method: ' + e) + exceptionUtil.buildAndThrowWorkflowException(execution, 9999, 'Internal Error occured during PostProcess Method') // TODO: what message and error code? + } + msoLogger.trace("End POSTProcess SDNCAdapter ") + } + + public void callbackResponsecheck(DelegateExecution execution){ + + def sdnccallbackreq=execution.getVariable("sdncAdapterCallbackRequest") + msoLogger.debug("sdncAdapterCallbackRequest :" + sdnccallbackreq) + if (sdnccallbackreq==null){ + execution.setVariable("callbackResponseReceived",false); + }else{ + execution.setVariable("callbackResponseReceived",true); + } + } + + public void resetCallbackRequest(DelegateExecution execution) { + + msoLogger.trace("Begin Reset Callback Info SDNCAdapter ") + + // Clear sdncAdapterCallbackRequest variable + execution.removeVariable("sdncAdapterCallbackRequest") + + // Determine and set SDNC Timeout Value + def enhancedCallbackRequestData = execution.getVariable("enhancedCallbackRequestData") + msoLogger.debug("sdncAdapter - enhancedCallbackRequestData :" + enhancedCallbackRequestData) + def interim = false + if (enhancedCallbackRequestData != null) { + if (utils.nodeExists(enhancedCallbackRequestData, "ack-final-indicator")) { + if (utils.getNodeText(enhancedCallbackRequestData, "ack-final-indicator") == 'N') { + interim = true + } + } + } + def timeoutValue = UrnPropertiesReader.getVariable("mso.adapters.sdnc.timeout", execution) + if(timeoutValue==null) + timeoutValue="PT5M" + def sdncAdapterWorkflowRequest = execution.getVariable("sdncAdapterWorkflowRequest") + if (interim && utils.nodeExists(sdncAdapterWorkflowRequest, "InterimSDNCTimeOutValueInHours")) { + timeoutValue = "PT" + utils.getNodeText(sdncAdapterWorkflowRequest, "InterimSDNCTimeOutValueInHours") + "H" + } else if (utils.nodeExists(sdncAdapterWorkflowRequest, "SDNCTimeOutValueInMinutes")) { + timeoutValue = "PT" + utils.getNodeText(sdncAdapterWorkflowRequest, "SDNCTimeOutValueInMinutes") + "M" + } + execution.setVariable("sdncTimeoutValue", timeoutValue) + msoLogger.debug("Setting SDNC Timeout Value to " + timeoutValue) + + msoLogger.trace("End Reset Callback Info SDNCAdapter ") + } + + + public void prepareDBMessage(DelegateExecution execution) { + + msoLogger.trace("Begin Prepare DB Message SDNCAdapter ") + + // Create DB Message + def dbRequestId = execution.getVariable("mso-request-id") + String dbUpdateInterimStageCompletion = """ + <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> + <SOAP-ENV:Body> + <DBAdapter:updateInterimStageCompletion xmlns:DBAdapter="http://org.onap.so/requestsdb"> + <requestId>${MsoUtils.xmlEscape(dbRequestId)}</requestId> + <interimStageCompletion>1</interimStageCompletion> + <lastModifiedBy>BPEL</lastModifiedBy> + </DBAdapter:updateInterimStageCompletion> + </SOAP-ENV:Body> + </SOAP-ENV:Envelope> + """ + + execution.setVariable("dbUpdateInterimStageCompletion", dbUpdateInterimStageCompletion) + msoLogger.debug("sdncAdapter - dbUpdateInterimStageCompletion :" + dbUpdateInterimStageCompletion) + msoLogger.debug("DB UpdateInterimStageCompletion:\n" + dbUpdateInterimStageCompletion) + msoLogger.trace("End Prepare DB Message SDNCAdapter ") + } + + public String generateCurrentTimeInUtc(){ + final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); + sdf.setTimeZone(TimeZone.getTimeZone("UTC")); + final String utcTime = sdf.format(new Date()); + return utcTime; + } + + public void toggleSuccessIndicator(DelegateExecution execution){ + execution.setVariable("SDNCA_SuccessIndicator", true) + msoLogger.debug("Setting SDNCA Success Indicator to True") + } + + public void assignError(DelegateExecution execution){ + msoLogger.trace("Started Assign Error ") + WorkflowException wf = execution.getVariable("WorkflowException") + if(wf == null){ + exceptionUtil.buildWorkflowException(execution, 5000, "SDNCAdapter Encountered an Internal Error") // TODO: Not sure what message and error code we want here..... + }else{ + execution.setVariable("WorkflowException", wf) + } + + msoLogger.debug("Outgoing WorkflowException is: " + execution.getVariable("WorkflowException")) + msoLogger.trace("End Assign Error ") + } + + public void setTimeout(DelegateExecution execution){ + msoLogger.trace("Started SetTimeout ") + msoLogger.debug("Timer expired, telling correlation service to stop listening") + execution.setVariable("asynchronousResponseTimeout", true) + + msoLogger.debug("Timed out branch sleeping for one second to give success branch a chance to complete if running") + Thread.sleep(1000) + msoLogger.trace("End SetTimeout ") + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterRestV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy index 41fcb6d08d..f610ea4782 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterRestV1.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy @@ -1,4 +1,24 @@ -package org.openecomp.mso.bpmn.common.scripts +/*- + * ============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.common.scripts import java.text.SimpleDateFormat import java.net.URLEncoder @@ -12,14 +32,22 @@ import groovy.json.* import org.json.JSONObject -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.rest.APIResponse -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.domain.RollbackData +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.rest.APIResponse +import org.onap.so.rest.RESTClient +import org.onap.so.rest.RESTConfig +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + + class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SDNCAdapterRestV1.class); + ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() @@ -31,8 +59,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { def method = getClass().getSimpleName() + '.preProcessRequest(' + 'execution=' + execution.getId() + ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) + msoLogger.trace('Entered ' + method) def prefix="SDNCREST_" execution.setVariable("prefix", prefix) @@ -44,17 +71,16 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { String request = validateRequest(execution, "mso-request-id") String requestType = jsonUtil.getJsonRootProperty(request) execution.setVariable(prefix + 'requestType', requestType) - logDebug(getProcessKey(execution) + ': ' + prefix + 'requestType = ' + requestType, isDebugLogEnabled) - utils.logAudit('SDNCAdapterRestV1, request: ' + request) + msoLogger.debug(getProcessKey(execution) + ': ' + prefix + 'requestType = ' + requestType) // Determine the SDNCAdapter endpoint - String sdncAdapterEndpoint = execution.getVariable("URN_mso_adapters_sdnc_rest_endpoint") + String sdncAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.sdnc.rest.endpoint", execution) if (sdncAdapterEndpoint == null || sdncAdapterEndpoint.isEmpty()) { String msg = getProcessKey(execution) + ': mso:adapters:sdnc:rest:endpoint URN mapping is not defined' - logDebug(msg, isDebugLogEnabled) - logError(msg) + msoLogger.debug(msg) + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -73,13 +99,13 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { if (sdncRequestId == null || sdncRequestId.isEmpty()) { String msg = getProcessKey(execution) + ': no sdncRequestId in ' + requestType - logDebug(msg, isDebugLogEnabled) - logError(msg) + msoLogger.debug(msg) + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } execution.setVariable('SDNCAResponse_CORRELATOR', sdncRequestId) - logDebug(getProcessKey(execution) + ': SDNCAResponse_CORRELATOR = ' + sdncRequestId, isDebugLogEnabled) + msoLogger.debug(getProcessKey(execution) + ': SDNCAResponse_CORRELATOR = ' + sdncRequestId) // Get the bpNotificationUrl from the request (just to make sure it's there) @@ -87,44 +113,45 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { if (bpNotificationUrl == null || bpNotificationUrl.isEmpty()) { String msg = getProcessKey(execution) + ': no bpNotificationUrl in ' + requestType - logDebug(msg, isDebugLogEnabled) - logError(msg) + msoLogger.debug(msg) + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } sdncAdapterMethod = 'POST' - sdncAdapterUrl = sdncAdapterEndpoint + '/services' + sdncAdapterUrl = sdncAdapterEndpoint + + RollbackData rollbackData = new RollbackData() + rollbackData.setRequestId(sdncRequestId) + rollbackData.getAdditionalData().put("service", jsonUtil.getJsonValue(request, requestType + ".sdncService")) + rollbackData.getAdditionalData().put("operation", jsonUtil.getJsonValue(request, requestType + ".sdncOperation")) + execution.setVariable("RollbackData", rollbackData) } else { String msg = getProcessKey(execution) + ': Unsupported request type: ' + requestType - logDebug(msg, isDebugLogEnabled) - logError(msg) + msoLogger.debug(msg) + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } execution.setVariable(prefix + 'sdncAdapterMethod', sdncAdapterMethod) - logDebug(getProcessKey(execution) + ': ' + prefix + 'sdncAdapterMethod = ' + sdncAdapterMethod, isDebugLogEnabled) execution.setVariable(prefix + 'sdncAdapterUrl', sdncAdapterUrl) - logDebug(getProcessKey(execution) + ': ' + prefix + 'sdncAdapterUrl = ' + sdncAdapterUrl, isDebugLogEnabled) execution.setVariable(prefix + 'sdncAdapterRequest', sdncAdapterRequest) - logDebug(getProcessKey(execution) + ': ' + prefix + 'sdncAdapterRequest = \n' + sdncAdapterRequest, isDebugLogEnabled) // Get the Basic Auth credentials for the SDNCAdapter (yes... we ARE using the PO adapters credentials) - String basicAuthValue = execution.getVariable("URN_mso_adapters_po_auth") + String basicAuthValue = UrnPropertiesReader.getVariable("mso.adapters.po.auth", execution) if (basicAuthValue == null || basicAuthValue.isEmpty()) { - logDebug(getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined", isDebugLogEnabled) - logError(getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined") + msoLogger.debug(getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined") + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); } else { - logDebug(getProcessKey(execution) + ": Obtained BasicAuth credentials for SDNCAdapter:" + - basicAuthValue, isDebugLogEnabled) try { - def encodedString = utils.getBasicAuth(basicAuthValue, execution.getVariable("URN_mso_msoKey")) + def encodedString = utils.getBasicAuth(basicAuthValue, UrnPropertiesReader.getVariable("mso.msoKey", execution)) execution.setVariable(prefix + 'basicAuthHeaderValue', encodedString) } catch (IOException ex) { - logDebug(getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter", isDebugLogEnabled) - logError(getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter") + msoLogger.debug(getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter") + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); } } @@ -133,18 +160,28 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { String timeout = jsonUtil.getJsonValue(request, requestType + ".bpTimeout") - if (timeout == null || timeout.isEmpty()) { - timeout = execution.getVariable("URN_mso_sdnc_timeout") + // in addition to null/empty, also need to verify that the timer value is a valid duration "P[n]T[n]H|M|S" + String timerRegex = "PT[0-9]+[HMS]"; + if (timeout == null || timeout.isEmpty() || !timeout.matches(timerRegex)) { + msoLogger.debug(getProcessKey(execution) + ': preProcessRequest(): null/empty/invalid bpTimeout value. Using "mso.adapters.sdnc.timeout"') + timeout = UrnPropertiesReader.getVariable("mso.adapters.sdnc.timeout", execution) + } + + // the timeout could still be null at this point if the config parm is missing/undefined + // forced to log (so OPs can fix the config) and temporarily use a hard coded value of 10 seconds + if (timeout == null) { + msoLogger.warnSimple('preProcessRequest()', 'property "mso.adapters.sdnc.timeout" is missing/undefined. Using "PT10S"') + timeout = "PT10S" } execution.setVariable(prefix + 'timeout', timeout) - logDebug(getProcessKey(execution) + ': ' + prefix + 'timeout = ' + timeout, isDebugLogEnabled) + msoLogger.debug(getProcessKey(execution) + ': ' + prefix + 'timeout = ' + timeout) } catch (BpmnError e) { throw e } catch (Exception e) { String msg = 'Caught exception in ' + method + ": " + e - logDebug(msg, isDebugLogEnabled) - logError(msg) + msoLogger.debug(msg) + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } } @@ -156,21 +193,24 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { def method = getClass().getSimpleName() + '.sendRequestToSDNCAdapter(' + 'execution=' + execution.getId() + ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) + msoLogger.trace('Entered ' + method) String prefix = execution.getVariable('prefix') try { String sdncAdapterMethod = execution.getVariable(prefix + 'sdncAdapterMethod') + msoLogger.debug("SDNC Method is: " + sdncAdapterMethod) String sdncAdapterUrl = execution.getVariable(prefix + 'sdncAdapterUrl') + msoLogger.debug("SDNC Url is: " + sdncAdapterUrl) String sdncAdapterRequest = execution.getVariable(prefix + 'sdncAdapterRequest') - utils.logAudit("Outgoing SDNC Rest Request is: " + sdncAdapterRequest) + msoLogger.debug("SDNC Rest Request is: " + sdncAdapterRequest) RESTConfig config = new RESTConfig(sdncAdapterUrl) RESTClient client = new RESTClient(config). - addHeader("Content-Type", "application/json"). - addAuthorizationHeader(execution.getVariable(prefix + "basicAuthHeaderValue")) + addHeader("Content-Type", "application/json") + .addHeader("mso-request-id",execution.getVariable("mso-request-id")) + .addHeader("mso-service-instance-id",execution.getVariable("mso-service-instance-id")) + .addAuthorizationHeader(execution.getVariable(prefix + "basicAuthHeaderValue")) APIResponse response @@ -184,8 +224,8 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { response = client.httpDelete(sdncAdapterRequest) } else { String msg = 'Unsupported HTTP method "' + sdncAdapterMethod + '" in ' + method + ": " + e - logDebug(msg, isDebugLogEnabled) - logError(msg) + msoLogger.debug(msg) + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -195,8 +235,8 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { throw e } catch (Exception e) { String msg = 'Caught exception in ' + method + ": " + e - logDebug(msg, isDebugLogEnabled) - logError(msg) + msoLogger.debug(msg) + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } } @@ -208,16 +248,16 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { def method = getClass().getSimpleName() + '.processCallback(' + 'execution=' + execution.getId() + ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) + msoLogger.trace('Entered ' + method) String prefix = execution.getVariable('prefix') String callback = execution.getVariable('SDNCAResponse_MESSAGE') - utils.logAudit("Incoming SDNC Rest Callback is: " + callback) + String requestId = execution.getVariable("mso-request-id"); + String serviceInstanceId = execution.getVariable("mso-service-instance-id") + utils.logContext(requestId, serviceInstanceId) + msoLogger.debug("Incoming SDNC Rest Callback is: " + callback) try { - logDebug(getProcessKey(execution) + ": received callback:\n" + callback, isDebugLogEnabled) - int callbackNumber = 1 while (execution.getVariable(prefix + 'callback' + callbackNumber) != null) { ++callbackNumber @@ -243,7 +283,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { } catch (Exception e) { callback = callback == null || String.valueOf(callback).isEmpty() ? "NONE" : callback String msg = "Received error from SDNCAdapter: " + callback - logDebug(getProcessKey(execution) + ': ' + msg, isDebugLogEnabled) + msoLogger.debug(getProcessKey(execution) + ': ' + msg) exceptionUtil.buildWorkflowException(execution, 5300, msg) } } @@ -286,8 +326,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { def method = getClass().getSimpleName() + '.getLastCallback(' + 'execution=' + execution.getId() + ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) + msoLogger.trace('Entered ' + method) String prefix = execution.getVariable('prefix') @@ -309,8 +348,8 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { return callback } catch (Exception e) { String msg = 'Caught exception in ' + method + ": " + e - logDebug(msg, isDebugLogEnabled) - logError(msg) + msoLogger.debug(msg) + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } } @@ -322,21 +361,20 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { def method = getClass().getSimpleName() + '.setTimeoutValue(' + 'execution=' + execution.getId() + ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) + msoLogger.trace('Entered ' + method) String prefix = execution.getVariable('prefix') try { - def timeoutValue = execution.getVariable("URN_mso_sdnc_timeout") + def timeoutValue = UrnPropertiesReader.getVariable("mso.adapters.sdnc.timeout", execution) if (execution.getVariable(prefix + 'callback1') != null) { // Waiting for subsequent notifications } } catch (Exception e) { String msg = 'Caught exception in ' + method + ": " + e - logDebug(msg, isDebugLogEnabled) - logError(msg) + msoLogger.debug(msg) + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterRestV2.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy index f4a7f055bd..967b9fa93f 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterRestV2.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy @@ -1,4 +1,24 @@ -package org.openecomp.mso.bpmn.common.scripts +/*- + * ============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.common.scripts import java.text.SimpleDateFormat import java.net.URLEncoder @@ -12,17 +32,24 @@ import groovy.json.* import org.json.JSONObject -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.rest.APIResponse -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.rest.APIResponse +import org.onap.so.rest.RESTClient +import org.onap.so.rest.RESTConfig +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + + /** * This version of SDNCAdapterRest allows for interim notifications to be sent for * any non-final response received from SDNC. */ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SDNCAdapterRestV2.class); + ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() @@ -34,8 +61,7 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 { def method = getClass().getSimpleName() + '.preProcessRequest(' + 'execution=' + execution.getId() + ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) + msoLogger.trace('Entered ' + method) def prefix="SDNCREST_" execution.setVariable("prefix", prefix) @@ -47,17 +73,17 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 { String request = validateRequest(execution, "mso-request-id") String requestType = jsonUtil.getJsonRootProperty(request) execution.setVariable(prefix + 'requestType', requestType) - logDebug(getProcessKey(execution) + ': ' + prefix + 'requestType = ' + requestType, isDebugLogEnabled) - utils.logAudit('SDNCAdapterRestV2, request: ' + request) + msoLogger.debug(getProcessKey(execution) + ': ' + prefix + 'requestType = ' + requestType) + msoLogger.debug('SDNCAdapterRestV2, request: ' + request) // Determine the SDNCAdapter endpoint - String sdncAdapterEndpoint = execution.getVariable("URN_mso_adapters_sdnc_rest_endpoint") + String sdncAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.sdnc.rest.endpoint",execution) if (sdncAdapterEndpoint == null || sdncAdapterEndpoint.isEmpty()) { String msg = getProcessKey(execution) + ': mso:adapters:sdnc:rest:endpoint URN mapping is not defined' - logDebug(msg, isDebugLogEnabled) - logError(msg) + msoLogger.debug(msg) + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -76,13 +102,13 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 { if (sdncRequestId == null || sdncRequestId.isEmpty()) { String msg = getProcessKey(execution) + ': no sdncRequestId in ' + requestType - logDebug(msg, isDebugLogEnabled) - logError(msg) + msoLogger.debug(msg) + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } execution.setVariable('SDNCAResponse_CORRELATOR', sdncRequestId) - logDebug(getProcessKey(execution) + ': SDNCAResponse_CORRELATOR = ' + sdncRequestId, isDebugLogEnabled) + msoLogger.debug(getProcessKey(execution) + ': SDNCAResponse_CORRELATOR = ' + sdncRequestId) // Get the bpNotificationUrl from the request (just to make sure it's there) @@ -90,44 +116,42 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 { if (bpNotificationUrl == null || bpNotificationUrl.isEmpty()) { String msg = getProcessKey(execution) + ': no bpNotificationUrl in ' + requestType - logDebug(msg, isDebugLogEnabled) - logError(msg) + msoLogger.debug(msg) + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } sdncAdapterMethod = 'POST' - sdncAdapterUrl = sdncAdapterEndpoint + '/services' + sdncAdapterUrl = sdncAdapterEndpoint } else { String msg = getProcessKey(execution) + ': Unsupported request type: ' + requestType - logDebug(msg, isDebugLogEnabled) - logError(msg) + msoLogger.debug(msg) + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } execution.setVariable(prefix + 'sdncAdapterMethod', sdncAdapterMethod) - logDebug(getProcessKey(execution) + ': ' + prefix + 'sdncAdapterMethod = ' + sdncAdapterMethod, isDebugLogEnabled) + msoLogger.debug(getProcessKey(execution) + ': ' + prefix + 'sdncAdapterMethod = ' + sdncAdapterMethod) execution.setVariable(prefix + 'sdncAdapterUrl', sdncAdapterUrl) - logDebug(getProcessKey(execution) + ': ' + prefix + 'sdncAdapterUrl = ' + sdncAdapterUrl, isDebugLogEnabled) + msoLogger.debug(getProcessKey(execution) + ': ' + prefix + 'sdncAdapterUrl = ' + sdncAdapterUrl) execution.setVariable(prefix + 'sdncAdapterRequest', sdncAdapterRequest) - logDebug(getProcessKey(execution) + ': ' + prefix + 'sdncAdapterRequest = \n' + sdncAdapterRequest, isDebugLogEnabled) + msoLogger.debug(getProcessKey(execution) + ': ' + prefix + 'sdncAdapterRequest = \n' + sdncAdapterRequest) // Get the Basic Auth credentials for the SDNCAdapter (yes... we ARE using the PO adapters credentials) - String basicAuthValue = execution.getVariable("URN_mso_adapters_po_auth") + String basicAuthValue = UrnPropertiesReader.getVariable("mso.adapters.po.auth",execution) if (basicAuthValue == null || basicAuthValue.isEmpty()) { - logDebug(getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined", isDebugLogEnabled) - logError(getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined") + msoLogger.debug(getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined") + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); } else { - logDebug(getProcessKey(execution) + ": Obtained BasicAuth credentials for SDNCAdapter:" + - basicAuthValue, isDebugLogEnabled) try { - def encodedString = utils.getBasicAuth(basicAuthValue, execution.getVariable("URN_mso_msoKey")) + def encodedString = utils.getBasicAuth(basicAuthValue, UrnPropertiesReader.getVariable("mso.msoKey", execution)) execution.setVariable(prefix + 'basicAuthHeaderValue', encodedString) } catch (IOException ex) { - logDebug(getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter", isDebugLogEnabled) - logError(getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter") + msoLogger.debug(getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter") + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); } } @@ -136,18 +160,28 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 { String timeout = jsonUtil.getJsonValue(request, requestType + ".bpTimeout") - if (timeout == null || timeout.isEmpty()) { - timeout = execution.getVariable("URN_mso_sdnc_timeout") + // in addition to null/empty, also need to verify that the timer value is a valid duration "P[n]T[n]H|M|S" + String timerRegex = "PT[0-9]+[HMS]"; + if (timeout == null || timeout.isEmpty() || !timeout.matches(timerRegex)) { + msoLogger.debug(getProcessKey(execution) + ': preProcessRequest(): null/empty/invalid bpTimeout value. Using "mso.adapters.sdnc.timeout"') + timeout = UrnPropertiesReader.getVariable("mso.adapters.sdnc.timeout", execution) + } + + // the timeout could still be null at this point if the config parm is missing/undefined + // forced to log (so OPs can fix the config) and temporarily use a hard coded value of 10 seconds + if (timeout == null) { + msoLogger.warnSimple('preProcessRequest()', 'property "mso.adapters.sdnc.timeout" is missing/undefined. Using "PT10S"') + timeout = "PT10S" } execution.setVariable(prefix + 'timeout', timeout) - logDebug(getProcessKey(execution) + ': ' + prefix + 'timeout = ' + timeout, isDebugLogEnabled) + msoLogger.debug(getProcessKey(execution) + ': ' + prefix + 'timeout = ' + timeout) } catch (BpmnError e) { throw e } catch (Exception e) { String msg = 'Caught exception in ' + method + ": " + e - logDebug(msg, isDebugLogEnabled) - logError(msg) + msoLogger.debug(msg) + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } } @@ -159,15 +193,14 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 { def method = getClass().getSimpleName() + '.processCallback(' + 'execution=' + execution.getId() + ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) + msoLogger.trace('Entered ' + method) String prefix = execution.getVariable('prefix') String callback = execution.getVariable('SDNCAResponse_MESSAGE') - utils.logAudit("Incoming SDNC Rest Callback is: " + callback) + msoLogger.debug("Incoming SDNC Rest Callback is: " + callback) try { - logDebug(getProcessKey(execution) + ": received callback:\n" + callback, isDebugLogEnabled) + msoLogger.debug(getProcessKey(execution) + ": received callback:\n" + callback) int callbackNumber = 1 while (execution.getVariable(prefix + 'callback' + callbackNumber) != null) { @@ -206,7 +239,7 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 { } catch (Exception e) { callback = callback == null || String.valueOf(callback).isEmpty() ? "NONE" : callback String msg = "Received error from SDNCAdapter: " + callback - logDebug(getProcessKey(execution) + ': ' + msg, isDebugLogEnabled) + msoLogger.debug(getProcessKey(execution) + ': ' + msg) exceptionUtil.buildWorkflowException(execution, 5300, msg) } } @@ -220,15 +253,14 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 { def method = getClass().getSimpleName() + '.prepareInterimNotification(' + 'execution=' + execution.getId() + ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) + msoLogger.trace('Entered ' + method) String prefix = execution.getVariable('prefix') - utils.logAudit("Preparing Interim Notification") + msoLogger.debug("Preparing Interim Notification") try { def interimNotification = execution.getVariable(prefix + "interimNotification") - logDebug("Preparing Interim Notification:\n" + JsonUtils.prettyJson(interimNotification), isDebugLogEnabled) + msoLogger.debug("Preparing Interim Notification:\n" + JsonUtils.prettyJson(interimNotification)) for (int i = 0; ; i++) { def variable = JsonUtils.getJsonParamValue(interimNotification, 'variableList', 'variable', i) @@ -241,13 +273,13 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 { if ((variableName != null) && !variableName.isEmpty()) { def variableValue = JsonUtils.getJsonValue(variable, "value") execution.setVariable(variableName, variableValue) - logDebug("Setting "+ variableName + "=" + variableValue, isDebugLogEnabled) + msoLogger.debug("Setting "+ variableName + "=" + variableValue) } } } catch (Exception e) { String msg = "Error preparing interim notification" - logDebug(getProcessKey(execution) + ': ' + msg, isDebugLogEnabled) + msoLogger.debug(getProcessKey(execution) + ': ' + msg) exceptionUtil.buildWorkflowException(execution, 5300, msg) } } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtils.groovy index 7aa7b200f3..ba450c1b12 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtils.groovy @@ -1,1043 +1,1024 @@ -/*-
- * ============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.common.scripts;
-
-import org.apache.commons.lang3.*
-import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.delegate.DelegateExecution
-
-import org.openecomp.mso.bpmn.core.WorkflowException
-import org.openecomp.mso.bpmn.core.json.JsonUtils;
-import org.springframework.web.util.UriUtils
-
-
-/**
- * @version 1.0
- *
- */
-class SDNCAdapterUtils {
-
- ExceptionUtil exceptionUtil = new ExceptionUtil()
- JsonUtils jsonUtil = new JsonUtils()
-
- private AbstractServiceTaskProcessor taskProcessor
-
- public SDNCAdapterUtils(AbstractServiceTaskProcessor taskProcessor) {
- this.taskProcessor = taskProcessor
- }
-
- String SDNCAdapterFeatureRequest(DelegateExecution execution, String requestName, String action, String callbackURL, String serviceOperation, String timeoutValueInMinutes) {
-
- def utils=new MsoUtils()
-
- def prefix = execution.getVariable('prefix')
- def request = taskProcessor.getVariable(execution, requestName)
- def requestInformation = utils.getNodeXml(request, 'request-information', false)
- def serviceInformation = utils.getNodeXml(request, 'service-information', false)
- def featureInformation = utils.getNodeXml(request, 'feature-information', false)
- def featureParameters = utils.getNodeXml(request, 'feature-parameters', false)
-
- def requestId = execution.getVariable('testReqId') // for junits
- if(requestId==null){
- requestId = execution.getVariable("mso-request-id") + "-" + System.currentTimeMillis()
- }
-
- def svcInstanceId = execution.getVariable("mso-service-instance-id")
-
- def nnsRequestInformation = utils.removeXmlNamespaces(requestInformation)
- def nnsServiceInformation = utils.removeXmlNamespaces(serviceInformation)
- def nnsFeatureInformation = utils.removeXmlNamespaces(featureInformation)
- def nnsFeatureParameters = utils.removeXmlNamespaces(featureParameters)
-
- String sdncAdapterFeatureRequest = """
- <sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:sdncadapterworkflow="http://openecomp.com/mso/workflow/schema/v1"
- xmlns:sdncadapter="http://domain2.openecomp.com/workflow/sdnc/adapter/schema/v1">
- <sdncadapter:RequestHeader>
- <sdncadapter:RequestId>${requestId}</sdncadapter:RequestId>
- <sdncadapter:SvcInstanceId>${svcInstanceId}</sdncadapter:SvcInstanceId>
- <sdncadapter:SvcAction>${action}</sdncadapter:SvcAction>
- <sdncadapter:SvcOperation>${serviceOperation}</sdncadapter:SvcOperation>
- <sdncadapter:CallbackUrl>${callbackURL}</sdncadapter:CallbackUrl>
- </sdncadapter:RequestHeader>
- <sdncadapterworkflow:SDNCRequestData>
- ${nnsRequestInformation}
- ${nnsServiceInformation}
- ${nnsFeatureInformation}
- ${nnsFeatureParameters}
- </sdncadapterworkflow:SDNCRequestData>
- <sdncadapterworkflow:SDNCTimeOutValueInMinutes>${timeoutValueInMinutes}</sdncadapterworkflow:SDNCTimeOutValueInMinutes>
- </sdncadapterworkflow:SDNCAdapterWorkflowRequest>
- """
- sdncAdapterFeatureRequest = utils.removeXmlPreamble(utils.formatXML(sdncAdapterFeatureRequest))
- return sdncAdapterFeatureRequest
- }
-
- String SDNCAdapterActivateVnfRequest(DelegateExecution execution, String action, String callbackURL, String serviceOperation, String msoAction, String timeoutValueInMinutes) {
-
- def utils=new MsoUtils()
-
- def prefix = execution.getVariable('prefix')
- def request = taskProcessor.getVariable(execution, prefix+'Request')
- def requestInformation = utils.getNodeXml(request, 'request-information', false)
- def serviceInformation = utils.getNodeXml(request, 'service-information', false)
- def vnfInformationList = utils.getNodeXml(request, 'vnf-information-list', false)
-
- def requestId = execution.getVariable('testReqId') // for junits
- if(requestId==null){
- requestId = execution.getVariable("mso-request-id") + "-" + System.currentTimeMillis()
- }
-
- def svcInstanceId = execution.getVariable("mso-service-instance-id")
-
- def nnsRequestInformation = utils.removeXmlNamespaces(requestInformation)
- def nnsServiceInformation = utils.removeXmlNamespaces(serviceInformation)
- def nnsVnfInformationList = utils.removeXmlNamespaces(vnfInformationList)
-
- String sdncAdapterActivateVnfRequest = """
- <sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:sdncadapterworkflow="http://openecomp.com/mso/workflow/schema/v1"
- xmlns:sdncadapter="http://domain2.openecomp.com/workflow/sdnc/adapter/schema/v1">
- <sdncadapter:RequestHeader>
- <sdncadapter:RequestId>${requestId}</sdncadapter:RequestId>
- <sdncadapter:SvcInstanceId>${svcInstanceId}</sdncadapter:SvcInstanceId>
- <sdncadapter:SvcAction>${action}</sdncadapter:SvcAction>
- <sdncadapter:SvcOperation>${serviceOperation}</sdncadapter:SvcOperation>
- <sdncadapter:CallbackUrl>${callbackURL}</sdncadapter:CallbackUrl>
- <sdncadapter:MsoAction>${msoAction}</sdncadapter:MsoAction>
- </sdncadapter:RequestHeader>
- <sdncadapterworkflow:SDNCRequestData>
- ${nnsRequestInformation}
- ${nnsServiceInformation}
- ${nnsVnfInformationList}
- </sdncadapterworkflow:SDNCRequestData>
- <sdncadapterworkflow:SDNCTimeOutValueInMinutes>${timeoutValueInMinutes}</sdncadapterworkflow:SDNCTimeOutValueInMinutes>
- </sdncadapterworkflow:SDNCAdapterWorkflowRequest>
- """
- sdncAdapterActivateVnfRequest = utils.removeXmlPreamble(utils.formatXML(sdncAdapterActivateVnfRequest))
- return sdncAdapterActivateVnfRequest
- }
-
- String SDNCAdapterL3ToHigherLayerRequest(DelegateExecution execution, String action, String callbackURL, String serviceOperation, String timeoutValueInMinutes) {
-
- def utils=new MsoUtils()
-
- def prefix = execution.getVariable('prefix')
- def request = taskProcessor.getVariable(execution, prefix+'Request')
-
- def requestInformation = """<request-information>
- <request-id>${execution.getVariable("mso-request-id")}</request-id>
- <request-action>torepl</request-action>
- <source>${execution.getVariable(prefix+"source")}</source>
- <notification-url>${execution.getVariable(prefix+"notificationUrl")}</notification-url>
- </request-information>"""
-
- // Change the value of the 'request-information'.'request-action' element
- def xml = new XmlSlurper().parseText(requestInformation)
- if("assign".equalsIgnoreCase(action)){
- xml.'request-action'.replaceBody('createTrinityBonding')
- }else if("activate".equalsIgnoreCase(action)){
- xml.'request-action'.replaceBody('activateTrinityBonding')
- }else if("delete".equalsIgnoreCase(action)){
- xml.'request-action'.replaceBody('deleteTrinityBonding')
- }
- requestInformation = utils.removeXmlPreamble(groovy.xml.XmlUtil.serialize(xml))
- def nnsRequestInformation = utils.removeXmlNamespaces(requestInformation)
-
- def requestId = execution.getVariable('testReqId') // for junits
- if(requestId==null){
- requestId = execution.getVariable("mso-request-id") + "-" + System.currentTimeMillis()
- }
-
- def svcInstanceId = execution.getVariable("mso-service-instance-id")
-
- //Build Service Information
- // Send serviceName from CANOPI to sdnc for service-type
- def serviceInformation = """<service-information>
- <service-type>${execution.getVariable(prefix+"serviceName")}</service-type>
- <service-instance-id>${svcInstanceId}</service-instance-id>
- <subscriber-name>${execution.getVariable(prefix+"subscriberName")}</subscriber-name>
- <subscriber-global-id>${execution.getVariable(prefix+"subscriberGlobalId")}</subscriber-global-id>
- </service-information>"""
-
- //Build Additional Information - vpn or vni
- // Send serviceType from CANOPI to SDNC for nbnc-request-information service-type
- def service = execution.getVariable(prefix+"serviceType")
- def customerId = execution.getVariable(prefix+"customerId")
- def vpnId = execution.getVariable(prefix+"vpnId")
- def vpnRt = execution.getVariable(prefix+"vpnRt")
- def vpnService = execution.getVariable(prefix+"vpnService")
- def vpnRegion = execution.getVariable(prefix+"vpnRegion")
- def additionalInfo = ""
- if("assign".equalsIgnoreCase(action)){
- additionalInfo = """<vpn-data-list>
- <vpn-id>${vpnId}</vpn-id>
- <vpn-rt>${vpnRt}</vpn-rt>
- <vpn-service>${vpnService}</vpn-service>
- <vpn-region>${vpnRegion}</vpn-region>
- </vpn-data-list>"""
- }else if("activate".equalsIgnoreCase(action) || "delete".equalsIgnoreCase(action)){
- def vniId = execution.getVariable(prefix+'vniId')
- additionalInfo = "<vni-id>${vniId}</vni-id>"
- }
-
- //Set Interface Status
- def interfaceStatus = "DISABLE"
- if("activate".equalsIgnoreCase(action)){
- interfaceStatus = "ENABLE"
- }
-
- //Build SDNC Adapter Request
- String sdncAdapterL3ToHLRequest = """
- <sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:sdncadapterworkflow="http://openecomp.com/mso/workflow/schema/v1"
- xmlns:sdncadapter="http://domain2.openecomp.com/workflow/sdnc/adapter/schema/v1">
- <sdncadapter:RequestHeader>
- <sdncadapter:RequestId>${requestId}</sdncadapter:RequestId>
- <sdncadapter:SvcInstanceId>${svcInstanceId}</sdncadapter:SvcInstanceId>
- <sdncadapter:SvcAction>${action}</sdncadapter:SvcAction>
- <sdncadapter:SvcOperation>${serviceOperation}</sdncadapter:SvcOperation>
- <sdncadapter:CallbackUrl>${callbackURL}</sdncadapter:CallbackUrl>
- </sdncadapter:RequestHeader>
- <sdncadapterworkflow:SDNCRequestData>
- ${nnsRequestInformation}
- ${serviceInformation}
- <nbnc-request-information>
- <service-type>${service}</service-type>
- <customer-id>${customerId}</customer-id>
- <interface-status>${interfaceStatus}</interface-status>
- ${additionalInfo}
- </nbnc-request-information>
- </sdncadapterworkflow:SDNCRequestData>
- <sdncadapterworkflow:SDNCTimeOutValueInMinutes>${timeoutValueInMinutes}</sdncadapterworkflow:SDNCTimeOutValueInMinutes>
- </sdncadapterworkflow:SDNCAdapterWorkflowRequest>
- """
- sdncAdapterL3ToHLRequest = utils.removeXmlPreamble(utils.formatXML(sdncAdapterL3ToHLRequest))
-
- return sdncAdapterL3ToHLRequest
- }
-
-
-
- private void SDNCAdapterActivateRequest(DelegateExecution execution, String resultVar, String svcAction,
-
- String svcOperation, String additionalData) {
- def utils=new MsoUtils()
-
- def prefix = execution.getVariable('prefix')
- def request = taskProcessor.getVariable(execution, prefix+'Request')
- def requestInformation = utils.getNodeXml(request, 'request-information', false)
- def serviceInformation = utils.getNodeXml(request, 'service-information', false)
- def serviceParameters = utils.getNodeXml(request, 'service-parameters', false)
-
- def requestId = execution.getVariable('testReqId') // for junits
- if(requestId==null){
- requestId = execution.getVariable("mso-request-id") + "-" + System.currentTimeMillis()
- }
-
- def svcInstanceId = execution.getVariable("mso-service-instance-id")
- def msoAction = 'gammainternet'
-
- def timeoutInMinutes = execution.getVariable('URN_mso_sdnc_timeout_firewall_minutes')
-
- def callbackUrl = (String) execution.getVariable('URN_mso_workflow_sdncadapter_callback')
- if (callbackUrl == null || callbackUrl.trim() == "") {
- logError('mso:workflow:sdncadapter:callback URN is not set')
- workflowException(execution, 'Internal Error', 9999) // TODO: what message and error code?
- }
-
- def l2HomingInformation = utils.getNodeXml(serviceParameters, 'l2-homing-information', false)
- def internetEvcAccessInformation = utils.getNodeXml(serviceParameters, 'internet-evc-access-information', false)
- def vrLan = utils.getNodeXml(serviceParameters, 'vr-lan', false)
- def upceVmsServiceInformation = utils.getNodeXml(serviceParameters, 'ucpe-vms-service-information', false)
-
-
- def nnsRequestInformation = utils.removeXmlNamespaces(requestInformation)
- def nnsServiceInformation = utils.removeXmlNamespaces(serviceInformation)
- def nnsl2HomingInformation = utils.removeXmlNamespaces(l2HomingInformation)
- def nnsInternetEvcAccessInformation = utils.removeXmlNamespaces(internetEvcAccessInformation)
- def nnsVrLan = utils.removeXmlNamespaces(vrLan)
- def nnsUpceVmsServiceInformation = utils.removeXmlNamespaces(upceVmsServiceInformation)
-
- if (additionalData == null) {
- additionalData = ""
- }
-
- boolean isAic3 = execution.getVariable("isAic3")
-
- if(isAic3) {
- nnsl2HomingInformation = updateHomingInfo(nnsl2HomingInformation, "AIC3.0")
- }
- else {
- nnsl2HomingInformation = updateHomingInfo(nnsl2HomingInformation, "AIC2.X")
- }
-
- String content = """
- <sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:sdncadapterworkflow="http://openecomp.com/mso/workflow/schema/v1"
- xmlns:sdncadapter="http://domain2.openecomp.com/workflow/sdnc/adapter/schema/v1">
- <sdncadapter:RequestHeader>
- <sdncadapter:RequestId>${requestId}</sdncadapter:RequestId>
- <sdncadapter:SvcInstanceId>${svcInstanceId}</sdncadapter:SvcInstanceId>
- <sdncadapter:SvcAction>${svcAction}</sdncadapter:SvcAction>
- <sdncadapter:SvcOperation>${svcOperation}</sdncadapter:SvcOperation>
- <sdncadapter:CallbackUrl>${callbackUrl}</sdncadapter:CallbackUrl>
- <sdncadapter:MsoAction>${msoAction}</sdncadapter:MsoAction>
- </sdncadapter:RequestHeader>
- <sdncadapterworkflow:SDNCRequestData>
- ${additionalData}
- ${nnsRequestInformation}
- ${nnsServiceInformation}
- ${nnsl2HomingInformation}
- ${nnsInternetEvcAccessInformation}
- ${nnsVrLan}
- ${nnsUpceVmsServiceInformation}
- </sdncadapterworkflow:SDNCRequestData>
- <sdncadapterworkflow:SDNCTimeOutValueInMinutes>${timeoutInMinutes}</sdncadapterworkflow:SDNCTimeOutValueInMinutes>
- </sdncadapterworkflow:SDNCAdapterWorkflowRequest>
- """
-
- content = utils.removeXmlPreamble(utils.formatXML(content))
- execution.setVariable(resultVar, content)
- }
-
- /**
- * Builds an SDNC "reserve" request and stores it in the specified execution
- * variable.
- * @param execution the execution
- * @param action the type of action: reserve, turnup, etc
- * @param resultVar the execution variable in which the result will be stored
- */
- public void sdncReservePrep(DelegateExecution execution, String action, String resultVar) {
- sdncReservePrep(execution, action, resultVar, false)
- }
-
- /**
- * Builds an SDNC "reserve" request and stores it in the specified execution
- * variable.
- * @param execution the execution
- * @param action the type of action: reserve, turnup, etc
- * @param resultVar the execution variable in which the result will be stored
- * @param isAic3 boolean to indicate whether request is for AIC3.0
- */
- public void sdncReservePrep(DelegateExecution execution, String action, String resultVar, boolean isAic3) {
-
- sdncPrep(execution, resultVar, action , 'service-configuration-operation', null, isAic3, this.taskProcessor)
- }
-
- /**
- * Builds a basic SDNC request and stores it in the specified execution variable.
- * @param execution the execution
- * @param resultVar the execution variable in which the result will be stored
- * @param svcAction the svcAction element value
- * @param svcOperation the svcOperation element value
- * @param additionalData additional XML content to be inserted into the
- * RequestData element (may be null)
- */
- public void sdncPrep(DelegateExecution execution, String resultVar, String svcAction,
- String svcOperation, String additionalData, AbstractServiceTaskProcessor taskProcessor) {
- sdncPrep(execution, resultVar, svcAction, svcOperation, additionalData, false, taskProcessor)
- }
-
- /**
- * Builds a basic SDNC request and stores it in the specified execution variable.
- * @param execution the execution
- * @param resultVar the execution variable in which the result will be stored
- * @param svcAction the svcAction element value
- * @param svcOperation the svcOperation element value
- * @param additionalData additional XML content to be inserted into the RequestData element (may be null)
- * @param isAic3 boolean to indicate whether request is for AIC3.0
- */
- public void sdncPrep(DelegateExecution execution, String resultVar, String svcAction,
-
- String svcOperation, String additionalData, boolean isAic3, AbstractServiceTaskProcessor taskProcessor) {
- def method = getClass().getSimpleName() + '.sdncPrep(' +
- 'execution=' + execution.getId() +
- ', resultVar=' + resultVar +
- ', svcAction=' + svcAction +
- ', svcOperation=' + svcOperation +
- ', additionalData=' + (additionalData == null ? "no" : "yes") +
- ')'
-
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled)
- MsoUtils utils = taskProcessor.utils
- try {
- def prefix = execution.getVariable('prefix')
- def request = taskProcessor.getVariable(execution, prefix+'Request')
- def requestInformation = utils.getNodeXml(request, 'request-information', false)
- def serviceInformation = utils.getNodeXml(request, 'service-information', false)
- def serviceParameters = utils.getChildNodes(request, 'service-parameters')
- def requestAction = utils.getNodeText1(request, 'request-action')
-
- def timeoutInMinutes = execution.getVariable('URN_mso_sdnc_timeout_firewall_minutes')
-
- def requestId = execution.getVariable('testReqId') // for junits
- if(requestId==null){
- requestId = execution.getVariable("mso-request-id") + "-" + System.currentTimeMillis()
- }
-
- def svcInstanceId = execution.getVariable("mso-service-instance-id")
- def msoAction = 'gammainternet'
-
- def callbackUrl = (String) execution.getVariable('URN_mso_workflow_sdncadapter_callback')
- if (callbackUrl == null || callbackUrl.trim() == "") {
- taskProcessor.logError('mso:workflow:sdncadapter:callback URN is not set')
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Internal Error - During PreProcess Request")
- }
-
- def l2HomingInformation = utils.getNodeXml(request, 'l2-homing-information', false)
- def internetEvcAccessInformation = utils.getNodeXml(request, 'internet-evc-access-information', false)
- def vrLan = utils.getNodeXml(request, 'vr-lan', false)
- def upceVmsServiceInfo = utils.getNodeXml(request, 'ucpe-vms-service-information', false)
- def vnfInformationList = utils.getNodeXml(request, 'vnf-information-list', false)
-
- def nnsRequestInformation = utils.removeXmlNamespaces(requestInformation)
- def nnsServiceInformation = utils.removeXmlNamespaces(serviceInformation)
- def nnsl2HomingInformation = utils.removeXmlNamespaces(l2HomingInformation)
- def nnsInternetEvcAccessInformation = utils.removeXmlNamespaces(internetEvcAccessInformation)
- def nnsVrLan = utils.removeXmlNamespaces(vrLan)
- def nnsUpceVmsServiceInfo = utils.removeXmlNamespaces(upceVmsServiceInfo)
- def nnsVnfInformationList = utils.removeXmlNamespaces(vrLan)
- def nnsinternetSvcChangeDetails = ""
-
- if(requestAction!=null && requestAction.equals("ChangeLayer3ServiceProvRequest")){
- def internetSvcChangeDetails = utils.removeXmlNamespaces(serviceParameters)
- nnsinternetSvcChangeDetails = """<internet-service-change-details>
- ${internetSvcChangeDetails}
- </internet-service-change-details>"""
- }
-
- if (additionalData == null) {
- additionalData = ""
- }
-
- if(isAic3) {
- nnsl2HomingInformation = updateHomingInfo(nnsl2HomingInformation, "AIC3.0")
- }
- else {
- nnsl2HomingInformation = updateHomingInfo(nnsl2HomingInformation, "AIC2.X")
- }
-
-
- String content = """
- <sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:sdncadapterworkflow="http://openecomp.com/mso/workflow/schema/v1"
- xmlns:sdncadapter="http://domain2.openecomp.com/workflow/sdnc/adapter/schema/v1">
- <sdncadapter:RequestHeader>
- <sdncadapter:RequestId>${requestId}</sdncadapter:RequestId>
- <sdncadapter:SvcInstanceId>${svcInstanceId}</sdncadapter:SvcInstanceId>
- <sdncadapter:SvcAction>${svcAction}</sdncadapter:SvcAction>
- <sdncadapter:SvcOperation>${svcOperation}</sdncadapter:SvcOperation>
- <sdncadapter:CallbackUrl>${callbackUrl}</sdncadapter:CallbackUrl>
- <sdncadapter:MsoAction>${msoAction}</sdncadapter:MsoAction>
- </sdncadapter:RequestHeader>
- <sdncadapterworkflow:SDNCRequestData>
- ${additionalData}
- ${nnsRequestInformation}
- ${nnsServiceInformation}
- ${nnsl2HomingInformation}
- ${nnsInternetEvcAccessInformation}
- ${nnsVrLan}
- ${nnsUpceVmsServiceInfo}
- ${nnsVnfInformationList}
- ${nnsinternetSvcChangeDetails}
- </sdncadapterworkflow:SDNCRequestData>
- </sdncadapterworkflow:SDNCAdapterWorkflowRequest>
- """
-
- content = utils.removeXmlPreamble(utils.formatXML(content))
- execution.setVariable(resultVar, content)
- taskProcessor.logDebug(resultVar + ' = ' + System.lineSeparator() + content, isDebugLogEnabled)
-
- taskProcessor.logDebug('Exited ' + method, isDebugLogEnabled)
- } catch (BpmnError e) {
- throw e;
- } catch (Exception e) {
- taskProcessor.logError('Caught exception in ' + method, e)
- exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error")
- }
- }
-
- public String updateHomingInfo(String homingInfo, String aicVersion) {
- String newHomingInfo
- if(homingInfo == null || homingInfo.trim().length() == 0) {
- newHomingInfo = "<l2-homing-information><aic-version>" + aicVersion + "</aic-version></l2-homing-information>"
- }
- else {
- newHomingInfo = homingInfo.substring(0, homingInfo.indexOf("</l2-homing-information>")) + "<aic-version>" + aicVersion + "</aic-version></l2-homing-information>"
- }
- }
-
- /**
- * Builds a topology SDNC request and return String request.
- * As V2 will use 1607-style request, region instead of aic clli code
- * @param execution, the execution
- * @param requestXML, the incoming request for the flow
- * @param serviceInstanceId, the serviceIntance (if available)
- * @param callbackUrl, the call back url
- * @param action, the action element value
- * @param requestAction the svcOperation element value
- * @param cloudRegionId the aai's cloud-region-id
- * @param networkId the aai's network-id
- * @param additionalData additional XML content to be inserted into the
- * RequestData element (may be null)
- */
- public String sdncTopologyRequestV2 (DelegateExecution execution, String requestXML, String serviceInstanceId, String callbackUrl, String action, String requestAction, String cloudRegionId, networkId, String queryAAIResponse, String additionalData) {
-
- def utils=new MsoUtils()
-
- // SNDC is expecting request Id for header as unique each call.
- String hdrRequestId = ""
- String testHdrRequestId = execution.getVariable("testMessageId") // for test purposes.
- if (testHdrRequestId == null) {
- hdrRequestId = UUID.randomUUID() // generate unique
- } else {
- hdrRequestId = testHdrRequestId
- }
-
- String requestId = ""
- try {
- requestId = execution.getVariable("mso-request-id")
- } catch (Exception ex) {
- requestId = utils.getNodeText1(requestXML, "request-id")
- }
-
- String aicCloudRegion = cloudRegionId
- String tenantId = ""
- if (utils.nodeExists(requestXML, "tenant-id")) {
- tenantId = utils.getNodeText1(requestXML, "tenant-id")
- }
- String networkType = ""
- if (utils.nodeExists(requestXML, "network-type")) {
- networkType = utils.getNodeText1(requestXML, "network-type")
- }
-
- // Replace/Use the value of network-type from aai query (vs input) during Delete Network flows.
- if (queryAAIResponse != null) {
- networkType = utils.getNodeText1(queryAAIResponse, "network-type")
- }
-
- String serviceId = ""
- if (utils.nodeExists(requestXML, "service-id")) {
- serviceId = utils.getNodeText1(requestXML, "service-id")
- }
- String networkName = ""
- if (utils.nodeExists(requestXML, "network-name")) {
- networkName = utils.getNodeText1(requestXML, "network-name")
- }
- String source = ""
- if (utils.nodeExists(requestXML, "source")) {
- source = utils.getNodeText1(requestXML, "source")
- }
-
- // get resourceLink from subflow execution variable
- String serviceType = ""
- String subscriberName = ""
- String siRelatedLink = execution.getVariable("GENGSI_siResourceLink")
- if (siRelatedLink != null) {
- // get service type
- int serviceStart = siRelatedLink.indexOf("service-subscription/")
- int serviceEnd = siRelatedLink.indexOf("/service-instances/")
- serviceType = siRelatedLink.substring(serviceStart + 21, serviceEnd)
- serviceType = UriUtils.decode(serviceType,"UTF-8")
- // get subscriber name
- int subscriberNameStart = siRelatedLink.indexOf("customers/customer/")
- int subscriberNameEnd = siRelatedLink.indexOf("/service-subscriptions/")
- subscriberName = siRelatedLink.substring(subscriberNameStart + 19, subscriberNameEnd)
- subscriberName = UriUtils.decode(subscriberName,"UTF-8")
- }
-
- String content =
- """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1"
- xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1"
- xmlns:sdncadapter="http://org.openecomp.mso/workflow/sdnc/adapter/schema/v1"
- xmlns:ns5="http://org.openecomp/mso/request/types/v1">
- <sdncadapter:RequestHeader>
- <sdncadapter:RequestId>${hdrRequestId}</sdncadapter:RequestId>
- <sdncadapter:SvcInstanceId>${serviceInstanceId}</sdncadapter:SvcInstanceId>
- <sdncadapter:SvcAction>${action}</sdncadapter:SvcAction>
- <sdncadapter:SvcOperation>network-topology-operation</sdncadapter:SvcOperation>
- <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl>
- </sdncadapter:RequestHeader>
- <sdncadapterworkflow:SDNCRequestData>
- <request-information>
- <request-id>${requestId}</request-id>
- <request-action>${requestAction}</request-action>
- <source>${source}</source>
- <notification-url></notification-url>
- <order-number></order-number>
- <order-version></order-version>
- </request-information>
- <service-information>
- <service-id>${serviceId}</service-id>
- <service-type>${serviceType}</service-type>
- <service-instance-id>${serviceInstanceId}</service-instance-id>
- <subscriber-name>${subscriberName}</subscriber-name>
- </service-information>
- <network-request-information>
- <network-id>${networkId}</network-id>
- <network-type>${networkType}</network-type>
- <network-name>${networkName}</network-name>
- <tenant>${tenantId}</tenant>
- <aic-cloud-region>${aicCloudRegion}</aic-cloud-region>
- </network-request-information>
- </sdncadapterworkflow:SDNCRequestData>
- </aetgt:SDNCAdapterWorkflowRequest>""".trim()
-
- return content
- }
-
- /**
- * Builds a topology SDNC request and return String request.
- * As V2 will use 1607-style request, region instead of aic clli code
- * @param execution, the execution
- * @param requestXML, the incoming request for the flow
- * @param serviceInstanceId, the serviceIntance (if available)
- * @param callbackUrl, the call back url
- * @param action, the action element value
- * @param requestAction the svcOperation element value
- * @param cloudRegionId the aai's cloud-region-id
- * @param networkId the aai's network-id
- * @param additionalData additional XML content to be inserted into the
- * RequestData element (may be null)
- */
- public String sdncTopologyRequestRsrc (DelegateExecution execution, String requestXML, String serviceInstanceId, String callbackUrl, String action, String requestAction, String cloudRegionId, networkId, String additionalData) {
-
- def utils=new MsoUtils()
-
- // SNDC is expecting request Id for header as unique each call.
- String hdrRequestId = ""
- String testHdrRequestId = execution.getVariable("testMessageId") // for test purposes.
- if (testHdrRequestId == null) {
- hdrRequestId = UUID.randomUUID() // generate unique
- } else {
- hdrRequestId = testHdrRequestId
- }
-
- String requestId = ""
- String testRequestId = execution.getVariable("testMessageId") // for test purposes.
- if (testRequestId == null) {
- requestId = execution.getVariable("mso-request-id")
- if (requestId == null) {
- requestId = execution.getVariable("msoRequestId")
- }
- } else {
- requestId = testRequestId
- }
-
- String aicCloudRegion = cloudRegionId
- String tenantId = ""
- if (utils.nodeExists(requestXML, "tenant-id")) {
- tenantId = utils.getNodeText1(requestXML, "tenant-id")
- }
- String networkType = ""
- if (utils.nodeExists(requestXML, "network-type")) {
- networkType = utils.getNodeText1(requestXML, "network-type")
- }
-
- String subscriptionServiceType = ""
- if (utils.nodeExists(requestXML, "subscription-service-type")) {
- subscriptionServiceType = utils.getNodeText1(requestXML, "subscription-service-type")
- }
-
- String globalCustomerId = ""
- if (utils.nodeExists(requestXML, "global-customer-id")) {
- globalCustomerId = utils.getNodeText1(requestXML, "global-customer-id")
- }
-
- String serviceId = ""
- if (utils.nodeExists(requestXML, "service-id")) {
- serviceId = utils.getNodeText1(requestXML, "service-id")
- }
- String networkName = ""
- if (utils.nodeExists(requestXML, "network-name")) {
- networkName = utils.getNodeText1(requestXML, "network-name")
- }
- String source = ""
- if (utils.nodeExists(requestXML, "source")) {
- source = utils.getNodeText1(requestXML, "source")
- }
-
- // get resourceLink from subflow execution variable
- String serviceType = ""
- String subscriberName = ""
- String siRelatedLink = execution.getVariable("GENGSI_siResourceLink")
- if (siRelatedLink != null) {
- // get service type
- int serviceStart = siRelatedLink.indexOf("service-subscription/")
- int serviceEnd = siRelatedLink.indexOf("/service-instances/")
- serviceType = siRelatedLink.substring(serviceStart + 21, serviceEnd)
- serviceType = UriUtils.decode(serviceType,"UTF-8")
- // get subscriber name
- int subscriberNameStart = siRelatedLink.indexOf("customers/customer/")
- int subscriberNameEnd = siRelatedLink.indexOf("/service-subscriptions/")
- subscriberName = siRelatedLink.substring(subscriberNameStart + 19, subscriberNameEnd)
- subscriberName = UriUtils.decode(subscriberName,"UTF-8")
- }
-
- // network-information from 'networkModelInfo' // verify the DB Catalog response
- String networkModelInfo = utils.getNodeXml(requestXML, "networkModelInfo", false).replace("tag0:","").replace(":tag0","")
- String modelInvariantUuid = utils.getNodeText1(networkModelInfo, "modelInvariantUuid") !=null ?
- utils.getNodeText1(networkModelInfo, "modelInvariantUuid") : ""
- String modelCustomizationUuid = utils.getNodeText1(networkModelInfo, "modelCustomizationUuid") !=null ?
- utils.getNodeText1(networkModelInfo, "modelCustomizationUuid") : ""
- String modelUuid = utils.getNodeText1(networkModelInfo, "modelUuid") !=null ?
- utils.getNodeText1(networkModelInfo, "modelUuid") : ""
- String modelVersion = utils.getNodeText1(networkModelInfo, "modelVersion") !=null ?
- utils.getNodeText1(networkModelInfo, "modelVersion") : ""
- String modelName = utils.getNodeText1(networkModelInfo, "modelName") !=null ?
- utils.getNodeText1(networkModelInfo, "modelName") : ""
-
- // service-information from 'networkModelInfo' // verify the DB Catalog response
- String serviceModelInfo = utils.getNodeXml(requestXML, "serviceModelInfo", false).replace("tag0:","").replace(":tag0","")
- String serviceModelInvariantUuid = utils.getNodeText1(serviceModelInfo, "modelInvariantUuid") !=null ?
- utils.getNodeText1(serviceModelInfo, "modelInvariantUuid") : ""
- String serviceModelUuid = utils.getNodeText1(serviceModelInfo, "modelUuid") !=null ?
- utils.getNodeText1(serviceModelInfo, "modelUuid") : ""
- String serviceModelVersion = utils.getNodeText1(serviceModelInfo, "modelVersion") !=null ?
- utils.getNodeText1(serviceModelInfo, "modelVersion") : ""
- String serviceModelName = utils.getNodeText1(serviceModelInfo, "modelName") !=null ?
- utils.getNodeText1(serviceModelInfo, "modelName") : ""
-
-
- String content =
- """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1"
- xmlns:sdncadapter="http://org.openecomp.mso/workflow/sdnc/adapter/schema/v1"
- xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1">
- <sdncadapter:RequestHeader>
- <sdncadapter:RequestId>${hdrRequestId}</sdncadapter:RequestId>
- <sdncadapter:SvcInstanceId>${serviceInstanceId}</sdncadapter:SvcInstanceId>
- <sdncadapter:SvcAction>${action}</sdncadapter:SvcAction>
- <sdncadapter:SvcOperation>network-topology-operation</sdncadapter:SvcOperation>
- <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl>
- <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction>
- </sdncadapter:RequestHeader>
- <sdncadapterworkflow:SDNCRequestData>
- <request-information>
- <request-id>${requestId}</request-id>
- <request-action>${requestAction}</request-action>
- <source>${source}</source>
- <notification-url></notification-url>
- <order-number></order-number>
- <order-version></order-version>
- </request-information>
- <service-information>
- <service-id>${serviceId}</service-id>
- <subscription-service-type>${subscriptionServiceType}</subscription-service-type>
- <onap-model-information>
- <model-invariant-uuid>${serviceModelInvariantUuid}</model-invariant-uuid>
- <model-uuid>${serviceModelUuid}</model-uuid>
- <model-version>${serviceModelVersion}</model-version>
- <model-name>${serviceModelName}</model-name>
- </onap-model-information>
- <service-instance-id>${serviceInstanceId}</service-instance-id>
- <global-customer-id>${globalCustomerId}</global-customer-id>
- <subscriber-name>${subscriberName}</subscriber-name>
- </service-information>
- <network-information>
- <network-id>${networkId}</network-id>
- <network-type>${networkType}</network-type>
- <onap-model-information>
- <model-invariant-uuid>${modelInvariantUuid}</model-invariant-uuid>
- <model-customization-uuid>${modelCustomizationUuid}</model-customization-uuid>
- <model-uuid>${modelUuid}</model-uuid>
- <model-version>${modelVersion}</model-version>
- <model-name>${modelName}</model-name>
- </onap-model-information>
- </network-information>
- <network-request-input>
- <network-name>${networkName}</network-name>
- <tenant>${tenantId}</tenant>
- <aic-cloud-region>${aicCloudRegion}</aic-cloud-region>
- <aic-clli></aic-clli>
- <network-input-parameters/>
- </network-request-input>
- </sdncadapterworkflow:SDNCRequestData>
- </aetgt:SDNCAdapterWorkflowRequest>""".trim()
-
- return content
- }
-
- /**
- * Validates a workflow response.
- * @param execution the execution
- * @param responseVar the execution variable in which the response is stored
- * @param workflowException the WorkflowException Object returned from sdnc call
- */
- public void validateSDNCResponse(DelegateExecution execution, String response, WorkflowException workflowException, boolean successIndicator){
-
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- taskProcessor.utils.log("DEBUG", "SDNC Response is: " + response, isDebugLogEnabled)
- taskProcessor.utils.log("DEBUG", "SuccessIndicator is: " + successIndicator, isDebugLogEnabled)
-
- try {
- def prefix = execution.getVariable('prefix')
- execution.setVariable(prefix+'sdncResponseSuccess', false)
- taskProcessor.utils.log("DEBUG", "Response" + ' = ' + (response == null ? "" : System.lineSeparator()) + response, isDebugLogEnabled)
-
- if (successIndicator){
- if (response == null || response.trim().equals("")) {
- taskProcessor.utils.log("DEBUG", response + ' is empty');
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, "SDNCAdapter Workflow Response is Empty")
- }else{
-
- // we need to peer into the request data for error
- def String sdncAdapterWorkflowResponse = taskProcessor.utils.getNodeXml(response, 'response-data', false)
- def String decodedXml = decodeXML(sdncAdapterWorkflowResponse).replace('<?xml version="1.0" encoding="UTF-8"?>', "")
-
- // change '&' to "& (if present as data, ex: subscriber-name = 'FOUR SEASONS HEATING & COOLING_8310006378683'
- decodedXml = decodedXml.replace("&", "&")
-
- taskProcessor.utils.log("DEBUG","decodedXml:\n" + decodedXml, isDebugLogEnabled)
-
- int requestDataResponseCode = 200
- def String requestDataResponseMessage = ''
-
- try{
- if (taskProcessor.utils.nodeExists(decodedXml, "response-message")) {
- requestDataResponseMessage = taskProcessor.utils.getNodeText(decodedXml, "response-message")
- } else if (taskProcessor.utils.nodeExists(decodedXml, "ResponseMessage")) {
- requestDataResponseMessage = taskProcessor.utils.getNodeText(decodedXml, "ResponseMessage")
- }
- }catch(Exception e){
- taskProcessor.utils.log("DEBUG", 'Error caught while decoding resposne ' + e.getMessage(), isDebugLogEnabled)
- }
-
- if(taskProcessor.utils.nodeExists(decodedXml, "response-code")) {
- taskProcessor.utils.log("DEBUG","response-code node Exist ", isDebugLogEnabled)
- String code = taskProcessor.utils.getNodeText1(decodedXml, "response-code")
- if(code.isEmpty() || code.equals("")){
- // if response-code is blank then Success
- taskProcessor.utils.log("DEBUG","response-code node is empty", isDebugLogEnabled)
- requestDataResponseCode = 0
- }else{
- requestDataResponseCode = code.toInteger()
- taskProcessor.utils.log("DEBUG","response-code is: " + requestDataResponseCode, isDebugLogEnabled)
- }
- }else if(taskProcessor.utils.nodeExists(decodedXml, "ResponseCode")){
- taskProcessor.utils.log("DEBUG","ResponseCode node Exist ", isDebugLogEnabled)
- String code = taskProcessor.utils.getNodeText1(decodedXml, "ResponseCode")
- if(code.isEmpty() || code.equals("")){
- // if ResponseCode blank then Success
- taskProcessor.utils.log("DEBUG","ResponseCode node is empty", isDebugLogEnabled)
- requestDataResponseCode = 0
- }else{
- requestDataResponseCode = code.toInteger()
- taskProcessor.utils.log("DEBUG","ResponseCode is: " + requestDataResponseCode, isDebugLogEnabled)
- }
- }else{
- taskProcessor.utils.log("DEBUG","A Response Code DOES NOT Exist.", isDebugLogEnabled)
- // if a response code does not exist then Success
- requestDataResponseCode = 0
- }
- try{
-
- execution.setVariable(prefix+'sdncRequestDataResponseCode', requestDataResponseCode.toString())
- // if a response code is 0 or 2XX then Success
- if ((requestDataResponseCode >= 200 && requestDataResponseCode <= 299) || requestDataResponseCode == 0) {
- execution.setVariable(prefix+'sdncResponseSuccess', true)
- taskProcessor.utils.log("DEBUG", "Setting sdncResponseSuccess to True ", isDebugLogEnabled)
- taskProcessor.utils.log("DEBUG", "Exited ValidateSDNCResponse Method", isDebugLogEnabled)
- }else{
- ExceptionUtil exceptionUtil = new ExceptionUtil()
- String convertedCode = exceptionUtil.MapSDNCResponseCodeToErrorCode(requestDataResponseCode.toString())
- int convertedCodeInt = Integer.parseInt(convertedCode)
- exceptionUtil.buildAndThrowWorkflowException(execution, convertedCodeInt, "Received error from SDN-C: " + requestDataResponseMessage)
- }
-
- }catch(Exception e){
- //TODO proper handling of new, non numerical response codes in 1607 and new error handling for common API
- requestDataResponseCode = 500
- }
-
- taskProcessor.utils.log("DEBUG", "SDNC callback response-code: " + requestDataResponseCode, isDebugLogEnabled)
- taskProcessor.utils.log("DEBUG", "SDNC callback response-message: " + requestDataResponseMessage, isDebugLogEnabled)
- }
-
- }else {
- taskProcessor.utils.log("DEBUG", 'SDNCAdapter Subflow did NOT complete Successfully. SuccessIndicator is False. ')
- if(workflowException != null){
- exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage())
- }else{
- //TODO : what error code and error message use here
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Internal Error - SDNCAdapter Subflow did NOT complete successfully.")
- }
- }
-
- } catch (BpmnError e) {
- throw e;
- } catch (Exception e) {
- taskProcessor.utils.log("DEBUG", 'END of Validate SDNC Response', isDebugLogEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, 'Internal Error- Unable to validate SDNC Response ');
- }
- }
-
- /**
- * Validates a workflow response.
- * @param execution the execution
- * @param responseVar the execution variable in which the response is stored
- * @param responseCodeVar the execution variable in which the response code is stored
- * @param errorResponseVar the execution variable in which the error response is stored
- */
- public void validateL3BondingSDNCResp(DelegateExecution execution, String response, WorkflowException workflowException, boolean success) {
-
- def method = getClass().getSimpleName() + '.validateL3BondingSDNCResp(' +
- 'execution=' + execution.getId() +
- ', response=' + response +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled)
- def prefix = execution.getVariable('prefix')
- TrinityExceptionUtil trinityExceptionUtil = new TrinityExceptionUtil()
-
- try {
- execution.setVariable(prefix+'sdncResponseSuccess', false)
-
- taskProcessor.utils.log("sdncAdapter Success Indicator is: " + success, isDebugLogEnabled)
- if (success) {
-
- // we need to look inside the request data for error
- def String callbackRequestData = taskProcessor.utils.getNodeXml(response, 'RequestData', false)
- def String decodedXml = decodeXML(callbackRequestData)
- taskProcessor.utils.log("DEBUG","decodedXml:\n" + decodedXml, isDebugLogEnabled)
-
- def requestDataResponseCode = '200'
- def requestDataResponseMessage = ''
- int intDataResponseCode = 200
-
- if (taskProcessor.utils.nodeExists(decodedXml, "response-code")) {
-
- requestDataResponseCode = ((String) taskProcessor.utils.getNodeText(decodedXml, "response-code"))
- if (taskProcessor.utils.nodeExists(decodedXml, "response-message")) {
- requestDataResponseMessage = taskProcessor.utils.getNodeText(decodedXml, "response-message")
- }
- }else if(taskProcessor.utils.nodeExists(decodedXml, "ResponseCode")){
- requestDataResponseCode = ((String) taskProcessor.utils.getNodeText1(decodedXml, "ResponseCode")).toInteger()
- }else if(taskProcessor.utils.nodeExists(response, "ResponseCode")){
- requestDataResponseCode = ((String) taskProcessor.utils.getNodeText1(response, "ResponseCode")).toInteger()
- requestDataResponseMessage = taskProcessor.utils.getNodeText(response, "ResponseMessage")
- }
-
- taskProcessor.utils.log("DEBUG", "SDNC callback response-code: " + requestDataResponseCode, isDebugLogEnabled)
- taskProcessor.utils.log("DEBUG", "SDNC callback response-message: " + requestDataResponseMessage, isDebugLogEnabled)
-
- // Get the AAI Status to determine if rollback is needed on ASSIGN
- def aai_status = ''
- if (taskProcessor.utils.nodeExists(decodedXml, "aai-status")) {
- aai_status = ((String) taskProcessor.utils.getNodeText(decodedXml, "aai-status"))
- taskProcessor.utils.log("DEBUG", "SDNC sent AAI STATUS code: " + aai_status, isDebugLogEnabled)
- }
- if (aai_status != null && !aai_status.equals("")) {
- execution.setVariable(prefix+"AaiStatus",aai_status)
- taskProcessor.utils.log("DEBUG", "Set variable " + prefix + "AaiStatus: " + execution.getVariable(prefix+"AaiStatus"), isDebugLogEnabled)
- }
-
- // Get the result string to determine if rollback is needed on ASSIGN in Add Bonding flow only
- def sdncResult = ''
- if (taskProcessor.utils.nodeExists(decodedXml, "result")) {
- sdncResult = ((String) taskProcessor.utils.getNodeText(decodedXml, "result"))
- taskProcessor.utils.log("DEBUG", "SDNC sent result: " + sdncResult, isDebugLogEnabled)
- }
- if (sdncResult != null && !sdncResult.equals("")) {
- execution.setVariable(prefix+"SdncResult",sdncResult)
- taskProcessor.utils.log("DEBUG", "Set variable " + prefix + "SdncResult: " + execution.getVariable(prefix+"SdncResult"), isDebugLogEnabled)
- }
-
- try{
- intDataResponseCode = Integer.parseInt(String.valueOf(requestDataResponseCode))
- }catch(Exception e){
- intDataResponseCode = 400
- }
-
- taskProcessor.utils.log("DEBUG", "intDataResponseCode " + intDataResponseCode , isDebugLogEnabled)
-
- // if response-code is not Success (200, 201, etc) we need to throw an exception
- if ((intDataResponseCode < 200 || intDataResponseCode > 299) && intDataResponseCode != 0) {
- execution.setVariable(prefix+'ResponseCode', intDataResponseCode)
- execution.setVariable("L3HLAB_rollback", true)
- def msg = trinityExceptionUtil.mapSDNCAdapterExceptionToErrorResponse(response, execution)
- exceptionUtil.buildAndThrowWorkflowException(execution, intDataResponseCode, "Received error from SDN-C: " + msg)
-
- }
- }else {
- taskProcessor.logWarn('sdncAdapter did not complete successfully, sdncAdapter Success Indicator was false ')
- execution.setVariable("L3HLAB_rollback", true)
- def msg = trinityExceptionUtil.mapSDNCAdapterExceptionToErrorResponse(response, execution)
- exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, msg)
- }
-
- if (response == null || response.trim().equals("")) {
- taskProcessor.logWarn('sdncAdapter workflow response is empty');
- execution.setVariable("L3HLAB_rollback", true)
- def msg = trinityExceptionUtil.buildException("Exception occurred while validating SDNC response " , execution)
- exceptionUtil.buildAndThrowWorkflowException(execution, intResponseCode, msg)
- }
-
- execution.setVariable(prefix+'sdncResponseSuccess', true)
- taskProcessor.logDebug('Exited ' + method, isDebugLogEnabled)
- } catch (BpmnError e) {
- throw e;
- } catch (Exception e) {
- taskProcessor.logError('Caught exception in ' + method, e)
- execution.setVariable(prefix+"ResponseCode",400)
- execution.setVariable("L3HLAB_rollback", true)
- def msg = trinityExceptionUtil.buildException("Exception occurred while validating SDNC response: " + e.getMessage(), execution)
- exceptionUtil.buildAndThrowWorkflowException(execution, 400, msg)
- }
- }
-
- public String modelInfoToEcompModelInformation(String jsonModelInfo) {
- String modelInvariantUuid = jsonUtil.getJsonValue(jsonModelInfo, "modelInvariantUuid")
- String modelUuid = jsonUtil.getJsonValue(jsonModelInfo, "modelUuid")
- if (modelUuid == null) {
- modelUuid = ""
- }
- String modelCustomizationUuid = jsonUtil.getJsonValue(jsonModelInfo, "modelCustomizationUuid")
- String modelCustomizationString = ""
- if (modelCustomizationUuid != null) {
- modelCustomizationString = "<model-customization-uuid>${modelCustomizationUuid}</model-customization-uuid>"
- }
- String modelVersion = jsonUtil.getJsonValue(jsonModelInfo, "modelVersion")
- if (modelVersion == null) {
- modelVersion = ""
- }
- String modelName = jsonUtil.getJsonValue(jsonModelInfo, "modelName")
- String ecompModelInformation =
- """<onap-model-information>
- <model-invariant-uuid>${modelInvariantUuid}</model-invariant-uuid>
- <model-uuid>${modelUuid}</model-uuid>
- ${modelCustomizationString}
- <model-version>${modelVersion}</model-version>
- <model-name>${modelName}</model-name>
- </onap-model-information>"""
-
- return ecompModelInformation
- }
-
- /**
- * Decode XML - replace & < and > with '&', '<' and '>'
- * @param xml - the xml to be decoded
- */
- private String decodeXML(String xml) {
- def String decodedXml = xml.replaceAll("&", "&")
- decodedXml = decodedXml.replaceAll("<", "<")
- decodedXml = decodedXml.replaceAll(">", ">")
- }
-
-
-
-}
+/*- + * ============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.common.scripts; + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.json.JsonUtils; +import org.springframework.web.util.UriUtils +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + + + + +/** + * @version 1.0 + * + */ +class SDNCAdapterUtils { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SDNCAdapterUtils.class); + + + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + + private AbstractServiceTaskProcessor taskProcessor + + public SDNCAdapterUtils(AbstractServiceTaskProcessor taskProcessor) { + this.taskProcessor = taskProcessor + } + + String SDNCAdapterFeatureRequest(DelegateExecution execution, String requestName, String action, String callbackURL, String serviceOperation, String timeoutValueInMinutes) { + def utils=new MsoUtils() + + def prefix = execution.getVariable('prefix') + def request = taskProcessor.getVariable(execution, requestName) + def requestInformation = utils.getNodeXml(request, 'request-information', false) + def serviceInformation = utils.getNodeXml(request, 'service-information', false) + def featureInformation = utils.getNodeXml(request, 'feature-information', false) + def featureParameters = utils.getNodeXml(request, 'feature-parameters', false) + + def requestId = execution.getVariable('testReqId') // for junits + if(requestId==null){ + requestId = execution.getVariable("mso-request-id") + "-" + System.currentTimeMillis() + } + + def svcInstanceId = execution.getVariable("mso-service-instance-id") + + def nnsRequestInformation = utils.removeXmlNamespaces(requestInformation) + def nnsServiceInformation = utils.removeXmlNamespaces(serviceInformation) + def nnsFeatureInformation = utils.removeXmlNamespaces(featureInformation) + def nnsFeatureParameters = utils.removeXmlNamespaces(featureParameters) + + String sdncAdapterFeatureRequest = """ + <sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:sdncadapterworkflow="http://openecomp.com/mso/workflow/schema/v1" + xmlns:sdncadapter="http://domain2.openecomp.com/workflow/sdnc/adapter/schema/v1"> + <sdncadapter:RequestHeader> + <sdncadapter:RequestId>${MsoUtils.xmlEscape(requestId)}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(svcInstanceId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${MsoUtils.xmlEscape(action)}</sdncadapter:SvcAction> + <sdncadapter:SvcOperation>${MsoUtils.xmlEscape(serviceOperation)}</sdncadapter:SvcOperation> + <sdncadapter:CallbackUrl>${MsoUtils.xmlEscape(callbackURL)}</sdncadapter:CallbackUrl> + </sdncadapter:RequestHeader> + <sdncadapterworkflow:SDNCRequestData> + ${nnsRequestInformation} + ${nnsServiceInformation} + ${nnsFeatureInformation} + ${nnsFeatureParameters} + </sdncadapterworkflow:SDNCRequestData> + <sdncadapterworkflow:SDNCTimeOutValueInMinutes>${MsoUtils.xmlEscape(timeoutValueInMinutes)}</sdncadapterworkflow:SDNCTimeOutValueInMinutes> + </sdncadapterworkflow:SDNCAdapterWorkflowRequest> + """ + sdncAdapterFeatureRequest = utils.removeXmlPreamble(utils.formatXML(sdncAdapterFeatureRequest)) + return sdncAdapterFeatureRequest + } + + String SDNCAdapterActivateVnfRequest(DelegateExecution execution, String action, String callbackURL, String serviceOperation, String msoAction, String timeoutValueInMinutes) { + def utils=new MsoUtils() + + def prefix = execution.getVariable('prefix') + def request = taskProcessor.getVariable(execution, prefix+'Request') + def requestInformation = utils.getNodeXml(request, 'request-information', false) + def serviceInformation = utils.getNodeXml(request, 'service-information', false) + def vnfInformationList = utils.getNodeXml(request, 'vnf-information-list', false) + + def requestId = execution.getVariable('testReqId') // for junits + if(requestId==null){ + requestId = execution.getVariable("mso-request-id") + "-" + System.currentTimeMillis() + } + + def svcInstanceId = execution.getVariable("mso-service-instance-id") + + def nnsRequestInformation = utils.removeXmlNamespaces(requestInformation) + def nnsServiceInformation = utils.removeXmlNamespaces(serviceInformation) + def nnsVnfInformationList = utils.removeXmlNamespaces(vnfInformationList) + + String sdncAdapterActivateVnfRequest = """ + <sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:sdncadapterworkflow="http://openecomp.com/mso/workflow/schema/v1" + xmlns:sdncadapter="http://domain2.openecomp.com/workflow/sdnc/adapter/schema/v1"> + <sdncadapter:RequestHeader> + <sdncadapter:RequestId>${MsoUtils.xmlEscape(requestId)}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(svcInstanceId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${MsoUtils.xmlEscape(action)}</sdncadapter:SvcAction> + <sdncadapter:SvcOperation>${MsoUtils.xmlEscape(serviceOperation)}</sdncadapter:SvcOperation> + <sdncadapter:CallbackUrl>${MsoUtils.xmlEscape(callbackURL)}</sdncadapter:CallbackUrl> + <sdncadapter:MsoAction>${MsoUtils.xmlEscape(msoAction)}</sdncadapter:MsoAction> + </sdncadapter:RequestHeader> + <sdncadapterworkflow:SDNCRequestData> + ${nnsRequestInformation} + ${nnsServiceInformation} + ${nnsVnfInformationList} + </sdncadapterworkflow:SDNCRequestData> + <sdncadapterworkflow:SDNCTimeOutValueInMinutes>${MsoUtils.xmlEscape(timeoutValueInMinutes)}</sdncadapterworkflow:SDNCTimeOutValueInMinutes> + </sdncadapterworkflow:SDNCAdapterWorkflowRequest> + """ + sdncAdapterActivateVnfRequest = utils.removeXmlPreamble(utils.formatXML(sdncAdapterActivateVnfRequest)) + return sdncAdapterActivateVnfRequest + } + + String SDNCAdapterL3ToHigherLayerRequest(DelegateExecution execution, String action, String callbackURL, String serviceOperation, String timeoutValueInMinutes) { + def utils=new MsoUtils() + + def prefix = execution.getVariable('prefix') + def request = taskProcessor.getVariable(execution, prefix+'Request') + + def requestInformation = """<request-information> + <request-id>${MsoUtils.xmlEscape(execution.getVariable("mso-request-id"))}</request-id> + <request-action>torepl</request-action> + <source>${MsoUtils.xmlEscape(execution.getVariable(prefix+"source"))}</source> + <notification-url>${MsoUtils.xmlEscape(execution.getVariable(prefix+"notificationUrl"))}</notification-url> + </request-information>""" + + // Change the value of the 'request-information'.'request-action' element + def xml = new XmlSlurper().parseText(requestInformation) + if("assign".equalsIgnoreCase(action)){ + xml.'request-action'.replaceBody('createTrinityBonding') + }else if("activate".equalsIgnoreCase(action)){ + xml.'request-action'.replaceBody('activateTrinityBonding') + }else if("delete".equalsIgnoreCase(action)){ + xml.'request-action'.replaceBody('deleteTrinityBonding') + } + requestInformation = utils.removeXmlPreamble(groovy.xml.XmlUtil.serialize(xml)) + def nnsRequestInformation = utils.removeXmlNamespaces(requestInformation) + + def requestId = execution.getVariable('testReqId') // for junits + if(requestId==null){ + requestId = execution.getVariable("mso-request-id") + "-" + System.currentTimeMillis() + } + + def svcInstanceId = execution.getVariable("mso-service-instance-id") + + //Build Service Information + // Send serviceName from CANOPI to sdnc for service-type + def serviceInformation = """<service-information> + <service-type>${MsoUtils.xmlEscape(execution.getVariable(prefix+"serviceName"))}</service-type> + <service-instance-id>${MsoUtils.xmlEscape(svcInstanceId)}</service-instance-id> + <subscriber-name>${MsoUtils.xmlEscape(execution.getVariable(prefix+"subscriberName"))}</subscriber-name> + <subscriber-global-id>${MsoUtils.xmlEscape(execution.getVariable(prefix+"subscriberGlobalId"))}</subscriber-global-id> + </service-information>""" + + //Build Additional Information - vpn or vni + // Send serviceType from CANOPI to SDNC for nbnc-request-information service-type + def service = execution.getVariable(prefix+"serviceType") + def customerId = execution.getVariable(prefix+"customerId") + def vpnId = execution.getVariable(prefix+"vpnId") + def vpnRt = execution.getVariable(prefix+"vpnRt") + def vpnService = execution.getVariable(prefix+"vpnService") + def vpnRegion = execution.getVariable(prefix+"vpnRegion") + def additionalInfo = "" + if("assign".equalsIgnoreCase(action)){ + additionalInfo = """<vpn-data-list> + <vpn-id>${MsoUtils.xmlEscape(vpnId)}</vpn-id> + <vpn-rt>${MsoUtils.xmlEscape(vpnRt)}</vpn-rt> + <vpn-service>${MsoUtils.xmlEscape(vpnService)}</vpn-service> + <vpn-region>${MsoUtils.xmlEscape(vpnRegion)}</vpn-region> + </vpn-data-list>""" + }else if("activate".equalsIgnoreCase(action) || "delete".equalsIgnoreCase(action)){ + def vniId = execution.getVariable(prefix+'vniId') + additionalInfo = "<vni-id>${MsoUtils.xmlEscape(vniId)}</vni-id>" + } + + //Set Interface Status + def interfaceStatus = "DISABLE" + if("activate".equalsIgnoreCase(action)){ + interfaceStatus = "ENABLE" + } + + //Build SDNC Adapter Request + String sdncAdapterL3ToHLRequest = """ + <sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:sdncadapterworkflow="http://openecomp.com/mso/workflow/schema/v1" + xmlns:sdncadapter="http://domain2.openecomp.com/workflow/sdnc/adapter/schema/v1"> + <sdncadapter:RequestHeader> + <sdncadapter:RequestId>${MsoUtils.xmlEscape(requestId)}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(svcInstanceId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${MsoUtils.xmlEscape(action)}</sdncadapter:SvcAction> + <sdncadapter:SvcOperation>${MsoUtils.xmlEscape(serviceOperation)}</sdncadapter:SvcOperation> + <sdncadapter:CallbackUrl>${MsoUtils.xmlEscape(callbackURL)}</sdncadapter:CallbackUrl> + </sdncadapter:RequestHeader> + <sdncadapterworkflow:SDNCRequestData> + ${nnsRequestInformation} + ${serviceInformation} + <nbnc-request-information> + <service-type>${MsoUtils.xmlEscape(service)}</service-type> + <customer-id>${MsoUtils.xmlEscape(customerId)}</customer-id> + <interface-status>${MsoUtils.xmlEscape(interfaceStatus)}</interface-status> + ${additionalInfo} + </nbnc-request-information> + </sdncadapterworkflow:SDNCRequestData> + <sdncadapterworkflow:SDNCTimeOutValueInMinutes>${MsoUtils.xmlEscape(timeoutValueInMinutes)}</sdncadapterworkflow:SDNCTimeOutValueInMinutes> + </sdncadapterworkflow:SDNCAdapterWorkflowRequest> + """ + sdncAdapterL3ToHLRequest = utils.removeXmlPreamble(utils.formatXML(sdncAdapterL3ToHLRequest)) + + return sdncAdapterL3ToHLRequest + } + + + + private void SDNCAdapterActivateRequest(DelegateExecution execution, String resultVar, String svcAction, + String svcOperation, String additionalData) { + def utils=new MsoUtils() + + def prefix = execution.getVariable('prefix') + def request = taskProcessor.getVariable(execution, prefix+'Request') + def requestInformation = utils.getNodeXml(request, 'request-information', false) + def serviceInformation = utils.getNodeXml(request, 'service-information', false) + def serviceParameters = utils.getNodeXml(request, 'service-parameters', false) + + def requestId = execution.getVariable('testReqId') // for junits + if(requestId==null){ + requestId = execution.getVariable("mso-request-id") + "-" + System.currentTimeMillis() + } + + def svcInstanceId = execution.getVariable("mso-service-instance-id") + def msoAction = 'gammainternet' + + def timeoutInMinutes = UrnPropertiesReader.getVariable('mso.sdnc.timeout.firewall.minutes',execution) + + def callbackUrl = (String)UrnPropertiesReader.getVariable('mso.workflow.sdncadapter.callback',execution) + if (callbackUrl == null || callbackUrl.trim() == "") { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'mso:workflow:sdncadapter:callback URN is not set', "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + workflowException(execution, 'Internal Error', 9999) // TODO: what message and error code? + } + + def l2HomingInformation = utils.getNodeXml(serviceParameters, 'l2-homing-information', false) + def internetEvcAccessInformation = utils.getNodeXml(serviceParameters, 'internet-evc-access-information', false) + def vrLan = utils.getNodeXml(serviceParameters, 'vr-lan', false) + def upceVmsServiceInformation = utils.getNodeXml(serviceParameters, 'ucpe-vms-service-information', false) + + + def nnsRequestInformation = utils.removeXmlNamespaces(requestInformation) + def nnsServiceInformation = utils.removeXmlNamespaces(serviceInformation) + def nnsl2HomingInformation = utils.removeXmlNamespaces(l2HomingInformation) + def nnsInternetEvcAccessInformation = utils.removeXmlNamespaces(internetEvcAccessInformation) + def nnsVrLan = utils.removeXmlNamespaces(vrLan) + def nnsUpceVmsServiceInformation = utils.removeXmlNamespaces(upceVmsServiceInformation) + + if (additionalData == null) { + additionalData = "" + } + + boolean isAic3 = execution.getVariable("isAic3") + + if(isAic3) { + nnsl2HomingInformation = updateHomingInfo(nnsl2HomingInformation, "AIC3.0") + } + else { + nnsl2HomingInformation = updateHomingInfo(nnsl2HomingInformation, "AIC2.X") + } + + String content = """ + <sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:sdncadapterworkflow="http://openecomp.com/mso/workflow/schema/v1" + xmlns:sdncadapter="http://domain2.openecomp.com/workflow/sdnc/adapter/schema/v1"> + <sdncadapter:RequestHeader> + <sdncadapter:RequestId>${MsoUtils.xmlEscape(requestId)}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(svcInstanceId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${MsoUtils.xmlEscape(svcAction)}</sdncadapter:SvcAction> + <sdncadapter:SvcOperation>${MsoUtils.xmlEscape(svcOperation)}</sdncadapter:SvcOperation> + <sdncadapter:CallbackUrl>${MsoUtils.xmlEscape(callbackUrl)}</sdncadapter:CallbackUrl> + <sdncadapter:MsoAction>${MsoUtils.xmlEscape(msoAction)}</sdncadapter:MsoAction> + </sdncadapter:RequestHeader> + <sdncadapterworkflow:SDNCRequestData> + ${additionalData} + ${nnsRequestInformation} + ${nnsServiceInformation} + ${nnsl2HomingInformation} + ${nnsInternetEvcAccessInformation} + ${nnsVrLan} + ${nnsUpceVmsServiceInformation} + </sdncadapterworkflow:SDNCRequestData> + <sdncadapterworkflow:SDNCTimeOutValueInMinutes>${MsoUtils.xmlEscape(timeoutInMinutes)}</sdncadapterworkflow:SDNCTimeOutValueInMinutes> + </sdncadapterworkflow:SDNCAdapterWorkflowRequest> + """ + + content = utils.removeXmlPreamble(utils.formatXML(content)) + execution.setVariable(resultVar, content) + } + + /** + * Builds an SDNC "reserve" request and stores it in the specified execution + * variable. + * @param execution the execution + * @param action the type of action: reserve, turnup, etc + * @param resultVar the execution variable in which the result will be stored + */ + public void sdncReservePrep(DelegateExecution execution, String action, String resultVar) { + sdncReservePrep(execution, action, resultVar, false) + } + + /** + * Builds an SDNC "reserve" request and stores it in the specified execution + * variable. + * @param execution the execution + * @param action the type of action: reserve, turnup, etc + * @param resultVar the execution variable in which the result will be stored + * @param isAic3 boolean to indicate whether request is for AIC3.0 + */ + public void sdncReservePrep(DelegateExecution execution, String action, String resultVar, boolean isAic3) { + sdncPrep(execution, resultVar, action , 'service-configuration-operation', null, isAic3, this.taskProcessor) + } + + /** + * Builds a basic SDNC request and stores it in the specified execution variable. + * @param execution the execution + * @param resultVar the execution variable in which the result will be stored + * @param svcAction the svcAction element value + * @param svcOperation the svcOperation element value + * @param additionalData additional XML content to be inserted into the + * RequestData element (may be null) + */ + public void sdncPrep(DelegateExecution execution, String resultVar, String svcAction, + String svcOperation, String additionalData, AbstractServiceTaskProcessor taskProcessor) { + sdncPrep(execution, resultVar, svcAction, svcOperation, additionalData, false, taskProcessor) + } + + /** + * Builds a basic SDNC request and stores it in the specified execution variable. + * @param execution the execution + * @param resultVar the execution variable in which the result will be stored + * @param svcAction the svcAction element value + * @param svcOperation the svcOperation element value + * @param additionalData additional XML content to be inserted into the RequestData element (may be null) + * @param isAic3 boolean to indicate whether request is for AIC3.0 + */ + public void sdncPrep(DelegateExecution execution, String resultVar, String svcAction, + String svcOperation, String additionalData, boolean isAic3, AbstractServiceTaskProcessor taskProcessor) { + def method = getClass().getSimpleName() + '.sdncPrep(' + + 'execution=' + execution.getId() + + ', resultVar=' + resultVar + + ', svcAction=' + svcAction + + ', svcOperation=' + svcOperation + + ', additionalData=' + (additionalData == null ? "no" : "yes") + + ')' + + msoLogger.trace('Entered ' + method) + MsoUtils utils = taskProcessor.utils + try { + def prefix = execution.getVariable('prefix') + def request = taskProcessor.getVariable(execution, prefix+'Request') + def requestInformation = utils.getNodeXml(request, 'request-information', false) + def serviceInformation = utils.getNodeXml(request, 'service-information', false) + def serviceParameters = utils.getChildNodes(request, 'service-parameters') + def requestAction = utils.getNodeText(request, 'request-action') + + def timeoutInMinutes = UrnPropertiesReader.getVariable('mso.sdnc.timeout.firewall.minutes',execution) + + def requestId = execution.getVariable('testReqId') // for junits + if(requestId==null){ + requestId = execution.getVariable("mso-request-id") + "-" + System.currentTimeMillis() + } + + def svcInstanceId = execution.getVariable("mso-service-instance-id") + def msoAction = 'gammainternet' + + def callbackUrl = (String)UrnPropertiesReader.getVariable('mso.workflow.sdncadapter.callback',execution) + if (callbackUrl == null || callbackUrl.trim() == "") { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'mso:workflow:sdncadapter:callback URN is not set', "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Internal Error - During PreProcess Request") + } + + def l2HomingInformation = utils.getNodeXml(request, 'l2-homing-information', false) + def internetEvcAccessInformation = utils.getNodeXml(request, 'internet-evc-access-information', false) + def vrLan = utils.getNodeXml(request, 'vr-lan', false) + def upceVmsServiceInfo = utils.getNodeXml(request, 'ucpe-vms-service-information', false) + def vnfInformationList = utils.getNodeXml(request, 'vnf-information-list', false) + + def nnsRequestInformation = utils.removeXmlNamespaces(requestInformation) + def nnsServiceInformation = utils.removeXmlNamespaces(serviceInformation) + def nnsl2HomingInformation = utils.removeXmlNamespaces(l2HomingInformation) + def nnsInternetEvcAccessInformation = utils.removeXmlNamespaces(internetEvcAccessInformation) + def nnsVrLan = utils.removeXmlNamespaces(vrLan) + def nnsUpceVmsServiceInfo = utils.removeXmlNamespaces(upceVmsServiceInfo) + def nnsVnfInformationList = utils.removeXmlNamespaces(vrLan) + def nnsinternetSvcChangeDetails = "" + + if(requestAction!=null && requestAction.equals("ChangeLayer3ServiceProvRequest")){ + def internetSvcChangeDetails = utils.removeXmlNamespaces(serviceParameters) + nnsinternetSvcChangeDetails = """<internet-service-change-details> + ${internetSvcChangeDetails} + </internet-service-change-details>""" + } + + if (additionalData == null) { + additionalData = "" + } + + if(isAic3) { + nnsl2HomingInformation = updateHomingInfo(nnsl2HomingInformation, "AIC3.0") + } + else { + nnsl2HomingInformation = updateHomingInfo(nnsl2HomingInformation, "AIC2.X") + } + + + String content = """ + <sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:sdncadapterworkflow="http://openecomp.com/mso/workflow/schema/v1" + xmlns:sdncadapter="http://domain2.openecomp.com/workflow/sdnc/adapter/schema/v1"> + <sdncadapter:RequestHeader> + <sdncadapter:RequestId>${MsoUtils.xmlEscape(requestId)}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(svcInstanceId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${MsoUtils.xmlEscape(svcAction)}</sdncadapter:SvcAction> + <sdncadapter:SvcOperation>${MsoUtils.xmlEscape(svcOperation)}</sdncadapter:SvcOperation> + <sdncadapter:CallbackUrl>${MsoUtils.xmlEscape(callbackUrl)}</sdncadapter:CallbackUrl> + <sdncadapter:MsoAction>${MsoUtils.xmlEscape(msoAction)}</sdncadapter:MsoAction> + </sdncadapter:RequestHeader> + <sdncadapterworkflow:SDNCRequestData> + ${additionalData} + ${nnsRequestInformation} + ${nnsServiceInformation} + ${nnsl2HomingInformation} + ${nnsInternetEvcAccessInformation} + ${nnsVrLan} + ${nnsUpceVmsServiceInfo} + ${nnsVnfInformationList} + ${nnsinternetSvcChangeDetails} + </sdncadapterworkflow:SDNCRequestData> + </sdncadapterworkflow:SDNCAdapterWorkflowRequest> + """ + + content = utils.removeXmlPreamble(utils.formatXML(content)) + execution.setVariable(resultVar, content) + msoLogger.debug(resultVar + ' = ' + System.lineSeparator() + content) + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error") + } + } + + public String updateHomingInfo(String homingInfo, String aicVersion) { + String newHomingInfo + if(homingInfo == null || homingInfo.trim().length() == 0) { + newHomingInfo = "<l2-homing-information><aic-version>" + aicVersion + "</aic-version></l2-homing-information>" + } + else { + newHomingInfo = homingInfo.substring(0, homingInfo.indexOf("</l2-homing-information>")) + "<aic-version>" + aicVersion + "</aic-version></l2-homing-information>" + } + } + + /** + * Builds a topology SDNC request and return String request. + * As V2 will use 1607-style request, region instead of aic clli code + * @param execution, the execution + * @param requestXML, the incoming request for the flow + * @param serviceInstanceId, the serviceIntance (if available) + * @param callbackUrl, the call back url + * @param action, the action element value + * @param requestAction the svcOperation element value + * @param cloudRegionId the aai's cloud-region-id + * @param networkId the aai's network-id + * @param additionalData additional XML content to be inserted into the + * RequestData element (may be null) + */ + public String sdncTopologyRequestV2 (DelegateExecution execution, String requestXML, String serviceInstanceId, String callbackUrl, String action, String requestAction, String cloudRegionId, networkId, String queryAAIResponse, String additionalData) { + def utils=new MsoUtils() + + // SNDC is expecting request Id for header as unique each call. + String hdrRequestId = "" + String testHdrRequestId = execution.getVariable("testMessageId") // for test purposes. + if (testHdrRequestId == null) { + hdrRequestId = UUID.randomUUID() // generate unique + } else { + hdrRequestId = testHdrRequestId + } + + String requestId = "" + try { + requestId = execution.getVariable("mso-request-id") + } catch (Exception ex) { + requestId = utils.getNodeText(requestXML, "request-id") + } + + String aicCloudRegion = cloudRegionId + String tenantId = "" + if (utils.nodeExists(requestXML, "tenant-id")) { + tenantId = utils.getNodeText(requestXML, "tenant-id") + } + String networkType = "" + if (utils.nodeExists(requestXML, "network-type")) { + networkType = utils.getNodeText(requestXML, "network-type") + } + + // Replace/Use the value of network-type from aai query (vs input) during Delete Network flows. + if (queryAAIResponse != null) { + networkType = utils.getNodeText(queryAAIResponse, "network-type") + } + + String serviceId = "" + if (utils.nodeExists(requestXML, "service-id")) { + serviceId = utils.getNodeText(requestXML, "service-id") + } + String networkName = "" + // Replace/Use the value of network-name from aai query (vs input) if it was already set in AAI + if (queryAAIResponse != null) { + networkName = utils.getNodeText(queryAAIResponse, "network-name") + } + if (networkName.isEmpty() && utils.nodeExists(requestXML, "network-name")) { + networkName = utils.getNodeText(requestXML, "network-name") + } + String source = "" + if (utils.nodeExists(requestXML, "source")) { + source = utils.getNodeText(requestXML, "source") + } + + // get resourceLink from subflow execution variable + String serviceType = "" + String subscriberName = "" + String siRelatedLink = execution.getVariable("GENGSI_siResourceLink") + if (siRelatedLink != null) { + // get service type + int serviceStart = siRelatedLink.indexOf("service-subscription/") + int serviceEnd = siRelatedLink.indexOf("/service-instances/") + serviceType = siRelatedLink.substring(serviceStart + 21, serviceEnd) + serviceType = UriUtils.decode(serviceType,"UTF-8") + // get subscriber name + int subscriberNameStart = siRelatedLink.indexOf("customers/customer/") + int subscriberNameEnd = siRelatedLink.indexOf("/service-subscriptions/") + subscriberName = siRelatedLink.substring(subscriberNameStart + 19, subscriberNameEnd) + subscriberName = UriUtils.decode(subscriberName,"UTF-8") + } + + String content = + """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" + xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1" + xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" + xmlns:ns5="http://org.onap/so/request/types/v1"> + <sdncadapter:RequestHeader> + <sdncadapter:RequestId>${MsoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${MsoUtils.xmlEscape(action)}</sdncadapter:SvcAction> + <sdncadapter:SvcOperation>network-topology-operation</sdncadapter:SvcOperation> + <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> + </sdncadapter:RequestHeader> + <sdncadapterworkflow:SDNCRequestData> + <request-information> + <request-id>${MsoUtils.xmlEscape(requestId)}</request-id> + <request-action>${MsoUtils.xmlEscape(requestAction)}</request-action> + <source>${MsoUtils.xmlEscape(source)}</source> + <notification-url></notification-url> + <order-number></order-number> + <order-version></order-version> + </request-information> + <service-information> + <service-id>${MsoUtils.xmlEscape(serviceId)}</service-id> + <service-type>${MsoUtils.xmlEscape(serviceType)}</service-type> + <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> + <subscriber-name>${MsoUtils.xmlEscape(subscriberName)}</subscriber-name> + </service-information> + <network-request-information> + <network-id>${MsoUtils.xmlEscape(networkId)}</network-id> + <network-type>${MsoUtils.xmlEscape(networkType)}</network-type> + <network-name>${MsoUtils.xmlEscape(networkName)}</network-name> + <tenant>${MsoUtils.xmlEscape(tenantId)}</tenant> + <aic-cloud-region>${MsoUtils.xmlEscape(aicCloudRegion)}</aic-cloud-region> + </network-request-information> + </sdncadapterworkflow:SDNCRequestData> + </aetgt:SDNCAdapterWorkflowRequest>""".trim() + + return content + } + + /** + * Builds a topology SDNC request and return String request. + * As V2 will use 1607-style request, region instead of aic clli code + * @param execution, the execution + * @param requestXML, the incoming request for the flow + * @param serviceInstanceId, the serviceIntance (if available) + * @param callbackUrl, the call back url + * @param action, the action element value + * @param requestAction the svcOperation element value + * @param cloudRegionId the aai's cloud-region-id + * @param networkId the aai's network-id + * @param additionalData additional XML content to be inserted into the + * RequestData element (may be null) + */ + public String sdncTopologyRequestRsrc (DelegateExecution execution, String requestXML, String serviceInstanceId, String callbackUrl, String action, String requestAction, String cloudRegionId, networkId, String additionalData) { + def utils=new MsoUtils() + + // SNDC is expecting request Id for header as unique each call. + String hdrRequestId = "" + String testHdrRequestId = execution.getVariable("testMessageId") // for test purposes. + if (testHdrRequestId == null) { + hdrRequestId = UUID.randomUUID() // generate unique + } else { + hdrRequestId = testHdrRequestId + } + + String requestId = "" + String testRequestId = execution.getVariable("testMessageId") // for test purposes. + if (testRequestId == null) { + requestId = execution.getVariable("mso-request-id") + if (requestId == null) { + requestId = execution.getVariable("msoRequestId") + } + } else { + requestId = testRequestId + } + + String aicCloudRegion = cloudRegionId + String tenantId = "" + if (utils.nodeExists(requestXML, "tenant-id")) { + tenantId = utils.getNodeText(requestXML, "tenant-id") + } + String networkType = "" + if (utils.nodeExists(requestXML, "network-type")) { + networkType = utils.getNodeText(requestXML, "network-type") + } + + String subscriptionServiceType = "" + if (utils.nodeExists(requestXML, "subscription-service-type")) { + subscriptionServiceType = utils.getNodeText(requestXML, "subscription-service-type") + } + + String globalCustomerId = "" + if (utils.nodeExists(requestXML, "global-customer-id")) { + globalCustomerId = utils.getNodeText(requestXML, "global-customer-id") + } + + String serviceId = "" + if (utils.nodeExists(requestXML, "service-id")) { + serviceId = utils.getNodeText(requestXML, "service-id") + } + String networkName = "" + if (utils.nodeExists(requestXML, "network-name")) { + networkName = utils.getNodeText(requestXML, "network-name") + } + String source = "" + if (utils.nodeExists(requestXML, "source")) { + source = utils.getNodeText(requestXML, "source") + } + + // get resourceLink from subflow execution variable + String serviceType = "" + String subscriberName = "" + String siRelatedLink = execution.getVariable("GENGSI_siResourceLink") + if (siRelatedLink != null) { + // get service type + int serviceStart = siRelatedLink.indexOf("service-subscription/") + int serviceEnd = siRelatedLink.indexOf("/service-instances/") + serviceType = siRelatedLink.substring(serviceStart + 21, serviceEnd) + serviceType = UriUtils.decode(serviceType,"UTF-8") + // get subscriber name + int subscriberNameStart = siRelatedLink.indexOf("customers/customer/") + int subscriberNameEnd = siRelatedLink.indexOf("/service-subscriptions/") + subscriberName = siRelatedLink.substring(subscriberNameStart + 19, subscriberNameEnd) + subscriberName = UriUtils.decode(subscriberName,"UTF-8") + } + + // network-information from 'networkModelInfo' // verify the DB Catalog response + String networkModelInfo = utils.getNodeXml(requestXML, "networkModelInfo", false).replace("tag0:","").replace(":tag0","") + String modelInvariantUuid = utils.getNodeText(networkModelInfo, "modelInvariantUuid") !=null ? + utils.getNodeText(networkModelInfo, "modelInvariantUuid") : "" + String modelCustomizationUuid = utils.getNodeText(networkModelInfo, "modelCustomizationUuid") !=null ? + utils.getNodeText(networkModelInfo, "modelCustomizationUuid") : "" + String modelUuid = utils.getNodeText(networkModelInfo, "modelUuid") !=null ? + utils.getNodeText(networkModelInfo, "modelUuid") : "" + String modelVersion = utils.getNodeText(networkModelInfo, "modelVersion") !=null ? + utils.getNodeText(networkModelInfo, "modelVersion") : "" + String modelName = utils.getNodeText(networkModelInfo, "modelName") !=null ? + utils.getNodeText(networkModelInfo, "modelName") : "" + + // service-information from 'networkModelInfo' // verify the DB Catalog response + String serviceModelInfo = utils.getNodeXml(requestXML, "serviceModelInfo", false).replace("tag0:","").replace(":tag0","") + String serviceModelInvariantUuid = utils.getNodeText(serviceModelInfo, "modelInvariantUuid") !=null ? + utils.getNodeText(serviceModelInfo, "modelInvariantUuid") : "" + String serviceModelUuid = utils.getNodeText(serviceModelInfo, "modelUuid") !=null ? + utils.getNodeText(serviceModelInfo, "modelUuid") : "" + String serviceModelVersion = utils.getNodeText(serviceModelInfo, "modelVersion") !=null ? + utils.getNodeText(serviceModelInfo, "modelVersion") : "" + String serviceModelName = utils.getNodeText(serviceModelInfo, "modelName") !=null ? + utils.getNodeText(serviceModelInfo, "modelName") : "" + + + String content = + """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" + xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" + xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> + <sdncadapter:RequestHeader> + <sdncadapter:RequestId>${MsoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${MsoUtils.xmlEscape(action)}</sdncadapter:SvcAction> + <sdncadapter:SvcOperation>network-topology-operation</sdncadapter:SvcOperation> + <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> + <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> + </sdncadapter:RequestHeader> + <sdncadapterworkflow:SDNCRequestData> + <request-information> + <request-id>${MsoUtils.xmlEscape(requestId)}</request-id> + <request-action>${MsoUtils.xmlEscape(requestAction)}</request-action> + <source>${MsoUtils.xmlEscape(source)}</source> + <notification-url></notification-url> + <order-number></order-number> + <order-version></order-version> + </request-information> + <service-information> + <service-id>${MsoUtils.xmlEscape(serviceId)}</service-id> + <subscription-service-type>${MsoUtils.xmlEscape(subscriptionServiceType)}</subscription-service-type> + <onap-model-information> + <model-invariant-uuid>${MsoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid> + <model-uuid>${MsoUtils.xmlEscape(serviceModelUuid)}</model-uuid> + <model-version>${MsoUtils.xmlEscape(serviceModelVersion)}</model-version> + <model-name>${MsoUtils.xmlEscape(serviceModelName)}</model-name> + </onap-model-information> + <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> + <global-customer-id>${MsoUtils.xmlEscape(globalCustomerId)}</global-customer-id> + <subscriber-name>${MsoUtils.xmlEscape(subscriberName)}</subscriber-name> + </service-information> + <network-information> + <network-id>${MsoUtils.xmlEscape(networkId)}</network-id> + <network-type>${MsoUtils.xmlEscape(networkType)}</network-type> + <onap-model-information> + <model-invariant-uuid>${MsoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> + <model-customization-uuid>${MsoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid> + <model-uuid>${MsoUtils.xmlEscape(modelUuid)}</model-uuid> + <model-version>${MsoUtils.xmlEscape(modelVersion)}</model-version> + <model-name>${MsoUtils.xmlEscape(modelName)}</model-name> + </onap-model-information> + </network-information> + <network-request-input> + <network-name>${MsoUtils.xmlEscape(networkName)}</network-name> + <tenant>${MsoUtils.xmlEscape(tenantId)}</tenant> + <aic-cloud-region>${MsoUtils.xmlEscape(aicCloudRegion)}</aic-cloud-region> + <aic-clli></aic-clli> + <network-input-parameters/> + </network-request-input> + </sdncadapterworkflow:SDNCRequestData> + </aetgt:SDNCAdapterWorkflowRequest>""".trim() + + return content + } + + /** + * Validates a workflow response. + * @param execution the execution + * @param responseVar the execution variable in which the response is stored + * @param workflowException the WorkflowException Object returned from sdnc call + */ + public void validateSDNCResponse(DelegateExecution execution, String response, WorkflowException workflowException, boolean successIndicator){ + msoLogger.debug("SDNC Response is: " + response) + msoLogger.debug("SuccessIndicator is: " + successIndicator) + + try { + def prefix = execution.getVariable('prefix') + execution.setVariable(prefix+'sdncResponseSuccess', false) + msoLogger.debug("Response" + ' = ' + (response == null ? "" : System.lineSeparator()) + response) + + if (successIndicator){ + if (response == null || response.trim().equals("")) { + msoLogger.debug(response + ' is empty'); + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "SDNCAdapter Workflow Response is Empty") + }else{ + + // we need to peer into the request data for error + def String sdncAdapterWorkflowResponse = taskProcessor.utils.getNodeXml(response, 'response-data', false) + def String decodedXml = sdncAdapterWorkflowResponse.replace('<?xml version="1.0" encoding="UTF-8"?>', "") + decodedXml = taskProcessor.utils.getNodeXml(response, 'RequestData') + msoLogger.debug("decodedXml:\n" + decodedXml) + + int requestDataResponseCode = 200 + def String requestDataResponseMessage = '' + + try{ + if (taskProcessor.utils.nodeExists(decodedXml, "response-message")) { + requestDataResponseMessage = taskProcessor.utils.getNodeText(decodedXml, "response-message") + } else if (taskProcessor.utils.nodeExists(sdncAdapterWorkflowResponse, "ResponseMessage")) { + requestDataResponseMessage = taskProcessor.utils.getNodeText(sdncAdapterWorkflowResponse, "ResponseMessage") + } + }catch(Exception e){ + msoLogger.debug('Error caught while decoding resposne ' + e.getMessage()) + } + + if(taskProcessor.utils.nodeExists(decodedXml, "response-code")) { + msoLogger.debug("response-code node Exist ") + String code = taskProcessor.utils.getNodeText(decodedXml, "response-code") + if(code.isEmpty() || code.equals("")){ + // if response-code is blank then Success + msoLogger.debug("response-code node is empty") + requestDataResponseCode = 0 + }else{ + requestDataResponseCode = code.toInteger() + msoLogger.debug("response-code is: " + requestDataResponseCode) + } + }else if(taskProcessor.utils.nodeExists(sdncAdapterWorkflowResponse, "ResponseCode")){ + msoLogger.debug("ResponseCode node Exist ") + String code = taskProcessor.utils.getNodeText(sdncAdapterWorkflowResponse, "ResponseCode") + if(code.isEmpty() || code.equals("")){ + // if ResponseCode blank then Success + msoLogger.debug("ResponseCode node is empty") + requestDataResponseCode = 0 + }else{ + requestDataResponseCode = code.toInteger() + msoLogger.debug("ResponseCode is: " + requestDataResponseCode) + } + }else{ + msoLogger.debug("A Response Code DOES NOT Exist.") + // if a response code does not exist then Success + requestDataResponseCode = 0 + } + try{ + + execution.setVariable(prefix+'sdncRequestDataResponseCode', requestDataResponseCode.toString()) + // if a response code is 0 or 2XX then Success + if ((requestDataResponseCode >= 200 && requestDataResponseCode <= 299) || requestDataResponseCode == 0) { + execution.setVariable(prefix+'sdncResponseSuccess', true) + msoLogger.debug("Setting sdncResponseSuccess to True ") + msoLogger.debug("Exited ValidateSDNCResponse Method") + }else{ + ExceptionUtil exceptionUtil = new ExceptionUtil() + String convertedCode = exceptionUtil.MapSDNCResponseCodeToErrorCode(requestDataResponseCode.toString()) + int convertedCodeInt = Integer.parseInt(convertedCode) + exceptionUtil.buildAndThrowWorkflowException(execution, convertedCodeInt, "Received error from SDN-C: " + requestDataResponseMessage) + } + + }catch(Exception e){ + //TODO proper handling of new, non numerical response codes in 1607 and new error handling for common API + requestDataResponseCode = 500 + } + + msoLogger.debug("SDNC callback response-code: " + requestDataResponseCode) + msoLogger.debug("SDNC callback response-message: " + requestDataResponseMessage) + } + + }else { + msoLogger.debug('SDNCAdapter Subflow did NOT complete Successfully. SuccessIndicator is False. ') + if(workflowException != null){ + exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) + }else{ + //TODO : what error code and error message use here + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Internal Error - SDNCAdapter Subflow did NOT complete successfully.") + } + } + + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.debug('END of Validate SDNC Response') + exceptionUtil.buildAndThrowWorkflowException(execution, 500, 'Internal Error- Unable to validate SDNC Response '); + } + } + + /** + * Validates a workflow response. + * @param execution the execution + * @param responseVar the execution variable in which the response is stored + * @param responseCodeVar the execution variable in which the response code is stored + * @param errorResponseVar the execution variable in which the error response is stored + */ + public void validateL3BondingSDNCResp(DelegateExecution execution, String response, WorkflowException workflowException, boolean success) { + def method = getClass().getSimpleName() + '.validateL3BondingSDNCResp(' + + 'execution=' + execution.getId() + + ', response=' + response + + ')' + msoLogger.trace('Entered ' + method) + def prefix = execution.getVariable('prefix') + TrinityExceptionUtil trinityExceptionUtil = new TrinityExceptionUtil() + + try { + execution.setVariable(prefix+'sdncResponseSuccess', false) + + msoLogger.debug("sdncAdapter Success Indicator is: " + success) + if (success) { + + // we need to look inside the request data for error + def String callbackRequestData = taskProcessor.utils.getNodeXml(response, 'RequestData', false) + def String decodedXml = callbackRequestData + msoLogger.debug("decodedXml:\n" + decodedXml) + + def requestDataResponseCode = '200' + def requestDataResponseMessage = '' + int intDataResponseCode = 200 + + if (taskProcessor.utils.nodeExists(decodedXml, "response-code")) { + + requestDataResponseCode = ((String) taskProcessor.utils.getNodeText(decodedXml, "response-code")) + if (taskProcessor.utils.nodeExists(decodedXml, "response-message")) { + requestDataResponseMessage = taskProcessor.utils.getNodeText(decodedXml, "response-message") + } + }else if(taskProcessor.utils.nodeExists(decodedXml, "ResponseCode")){ + requestDataResponseCode = ((String) taskProcessor.utils.getNodeText(decodedXml, "ResponseCode")).toInteger() + }else if(taskProcessor.utils.nodeExists(response, "ResponseCode")){ + requestDataResponseCode = ((String) taskProcessor.utils.getNodeText(response, "ResponseCode")).toInteger() + requestDataResponseMessage = taskProcessor.utils.getNodeText(response, "ResponseMessage") + } + + msoLogger.debug("SDNC callback response-code: " + requestDataResponseCode) + msoLogger.debug("SDNC callback response-message: " + requestDataResponseMessage) + + // Get the AAI Status to determine if rollback is needed on ASSIGN + def aai_status = '' + if (taskProcessor.utils.nodeExists(decodedXml, "aai-status")) { + aai_status = ((String) taskProcessor.utils.getNodeText(decodedXml, "aai-status")) + msoLogger.debug("SDNC sent AAI STATUS code: " + aai_status) + } + if (aai_status != null && !aai_status.equals("")) { + execution.setVariable(prefix+"AaiStatus",aai_status) + msoLogger.debug("Set variable " + prefix + "AaiStatus: " + execution.getVariable(prefix+"AaiStatus")) + } + + // Get the result string to determine if rollback is needed on ASSIGN in Add Bonding flow only + def sdncResult = '' + if (taskProcessor.utils.nodeExists(decodedXml, "result")) { + sdncResult = ((String) taskProcessor.utils.getNodeText(decodedXml, "result")) + msoLogger.debug("SDNC sent result: " + sdncResult) + } + if (sdncResult != null && !sdncResult.equals("")) { + execution.setVariable(prefix+"SdncResult",sdncResult) + msoLogger.debug("Set variable " + prefix + "SdncResult: " + execution.getVariable(prefix+"SdncResult")) + } + + try{ + intDataResponseCode = Integer.parseInt(String.valueOf(requestDataResponseCode)) + }catch(Exception e){ + intDataResponseCode = 400 + } + + msoLogger.debug("intDataResponseCode " + intDataResponseCode ) + + // if response-code is not Success (200, 201, etc) we need to throw an exception + if ((intDataResponseCode < 200 || intDataResponseCode > 299) && intDataResponseCode != 0) { + execution.setVariable(prefix+'ResponseCode', intDataResponseCode) + execution.setVariable("L3HLAB_rollback", true) + def msg = trinityExceptionUtil.mapSDNCAdapterExceptionToErrorResponse(response, execution) + exceptionUtil.buildAndThrowWorkflowException(execution, intDataResponseCode, "Received error from SDN-C: " + msg) + + } + }else { + msoLogger.warn(MessageEnum.BPMN_GENERAL_WARNING, 'sdncAdapter did not complete successfully, sdncAdapter Success Indicator was false ', "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, 'sdncAdapter did not complete successfully, sdncAdapter Success Indicator was false '); + execution.setVariable("L3HLAB_rollback", true) + def msg = trinityExceptionUtil.intDataResponseCode(response, execution) + exceptionUtil.buildAndThrowWorkflowException(execution, intDataResponseCode, msg) + } + + if (response == null || response.trim().equals("")) { + msoLogger.warn(MessageEnum.BPMN_GENERAL_WARNING, 'sdncAdapter workflow response is empty', "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, 'sdncAdapter workflow response is empty');; + execution.setVariable("L3HLAB_rollback", true) + def msg = trinityExceptionUtil.buildException("Exception occurred while validating SDNC response " , execution) + exceptionUtil.buildAndThrowWorkflowException(execution, intResponseCode, msg) + } + + execution.setVariable(prefix+'sdncResponseSuccess', true) + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + execution.setVariable(prefix+"ResponseCode",400) + execution.setVariable("L3HLAB_rollback", true) + def msg = trinityExceptionUtil.buildException("Exception occurred while validating SDNC response: " + e.getMessage(), execution) + exceptionUtil.buildAndThrowWorkflowException(execution, 400, msg) + } + } + + public String modelInfoToEcompModelInformation(String jsonModelInfo) { + String modelInvariantUuid = jsonUtil.getJsonValue(jsonModelInfo, "modelInvariantUuid") + String modelUuid = jsonUtil.getJsonValue(jsonModelInfo, "modelUuid") + if (modelUuid == null) { + modelUuid = "" + } + String modelCustomizationUuid = jsonUtil.getJsonValue(jsonModelInfo, "modelCustomizationUuid") + String modelCustomizationString = "" + if (modelCustomizationUuid != null) { + modelCustomizationString = "<model-customization-uuid>${MsoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid>" + } + String modelVersion = jsonUtil.getJsonValue(jsonModelInfo, "modelVersion") + if (modelVersion == null) { + modelVersion = "" + } + String modelName = jsonUtil.getJsonValue(jsonModelInfo, "modelName") + String ecompModelInformation = + """<onap-model-information> + <model-invariant-uuid>${MsoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> + <model-uuid>${MsoUtils.xmlEscape(modelUuid)}</model-uuid> + ${modelCustomizationString} + <model-version>${MsoUtils.xmlEscape(modelVersion)}</model-version> + <model-name>${MsoUtils.xmlEscape(modelName)}</model-name> + </onap-model-information>""" + + return ecompModelInformation + } +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ServiceTaskProcessor.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ServiceTaskProcessor.groovy index 0b5d013fe0..4e2ed0970f 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ServiceTaskProcessor.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ServiceTaskProcessor.groovy @@ -1,33 +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.openecomp.mso.bpmn.common.scripts;
-
-import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.camunda.bpm.engine.delegate.DelegateExecution
-
-
-/**
- * @version 1.0
- *
- */
-public interface ServiceTaskProcessor {
- public void preProcessRequest(DelegateExecution execution);
-}
+/*- + * ============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.common.scripts; + +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.camunda.bpm.engine.delegate.DelegateExecution + + +/** + * @version 1.0 + * + */ +public interface ServiceTaskProcessor { + public void preProcessRequest(DelegateExecution execution); +} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1.groovy new file mode 100644 index 0000000000..8d14ead6e0 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1.groovy @@ -0,0 +1,260 @@ +/* + * ============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.common.scripts + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution + +import org.onap.so.bpmn.common.scripts.AaiUtil +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.bpmn.core.domain.InventoryType +import org.onap.so.bpmn.core.domain.Resource +import org.onap.so.bpmn.core.domain.ServiceDecomposition +import org.onap.so.bpmn.core.domain.Subscriber +import org.onap.so.bpmn.core.domain.VnfResource +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.rest.APIResponse +import org.onap.so.rest.RESTClient +import org.onap.so.rest.RESTConfig +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor + +import org.json.JSONArray +import org.json.JSONObject + +import static org.onap.so.bpmn.common.scripts.GenericUtils.*; +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + + +/** + * This class is contains the scripts used + * by the Homing Subflow building block. The + * subflow attempts to home the provided + * resources by calling sniro. + * + * @author cb645j + * + */ +class SniroHomingV1 extends AbstractServiceTaskProcessor{ + + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SniroHomingV1.class); + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + SniroUtils sniroUtils = new SniroUtils(this) + + /** + * This method validates the incoming variables. + * The method then prepares the sniro request + * and posts it to sniro's rest api. + * + * @param execution + * + * @author cb645j + */ + public void callSniro(DelegateExecution execution){ + execution.setVariable("prefix","HOME_") + msoLogger.trace("Started Sniro Homing Call Sniro ") + try{ + execution.setVariable("rollbackData", null) + execution.setVariable("rolledBack", false) + + String requestId = execution.getVariable("msoRequestId") + msoLogger.debug("Incoming Request Id is: " + requestId) + String serviceInstanceId = execution.getVariable("serviceInstanceId") + msoLogger.debug("Incoming Service Instance Id is: " + serviceInstanceId) + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + msoLogger.debug("Incoming Service Decomposition is: " + serviceDecomposition) + String subscriberInfo = execution.getVariable("subscriberInfo") + msoLogger.debug("Incoming Subscriber Information is: " + subscriberInfo) + + if(isBlank(requestId) || isBlank(serviceInstanceId) || isBlank(serviceDecomposition.toString()) || isBlank(subscriberInfo)){ + exceptionUtil.buildAndThrowWorkflowException(execution, 4000, "A required input variable is missing or null") + }else{ + String subId = jsonUtil.getJsonValue(subscriberInfo, "globalSubscriberId") + String subName = jsonUtil.getJsonValue(subscriberInfo, "subscriberName") + String subCommonSiteId = "" + if(jsonUtil.jsonElementExist(subscriberInfo, "subscriberCommonSiteId")){ + subCommonSiteId = jsonUtil.getJsonValue(subscriberInfo, "subscriberCommonSiteId") + } + Subscriber subscriber = new Subscriber(subId, subName, subCommonSiteId) + + String cloudConfiguration = execution.getVariable("cloudConfiguration") // TODO Currently not being used + String homingParameters = execution.getVariable("homingParameters") // (aka. request parameters) Should be json format. TODO confirm its json format + + //Authentication + String authHeader = UrnPropertiesReader.getVariable("sniro.manager.headers.auth", execution) + execution.setVariable("BasicAuthHeaderValue", authHeader) + + //Prepare Callback + String timeout = execution.getVariable("timeout") + if(isBlank(timeout)){ + timeout = UrnPropertiesReader.getVariable("sniro.manager.timeout", execution) + if(isBlank(timeout)) { + timeout = "PT30M"; + } + } + msoLogger.debug("Async Callback Timeout will be: " + timeout) + + execution.setVariable("timeout", timeout); + execution.setVariable("correlator", requestId); + execution.setVariable("messageType", "SNIROResponse"); + + //Build Request & Call Sniro + String sniroRequest = sniroUtils.buildRequest(execution, requestId, serviceDecomposition, subscriber, homingParameters) + execution.setVariable("sniroRequest", sniroRequest) + msoLogger.debug("SNIRO Request is: " + sniroRequest) + + String endpoint = UrnPropertiesReader.getVariable("sniro.manager.uri.v1", execution) + String host = UrnPropertiesReader.getVariable("sniro.manager.host", execution) + String url = host + endpoint + msoLogger.debug("Sniro Url is: " + url) + + RESTConfig config = new RESTConfig(url); + RESTClient client = new RESTClient(config).addAuthorizationHeader(authHeader).addHeader("Content-Type", "application/json") + APIResponse response = client.httpPost(sniroRequest) + + int responseCode = response.getStatusCode() + msoLogger.debug("Sniro sync response code is: " + responseCode) + msoLogger.debug("Sniro sync response is: " + response.getResponseBodyAsString()) + + if(responseCode != 202){ + exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from Sniro.") + } + msoLogger.trace("Completed Sniro Homing Call Sniro") + } + }catch(BpmnError b){ + throw b + }catch(Exception e){ + msoLogger.debug("Error encountered within Homing CallSniro method: " + e) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in Homing CallSniro: " + e.getMessage()) + } + } + + /** + * This method processes the callback response + * and the contained homing solution. It sets + * homing solution assignment and license + * information to the corresponding resources + * + * @param execution + * + * @author cb645j + */ + public void processHomingSolution(DelegateExecution execution){ + msoLogger.trace("Started Sniro Homing Process Homing Solution") + try{ + String response = execution.getVariable("asyncCallbackResponse") + msoLogger.debug("Sniro Async Callback Response is: " + response) + + sniroUtils.validateCallbackResponse(execution, response) + + ServiceDecomposition decomposition = execution.getVariable("serviceDecomposition") + List<Resource> resourceList = decomposition.getServiceResources() + + if(JsonUtils.jsonElementExist(response, "solutionInfo.placementInfo")){ + String placements = jsonUtil.getJsonValue(response, "solutionInfo.placementInfo") + JSONArray arr = new JSONArray(placements) + for(int i = 0; i < arr.length(); i++){ + JSONObject placement = arr.getJSONObject(i) + String jsonServiceResourceId = placement.getString("serviceResourceId") + for(Resource resource:resourceList){ + String serviceResourceId = resource.getResourceId() + if(serviceResourceId.equalsIgnoreCase(jsonServiceResourceId)){ + //match + String inventoryType = placement.getString("inventoryType") + resource.getHomingSolution().setInventoryType(InventoryType.valueOf(inventoryType)) + resource.getHomingSolution().setCloudRegionId(placement.getString("cloudRegionId")) + resource.getHomingSolution().setRehome(placement.getBoolean("isRehome")) + JSONArray assignmentArr = placement.getJSONArray("assignmentInfo") + Map<String, String> assignmentMap = jsonUtil.entryArrayToMap(execution, assignmentArr.toString(), "variableName", "variableValue") + resource.getHomingSolution().setCloudOwner(assignmentMap.get("cloudOwner")) + resource.getHomingSolution().setAicClli(assignmentMap.get("aicClli")) + resource.getHomingSolution().setAicVersion(assignmentMap.get("aicVersion")) + if(inventoryType.equalsIgnoreCase("service")){ + VnfResource vnf = new VnfResource() + vnf.setVnfHostname(assignmentMap.get("vnfHostName")) + resource.getHomingSolution().setVnf(vnf) + resource.getHomingSolution().setServiceInstanceId(placement.getString("serviceInstanceId")) + } + } + } + } + } + + if(JsonUtils.jsonElementExist(response, "solutionInfo.licenseInfo")){ + String licenseInfo = jsonUtil.getJsonValue(response, "solutionInfo.licenseInfo") + JSONArray licenseArr = new JSONArray(licenseInfo) + for(int l = 0; l < licenseArr.length(); l++){ + JSONObject license = licenseArr.getJSONObject(l) + String jsonServiceResourceId = license.getString("serviceResourceId") + for(Resource resource:resourceList){ + String serviceResourceId = resource.getResourceId() + if(serviceResourceId.equalsIgnoreCase(jsonServiceResourceId)){ + //match + String jsonEntitlementPoolList = jsonUtil.getJsonValue(license.toString(), "entitlementPoolList") + List<String> entitlementPoolList = jsonUtil.StringArrayToList(execution, jsonEntitlementPoolList) + resource.getHomingSolution().getLicense().setEntitlementPoolList(entitlementPoolList) + + String jsonLicenseKeyGroupList = jsonUtil.getJsonValue(license.toString(), "licenseKeyGroupList") + List<String> licenseKeyGroupList = jsonUtil.StringArrayToList(execution, jsonLicenseKeyGroupList) + resource.getHomingSolution().getLicense().setLicenseKeyGroupList(licenseKeyGroupList) + } + } + } + } + execution.setVariable("serviceDecomposition", decomposition) + + msoLogger.trace("Completed Sniro Homing Process Homing Solution") + }catch(BpmnError b){ + throw b + }catch(Exception e){ + msoLogger.debug("Error encountered within Homing ProcessHomingSolution method: " + e) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in Sniro Homing Process Solution") + } + } + + /** + * This method logs the start of DHVCreateService + * to make debugging easier. + * + * @param - execution + * @author cb645j + */ + public String logStart(DelegateExecution execution){ + String requestId = execution.getVariable("testReqId") + if(isBlank(requestId)){ + requestId = execution.getVariable("msoRequestId") + } + execution.setVariable("DHVCS_requestId", requestId) + msoLogger.trace("STARTED Homing Subflow for request: " + requestId + " ") + msoLogger.debug("****** Homing Subflow Global Debug Enabled: " + execution.getVariable("isDebugLogEnabled") + " *****") + msoLogger.trace("STARTED Homing Subflow for request: " + requestId + " ") + } + + + /** + * Auto-generated method stub + */ + public void preProcessRequest(DelegateExecution execution){} + +} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SNIROUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroUtils.groovy index 1233d0423b..fd4ab32215 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SNIROUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroUtils.groovy @@ -1,334 +1,353 @@ -/*-
- * ============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.common.scripts
-
-import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.json.JSONArray
-import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor
-import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil
-import org.openecomp.mso.bpmn.common.scripts.MsoUtils
-import org.openecomp.mso.bpmn.core.domain.*
-import org.openecomp.mso.bpmn.core.json.JsonUtils
-import org.apache.commons.lang3.StringUtils
-
-import static org.openecomp.mso.bpmn.common.scripts.GenericUtils.*
-
-class SNIROUtils{
-
- ExceptionUtil exceptionUtil = new ExceptionUtil()
- JsonUtils jsonUtil = new JsonUtils()
-
- private AbstractServiceTaskProcessor utils
-
- public MsoUtils msoUtils = new MsoUtils()
-
- public SNIROUtils(AbstractServiceTaskProcessor taskProcessor) {
- this.utils = taskProcessor
- }
-
- /**
- * This method builds the service-agnostic
- * sniro json request to get a homing solution
- * and license solution
- *
- * @param execution
- * @param requestId
- * @param decomposition - ServiceDecomposition object
- * @param subscriber - Subscriber information
- * @param homingParams - Homing/Request parameters
- *
- * @return request - sniro v2 payload
- *
- * @author cb645j
- */
- public String buildRequest(DelegateExecution execution, String requestId, ServiceDecomposition decomposition, Subscriber subscriber, String homingParams){
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- utils.log("DEBUG", "Started Building Sniro Request", isDebugEnabled)
- def callbackUrl = utils.createWorkflowMessageAdapterCallbackURL(execution, "SNIROResponse", requestId)
- def transactionId = requestId
- //ServiceInstance Info
- ServiceInstance serviceInstance = decomposition.getServiceInstance()
- def serviceInstanceId
- if(serviceInstance == null){
- utils.log("DEBUG", "Unable to obtain Service Instance Id, ServiceInstance Object is null" , isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 400, "Internal Error - Unable to obtain Service Instance Id, ServiceInstance Object is null")
- }else{
- serviceInstanceId = serviceInstance.getInstanceId()
- }
- //Model Info
- ModelInfo model = decomposition.getModelInfo()
- String modelType = model.getModelType()
- String modelInvariantId = model.getModelInvariantUuid()
- String modelVersionId = model.getModelUuid()
- String modelName = model.getModelName()
- String modelVersion = model.getModelVersion()
- //Subscriber Info
- String subscriberId = subscriber.getGlobalId()
- String subscriberName = subscriber.getName()
- String commonSiteId = subscriber.getCommonSiteId()
- //OrderInfo
- String orderInfo
- if(!isBlank(homingParams)){
- orderInfo = homingParams.replaceAll("\"", "\\\\\"").replaceAll("\n", "").replaceAll("\r", "")
- orderInfo = StringUtils.normalizeSpace(orderInfo)
- }
-
- //Determine RequestType
- //TODO Figure out better way to determine this
- String requestType = "initial"
- List<Resource> resources = decomposition.getServiceResources()
- for(Resource r:resources){
- HomingSolution currentSolution = (HomingSolution) r.getCurrentHomingSolution()
- if(currentSolution != null){
- requestType = "speed changed"
- }
- }
-
- int timeoutSeconds = 1800
- String timeout = execution.getVariable("timeout")
- if(isNotBlank(timeout)){
- String subT = timeout.substring(2, timeout.length() - 1)
- int timeoutInt = Integer.parseInt(subT)
- timeoutSeconds = timeoutInt * 60
- }
-
- //Demands
- String placementDemands = ""
- StringBuilder sb = new StringBuilder()
- List<Resource> resourceList = decomposition.getServiceAllottedResources()
- List<VnfResource> vnfResourceList = decomposition.getServiceVnfs()
-
- // TODO: We should include both alloted resources and service resources in the placementDeamnds- not one or the other.
- if(resourceList.isEmpty() || resourceList == null){
- utils.log("DEBUG", "Allotted Resources List is empty - will try to get service VNFs instead.", isDebugEnabled)
- resourceList = decomposition.getServiceVnfs()
- }
-
- if(resourceList.isEmpty() || resourceList == null){
- utils.log("DEBUG", "Resources List is Empty", isDebugEnabled)
- }else{
- for(Resource resource:resourceList){
- ModelInfo resourceModelInfo = resource.getModelInfo()
- ResourceInstance resourceInstance = resource.getResourceInstance()
- def resourceInstanceType = resource.getResourceType()
- def serviceResourceId = resource.getResourceId() //TODO - resourceId versus instanceId - should be what is put in AAI, whatever we put here will be what is in response, used to correlate
- def resourceModuleName = resourceModelInfo.getModelInstanceName()
- def resouceModelCustomizationId = resourceModelInfo.getModelCustomizationUuid()
- def resouceModelInvariantId = resourceModelInfo.getModelInvariantUuid()
- def resouceModelName = resourceModelInfo.getModelName()
- def resouceModelVersion = resourceModelInfo.getModelVersion()
- def resouceModelVersionId = resourceModelInfo.getModelUuid()
- def resouceModelType = resourceModelInfo.getModelType()
- def tenantId = "" //Optional
- def tenantName = "" //Optional
-
-
- String existingPlacement = ""
- HomingSolution currentPlacement = resource.getCurrentHomingSolution()
- if(currentPlacement != null){
- String homedServiceInstanceId = currentPlacement.getServiceInstanceId()
- existingPlacement =
- ""","existingPlacement": {
- "serviceInstanceId": "${homedServiceInstanceId}"
- }"""
- }
-
-
- String demand =
- """{
- "resourceInstanceType": "${resourceInstanceType}",
- "serviceResourceId": "${serviceResourceId}",
- "resourceModuleName": "${resourceModuleName}",
- "resourceModelInfo": {
- "modelCustomizationId": "${resouceModelCustomizationId}",
- "modelInvariantId": "${resouceModelInvariantId}",
- "modelName": "${resouceModelName}",
- "modelVersion": "${resouceModelVersion}",
- "modelVersionId": "${resouceModelVersionId}",
- "modelType": "${resouceModelType}"
- },
- "tenantId": "${tenantId}",
- "tenantName": "${tenantName}"
- ${existingPlacement}
- },"""
-
- placementDemands = sb.append(demand)
- }
- placementDemands = placementDemands.substring(0, placementDemands.length() - 1);
- }
-
- String licenseDemands = ""
- sb = new StringBuilder()
- if(vnfResourceList.isEmpty() || vnfResourceList == null){
- utils.log("DEBUG", "Vnf Resources List is Empty", isDebugEnabled)
- }else{
- for(VnfResource vnfResource:vnfResourceList){
- ModelInfo vnfResourceModelInfo = vnfResource.getModelInfo()
- ResourceInstance vnfResourceInstance = vnfResource.getResourceInstance()
- def resourceInstanceType = vnfResource.getResourceType()
- def serviceResourceId = vnfResource.getResourceId()
- def resourceModuleName = vnfResourceModelInfo.getModelInstanceName()
- def resouceModelCustomizationId = vnfResourceModelInfo.getModelCustomizationUuid()
- def resouceModelInvariantId = vnfResourceModelInfo.getModelInvariantUuid()
- def resouceModelName = vnfResourceModelInfo.getModelName()
- def resouceModelVersion = vnfResourceModelInfo.getModelVersion()
- def resouceModelVersionId = vnfResourceModelInfo.getModelUuid()
- def resouceModelType = vnfResourceModelInfo.getModelType()
-
- String curentLicenseJson = ""
- HomingSolution currentSol = vnfResource.getCurrentHomingSolution()
- if(currentSol != null){
- JSONArray entitlementPoolList = currentSol.getLicense().getEntitlementPoolListAsString()
- JSONArray licenseKeyGroupList = currentSol.getLicense().getLicenseKeyGroupListAsString()
- curentLicenseJson =
- """ ,"existingLicense": [
- {
- "entitlementPoolUUID":
- ${entitlementPoolList},
- "licenseKeyGroupUUID":
- ${licenseKeyGroupList}
-
- }
- ]"""
- }
-
- String demand =
- """{
- "resourceInstanceType": "${resourceInstanceType}",
- "serviceResourceId": "${serviceResourceId}",
- "resourceModuleName": "${resourceModuleName}",
- "resourceModelInfo": {
- "modelCustomizationId": "${resouceModelCustomizationId}",
- "modelInvariantId": "${resouceModelInvariantId}",
- "modelName": "${resouceModelName}",
- "modelVersion": "${resouceModelVersion}",
- "modelVersionId": "${resouceModelVersionId}",
- "modelType": "${resouceModelType}"
- }
- ${curentLicenseJson}
- },"""
-
- licenseDemands = sb.append(demand)
- }
- licenseDemands = licenseDemands.substring(0, licenseDemands.length() - 1);
- }
-
- String request =
- """{
- "requestInfo": {
- "transactionId": "${transactionId}",
- "requestId": "${requestId}",
- "callbackUrl": "${callbackUrl}",
- "sourceId": "mso",
- "requestType": "${requestType}",
- "optimizer": [
- "placement",
- "license"
- ],
- "numSolutions": 1,
- "timeout": ${timeoutSeconds}
- },
- "placementInfo": {
- "serviceModelInfo": {
- "modelType": "${modelType}",
- "modelInvariantId": "${modelInvariantId}",
- "modelVersionId": "${modelVersionId}",
- "modelName": "${modelName}",
- "modelVersion": "${modelVersion}"
- },
- "subscriberInfo": {
- "globalSubscriberId": "${subscriberId}",
- "subscriberName": "${subscriberName}",
- "subscriberCommonSiteId": "${commonSiteId}"
- },
- "demandInfo": {
- "placementDemand": [
- ${placementDemands}
- ],
- "licenseDemand": [
- ${licenseDemands}
- ]
- },
- "policyId": [],
- "serviceInstanceId": "${serviceInstanceId}",
- "orderInfo": "{\\\"requestParameters\\\": ${orderInfo}}"
- }
- }"""
-
- utils.log("DEBUG", "Completed Building Sniro Request", isDebugEnabled)
- return request
- }
-
- /**
- * This method validates the callback response
- * from Sniro. If the response contains an
- * exception the method will build and throw
- * a workflow exception.
- *
- * @param execution
- * @param response - the async callback response from sniro
- *
- * @author cb645j
- */
- public void validateCallbackResponse(DelegateExecution execution, String response){
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- String placements = ""
- if(isBlank(response)){
- exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Sniro Async Callback Response is Empty")
- }else{
- if(JsonUtils.jsonElementExist(response, "solutionInfo.placement")){
- placements = jsonUtil.getJsonValue(response, "solutionInfo.placement")
- if(isBlank(placements) || placements.equalsIgnoreCase("[]")){
- String statusMessage = jsonUtil.getJsonValue(response, "statusMessage")
- if(isBlank(statusMessage)){
- utils.log("DEBUG", "Error Occured in Homing: Sniro Async Callback Response does not contain placement solution.", isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 400, "Sniro Async Callback Response does not contain placement solution.")
- }else{
- utils.log("DEBUG", "Error Occured in Homing: " + statusMessage, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 400, statusMessage)
- }
- }else{
- return
- }
- }else if(JsonUtils.jsonElementExist(response, "requestError") == true){
- String errorMessage = ""
- if(response.contains("policyException")){
- String text = jsonUtil.getJsonValue(response, "requestError.policyException.text")
- errorMessage = "Sniro Async Callback Response contains a Request Error Policy Exception: " + text
- }else if(response.contains("serviceException")){
- String text = jsonUtil.getJsonValue(response, "requestError.serviceException.text")
- errorMessage = "Sniro Async Callback Response contains a Request Error Service Exception: " + text
- }else{
- errorMessage = "Sniro Async Callback Response contains a Request Error. Unable to determine the Request Error Exception."
- }
- utils.log("DEBUG", "Error Occured in Homing: " + errorMessage, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 400, errorMessage)
-
- }else{
- utils.log("DEBUG", "Error Occured in Homing: Received an Unknown Async Callback Response from Sniro.", isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Received an Unknown Async Callback Response from Sniro.")
- }
- }
-
- }
-
-
+/*- + * ============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.common.scripts + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.json.JSONArray +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.core.domain.* +import org.onap.so.bpmn.core.json.JsonUtils +import org.apache.commons.lang3.StringUtils + +import static org.onap.so.bpmn.common.scripts.GenericUtils.* + +import java.time.Duration + +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + + + +class SniroUtils{ + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SniroUtils.class); + + + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + + private AbstractServiceTaskProcessor utils + + public MsoUtils msoUtils = new MsoUtils() + + public SniroUtils(AbstractServiceTaskProcessor taskProcessor) { + this.utils = taskProcessor + } + + /** + * This method builds the service-agnostic + * sniro json request to get a homing solution + * and license solution + * + * @param execution + * @param requestId + * @param decomposition - ServiceDecomposition object + * @param subscriber - Subscriber information + * @param homingParams - Homing/Request parameters + * + * @return request - sniro v2 payload + * + * @author cb645j + */ + public String buildRequest(DelegateExecution execution, String requestId, ServiceDecomposition decomposition, Subscriber subscriber, String homingParams){ + msoLogger.debug("Started Building Sniro Request") + def callbackUrl = utils.createWorkflowMessageAdapterCallbackURL(execution, "SNIROResponse", requestId) + def transactionId = requestId + //ServiceInstance Info + ServiceInstance serviceInstance = decomposition.getServiceInstance() + def serviceInstanceId + if(serviceInstance == null){ + msoLogger.debug("Unable to obtain Service Instance Id, ServiceInstance Object is null" ) + exceptionUtil.buildAndThrowWorkflowException(execution, 400, "Internal Error - Unable to obtain Service Instance Id, ServiceInstance Object is null") + }else{ + serviceInstanceId = serviceInstance.getInstanceId() + } + String type = decomposition.getServiceType() + String serviceType = "" + if(isNotBlank(type)){ + serviceType = """ "serviceType": "${type}", """ + } + //Model Info + ModelInfo model = decomposition.getModelInfo() + String modelType = model.getModelType() + String modelInvariantId = model.getModelInvariantUuid() + String modelVersionId = model.getModelUuid() + String modelName = model.getModelName() + String modelVersion = model.getModelVersion() + //Subscriber Info + String subscriberId = subscriber.getGlobalId() + String subscriberName = subscriber.getName() + String commonSiteId = subscriber.getCommonSiteId() + //OrderInfo + String orderInfo + if(!isBlank(homingParams)){ + orderInfo = homingParams.replaceAll("\"", "\\\\\"").replaceAll("\n", "").replaceAll("\r", "") + orderInfo = StringUtils.normalizeSpace(orderInfo) + } + + //Determine RequestType + //TODO Implement better way to determine this + String requestType = "initial" + List<Resource> resources = decomposition.getServiceResources() + for(Resource r:resources){ + HomingSolution currentSolution = (HomingSolution) r.getCurrentHomingSolution() + if(currentSolution != null){ + requestType = "speed changed" + } + } + + String timeout = execution.getVariable("timeout") + Duration d = Duration.parse(timeout); + long timeoutSeconds = d.getSeconds(); + + //Demands + String placementDemands = "" + StringBuilder sb = new StringBuilder() + List<Resource> resourceList = decomposition.getAllottedResources() + List<VnfResource> vnfResourceList = decomposition.getVnfResources() + + //TODO should be service agnostic so this is just a temp solution to all vnfs to be sent in placement container for adiod + if(resourceList.isEmpty() || resourceList == null){ + search : { + for(VnfResource vnf : vnfResourceList){ + if(StringUtils.containsIgnoreCase(vnf.getNfRole(), "vce") || StringUtils.containsIgnoreCase(vnf.getNfRole(), "vpe")){ + resourceList = decomposition.getVnfResources() + break search + } + } + } + } + + if(resourceList.isEmpty() || resourceList == null){ + msoLogger.debug("Resources List is Empty") + }else{ + for(Resource resource:resourceList){ + ModelInfo resourceModelInfo = resource.getModelInfo() + ResourceInstance resourceInstance = resource.getResourceInstance() + def resourceInstanceType = resource.getResourceType() + def serviceResourceId = resource.getResourceId() //TODO - resourceId versus instanceId - should be what is put in AAI, whatever we put here will be what is in response, used to correlate + def resourceModuleName = resourceModelInfo.getModelInstanceName() + def resouceModelCustomizationId = resourceModelInfo.getModelCustomizationUuid() + def resouceModelInvariantId = resourceModelInfo.getModelInvariantUuid() + def resouceModelName = resourceModelInfo.getModelName() + def resouceModelVersion = resourceModelInfo.getModelVersion() + def resouceModelVersionId = resourceModelInfo.getModelUuid() + def resouceModelType = resourceModelInfo.getModelType() + def tenantId = "" //Optional + def tenantName = "" //Optional + + + String existingPlacement = "" + HomingSolution currentPlacement = resource.getCurrentHomingSolution() + if(currentPlacement != null){ + String homedServiceInstanceId = currentPlacement.getServiceInstanceId() + existingPlacement = + ""","existingPlacement": { + "serviceInstanceId": "${homedServiceInstanceId}" + }""" + } + + + String demand = + """{ + "resourceInstanceType": "${resourceInstanceType}", + "serviceResourceId": "${serviceResourceId}", + "resourceModuleName": "${resourceModuleName}", + "resourceModelInfo": { + "modelCustomizationId": "${resouceModelCustomizationId}", + "modelInvariantId": "${resouceModelInvariantId}", + "modelName": "${resouceModelName}", + "modelVersion": "${resouceModelVersion}", + "modelVersionId": "${resouceModelVersionId}", + "modelType": "${resouceModelType}" + }, + "tenantId": "${tenantId}", + "tenantName": "${tenantName}" + ${existingPlacement} + },""" + + placementDemands = sb.append(demand) + } + placementDemands = placementDemands.substring(0, placementDemands.length() - 1); + } + + String licenseDemands = "" + sb = new StringBuilder() + if(vnfResourceList.isEmpty() || vnfResourceList == null){ + msoLogger.debug("Vnf Resources List is Empty") + }else{ + for(VnfResource vnfResource:vnfResourceList){ + ModelInfo vnfResourceModelInfo = vnfResource.getModelInfo() + ResourceInstance vnfResourceInstance = vnfResource.getResourceInstance() + def resourceInstanceType = vnfResource.getResourceType() + def serviceResourceId = vnfResource.getResourceId() + def resourceModuleName = vnfResourceModelInfo.getModelInstanceName() + def resouceModelCustomizationId = vnfResourceModelInfo.getModelCustomizationUuid() + def resouceModelInvariantId = vnfResourceModelInfo.getModelInvariantUuid() + def resouceModelName = vnfResourceModelInfo.getModelName() + def resouceModelVersion = vnfResourceModelInfo.getModelVersion() + def resouceModelVersionId = vnfResourceModelInfo.getModelUuid() + def resouceModelType = vnfResourceModelInfo.getModelType() + + String curentLicenseJson = "" + HomingSolution currentSol = vnfResource.getCurrentHomingSolution() + if(currentSol != null){ + JSONArray entitlementPoolList = currentSol.getLicense().getEntitlementPoolListAsString() + JSONArray licenseKeyGroupList = currentSol.getLicense().getLicenseKeyGroupListAsString() + curentLicenseJson = + """ ,"existingLicense": { + "entitlementPoolUUID": + ${entitlementPoolList}, + "licenseKeyGroupUUID": + ${licenseKeyGroupList} + + }""" + } + + String demand = + """{ + "resourceInstanceType": "${resourceInstanceType}", + "serviceResourceId": "${serviceResourceId}", + "resourceModuleName": "${resourceModuleName}", + "resourceModelInfo": { + "modelCustomizationId": "${resouceModelCustomizationId}", + "modelInvariantId": "${resouceModelInvariantId}", + "modelName": "${resouceModelName}", + "modelVersion": "${resouceModelVersion}", + "modelVersionId": "${resouceModelVersionId}", + "modelType": "${resouceModelType}" + } + ${curentLicenseJson} + },""" + + licenseDemands = sb.append(demand) + } + licenseDemands = licenseDemands.substring(0, licenseDemands.length() - 1); + } + + String request = + """{ + "requestInfo": { + "transactionId": "${transactionId}", + "requestId": "${requestId}", + "callbackUrl": "${callbackUrl}", + "sourceId": "mso", + "requestType": "${requestType}", + "optimizer": [ + "placement", + "license" + ], + "numSolutions": 1, + "timeout": ${timeoutSeconds} + }, + "placementInfo": { + ${serviceType} + "serviceModelInfo": { + "modelType": "${modelType}", + "modelInvariantId": "${modelInvariantId}", + "modelVersionId": "${modelVersionId}", + "modelName": "${modelName}", + "modelVersion": "${modelVersion}" + }, + "subscriberInfo": { + "globalSubscriberId": "${subscriberId}", + "subscriberName": "${subscriberName}", + "subscriberCommonSiteId": "${commonSiteId}" + }, + "demandInfo": { + "placementDemand": [ + ${placementDemands} + ], + "licenseDemand": [ + ${licenseDemands} + ] + }, + "policyId": [], + "serviceInstanceId": "${serviceInstanceId}", + "orderInfo": "{\\\"requestParameters\\\": ${orderInfo}}" + } + }""" + + msoLogger.debug("Completed Building Sniro Request") + return request + } + + /** + * This method validates the async callback response from Sniro. + * If the response contains an exception the method will build + * and throw a workflow exception. + * + * @param execution + * @param response - sniro async response + * + * @author cb645j + */ + //TODO needs updating per sniro changes + public void validateCallbackResponse(DelegateExecution execution, String response){ + try{ + String placements = "" + String licenses = "" + if(isBlank(response)){ + exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Sniro Async Callback Response is Empty") + }else{ + if(JsonUtils.jsonElementExist(response, "solutionInfo")){ + if(JsonUtils.jsonElementExist(response, "solutionInfo.placementInfo")){ + placements = jsonUtil.getJsonValue(response, "solutionInfo.placementInfo") + } + if(JsonUtils.jsonElementExist(response, "solutionInfo.licenseInfo")){ + licenses = jsonUtil.getJsonValue(response, "solutionInfo.licenseInfo") + } + if((isBlank(placements) || placements.equalsIgnoreCase("[]")) && (isBlank(licenses) || licenses.equalsIgnoreCase("[]"))){ + msoLogger.debug("Sniro Async Response does not contain: licenses or placements") + exceptionUtil.buildAndThrowWorkflowException(execution, 400, "Sniro Async Callback Response does not contain: licenses or placements") + }else{ + return + } + }else if(JsonUtils.jsonElementExist(response, "requestError") == true){ + String errorMessage = "" + if(response.contains("policyException")){ + String text = jsonUtil.getJsonValue(response, "requestError.policyException.text") + errorMessage = "Sniro Async Response contains a policy error: " + text + }else if(response.contains("serviceException")){ + String text = jsonUtil.getJsonValue(response, "requestError.serviceException.text") + errorMessage = "Sniro Async Response contains a service error: " + text + }else{ + errorMessage = "Sniro Async Response contains an error: not provided" + } + msoLogger.debug("Sniro Async Response contains an error: " + errorMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 400, errorMessage) + + }else{ + msoLogger.debug("Sniro Async Response contains an error: not provided") + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Sniro Async Response contains an error: not provided") + } + } + }catch(BpmnError b){ + throw b + }catch(Exception e){ + msoLogger.debug("Error encountered within Homing validateCallbackResponse method: " + e) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in Sniro Homing Validate Async Response") + } + } + }
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/TrinityExceptionUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/TrinityExceptionUtil.groovy index e75b115b63..3cf1edb8ca 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/TrinityExceptionUtil.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/TrinityExceptionUtil.groovy @@ -1,382 +1,382 @@ -/*-
- * ============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.common.scripts
-
-import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.apache.commons.lang3.*
-
-class TrinityExceptionUtil {
-
-
-
- public static enum Error {
- SVC_GENERAL_SERVICE_ERROR("SVC0001","Internal Error"),
- SVC_BAD_PARAMETER("SVC0002", "Invalid input value for message part %1"),
- SVC_NO_SERVER_RESOURCES("SVC1000", "No server resources available to process the request"),
- SVC_DETAILED_SERVICE_ERROR("SVC2000", "The following service error occurred: %1. Error code is %2."),
- POL_GENERAL_POLICY_ERROR("POL0001", "A policy error occurred."),
- POL_USER_NOT_PROVISIONED("POL1009", "User has not been provisioned for service"),
- POL_USER_SUSPENDED("POL1010", "User has been suspended from service"),
- POL_DETAILED_POLICY_ERROR("POL2000", "The following policy error occurred: %1. Error code is %2."),
- POL_MSG_SIZE_EXCEEDS_LIMIT("POL9003", "Message content size exceeds the allowable limit")
-
-
- private final String msgId
- private final String msgTxt
-
- private Error(String msgId, String msgTxt) {
- this.msgId = msgId
- this.msgTxt = msgTxt
- }
-
- public String getMsgId() {
- return msgId
- }
-
- public String getMsgTxt() {
- return msgTxt
- }
-
- }
-
-
-
-
- String mapAdapterExecptionToCommonException(String response, DelegateExecution execution)
- {
- def utils=new MsoUtils()
- def method = getClass().getSimpleName() + '.mapAdapterExecptionToCommonException(' +
- 'execution=' + execution.getId() +
- ')'
-
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- utils.log("DEBUG",'Entered ' + method, isDebugLogEnabled)
-
-
- def errorCode
-
-
- try {
- errorCode = MapCategoryToErrorCode(utils.getNodeText(response, "category"))
- execution.setVariable(prefix+"err",errorCode)
- String message = buildException(response, execution)
- utils.log("DEBUG","=========== End MapAdapterExecptionToWorkflowException ===========",isDebugLogEnabled)
- return message
- }catch (Exception ex) {
- //Ignore the exception - cases include non xml payload
- utils.log("DEBUG","error mapping error, ignoring: " + ex,isDebugLogEnabled)
- utils.log("DEBUG","=========== End MapAdapterExecptionToWorkflowException ===========",isDebugLogEnabled)
- return buildException(response, execution)
- }
- }
-
- /**
- * @param response
- * @param execution
- * @return mapped exception
- */
- String mapAOTSExecptionToCommonException(String response, DelegateExecution execution)
- {
- def utils=new MsoUtils()
-
- def prefix=execution.getVariable("prefix")
- def method = getClass().getSimpleName() + '.mapAOTSExecptionToCommonException(' +
- 'execution=' + execution.getId() +
- ')'
-
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- utils.log("DEBUG",'Entered ' + method, isDebugLogEnabled)
-
-
- try {
- def errorCode = utils.getNodeText(response,"code")
- def descr = utils.getNodeText(response, "description")
- def mappedErr = mapErrorCodetoError(errorCode, descr)
- if(mappedErr == Error.SVC_DETAILED_SERVICE_ERROR || mappedError == Error.POL_DETAILED_POLICY_ERROR){
- ArrayList myVars = new ArrayList()
- myVars.add(descr)
- myVars.add(errorCode)
- execution.setVariable(prefix+"errVariables", myVars)
- }
- execution.setVariable(prefix+"err",mappedErr)
- def message = buildException("Received error from AOTS: " + descr, execution)
- utils.log("DEBUG","=========== End MapAOTSExecptionToCommonException ===========",isDebugLogEnabled)
- return message
- }catch (Exception ex) {
- //Ignore the exception - cases include non xml payload
- utils.log("DEBUG","error mapping error, ignoring: " + ex,isDebugLogEnabled)
- utils.log("DEBUG","=========== End MapAOTSExecptionToCommonException ===========",isDebugLogEnabled)
- return buildException(response, execution)
- }
- }
-
- String mapSDNCAdapterExceptionToErrorResponse(String sdncAdapterCallbackRequest, DelegateExecution execution) {
- def utils=new MsoUtils()
- def prefix=execution.getVariable("prefix")
- def method = getClass().getSimpleName() + '.mapSDNCAdapterExceptionToErrorResponse(' +
- 'execution=' + execution.getId() +
- ')'
-
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- utils.log("DEBUG",'Entered ' + method, isDebugLogEnabled)
-
- def sdncResponseCode
- String responseCode = execution.getVariable(prefix+"ResponseCode")
- utils.log("DEBUG",'responseCode to map: ' + responseCode, isDebugLogEnabled)
- def errorMessage
-
- try {
-
- if(utils.nodeExists(sdncAdapterCallbackRequest, "RequestData")) {
- def reqDataXml = StringEscapeUtils.unescapeXml(utils.getNodeXml(sdncAdapterCallbackRequest, "RequestData"))
- errorMessage = utils.getNodeText(reqDataXml, "response-message")
- sdncResponseCode = utils.getNodeText(reqDataXml, "response-code")
- }else{
- errorMessage = utils.getNodeText(sdncAdapterCallbackRequest, "ResponseMessage")
- sdncResponseCode = responseCode
- }
- def mappedErr = mapErrorCodetoError(responseCode, errorMessage)
- errorMessage = errorMessage.replace("&", "&").replace("<", "<").replace(">", ">")
- def modifiedErrorMessage = "Received error from SDN-C: " + errorMessage
- if(mappedErr == Error.SVC_DETAILED_SERVICE_ERROR || mappedErr == Error.POL_DETAILED_POLICY_ERROR){
- ArrayList myVars = new ArrayList()
- myVars.add(errorMessage)
- myVars.add(sdncResponseCode)
- execution.setVariable(prefix+"errVariables", myVars)
- }
- execution.setVariable(prefix+"err",mappedErr)
- def message = buildException(modifiedErrorMessage, execution)
-
-
- utils.log("DEBUG","=========== End MapSDNCAdapterException ===========",isDebugLogEnabled)
- return message
- }catch (Exception ex) {
- //Ignore the exception - cases include non xml payload
- utils.log("DEBUG","error mapping sdnc error, ignoring: " + ex,isDebugLogEnabled)
- utils.log("DEBUG","=========== End MapSDNCAdapterException ===========",isDebugLogEnabled)
- return null
- }
-
- }
-
- /**
- * @param response message from called component (ex: AAI)
- * @param execution
- * @return an error response conforming to the common
- */
- String mapAAIExceptionTCommonException(String response, DelegateExecution execution)
- {
- def utils=new MsoUtils()
- def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled")
- def prefix=execution.getVariable("prefix")
- def method = getClass().getSimpleName() + '.mapAAIExceptionTCommonException(' +
- 'execution=' + execution.getId() +
- ')'
-
- utils.log("DEBUG",'Entered ' + method, isDebugLogEnabled)
- def variables
- def message
- String errorCode = 'SVC0001'
- utils.log("DEBUG","response: " + response, isDebugLogEnabled)
- //they use the same format we do, pass their error along
- //TODO add Received error from A&AI at beg of text
- try {
- message = utils.getNodeXml(response, "requestError")
- message = utils.removeXmlNamespaces(message)
- } catch (Exception ex) {
- //Ignore the exception - cases include non xml payload
- message = buildException("Received error from A&AI, unable to parse",execution)
- utils.log("DEBUG","error mapping error, ignoring: " + ex,isDebugLogEnabled)
- }
-
- if(message != null) {
- execution.setVariable(prefix+"ErrorResponse",message)
- utils.log("ERROR","Fault:"+ execution.getVariable(prefix+"ErrorResponse"))
- return message
- } else {
-
- return null
-
- }
- }
-
- /**
- * @param execution
- * @return an error response conforming to the common API with default text msg
- */
- String buildException(execution){
- return buildException(null, execution)
- }
-
- /**
- * @param response message from called component (ex: AAI)
- * @param execution
- * @return an error response conforming to the common
- */
- String buildException(response, execution){
- def utils=new MsoUtils()
- def method = getClass().getSimpleName() + '.buildException(' +
- 'execution=' + execution.getId() +
- ')'
-
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- utils.log("DEBUG",'Entered ' + method, isDebugLogEnabled)
- def prefix=execution.getVariable("prefix")
- def responseCode = String.valueOf(execution.getVariable(prefix+"ResponseCode"))
- def variables
- utils.log("DEBUG","response: " + response, isDebugLogEnabled)
-
- try {
- utils.log("DEBUG","formatting error message" ,isDebugLogEnabled)
- def msgVars = execution.getVariable(prefix+"errVariables")
- def myErr = execution.getVariable(prefix+"err")
- def messageTxt = execution.getVariable(prefix+"errTxt")
- def messageId = null
-
- if(myErr == null){
- utils.log("DEBUG","mapping response code: " + responseCode, isDebugLogEnabled)
- myErr = mapErrorCodetoError(responseCode, response)
- if(myErr == null){
- //not a service or policy error, just return error code
- return ""
- }
- }
- messageId = myErr.getMsgId()
-
- if(messageTxt == null){
- if(myErr!=null){
- messageTxt = myErr.getMsgTxt()
- }else{
- messageTxt = response
- }
- }
-
- if(msgVars==null && (myErr == Error.SVC_DETAILED_SERVICE_ERROR || myErr == Error.POL_DETAILED_POLICY_ERROR)){
- msgVars = new ArrayList()
- msgVars.add(response)
- msgVars.add(responseCode)
- }
-
- def msgVarsXML=""
- StringBuffer msgVarsBuff = new StringBuffer()
- if(msgVars!=null){
- for(String msgVar : msgVars){
- msgVarsBuff.append(
- """
- <tns:variables>${msgVar}</tns:variables>""")
- }
-
- }
- def message = ""
- if(messageId.startsWith("SVC")){
- message = """<tns:requestError xmlns:tns="http://org.openecomp/mso/request/types/v1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://org.openecomp/mso/request/types/v1 MsoServiceInstanceTypesV1.xsd">
- <tns:serviceException>
- <tns:messageId>${messageId}</tns:messageId>
- <tns:text>${messageTxt}</tns:text>${msgVarsBuff}
- </tns:serviceException>
-</tns:requestError>"""
- }else{
- message ="""<tns:requestError xmlns:tns="http://org.openecomp/mso/request/types/v1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://org.openecomp/mso/request/types/v1 MsoServiceInstanceTypesV1.xsd">
- <tns:policyException>
- <tns:messageId>${messageId}</tns:messageId>
- <tns:text>${messageTxt}</tns:text>${msgVarsBuff}
- </tns:policyException>
-</tns:requestError>"""
- }
- utils.log("DEBUG", "message " + message, isDebugLogEnabled)
- execution.setVariable(prefix+"ErrorResponse",message)
- execution.setVariable(prefix+"err", myErr)
- execution.setVariable(prefix+"errTxt", messageTxt)
- execution.setVariable(prefix+"errVariables", msgVars)
- utils.log("ERROR","Fault:"+ execution.getVariable(prefix+"ErrorResponse"))
- return message
- }catch(Exception ex) {
- utils.log("DEBUG","error mapping error, return null: " + ex,isDebugLogEnabled)
- return null
- }
-
- }
-
- String parseError(DelegateExecution execution){
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- def utils=new MsoUtils()
- def prefix=execution.getVariable("prefix")
- def text = execution.getVariable(prefix+"errTxt")
- def msgVars = execution.getVariable(prefix+"errVariables")
- utils.log("DEBUG",'parsing message: ' + text, isDebugLogEnabled)
- if(text == null){
- return 'failed'
- }
- if(msgVars!=null && !msgVars.isEmpty()){
- for(int i=0; i<msgVars.size(); i++){
- text = text.replaceFirst("%"+(i+1), msgVars[i])
- }
- }
- utils.log("DEBUG",'parsed message is: ' + text, isDebugLogEnabled)
- return text
- }
-
-
-
- Error mapErrorCodetoError(responseCode, descr)
- {
-
- if(responseCode==null || responseCode=='0' || responseCode=='500' || responseCode =='408'){
- return Error.SVC_NO_SERVER_RESOURCES
- }else if(responseCode == '401' || responseCode == '405' || responseCode == '409' || responseCode == '503'){
- return null
- }else if(responseCode == '400'){
- if(descr==null){
- return Error.SVC_GENERAL_SERVICE_ERROR
- }else{
- return Error.SVC_DETAILED_SERVICE_ERROR
- }
- }else if(responseCode == '401'){
- if(descr==null){
- return Error.POL_GENERAL_POLICY_ERROR
- }else{
- return Error.POL_DETAILED_POLICY_ERROR
- }
- }else{
- return Error.SVC_NO_SERVER_RESOURCES
- }
- }
-
- String mapCategoryToErrorCode(String errorCategory)
- {
- if(errorCategory.equals('OPENSTACK'))
- return Error.SVC_NO_SERVER_RESOURCES
- else if (errorCategory.equals('IO'))
- return Error.SVC_NO_SERVER_RESOURCES
- else if (errorCategory.equals('INTERNAL'))
- return Error.SVC_NO_SERVER_RESOURCES
- else if (errorCategory.equals('USERDATA'))
- return Error.SVC_GENERAL_SERVICE_ERROR
- else
- return Error.SVC_GENERAL_SERVICE_ERROR
- }
-
-
-
-
-
-
+/*- + * ============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.common.scripts + +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.apache.commons.lang3.* +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + + + +class TrinityExceptionUtil { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, TrinityExceptionUtil.class); + + + + + public static enum Error { + SVC_GENERAL_SERVICE_ERROR("SVC0001","Internal Error"), + SVC_BAD_PARAMETER("SVC0002", "Invalid input value for message part %1"), + SVC_NO_SERVER_RESOURCES("SVC1000", "No server resources available to process the request"), + SVC_DETAILED_SERVICE_ERROR("SVC2000", "The following service error occurred: %1. Error code is %2."), + POL_GENERAL_POLICY_ERROR("POL0001", "A policy error occurred."), + POL_USER_NOT_PROVISIONED("POL1009", "User has not been provisioned for service"), + POL_USER_SUSPENDED("POL1010", "User has been suspended from service"), + POL_DETAILED_POLICY_ERROR("POL2000", "The following policy error occurred: %1. Error code is %2."), + POL_MSG_SIZE_EXCEEDS_LIMIT("POL9003", "Message content size exceeds the allowable limit") + + + private final String msgId + private final String msgTxt + + private Error(String msgId, String msgTxt) { + this.msgId = msgId + this.msgTxt = msgTxt + } + + public String getMsgId() { + return msgId + } + + public String getMsgTxt() { + return msgTxt + } + + } + + + + + String mapAdapterExecptionToCommonException(String response, DelegateExecution execution) + { + def utils=new MsoUtils() + def method = getClass().getSimpleName() + '.mapAdapterExecptionToCommonException(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + + + def errorCode + + + try { + errorCode = MapCategoryToErrorCode(utils.getNodeText(response, "category")) + execution.setVariable(prefix+"err",errorCode) + String message = buildException(response, execution) + msoLogger.trace("End MapAdapterExecptionToWorkflowException ") + return message + }catch (Exception ex) { + //Ignore the exception - cases include non xml payload + msoLogger.debug("error mapping error, ignoring: " + ex) + msoLogger.trace("End MapAdapterExecptionToWorkflowException ") + return buildException(response, execution) + } + } + + /** + * @param response + * @param execution + * @return mapped exception + */ + String mapAOTSExecptionToCommonException(String response, DelegateExecution execution) + { + def utils=new MsoUtils() + + def prefix=execution.getVariable("prefix") + def method = getClass().getSimpleName() + '.mapAOTSExecptionToCommonException(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + + + try { + def errorCode = utils.getNodeText(response,"code") + def descr = utils.getNodeText(response, "description") + def mappedErr = mapErrorCodetoError(errorCode, descr) + if(mappedErr == Error.SVC_DETAILED_SERVICE_ERROR || mappedError == Error.POL_DETAILED_POLICY_ERROR){ + ArrayList myVars = new ArrayList() + myVars.add(descr) + myVars.add(errorCode) + execution.setVariable(prefix+"errVariables", myVars) + } + execution.setVariable(prefix+"err",mappedErr) + def message = buildException("Received error from AOTS: " + descr, execution) + msoLogger.trace("End MapAOTSExecptionToCommonException ") + return message + }catch (Exception ex) { + //Ignore the exception - cases include non xml payload + msoLogger.debug("error mapping error, ignoring: " + ex) + msoLogger.trace("End MapAOTSExecptionToCommonException ") + return buildException(response, execution) + } + } + + String mapSDNCAdapterExceptionToErrorResponse(String sdncAdapterCallbackRequest, DelegateExecution execution) { + def utils=new MsoUtils() + def prefix=execution.getVariable("prefix") + def method = getClass().getSimpleName() + '.mapSDNCAdapterExceptionToErrorResponse(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + + def sdncResponseCode + String responseCode = execution.getVariable(prefix+"ResponseCode") + msoLogger.debug('responseCode to map: ' + responseCode) + def errorMessage + + try { + + if(utils.nodeExists(sdncAdapterCallbackRequest, "RequestData")) { + def reqDataXml = utils.getNodeXml(sdncAdapterCallbackRequest, "RequestData") + errorMessage = utils.getNodeText(reqDataXml, "response-message") + sdncResponseCode = utils.getNodeText(reqDataXml, "response-code") + }else{ + errorMessage = utils.getNodeText(sdncAdapterCallbackRequest, "ResponseMessage") + sdncResponseCode = responseCode + } + def mappedErr = mapErrorCodetoError(responseCode, errorMessage) + errorMessage = errorMessage + def modifiedErrorMessage = "Received error from SDN-C: " + errorMessage + if(mappedErr == Error.SVC_DETAILED_SERVICE_ERROR || mappedErr == Error.POL_DETAILED_POLICY_ERROR){ + ArrayList myVars = new ArrayList() + myVars.add(errorMessage) + myVars.add(sdncResponseCode) + execution.setVariable(prefix+"errVariables", myVars) + } + execution.setVariable(prefix+"err",mappedErr) + def message = buildException(modifiedErrorMessage, execution) + + + msoLogger.trace("End MapSDNCAdapterException ") + return message + }catch (Exception ex) { + //Ignore the exception - cases include non xml payload + msoLogger.debug("error mapping sdnc error, ignoring: " + ex) + msoLogger.trace("End MapSDNCAdapterException ") + return null + } + + } + + /** + * @param response message from called component (ex: AAI) + * @param execution + * @return an error response conforming to the common + */ + String mapAAIExceptionTCommonException(String response, DelegateExecution execution) + { + def utils=new MsoUtils() + def prefix=execution.getVariable("prefix") + def method = getClass().getSimpleName() + '.mapAAIExceptionTCommonException(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + def variables + def message + String errorCode = 'SVC0001' + msoLogger.debug("response: " + response) + //they use the same format we do, pass their error along + //TODO add Received error from A&AI at beg of text + try { + message = utils.getNodeXml(response, "requestError") + message = utils.removeXmlNamespaces(message) + } catch (Exception ex) { + //Ignore the exception - cases include non xml payload + message = buildException("Received error from A&AI, unable to parse",execution) + msoLogger.debug("error mapping error, ignoring: " + ex) + } + + if(message != null) { + execution.setVariable(prefix+"ErrorResponse",message) + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Fault", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, execution.getVariable(prefix+"ErrorResponse")); + return message + } else { + + return null + + } + } + + /** + * @param execution + * @return an error response conforming to the common API with default text msg + */ + String buildException(execution){ + return buildException(null, execution) + } + + /** + * @param response message from called component (ex: AAI) + * @param execution + * @return an error response conforming to the common + */ + String buildException(response, execution){ + def utils=new MsoUtils() + def method = getClass().getSimpleName() + '.buildException(' + + 'execution=' + execution.getId() + + ')' + + msoLogger.trace('Entered ' + method) + def prefix=execution.getVariable("prefix") + def responseCode = String.valueOf(execution.getVariable(prefix+"ResponseCode")) + def variables + msoLogger.debug("response: " + response) + + try { + msoLogger.debug("formatting error message" ) + def msgVars = execution.getVariable(prefix+"errVariables") + def myErr = execution.getVariable(prefix+"err") + def messageTxt = execution.getVariable(prefix+"errTxt") + def messageId = null + + if(myErr == null){ + msoLogger.debug("mapping response code: " + responseCode) + myErr = mapErrorCodetoError(responseCode, response) + if(myErr == null){ + //not a service or policy error, just return error code + return "" + } + } + messageId = myErr.getMsgId() + + if(messageTxt == null){ + if(myErr!=null){ + messageTxt = myErr.getMsgTxt() + }else{ + messageTxt = response + } + } + + if(msgVars==null && (myErr == Error.SVC_DETAILED_SERVICE_ERROR || myErr == Error.POL_DETAILED_POLICY_ERROR)){ + msgVars = new ArrayList() + msgVars.add(response) + msgVars.add(responseCode) + } + + def msgVarsXML="" + StringBuffer msgVarsBuff = new StringBuffer() + if(msgVars!=null){ + for(String msgVar : msgVars){ + msgVarsBuff.append( + """ + <tns:variables>${MsoUtils.xmlEscape(msgVar)}</tns:variables>""") + } + + } + def message = "" + if(messageId.startsWith("SVC")){ + message = """<tns:requestError xmlns:tns="http://org.onap/so/request/types/v1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://org.onap/so/request/types/v1 MsoServiceInstanceTypesV1.xsd"> + <tns:serviceException> + <tns:messageId>${MsoUtils.xmlEscape(messageId)}</tns:messageId> + <tns:text>${MsoUtils.xmlEscape(messageTxt)}</tns:text>${msgVarsBuff} + </tns:serviceException> +</tns:requestError>""" + }else{ + message ="""<tns:requestError xmlns:tns="http://org.onap/so/request/types/v1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://org.onap/so/request/types/v1 MsoServiceInstanceTypesV1.xsd"> + <tns:policyException> + <tns:messageId>${MsoUtils.xmlEscape(messageId)}</tns:messageId> + <tns:text>${MsoUtils.xmlEscape(messageTxt)}</tns:text>${msgVarsBuff} + </tns:policyException> +</tns:requestError>""" + } + msoLogger.debug("message " + message) + execution.setVariable(prefix+"ErrorResponse",message) + execution.setVariable(prefix+"err", myErr) + execution.setVariable(prefix+"errTxt", messageTxt) + execution.setVariable(prefix+"errVariables", msgVars) + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Fault", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, execution.getVariable(prefix+"ErrorResponse")); + return message + }catch(Exception ex) { + msoLogger.debug("error mapping error, return null: " + ex) + return null + } + + } + + String parseError(DelegateExecution execution){ + def utils=new MsoUtils() + def prefix=execution.getVariable("prefix") + def text = execution.getVariable(prefix+"errTxt") + def msgVars = execution.getVariable(prefix+"errVariables") + msoLogger.debug('parsing message: ' + text) + if(text == null){ + return 'failed' + } + if(msgVars!=null && !msgVars.isEmpty()){ + for(int i=0; i<msgVars.size(); i++){ + text = text.replaceFirst("%"+(i+1), msgVars[i]) + } + } + msoLogger.debug('parsed message is: ' + text) + return text + } + + + + Error mapErrorCodetoError(responseCode, descr) + { + + if(responseCode==null || responseCode=='0' || responseCode=='500' || responseCode =='408'){ + return Error.SVC_NO_SERVER_RESOURCES + }else if(responseCode == '401' || responseCode == '405' || responseCode == '409' || responseCode == '503'){ + return null + }else if(responseCode == '400'){ + if(descr==null){ + return Error.SVC_GENERAL_SERVICE_ERROR + }else{ + return Error.SVC_DETAILED_SERVICE_ERROR + } + }else if(responseCode == '401'){ + if(descr==null){ + return Error.POL_GENERAL_POLICY_ERROR + }else{ + return Error.POL_DETAILED_POLICY_ERROR + } + }else{ + return Error.SVC_NO_SERVER_RESOURCES + } + } + + String mapCategoryToErrorCode(String errorCategory) + { + if(errorCategory.equals('OPENSTACK')) + return Error.SVC_NO_SERVER_RESOURCES + else if (errorCategory.equals('IO')) + return Error.SVC_NO_SERVER_RESOURCES + else if (errorCategory.equals('INTERNAL')) + return Error.SVC_NO_SERVER_RESOURCES + else if (errorCategory.equals('USERDATA')) + return Error.SVC_GENERAL_SERVICE_ERROR + else + return Error.SVC_GENERAL_SERVICE_ERROR + } + + + + + + }
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/UpdateAAIGenericVnf.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy index 84d9ffdb6b..7d7b9e103f 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/UpdateAAIGenericVnf.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy @@ -1,347 +1,345 @@ -/*-
- * ============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.common.scripts
-
-import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.openecomp.mso.bpmn.core.WorkflowException
-import org.openecomp.mso.rest.APIResponse
-import org.springframework.web.util.UriUtils
-
-
-public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor {
-
- private XmlParser xmlParser = new XmlParser()
- ExceptionUtil exceptionUtil = new ExceptionUtil()
-
- /**
- * Initialize the flow's variables.
- *
- * @param execution The flow's execution instance.
- */
- public void initProcessVariables(DelegateExecution execution) {
- execution.setVariable('prefix', 'UAAIGenVnf_')
- execution.setVariable('UAAIGenVnf_vnfId', null)
- execution.setVariable('UAAIGenVnf_personaModelId', null)
- execution.setVariable('UAAIGenVnf_personaModelVersion', null)
- execution.setVariable("UAAIGenVnf_ipv4OamAddress", null)
- execution.setVariable('UAAIGenVnf_managementV6Address', null)
- execution.setVariable('UAAIGenVnf_orchestrationStatus', null)
- execution.setVariable('UAAIGenVnf_getGenericVnfResponseCode' ,null)
- execution.setVariable('UAAIGenVnf_getGenericVnfResponse', '')
- execution.setVariable('UAAIGenVnf_updateGenericVnfResponseCode', null)
- execution.setVariable('UAAIGenVnf_updateGenericVnfResponse', '')
- }
-
- /**
- * Check for missing elements in the received request.
- *
- * @param execution The flow's execution instance.
- */
- public void preProcessRequest(DelegateExecution execution) {
- def method = getClass().getSimpleName() + '.preProcessRequest(' +
- 'execution=' + execution.getId() +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- try {
- def xml = execution.getVariable('UpdateAAIGenericVnfRequest')
- logDebug('Received request xml:\n' + xml, isDebugLogEnabled)
- utils.logAudit("UpdateAAIGenericVnf Request XML: " + xml)
- initProcessVariables(execution)
-
- def vnfId = getRequiredNodeText(execution, xml,'vnf-id')
- execution.setVariable('UAAIGenVnf_vnfId', vnfId)
-
- def personaModelId = getNodeTextForce(xml,'persona-model-id')
- if (personaModelId != null && !personaModelId.isEmpty()) {
- execution.setVariable('UAAIGenVnf_personaModelId', personaModelId)
- }
-
- def personaModelVersion = getNodeTextForce(xml,'persona-model-version')
- if (personaModelVersion != null && !personaModelVersion.isEmpty()) {
- execution.setVariable('UAAIGenVnf_personaModelVersion', personaModelVersion)
- }
-
- def ipv4OamAddress = getNodeTextForce(xml, 'ipv4-oam-address')
- if (ipv4OamAddress != null && !ipv4OamAddress.isEmpty()) {
- execution.setVariable('UAAIGenVnf_ipv4OamAddress', ipv4OamAddress)
- }
-
- def managementV6Address = getNodeTextForce(xml, 'management-v6-address')
- if (managementV6Address != null && !managementV6Address.isEmpty()) {
- execution.setVariable('UAAIGenVnf_managementV6Address', managementV6Address)
- }
-
- def orchestrationStatus = getNodeTextForce(xml, 'orchestration-status')
- if (orchestrationStatus != null && !orchestrationStatus.isEmpty()) {
- execution.setVariable('UAAIGenVnf_orchestrationStatus', orchestrationStatus)
- }
-
- logDebug('Exited ' + method, isDebugLogEnabled)
- } catch (BpmnError e) {
- throw e;
- } catch (Exception e) {
- logError('Caught exception in ' + method, e)
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessRequest(): ' + e.getMessage())
- }
- }
-
- /**
- * Using the received vnfId, query AAI to get the corresponding Generic VNF.
- * A 200 response is expected with the VF Module in the response body.
- *
- * @param execution The flow's execution instance.
- */
- public void getGenericVnf(DelegateExecution execution) {
- def method = getClass().getSimpleName() + '.getGenericVnf(' +
- 'execution=' + execution.getId() +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- try {
- def vnfId = execution.getVariable('UAAIGenVnf_vnfId')
-
- // Construct endpoint
- AaiUtil aaiUriUtil = new AaiUtil(this)
- def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution)
- logDebug('AAI URI is: ' + aai_uri, isDebugLogEnabled)
- String endPoint = execution.getVariable('URN_aai_endpoint') + aai_uri + '/' + UriUtils.encode(vnfId, "UTF-8") + "?depth=1"
-
- try {
- logDebug('sending GET to AAI endpoint \'' + endPoint + '\'', isDebugLogEnabled)
- utils.logAudit("Sending GET to AAI endpoint: " + endPoint)
-
- APIResponse response = aaiUriUtil.executeAAIGetCall(execution, endPoint)
- def responseData = response.getResponseBodyAsString()
- execution.setVariable('UAAIGenVnf_getGenericVnfResponseCode', response.getStatusCode())
- execution.setVariable('UAAIGenVnf_getGenericVnfResponse', responseData)
- utils.logAudit("UpdateAAIGenericVnf Response data: " + responseData)
- logDebug('Response code:' + response.getStatusCode(), isDebugLogEnabled)
- logDebug('Response:' + System.lineSeparator() + responseData, isDebugLogEnabled)
- } catch (Exception ex) {
- ex.printStackTrace()
- logDebug('Exception occurred while executing AAI GET:' + ex.getMessage(),isDebugLogEnabled)
- execution.setVariable('UAAIGenVnf_getGenericVnfResponseCode', 500)
- execution.setVariable('UAAIGenVnf_getGenericVnfResponse', 'AAI GET Failed:' + ex.getMessage())
- }
- logDebug('Exited ' + method, isDebugLogEnabled)
- } catch (BpmnError e) {
- throw e;
- } catch (Exception e) {
- logError('Caught exception in ' + method, e)
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in getGenericVnf(): ' + e.getMessage())
- }
- }
-
- /**
- * Construct and send a PUT request to AAI to update the Generic VNF.
- *
- * @param execution The flow's execution instance.
- */
- public void updateGenericVnf(DelegateExecution execution) {
- def method = getClass().getSimpleName() + '.updateGenericVnf(' +
- 'execution=' + execution.getId() +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- try {
- def vnfId = execution.getVariable('UAAIGenVnf_vnfId')
- def genericVnf = execution.getVariable('UAAIGenVnf_getGenericVnfResponse')
- def origRequest = execution.getVariable('UpdateAAIGenericVnfRequest')
-
- utils.logAudit("UpdateGenericVnf Request: " + origRequest)
- // Confirm resource-version is in retrieved Generic VNF
- def Node genericVnfNode = xmlParser.parseText(genericVnf)
- if (utils.getChildNode(genericVnfNode, 'resource-version') == null) {
- def msg = 'Can\'t update Generic VNF ' + vnfId + ' since \'resource-version\' is missing'
- logError(msg)
- throw new Exception(msg)
- }
-
- // Handle persona-model-id/persona-model-version
-
- def String newPersonaModelId = execution.getVariable('UAAIGenVnf_personaModelId')
- def String newPersonaModelVersion = execution.getVariable('UAAIGenVnf_personaModelVersion')
- def String personaModelVersionEntry = ""
- if (newPersonaModelId != null || newPersonaModelVersion != null) {
-
- // Confirm "new" persona-model-id is same as "current" persona-model-id
- def Node currPersonaModelIdNode = utils.getChildNode(genericVnfNode, 'model-invariant-id')
- if (currPersonaModelIdNode == null) {
- // check the old attribute name
- currPersonaModelIdNode = utils.getChildNode(genericVnfNode, 'persona-model-id')
- }
- def String currPersonaModelId = ''
- if (currPersonaModelIdNode != null) {
- currPersonaModelId = currPersonaModelIdNode.text()
- }
- if (!newPersonaModelId.equals(currPersonaModelId)) {
- def msg = 'Can\'t update Generic VNF ' + vnfId + ' since there is \'persona-model-id\' mismatch between the current and new values'
- logError(msg)
- throw new Exception(msg)
- }
-
- // Construct payload
- personaModelVersionEntry = updateGenericVnfNode(origRequest, genericVnfNode, 'model-version-id')
- }
-
- // Handle ipv4-oam-address
- def String ipv4OamAddress = execution.getVariable('UAAIGenVnf_ipv4OamAddress')
- def String ipv4OamAddressEntry = ""
- if (ipv4OamAddress != null) {
- // Construct payload
- ipv4OamAddressEntry = updateGenericVnfNode(origRequest, genericVnfNode, 'ipv4-oam-address')
- }
-
- // Handle management-v6-address
- def String managementV6Address = execution.getVariable('UAAIGenVnf_managementV6Address')
- def String managementV6AddressEntry = ""
- if (managementV6Address != null) {
- // Construct payload
- managementV6AddressEntry = updateGenericVnfNode(origRequest, genericVnfNode, 'management-v6-address')
- }
-
- // Handle orchestration-status
- def String orchestrationStatus = execution.getVariable('UAAIGenVnf_orchestrationStatus')
- def String orchestrationStatusEntry = ""
- if (orchestrationStatus != null) {
- // Construct payload
- orchestrationStatusEntry = updateGenericVnfNode(origRequest, genericVnfNode, 'orchestration-status')
- }
-
- def payload = """
- { ${personaModelVersionEntry}
- ${ipv4OamAddressEntry}
- ${managementV6AddressEntry}
- ${orchestrationStatusEntry}
- "vnf-id": "${vnfId}"
- }
- """
-
- // Construct endpoint
- AaiUtil aaiUriUtil = new AaiUtil(this)
- def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution)
- logDebug('AAI URI is: ' + aai_uri, isDebugLogEnabled)
- String endPoint = execution.getVariable('URN_aai_endpoint') + aai_uri + '/' + UriUtils.encode(vnfId, "UTF-8")
-
- try {
- logDebug('sending PATCH to AAI endpoint \'' + endPoint + '\'' + 'with payload \n' + payload, isDebugLogEnabled)
- utils.logAudit("Sending PATCH to AAI endpoint: " + endPoint)
-
- APIResponse response = aaiUriUtil.executeAAIPatchCall(execution, endPoint, payload)
- def responseData = response.getResponseBodyAsString()
- execution.setVariable('UAAIGenVnf_updateGenericVnfResponseCode', response.getStatusCode())
- execution.setVariable('UAAIGenVnf_updateGenericVnfResponse', responseData)
- utils.logAudit("UpdateAAIGenericVnf Response Data: " + responseData)
- logDebug('Response code:' + response.getStatusCode(), isDebugLogEnabled)
- logDebug('Response:' + System.lineSeparator() + responseData, isDebugLogEnabled)
- } catch (Exception ex) {
- ex.printStackTrace()
- logDebug('Exception occurred while executing AAI PATCH:' + ex.getMessage(),isDebugLogEnabled)
- execution.setVariable('UAAIGenVnf_updateGenericVnfResponseCode', 500)
- execution.setVariable('UAAIGenVnf_updateGenericVnfResponse', 'AAI PATCH Failed:' + ex.getMessage())
- }
- logDebug('Exited ' + method, isDebugLogEnabled)
- } catch (BpmnError e) {
- throw e;
- } catch (Exception e) {
- logError('Caught exception in ' + method, e)
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in updateGenericVnf(): ' + e.getMessage())
- }
- }
-
- /**
- * Sets up json attributes for PATCH request for Update
- *
- * @param origRequest Incoming update request with Generic VNF element(s) to be updated.
- * @param genericVnf Current Generic VNF retrieved from AAI.
- * @param element Name of element to be inserted.
- */
- public String updateGenericVnfNode(String origRequest, Node genericVnfNode, String elementName) {
-
- if (!utils.nodeExists(origRequest, elementName)) {
- return ""
- }
- def elementValue = utils.getNodeText(origRequest, elementName)
-
- if (elementValue.equals('DELETE')) {
- // Set the element being deleted to null
- return """"${elementName}": null,"""
- }
- else {
- return """"${elementName}": "${elementValue}","""
- }
-
- }
-
- /**
- * Generates a WorkflowException if the AAI query returns a response code other than 200.
- *
- * @param execution The flow's execution instance.
- */
- public void handleAAIQueryFailure(DelegateExecution execution) {
- def method = getClass().getSimpleName() + '.handleAAIQueryFailure(' +
- 'execution=' + execution.getId() +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- logError('Error occurred attempting to query AAI, Response Code ' +
- execution.getVariable('UAAIGenVnf_getGenericVnfResponseCode') + ', Error Response ' +
- execution.getVariable('UAAIGenVnf_getGenericVnfResponse'))
- String processKey = getProcessKey(execution);
- WorkflowException exception = new WorkflowException(processKey, 5000,
- execution.getVariable('UAAIGenVnf_getGenericVnfResponse'))
- execution.setVariable('WorkflowException', exception)
-
- utils.logAudit("Workflow Exception occurred when handling Quering AAI: " + exception.getErrorMessage())
- logDebug('Exited ' + method, isDebugLogEnabled)
- }
-
- /**
- * Generates a WorkflowException if updating a VF Module in AAI returns a response code other than 200.
- *
- * @param execution The flow's execution instance.
- */
- public void handleUpdateGenericVnfFailure(DelegateExecution execution) {
- def method = getClass().getSimpleName() + '.handleUpdateGenericVnfFailure(' +
- 'execution=' + execution.getId() +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- logError('Error occurred attempting to update Generic VNF in AAI, Response Code ' +
- execution.getVariable('UAAIGenVnf_updateGenericVnfResponseCode') + ', Error Response ' +
- execution.getVariable('UAAIGenVnf_updateGenericVnfResponse'))
-
- String processKey = getProcessKey(execution);
- WorkflowException exception = new WorkflowException(processKey, 5000,
- execution.getVariable('UAAIGenVnf_updateGenericVnfResponse'))
- execution.setVariable('WorkflowException', exception)
-
- utils.logAudit("Workflow Exception occurred when Updating GenericVnf: " + exception.getErrorMessage())
- logDebug('Exited ' + method, isDebugLogEnabled)
- }
+/*- + * ============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.common.scripts + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.rest.APIResponse +import org.springframework.web.util.UriUtils +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + + + + +public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, UpdateAAIGenericVnf.class); + + + private XmlParser xmlParser = new XmlParser() + ExceptionUtil exceptionUtil = new ExceptionUtil() + + /** + * Initialize the flow's variables. + * + * @param execution The flow's execution instance. + */ + public void initProcessVariables(DelegateExecution execution) { + execution.setVariable('prefix', 'UAAIGenVnf_') + execution.setVariable('UAAIGenVnf_vnfId', null) + execution.setVariable('UAAIGenVnf_personaModelId', null) + execution.setVariable('UAAIGenVnf_personaModelVersion', null) + execution.setVariable("UAAIGenVnf_ipv4OamAddress", null) + execution.setVariable('UAAIGenVnf_managementV6Address', null) + execution.setVariable('UAAIGenVnf_orchestrationStatus', null) + execution.setVariable('UAAIGenVnf_getGenericVnfResponseCode' ,null) + execution.setVariable('UAAIGenVnf_getGenericVnfResponse', '') + execution.setVariable('UAAIGenVnf_updateGenericVnfResponseCode', null) + execution.setVariable('UAAIGenVnf_updateGenericVnfResponse', '') + } + + /** + * Check for missing elements in the received request. + * + * @param execution The flow's execution instance. + */ + public void preProcessRequest(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.preProcessRequest(' + + 'execution=' + execution.getId() + + ')' + msoLogger.trace('Entered ' + method) + + try { + def xml = execution.getVariable('UpdateAAIGenericVnfRequest') + msoLogger.debug('Received request xml:\n' + xml) + msoLogger.debug("UpdateAAIGenericVnf Request XML: " + xml) + initProcessVariables(execution) + + def vnfId = getRequiredNodeText(execution, xml,'vnf-id') + execution.setVariable('UAAIGenVnf_vnfId', vnfId) + + def personaModelId = getNodeTextForce(xml,'persona-model-id') + if (personaModelId != null && !personaModelId.isEmpty()) { + execution.setVariable('UAAIGenVnf_personaModelId', personaModelId) + } + + def personaModelVersion = getNodeTextForce(xml,'persona-model-version') + if (personaModelVersion != null && !personaModelVersion.isEmpty()) { + execution.setVariable('UAAIGenVnf_personaModelVersion', personaModelVersion) + } + + def ipv4OamAddress = getNodeTextForce(xml, 'ipv4-oam-address') + if (ipv4OamAddress != null && !ipv4OamAddress.isEmpty()) { + execution.setVariable('UAAIGenVnf_ipv4OamAddress', ipv4OamAddress) + } + + def managementV6Address = getNodeTextForce(xml, 'management-v6-address') + if (managementV6Address != null && !managementV6Address.isEmpty()) { + execution.setVariable('UAAIGenVnf_managementV6Address', managementV6Address) + } + + def orchestrationStatus = getNodeTextForce(xml, 'orchestration-status') + if (orchestrationStatus != null && !orchestrationStatus.isEmpty()) { + execution.setVariable('UAAIGenVnf_orchestrationStatus', orchestrationStatus) + } + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessRequest(): ' + e.getMessage()) + } + } + + /** + * Using the received vnfId, query AAI to get the corresponding Generic VNF. + * A 200 response is expected with the VF Module in the response body. + * + * @param execution The flow's execution instance. + */ + public void getGenericVnf(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.getGenericVnf(' + + 'execution=' + execution.getId() + + ')' + msoLogger.trace('Entered ' + method) + + try { + def vnfId = execution.getVariable('UAAIGenVnf_vnfId') + + // Construct endpoint + AaiUtil aaiUriUtil = new AaiUtil(this) + def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution) + msoLogger.debug('AAI URI is: ' + aai_uri) + String endPoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + aai_uri + '/' + UriUtils.encode(vnfId, "UTF-8") + "?depth=1" + + try { + msoLogger.debug('sending GET to AAI endpoint \'' + endPoint + '\'') + msoLogger.debug("Sending GET to AAI endpoint: " + endPoint) + + APIResponse response = aaiUriUtil.executeAAIGetCall(execution, endPoint) + def responseData = response.getResponseBodyAsString() + execution.setVariable('UAAIGenVnf_getGenericVnfResponseCode', response.getStatusCode()) + execution.setVariable('UAAIGenVnf_getGenericVnfResponse', responseData) + msoLogger.debug("UpdateAAIGenericVnf Response data: " + responseData) + msoLogger.debug('Response code:' + response.getStatusCode()) + msoLogger.debug('Response:' + System.lineSeparator() + responseData) + } catch (Exception ex) { + msoLogger.error(e); + msoLogger.debug('Exception occurred while executing AAI GET:' + ex.getMessage()) + execution.setVariable('UAAIGenVnf_getGenericVnfResponseCode', 500) + execution.setVariable('UAAIGenVnf_getGenericVnfResponse', 'AAI GET Failed:' + ex.getMessage()) + } + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in getGenericVnf(): ' + e.getMessage()) + } + } + + /** + * Construct and send a PUT request to AAI to update the Generic VNF. + * + * @param execution The flow's execution instance. + */ + public void updateGenericVnf(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.updateGenericVnf(' + + 'execution=' + execution.getId() + + ')' + msoLogger.trace('Entered ' + method) + + try { + def vnfId = execution.getVariable('UAAIGenVnf_vnfId') + def genericVnf = execution.getVariable('UAAIGenVnf_getGenericVnfResponse') + def origRequest = execution.getVariable('UpdateAAIGenericVnfRequest') + + msoLogger.debug("UpdateGenericVnf Request: " + origRequest) + // Confirm resource-version is in retrieved Generic VNF + def Node genericVnfNode = xmlParser.parseText(genericVnf) + if (utils.getChildNode(genericVnfNode, 'resource-version') == null) { + def msg = 'Can\'t update Generic VNF ' + vnfId + ' since \'resource-version\' is missing' + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + throw new Exception(msg) + } + + // Handle persona-model-id/persona-model-version + + def String newPersonaModelId = execution.getVariable('UAAIGenVnf_personaModelId') + def String newPersonaModelVersion = execution.getVariable('UAAIGenVnf_personaModelVersion') + def String personaModelVersionEntry = "" + if (newPersonaModelId != null || newPersonaModelVersion != null) { + + // Confirm "new" persona-model-id is same as "current" persona-model-id + def Node currPersonaModelIdNode = utils.getChildNode(genericVnfNode, 'model-invariant-id') + if (currPersonaModelIdNode == null) { + // check the old attribute name + currPersonaModelIdNode = utils.getChildNode(genericVnfNode, 'persona-model-id') + } + def String currPersonaModelId = '' + if (currPersonaModelIdNode != null) { + currPersonaModelId = currPersonaModelIdNode.text() + } + if (!newPersonaModelId.equals(currPersonaModelId)) { + def msg = 'Can\'t update Generic VNF ' + vnfId + ' since there is \'persona-model-id\' mismatch between the current and new values' + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + throw new Exception(msg) + } + + // Construct payload + personaModelVersionEntry = updateGenericVnfNode(origRequest, genericVnfNode, 'model-version-id') + } + + // Handle ipv4-oam-address + def String ipv4OamAddress = execution.getVariable('UAAIGenVnf_ipv4OamAddress') + def String ipv4OamAddressEntry = "" + if (ipv4OamAddress != null) { + // Construct payload + ipv4OamAddressEntry = updateGenericVnfNode(origRequest, genericVnfNode, 'ipv4-oam-address') + } + + // Handle management-v6-address + def String managementV6Address = execution.getVariable('UAAIGenVnf_managementV6Address') + def String managementV6AddressEntry = "" + if (managementV6Address != null) { + // Construct payload + managementV6AddressEntry = updateGenericVnfNode(origRequest, genericVnfNode, 'management-v6-address') + } + + // Handle orchestration-status + def String orchestrationStatus = execution.getVariable('UAAIGenVnf_orchestrationStatus') + def String orchestrationStatusEntry = "" + if (orchestrationStatus != null) { + // Construct payload + orchestrationStatusEntry = updateGenericVnfNode(origRequest, genericVnfNode, 'orchestration-status') + } + + def payload = """ + { ${personaModelVersionEntry} + ${ipv4OamAddressEntry} + ${managementV6AddressEntry} + ${orchestrationStatusEntry} + "vnf-id": "${vnfId}" + } + """ + + // Construct endpoint + AaiUtil aaiUriUtil = new AaiUtil(this) + def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution) + msoLogger.debug('AAI URI is: ' + aai_uri) + String endPoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + aai_uri + '/' + UriUtils.encode(vnfId, "UTF-8") + + try { + msoLogger.debug('sending PATCH to AAI endpoint \'' + endPoint + '\'' + 'with payload \n' + payload) + msoLogger.debug("Sending PATCH to AAI endpoint: " + endPoint) + + APIResponse response = aaiUriUtil.executeAAIPatchCall(execution, endPoint, payload) + def responseData = response.getResponseBodyAsString() + execution.setVariable('UAAIGenVnf_updateGenericVnfResponseCode', response.getStatusCode()) + execution.setVariable('UAAIGenVnf_updateGenericVnfResponse', responseData) + msoLogger.debug("UpdateAAIGenericVnf Response Data: " + responseData) + msoLogger.debug('Response code:' + response.getStatusCode()) + msoLogger.debug('Response:' + System.lineSeparator() + responseData) + } catch (Exception ex) { + ex.printStackTrace() + msoLogger.debug('Exception occurred while executing AAI PATCH:' + ex.getMessage()) + execution.setVariable('UAAIGenVnf_updateGenericVnfResponseCode', 500) + execution.setVariable('UAAIGenVnf_updateGenericVnfResponse', 'AAI PATCH Failed:' + ex.getMessage()) + } + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in updateGenericVnf(): ' + e.getMessage()) + } + } + + /** + * Sets up json attributes for PATCH request for Update + * + * @param origRequest Incoming update request with Generic VNF element(s) to be updated. + * @param genericVnf Current Generic VNF retrieved from AAI. + * @param element Name of element to be inserted. + */ + public String updateGenericVnfNode(String origRequest, Node genericVnfNode, String elementName) { + + if (!utils.nodeExists(origRequest, elementName)) { + return "" + } + def elementValue = utils.getNodeText(origRequest, elementName) + + if (elementValue.equals('DELETE')) { + // Set the element being deleted to null + return """"${elementName}": null,""" + } + else { + return """"${elementName}": "${elementValue}",""" + } + + } + + /** + * Generates a WorkflowException if the AAI query returns a response code other than 200. + * + * @param execution The flow's execution instance. + */ + public void handleAAIQueryFailure(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.handleAAIQueryFailure(' + + 'execution=' + execution.getId() + + ')' + msoLogger.trace('Entered ' + method) + + msoLogger.error( 'Error occurred attempting to query AAI, Response Code ' + execution.getVariable('UAAIGenVnf_getGenericVnfResponseCode')); + String processKey = getProcessKey(execution); + WorkflowException exception = new WorkflowException(processKey, 5000, + execution.getVariable('UAAIGenVnf_getGenericVnfResponse')) + execution.setVariable('WorkflowException', exception) + + msoLogger.debug("Workflow Exception occurred when handling Quering AAI: " + exception.getErrorMessage()) + msoLogger.trace('Exited ' + method) + } + + /** + * Generates a WorkflowException if updating a VF Module in AAI returns a response code other than 200. + * + * @param execution The flow's execution instance. + */ + public void handleUpdateGenericVnfFailure(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.handleUpdateGenericVnfFailure(' + + 'execution=' + execution.getId() + + ')' + msoLogger.trace('Entered ' + method) + + msoLogger.error('Error occurred attempting to update Generic VNF in AAI, Response Code ' + execution.getVariable('UAAIGenVnf_updateGenericVnfResponseCode')); + + String processKey = getProcessKey(execution); + WorkflowException exception = new WorkflowException(processKey, 5000, + execution.getVariable('UAAIGenVnf_updateGenericVnfResponse')) + execution.setVariable('WorkflowException', exception) + + msoLogger.debug("Workflow Exception occurred when Updating GenericVnf: " + exception.getErrorMessage()) + msoLogger.trace('Exited ' + method) + } }
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/UpdateAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModule.groovy index b3a9423727..68b2df213a 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/UpdateAAIVfModule.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModule.groovy @@ -1,382 +1,369 @@ -/*-
- * ============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.common.scripts
-
-import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.openecomp.mso.bpmn.core.WorkflowException
-import org.openecomp.mso.rest.APIResponse
-import org.springframework.web.util.UriUtils
-
-
-public class UpdateAAIVfModule extends AbstractServiceTaskProcessor {
-
- private XmlParser xmlParser = new XmlParser()
- ExceptionUtil exceptionUtil = new ExceptionUtil()
-
- /**
- * Initialize the flow's variables.
- *
- * @param execution The flow's execution instance.
- */
- public void initProcessVariables(DelegateExecution execution) {
- execution.setVariable('prefix', 'UAAIVfMod_')
- execution.setVariable('UAAIVfMod_vnfId', null)
- execution.setVariable('UAAIVfMod_vfModuleId', null)
- execution.setVariable('UAAIVfMod_orchestrationStatus', null)
- execution.setVariable('UAAIVfMod_heatStackId', null)
- execution.setVariable('UAAIVfMod_volumeGroupId', null)
- execution.setVariable('UAAIVfMod_getVfModuleResponseCode' ,null)
- execution.setVariable('UAAIVfMod_getVfModuleResponse', '')
- execution.setVariable('UAAIVfMod_updateVfModuleResponseCode', null)
- execution.setVariable('UAAIVfMod_updateVfModuleResponse', '')
- }
-
- /**
- * Check for missing elements in the received request.
- *
- * @param execution The flow's execution instance.
- */
- public void preProcessRequest(DelegateExecution execution) {
- def method = getClass().getSimpleName() + '.preProcessRequest(' +
- 'execution=' + execution.getId() +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- try {
- def xml = execution.getVariable('UpdateAAIVfModuleRequest')
- logDebug('Received request xml:\n' + xml, isDebugLogEnabled)
- utils.logAudit("UpdateAAIVfModule Request XML: " + xml)
- initProcessVariables(execution)
-
- def vnfId = getRequiredNodeText(execution, xml,'vnf-id')
- execution.setVariable('UAAIVfMod_vnfId', vnfId)
-
- def vfModuleId = getRequiredNodeText(execution, xml,'vf-module-id')
- execution.setVariable('UAAIVfMod_vfModuleId', vfModuleId)
-
- logDebug('Exited ' + method, isDebugLogEnabled)
- } catch (BpmnError e) {
- throw e;
- } catch (Exception e) {
- logError('Caught exception in ' + method, e)
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessRequest(): ' + e.getMessage())
- }
- }
-
- /**
- * Using the received vnfId and vfModuleId, query AAI to get the corresponding VF Module.
- * A 200 response is expected with the VF Module in the response body.
- *
- * @param execution The flow's execution instance.
- */
- public void getVfModule(DelegateExecution execution) {
- def method = getClass().getSimpleName() + '.getVfModule(' +
- 'execution=' + execution.getId() +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- try {
- def vnfId = execution.getVariable('UAAIVfMod_vnfId')
- def vfModuleId = execution.getVariable('UAAIVfMod_vfModuleId')
-
- // Construct endpoint
- AaiUtil aaiUriUtil = new AaiUtil(this)
- def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution)
- logDebug('AAI URI is: ' + aai_uri, isDebugLogEnabled)
- String endPoint = execution.getVariable('URN_aai_endpoint') + aai_uri + '/' + UriUtils.encode(vnfId, "UTF-8") + '/vf-modules/vf-module/' + UriUtils.encode(vfModuleId, "UTF-8")
-
- try {
- logDebug('sending GET to AAI endpoint \'' + endPoint + '\'', isDebugLogEnabled)
- utils.logAudit("UpdateAAIVfModule sending GET to AAI endpoint: " + endPoint)
-
- APIResponse response = aaiUriUtil.executeAAIGetCall(execution, endPoint)
- def responseData = response.getResponseBodyAsString()
- execution.setVariable('UAAIVfMod_getVfModuleResponseCode', response.getStatusCode())
- execution.setVariable('UAAIVfMod_getVfModuleResponse', responseData)
- logDebug('Response code:' + response.getStatusCode(), isDebugLogEnabled)
- logDebug('Response:' + System.lineSeparator() + responseData, isDebugLogEnabled)
- utils.logAudit("UpdateAAIVfModule response data: " + responseData)
- } catch (Exception ex) {
- ex.printStackTrace()
- logDebug('Exception occurred while executing AAI GET:' + ex.getMessage(),isDebugLogEnabled)
- execution.setVariable('UAAIVfMod_getVfModuleResponseCode', 500)
- execution.setVariable('UAAIVfMod_getVfModuleResponse', 'AAI GET Failed:' + ex.getMessage())
- }
- logDebug('Exited ' + method, isDebugLogEnabled)
- } catch (BpmnError e) {
- throw e;
- } catch (Exception e) {
- logError('Caught exception in ' + method, e)
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in getVfModule(): ' + e.getMessage())
- }
- }
-
- /**
- * Construct and send a PATCH request to AAI to update the VF Module.
- *
- * @param execution The flow's execution instance.
- */
- public void updateVfModule(DelegateExecution execution) {
- def method = getClass().getSimpleName() + '.updateVfModule(' +
- 'execution=' + execution.getId() +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- try {
- def vnfId = execution.getVariable('UAAIVfMod_vnfId')
- def vfModuleId = execution.getVariable('UAAIVfMod_vfModuleId')
- def vfModule = execution.getVariable('UAAIVfMod_getVfModuleResponse')
- def origRequest = execution.getVariable('UpdateAAIVfModuleRequest')
- def Node vfModuleNode = xmlParser.parseText(vfModule)
-
- utils.logAudit("UpdateAAIVfModule request: " + origRequest)
- // Confirm resource-version is in retrieved VF Module
- if (utils.getChildNode(vfModuleNode, 'resource-version') == null) {
- def msg = 'Can\'t update VF Module ' + vfModuleId + ' since \'resource-version\' is missing'
- logError(msg)
- throw new Exception(msg)
- }
-
- // TEMPORARY!!! Disable Volume Group Check
- // Check volume-group-id conditions
- //def checkVgiResult = checkVolumeGroupId(origRequest, vfModuleNode, isDebugLogEnabled)
- //if (checkVgiResult != null) {
- // def msg = 'Can\'t update VF Module ' + vfModuleId + ': ' + checkVgiResult
- // logError(msg)
- // throw new Exception(msg)
- //}
-
- // Handle persona-model-id/persona-model-version
- def boolean doPersonaModelVersion = true
- def String newPersonaModelId = utils.getNodeText1(origRequest, 'persona-model-id')
- def String newPersonaModelVersion = utils.getNodeText1(origRequest, 'persona-model-version')
- if ((newPersonaModelId == null) || (newPersonaModelVersion == null)) {
- doPersonaModelVersion = false
- } else {
- // Confirm "new" persona-model-id is same as "current" persona-model-id
- def String currPersonaModelId = utils.getChildNodeText(vfModuleNode, 'model-invariant-id')
- if (currPersonaModelId == null) {
- // check the old attribute name
- currPersonaModelId = utils.getChildNodeText(vfModuleNode, 'model-version-id')
- }
- if (currPersonaModelId == null) {
- currPersonaModelId = ''
- }
- if (!newPersonaModelId.equals(currPersonaModelId)) {
- def msg = 'Can\'t update VF Module ' + vfModuleId + ' since there is \'persona-model-id\' mismatch between the current and new values'
- logError(msg)
- throw new Exception(msg)
- }
- }
-
- // Construct payload
- String orchestrationStatusEntry = updateVfModuleNode(origRequest, vfModuleNode, 'orchestration-status')
- String heatStackIdEntry = updateVfModuleNode(origRequest, vfModuleNode, 'heat-stack-id')
- String personaModelVersionEntry = ""
- if (doPersonaModelVersion) {
- personaModelVersionEntry = updateVfModuleNode(origRequest, vfModuleNode, 'persona-model-version')
- }
- String contrailServiceInstanceFqdnEntry = updateVfModuleNode(origRequest, vfModuleNode, 'contrail-service-instance-fqdn')
- def payload = """
- { ${orchestrationStatusEntry}
- ${heatStackIdEntry}
- ${personaModelVersionEntry}
- ${contrailServiceInstanceFqdnEntry}
- "vf-module-id": "${vfModuleId}"
- }
- """
-
-
- // Construct endpoint
- AaiUtil aaiUriUtil = new AaiUtil(this)
- def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution)
- logDebug('AAI URI is: ' + aai_uri, isDebugLogEnabled)
- String endPoint = execution.getVariable('URN_aai_endpoint') + aai_uri + '/' + UriUtils.encode(vnfId, "UTF-8") + '/vf-modules/vf-module/' + UriUtils.encode(vfModuleId, "UTF-8")
-
- try {
- logDebug('sending PATCH to AAI endpoint \'' + endPoint + '\'' + 'with payload \n' + payload, isDebugLogEnabled)
- utils.logAudit("Sending PATCH to AAI endpoint: " + endPoint)
-
- APIResponse response = aaiUriUtil.executeAAIPatchCall(execution, endPoint, payload)
- def responseData = response.getResponseBodyAsString()
- execution.setVariable('UAAIVfMod_updateVfModuleResponseCode', response.getStatusCode())
- execution.setVariable('UAAIVfMod_updateVfModuleResponse', responseData)
- utils.logAudit("UpdateAAIVfModule Response data: " + responseData)
- logDebug('Response code:' + response.getStatusCode(), isDebugLogEnabled)
- logDebug('Response:' + System.lineSeparator() + responseData, isDebugLogEnabled)
- } catch (Exception ex) {
- ex.printStackTrace()
- logDebug('Exception occurred while executing AAI PATCH:' + ex.getMessage(),isDebugLogEnabled)
- execution.setVariable('UAAIVfMod_updateVfModuleResponseCode', 500)
- execution.setVariable('UAAIVfMod_updateVfModuleResponse', 'AAI PATCH Failed:' + ex.getMessage())
- }
- logDebug('Exited ' + method, isDebugLogEnabled)
- } catch (BpmnError e) {
- throw e;
- } catch (Exception e) {
- logError('Caught exception in ' + method, e)
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in updateVfModule(): ' + e.getMessage())
- }
- }
-
- /**
- * Sets up json attributes for PATCH request for Update
- *
- * @param origRequest Incoming update request with VF Module elements to be updated.
- * @param vfModule Current VF Module retrieved from AAI.
- * @param element Name of element to be inserted.
- */
- private String updateVfModuleNode(String origRequest, Node vfModuleNode, String elementName) {
-
- if (!utils.nodeExists(origRequest, elementName)) {
- return ""
- }
- def elementValue = utils.getNodeText(origRequest, elementName)
-
- if (elementValue.equals('DELETE')) {
- // Set the element being deleted to null
- return """"${elementName}": null,"""
- }
- else {
- return """"${elementName}": "${elementValue}","""
- }
- }
-
-
- /**
- * Check the Volume Group ID from the incoming update request against the Volume Group ID from the
- * given VF Module. If they are equal or if they are both 'null', then that is acceptable and 'null'
- * is returned. Otherwise a message describing how the values are unacceptable/incompatible is returned.
- *
- * @param origRequest Incoming update request with VF Module elements to be updated.
- * @param vfModuleNode VF Module (as a Node) retrieved from AAI.
- * @param isDebugLogEnabled Is DEBUG log enabled?
- * @return 'null' if the Volume Group IDs are acceptable. Otherwise return a message describing how the
- * values are unacceptable/incompatible.
- */
- private String checkVolumeGroupId(String origRequest, Node vfModuleNode, String isDebugLogEnabled) {
- def requestVolumeGroupId = utils.getNodeText1(origRequest, 'volume-group-id')
- def currVolumeGroupId = getCurrVolumeGroupId(vfModuleNode)
-
- logDebug('Check volume-group-id: volume-group-id in original request is \'' + requestVolumeGroupId +
- '\', volume-group-id from VF Module is \'' + currVolumeGroupId + '\'', isDebugLogEnabled)
-
- def result = null
-
- if (requestVolumeGroupId == null) {
- if (currVolumeGroupId == null) {
- // This is OK
- } else {
- result = 'Cannot detach a volume group from an existing VF Module'
- }
- } else {
- if (currVolumeGroupId == null) {
- result = 'Cannot add a volume gruop to an existing VF Module'
- } else {
- if (!requestVolumeGroupId.equals(currVolumeGroupId)) {
- result = 'Cannot change the volume group on an existing VF Module'
- }
- }
- }
-
- return result
- }
-
- /**
- * Find and return the value of the Volume Group ID for the specified VF Module. If
- * the value of the Volume Group ID cannot be found for any reason, 'null' is returned.
- *
- * @param vfModuleNode VF Module (as a Node) retrieved from AAI.
- * @return the value of the Volume Group ID for the specified VF Module. If the
- * value of the Volume Group ID cannot be found for any reason, 'null' is returned.
- */
- private String getCurrVolumeGroupId(Node vfModuleNode) {
- def Node relationshipList = utils.getChildNode(vfModuleNode, 'relationship-list')
- if (relationshipList == null) {
- return null
- }
- def NodeList relationships = utils.getIdenticalChildren(relationshipList, 'relationship')
- for (Node relationshipNode in relationships) {
- def String relatedTo = utils.getChildNodeText(relationshipNode, 'related-to')
- if ((relatedTo != null) && relatedTo.equals('volume-group')) {
- def NodeList relationshipDataList = utils.getIdenticalChildren(relationshipNode, 'relationship-data')
- for (Node relationshipDataNode in relationshipDataList) {
- def String relationshipKey = utils.getChildNodeText(relationshipDataNode, 'relationship-key')
- if ((relationshipKey != null) && relationshipKey.equals('volume-group.volume-group-id')) {
- return utils.getChildNodeText(relationshipDataNode, 'relationship-value')
- }
- }
- }
- }
- return null
- }
-
- /**
- * Generates a WorkflowException if the AAI query returns a response code other than 200.
- *
- * @param execution The flow's execution instance.
- */
- public void handleAAIQueryFailure(DelegateExecution execution) {
- def method = getClass().getSimpleName() + '.handleAAIQueryFailure(' +
- 'execution=' + execution.getId() +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- logError('Error occurred attempting to query AAI, Response Code ' +
- execution.getVariable('UAAIVfMod_getVfModuleResponseCode') + ', Error Response ' +
- execution.getVariable('UAAIVfMod_getVfModuleResponse'))
- String processKey = getProcessKey(execution);
- WorkflowException exception = new WorkflowException(processKey, 5000,
- execution.getVariable('UAAIVfMod_getVfModuleResponse'))
- execution.setVariable('WorkflowException', exception)
- utils.logAudit("UpdateAAIVfModule query failure: " + exception.getErrorMessage())
- logDebug('Exited ' + method, isDebugLogEnabled)
- }
-
- /**
- * Generates a WorkflowException if updating a VF Module in AAI returns a response code other than 200.
- *
- * @param execution The flow's execution instance.
- */
- public void handleUpdateVfModuleFailure(DelegateExecution execution) {
- def method = getClass().getSimpleName() + '.handleUpdateVfModuleFailure(' +
- 'execution=' + execution.getId() +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- logError('Error occurred attempting to update VF Module in AAI, Response Code ' +
- execution.getVariable('UAAIVfMod_updateVfModuleResponseCode') + ', Error Response ' +
- execution.getVariable('UAAIVfMod_updateVfModuleResponse'))
- String processKey = getProcessKey(execution);
- WorkflowException exception = new WorkflowException(processKey, 5000,
- execution.getVariable('UAAIVfMod_updateVfModuleResponse'))
- execution.setVariable('WorkflowException', exception)
-
- utils.logAudit("UpdateAAIVfModule failure: " + exception.getErrorMessage())
- logDebug('Exited ' + method, isDebugLogEnabled)
- }
-}
+/*- + * ============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.common.scripts + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.rest.APIResponse +import org.springframework.web.util.UriUtils +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + + + + +public class UpdateAAIVfModule extends AbstractServiceTaskProcessor { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, UpdateAAIVfModule.class); + + + private XmlParser xmlParser = new XmlParser() + ExceptionUtil exceptionUtil = new ExceptionUtil() + + /** + * Initialize the flow's variables. + * + * @param execution The flow's execution instance. + */ + public void initProcessVariables(DelegateExecution execution) { + execution.setVariable('prefix', 'UAAIVfMod_') + execution.setVariable('UAAIVfMod_vnfId', null) + execution.setVariable('UAAIVfMod_vfModuleId', null) + execution.setVariable('UAAIVfMod_orchestrationStatus', null) + execution.setVariable('UAAIVfMod_heatStackId', null) + execution.setVariable('UAAIVfMod_volumeGroupId', null) + execution.setVariable('UAAIVfMod_getVfModuleResponseCode' ,null) + execution.setVariable('UAAIVfMod_getVfModuleResponse', '') + execution.setVariable('UAAIVfMod_updateVfModuleResponseCode', null) + execution.setVariable('UAAIVfMod_updateVfModuleResponse', '') + } + + /** + * Check for missing elements in the received request. + * + * @param execution The flow's execution instance. + */ + public void preProcessRequest(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.preProcessRequest(' + + 'execution=' + execution.getId() + + ')' + msoLogger.trace('Entered ' + method) + + try { + def xml = execution.getVariable('UpdateAAIVfModuleRequest') + msoLogger.debug('Received request xml:\n' + xml) + initProcessVariables(execution) + + def vnfId = getRequiredNodeText(execution, xml,'vnf-id') + execution.setVariable('UAAIVfMod_vnfId', vnfId) + + def vfModuleId = getRequiredNodeText(execution, xml,'vf-module-id') + execution.setVariable('UAAIVfMod_vfModuleId', vfModuleId) + + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessRequest(): ' + e.getMessage()) + } + } + + /** + * Using the received vnfId and vfModuleId, query AAI to get the corresponding VF Module. + * A 200 response is expected with the VF Module in the response body. + * + * @param execution The flow's execution instance. + */ + public void getVfModule(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.getVfModule(' + + 'execution=' + execution.getId() + + ')' + msoLogger.trace('Entered ' + method) + + try { + def vnfId = execution.getVariable('UAAIVfMod_vnfId') + def vfModuleId = execution.getVariable('UAAIVfMod_vfModuleId') + + // Construct endpoint + AaiUtil aaiUriUtil = new AaiUtil(this) + def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution) + msoLogger.debug('AAI URI is: ' + aai_uri) + String endPoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + aai_uri + '/' + UriUtils.encode(vnfId, "UTF-8") + '/vf-modules/vf-module/' + UriUtils.encode(vfModuleId, "UTF-8") + + try { + msoLogger.debug('sending GET to AAI endpoint \'' + endPoint + '\'') + msoLogger.debug("UpdateAAIVfModule sending GET to AAI endpoint: " + endPoint) + + APIResponse response = aaiUriUtil.executeAAIGetCall(execution, endPoint) + def responseData = response.getResponseBodyAsString() + execution.setVariable('UAAIVfMod_getVfModuleResponseCode', response.getStatusCode()) + execution.setVariable('UAAIVfMod_getVfModuleResponse', responseData) + msoLogger.debug('Response code:' + response.getStatusCode()) + msoLogger.debug('Response:' + System.lineSeparator() + responseData) + msoLogger.debug("UpdateAAIVfModule response data: " + responseData) + } catch (Exception ex) { + ex.printStackTrace() + msoLogger.debug('Exception occurred while executing AAI GET:' + ex.getMessage()) + execution.setVariable('UAAIVfMod_getVfModuleResponseCode', 500) + execution.setVariable('UAAIVfMod_getVfModuleResponse', 'AAI GET Failed:' + ex.getMessage()) + } + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in getVfModule(): ' + e.getMessage()) + } + } + + /** + * Construct and send a PATCH request to AAI to update the VF Module. + * + * @param execution The flow's execution instance. + */ + public void updateVfModule(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.updateVfModule(' + + 'execution=' + execution.getId() + + ')' + msoLogger.trace('Entered ' + method) + + try { + def vnfId = execution.getVariable('UAAIVfMod_vnfId') + def vfModuleId = execution.getVariable('UAAIVfMod_vfModuleId') + def vfModule = execution.getVariable('UAAIVfMod_getVfModuleResponse') + def origRequest = execution.getVariable('UpdateAAIVfModuleRequest') + def Node vfModuleNode = xmlParser.parseText(vfModule) + + msoLogger.debug("UpdateAAIVfModule request: " + origRequest) + // Confirm resource-version is in retrieved VF Module + if (utils.getChildNode(vfModuleNode, 'resource-version') == null) { + def msg = 'Can\'t update VF Module ' + vfModuleId + ' since \'resource-version\' is missing' + msoLogger.error(msg); + throw new Exception(msg) + } + + // Handle persona-model-id/persona-model-version + def boolean doPersonaModelVersion = true + def String newPersonaModelId = utils.getNodeText(origRequest, 'persona-model-id') + def String newPersonaModelVersion = utils.getNodeText(origRequest, 'persona-model-version') + if ((newPersonaModelId == null) || (newPersonaModelVersion == null)) { + doPersonaModelVersion = false + } else { + // Confirm "new" persona-model-id is same as "current" persona-model-id + def String currPersonaModelId = utils.getChildNodeText(vfModuleNode, 'model-invariant-id') + if (currPersonaModelId == null) { + // check the old attribute name + currPersonaModelId = utils.getChildNodeText(vfModuleNode, 'model-version-id') + } + if (currPersonaModelId == null) { + currPersonaModelId = '' + } + if (!newPersonaModelId.equals(currPersonaModelId)) { + def msg = 'Can\'t update VF Module ' + vfModuleId + ' since there is \'persona-model-id\' mismatch between the current and new values' + msoLogger.error(msg) + throw new Exception(msg) + } + } + + // Construct payload + String orchestrationStatusEntry = updateVfModuleNode(origRequest, vfModuleNode, 'orchestration-status') + String heatStackIdEntry = updateVfModuleNode(origRequest, vfModuleNode, 'heat-stack-id') + String personaModelVersionEntry = "" + if (doPersonaModelVersion) { + personaModelVersionEntry = updateVfModuleNode(origRequest, vfModuleNode, 'persona-model-version') + } + String contrailServiceInstanceFqdnEntry = updateVfModuleNode(origRequest, vfModuleNode, 'contrail-service-instance-fqdn') + def payload = """ + { ${orchestrationStatusEntry} + ${heatStackIdEntry} + ${personaModelVersionEntry} + ${contrailServiceInstanceFqdnEntry} + "vf-module-id": "${vfModuleId}" + } + """ + + + // Construct endpoint + AaiUtil aaiUriUtil = new AaiUtil(this) + def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution) + msoLogger.debug('AAI URI is: ' + aai_uri) + String endPoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + aai_uri + '/' + UriUtils.encode(vnfId, "UTF-8") + '/vf-modules/vf-module/' + UriUtils.encode(vfModuleId, "UTF-8") + + try { + msoLogger.debug('sending PATCH to AAI endpoint \'' + endPoint + '\'' + 'with payload \n' + payload) + msoLogger.debug("Sending PATCH to AAI endpoint: " + endPoint) + + APIResponse response = aaiUriUtil.executeAAIPatchCall(execution, endPoint, payload) + def responseData = response.getResponseBodyAsString() + execution.setVariable('UAAIVfMod_updateVfModuleResponseCode', response.getStatusCode()) + execution.setVariable('UAAIVfMod_updateVfModuleResponse', responseData) + msoLogger.debug("UpdateAAIVfModule Response data: " + responseData) + msoLogger.debug('Response code:' + response.getStatusCode()) + msoLogger.debug('Response:' + System.lineSeparator() + responseData) + } catch (Exception ex) { + ex.printStackTrace() + msoLogger.debug('Exception occurred while executing AAI PATCH:' + ex.getMessage()) + execution.setVariable('UAAIVfMod_updateVfModuleResponseCode', 500) + execution.setVariable('UAAIVfMod_updateVfModuleResponse', 'AAI PATCH Failed:' + ex.getMessage()) + } + msoLogger.trace('Exited ' + method) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(e); + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in updateVfModule(): ' + e.getMessage()) + } + } + + /** + * Sets up json attributes for PATCH request for Update + * + * @param origRequest Incoming update request with VF Module elements to be updated. + * @param vfModule Current VF Module retrieved from AAI. + * @param element Name of element to be inserted. + */ + private String updateVfModuleNode(String origRequest, Node vfModuleNode, String elementName) { + + if (!utils.nodeExists(origRequest, elementName)) { + return "" + } + def elementValue = utils.getNodeText(origRequest, elementName) + + if (elementValue.equals('DELETE')) { + // Set the element being deleted to null + return """"${elementName}": null,""" + } + else { + return """"${elementName}": "${elementValue}",""" + } + } + + + /** + * Check the Volume Group ID from the incoming update request against the Volume Group ID from the + * given VF Module. If they are equal or if they are both 'null', then that is acceptable and 'null' + * is returned. Otherwise a message describing how the values are unacceptable/incompatible is returned. + * + * @param origRequest Incoming update request with VF Module elements to be updated. + * @param vfModuleNode VF Module (as a Node) retrieved from AAI. + * @param isDebugLogEnabled Is DEBUG log enabled? + * @return 'null' if the Volume Group IDs are acceptable. Otherwise return a message describing how the + * values are unacceptable/incompatible. + */ + private String checkVolumeGroupId(String origRequest, Node vfModuleNode, String isDebugLogEnabled) { + def requestVolumeGroupId = utils.getNodeText(origRequest, 'volume-group-id') + def currVolumeGroupId = getCurrVolumeGroupId(vfModuleNode) + + msoLogger.debug('Check volume-group-id: volume-group-id in original request is \'' + requestVolumeGroupId + '\', volume-group-id from VF Module is \'' + currVolumeGroupId + '\'') + + def result = null + + if (requestVolumeGroupId == null) { + if (currVolumeGroupId == null) { + // This is OK + } else { + result = 'Cannot detach a volume group from an existing VF Module' + } + } else { + if (currVolumeGroupId == null) { + result = 'Cannot add a volume gruop to an existing VF Module' + } else { + if (!requestVolumeGroupId.equals(currVolumeGroupId)) { + result = 'Cannot change the volume group on an existing VF Module' + } + } + } + + return result + } + + /** + * Find and return the value of the Volume Group ID for the specified VF Module. If + * the value of the Volume Group ID cannot be found for any reason, 'null' is returned. + * + * @param vfModuleNode VF Module (as a Node) retrieved from AAI. + * @return the value of the Volume Group ID for the specified VF Module. If the + * value of the Volume Group ID cannot be found for any reason, 'null' is returned. + */ + private String getCurrVolumeGroupId(Node vfModuleNode) { + def Node relationshipList = utils.getChildNode(vfModuleNode, 'relationship-list') + if (relationshipList == null) { + return null + } + def NodeList relationships = utils.getIdenticalChildren(relationshipList, 'relationship') + for (Node relationshipNode in relationships) { + def String relatedTo = utils.getChildNodeText(relationshipNode, 'related-to') + if ((relatedTo != null) && relatedTo.equals('volume-group')) { + def NodeList relationshipDataList = utils.getIdenticalChildren(relationshipNode, 'relationship-data') + for (Node relationshipDataNode in relationshipDataList) { + def String relationshipKey = utils.getChildNodeText(relationshipDataNode, 'relationship-key') + if ((relationshipKey != null) && relationshipKey.equals('volume-group.volume-group-id')) { + return utils.getChildNodeText(relationshipDataNode, 'relationship-value') + } + } + } + } + return null + } + + /** + * Generates a WorkflowException if the AAI query returns a response code other than 200. + * + * @param execution The flow's execution instance. + */ + public void handleAAIQueryFailure(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.handleAAIQueryFailure(' + + 'execution=' + execution.getId() + + ')' + msoLogger.trace('Entered ' + method) + + msoLogger.error( 'Error occurred attempting to query AAI, Response Code ' + execution.getVariable('UAAIVfMod_getVfModuleResponseCode')); + String processKey = getProcessKey(execution); + WorkflowException exception = new WorkflowException(processKey, 5000, + execution.getVariable('UAAIVfMod_getVfModuleResponse')) + execution.setVariable('WorkflowException', exception) + msoLogger.debug("UpdateAAIVfModule query failure: " + exception.getErrorMessage()) + msoLogger.trace('Exited ' + method) + } + + /** + * Generates a WorkflowException if updating a VF Module in AAI returns a response code other than 200. + * + * @param execution The flow's execution instance. + */ + public void handleUpdateVfModuleFailure(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.handleUpdateVfModuleFailure(' + + 'execution=' + execution.getId() + + ')' + msoLogger.trace('Entered ' + method) + + msoLogger.error('Error occurred attempting to update VF Module in AAI, Response Code ' + execution.getVariable('UAAIVfMod_updateVfModuleResponseCode')); + String processKey = getProcessKey(execution); + WorkflowException exception = new WorkflowException(processKey, 5000, + execution.getVariable('UAAIVfMod_updateVfModuleResponse')) + execution.setVariable('WorkflowException', exception) + + msoLogger.debug("UpdateAAIVfModule failure: " + exception.getErrorMessage()) + msoLogger.trace('Exited ' + method) + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModule.groovy index 74ff8b3642..b20cc38b8b 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VfModule.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModule.groovy @@ -1,87 +1,93 @@ -/*-
- * ============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.common.scripts;
-
-import org.apache.commons.lang3.*
-
-public class VfModule implements Serializable {
-
- /**
- * Class representing a VF Module Node. Fields of this class include indicators
- * as to whether the VF Module is the only VF Module in its containing Generic VNF
- * and whether the VF Module is the base VF Module in its containing Generic VNF.
- */
-
- private Node node
- private Boolean onlyVfModule
- private Boolean baseVfModule
-
- /**
- * Constructor.
- *
- * @param node Node representing the VF Module xml.
- * @param onlyVfModule Is this VF Module the only VF Module in its containing Generic VNF?
- */
- public VfModule(Node node, boolean onlyVfModule) {
- this.node = node
- this.onlyVfModule = onlyVfModule
- this.baseVfModule = getElementText('is-base-vf-module').equals('true')
- }
-
- /**
- * Get the Node representing the VF Module xml.
- *
- * @return the Node representing the VF Module xml.
- */
- public Node getNode() {
- return node
- }
-
- public String getElementText(String childNodeName) {
- def Node childNode = (new MsoUtils()).getChildNode(node, childNodeName)
- if (childNode == null) {
- return ''
- } else {
- return childNode.text()
- }
- }
-
- /**
- * Is this VF Module the only VF Module in its containing Generic VNF?
- *
- * @return true if this VF Module is the only VF Module in its containing Generic VNF;
- * false otherwise.
- */
- public boolean isOnlyVfModule() {
- return onlyVfModule
- }
-
- /**
- * Is this VF Module the base VF Module in its containing Generic VNF?
- *
- * @return true if this VF Module is the base VF Module in its containing Generic VNF;
- * false otherwise.
- */
- public boolean isBaseVfModule() {
- return baseVfModule
- }
-}
-
+/*- + * ============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.common.scripts; + +import org.apache.commons.lang3.* +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + + + +public class VfModule implements Serializable { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VfModule.class); + + + /** + * Class representing a VF Module Node. Fields of this class include indicators + * as to whether the VF Module is the only VF Module in its containing Generic VNF + * and whether the VF Module is the base VF Module in its containing Generic VNF. + */ + + private Node node + private Boolean onlyVfModule + private Boolean baseVfModule + + /** + * Constructor. + * + * @param node Node representing the VF Module xml. + * @param onlyVfModule Is this VF Module the only VF Module in its containing Generic VNF? + */ + public VfModule(Node node, boolean onlyVfModule) { + this.node = node + this.onlyVfModule = onlyVfModule + this.baseVfModule = getElementText('is-base-vf-module').equals('true') + } + + /** + * Get the Node representing the VF Module xml. + * + * @return the Node representing the VF Module xml. + */ + public Node getNode() { + return node + } + + public String getElementText(String childNodeName) { + def Node childNode = (new MsoUtils()).getChildNode(node, childNodeName) + if (childNode == null) { + return '' + } else { + return childNode.text() + } + } + + /** + * Is this VF Module the only VF Module in its containing Generic VNF? + * + * @return true if this VF Module is the only VF Module in its containing Generic VNF; + * false otherwise. + */ + public boolean isOnlyVfModule() { + return onlyVfModule + } + + /** + * Is this VF Module the base VF Module in its containing Generic VNF? + * + * @return true if this VF Module is the base VF Module in its containing Generic VNF; + * false otherwise. + */ + public boolean isBaseVfModule() { + return baseVfModule + } +} + diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VfModuleBase.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModuleBase.groovy index e0b9c3020c..fec140da33 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VfModuleBase.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModuleBase.groovy @@ -1,1285 +1,1285 @@ -/*-
- * ============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.common.scripts;
-
-import java.io.ObjectInputStream.BlockDataInputStream
-
-//import groovy.util.Node;
-
-import javax.xml.parsers.DocumentBuilder
-import javax.xml.parsers.DocumentBuilderFactory
-
-import org.apache.commons.lang3.*
-import org.w3c.dom.Document
-import org.w3c.dom.Element
-import org.w3c.dom.Node
-import org.w3c.dom.NodeList
-import org.xml.sax.InputSource
-
-
-public abstract class VfModuleBase extends AbstractServiceTaskProcessor {
-
- protected XmlParser xmlParser = new XmlParser()
-
- /**
- * Get the XmlParser.
- *
- * @return the XmlParser.
- */
- protected XmlParser getXmlParser() {
- return xmlParser
- }
-
- /**
- * Find the VF Module with specified ID in the specified Generic VF. If no such
- * VF Module is found, null is returned.
- *
- * @param genericVnf The Generic VNF in which to search for the specified VF Moduel.
- * @param vfModuleId The ID of the VF Module for which to search.
- * @return a VFModule object for the found VF Module or null if no VF Module is found.
- */
- protected VfModule findVfModule(String genericVnf, String vfModuleId) {
-
- def genericVnfNode = xmlParser.parseText(genericVnf)
- def vfModulesNode = utils.getChildNode(genericVnfNode, 'vf-modules')
- if (vfModulesNode == null) {
- return null
- }
- def vfModuleList = utils.getIdenticalChildren(vfModulesNode, 'vf-module')
- for (vfModuleNode in vfModuleList) {
- def vfModuleIdNode = utils.getChildNode(vfModuleNode, 'vf-module-id')
- if ((vfModuleIdNode != null) && (vfModuleIdNode.text().equals(vfModuleId))) {
- return new VfModule(vfModuleNode, (vfModuleList.size() == 1))
- }
- }
- return null
- }
-
- /**
- * Transform all '*_network' parameter specifications from the incoming '*-params' root
- * element to a corresponding list of 'vnf-networks' specifications (typically used when
- * invoking the VNF Rest Adpater). Each element in '*-params' whose name attribute ends
- * with '_network' is used to create an 'vnf-networks' element.
- *
- * @param paramsNode A Node representing a '*-params' element.
- * @return a String of 'vnf-networks' elements, one for each 'param' element whose name
- * attribute ends with '_network'.
- */
- protected String transformNetworkParamsToVnfNetworks(String paramsRootXml) {
- if ((paramsRootXml == null) || (paramsRootXml.isEmpty())) {
- return ''
- }
- def String vnfNetworks = ''
- try {
- paramsRootXml = utils.removeXmlNamespaces(paramsRootXml)
- def paramsNode = xmlParser.parseText(paramsRootXml)
- def params = utils.getIdenticalChildren(paramsNode, 'param')
- for (param in params) {
- def String attrName = (String) param.attribute('name')
- if (attrName.endsWith('_network')) {
- def networkRole = attrName.substring(0, (attrName.length()-'_network'.length()))
- def networkName = param.text()
- String vnfNetwork = """
- <vnf-networks>
- <network-role>${networkRole}</network-role>
- <network-name>${networkName}</network-name>
- </vnf-networks>
- """
- vnfNetworks = vnfNetworks + vnfNetwork
- }
- }
- } catch (Exception e) {
- logWarn('Exception transforming \'_network\' params to vnfNetworks', e)
- }
- return vnfNetworks
- }
-
- /**
- * Transform the parameter specifications from the incoming '*-params' root element to
- * a corresponding list of 'entry's (typically used when invoking the VNF Rest Adpater).
- * Each element in '*-params' is used to create an 'entry' element.
- *
- * @param paramsNode A Node representing a '*-params' element.
- * @return a String of 'entry' elements, one for each 'param' element.
- */
- protected String transformParamsToEntries(String paramsRootXml) {
- if ((paramsRootXml == null) || (paramsRootXml.isEmpty())) {
- return ''
- }
- def String entries = ''
- try {
- paramsRootXml = utils.removeXmlNamespaces(paramsRootXml)
- def paramsNode = xmlParser.parseText(paramsRootXml)
- def params = utils.getIdenticalChildren(paramsNode, 'param')
- for (param in params) {
- def key = (String) param.attribute('name')
- if (key == null) {
- key = ''
- }
- def value = (String) param.text()
- String entry = """
- <entry>
- <key>${key}</key>
- <value>${value}</value>
- </entry>
- """
- entries = entries + entry
- }
- } catch (Exception e) {
- logWarn('Exception transforming params to entries', e)
- }
- return entries
- }
-
- /**
- * Transform the parameter specifications from the incoming '*-params' root element to
- * a corresponding list of 'entry's (typically used when invoking the VNF Rest Adpater).
- * Each element in '*-params' is used to create an 'entry' element.
- *
- * @param paramsNode A Node representing a '*-params' element.
- * @return a String of 'entry' elements, one for each 'param' element.
- */
- protected String transformVolumeParamsToEntries(String paramsRootXml) {
- if ((paramsRootXml == null) || (paramsRootXml.isEmpty())) {
- return ''
- }
- def String entries = ''
- try {
- paramsRootXml = utils.removeXmlNamespaces(paramsRootXml)
- def paramsNode = xmlParser.parseText(paramsRootXml)
- def params = utils.getIdenticalChildren(paramsNode, 'param')
- for (param in params) {
- def key = (String) param.attribute('name')
- if (key == null) {
- key = ''
- }
- if ( !(key in ['vnf_id', 'vnf_name', 'vf_module_id', 'vf_module_name'])) {
- def value = (String) param.text()
- String entry = """
- <entry>
- <key>${key}</key>
- <value>${value}</value>
- </entry>
- """
- entries = entries + entry
- }
- }
- } catch (Exception e) {
- logWarn('Exception transforming params to entries', e)
- }
- return entries
- }
-
- /**
- * Extract the Tenant Id from the Volume Group information returned by AAI.
- *
- * @param volumeGroupXml Volume Group XML returned by AAI.
- * @return the Tenant Id extracted from the Volume Group information. 'null' is returned if
- * the Tenant Id is missing or could not otherwise be extracted.
- */
- protected String getTenantIdFromVolumeGroup(String volumeGroupXml) {
- def groovy.util.Node volumeGroupNode = xmlParser.parseText(volumeGroupXml)
- def groovy.util.Node relationshipList = utils.getChildNode(volumeGroupNode, 'relationship-list')
- if (relationshipList != null) {
- def groovy.util.NodeList relationships = utils.getIdenticalChildren(relationshipList, 'relationship')
- for (groovy.util.Node relationship in relationships) {
- def groovy.util.Node relatedTo = utils.getChildNode(relationship, 'related-to')
- if ((relatedTo != null) && (relatedTo.text().equals('tenant'))) {
- def groovy.util.NodeList relationshipDataList = utils.getIdenticalChildren(relationship, 'relationship-data')
- for (groovy.util.Node relationshipData in relationshipDataList) {
- def groovy.util.Node relationshipKey = utils.getChildNode(relationshipData, 'relationship-key')
- if ((relationshipKey != null) && (relationshipKey.text().equals('tenant.tenant-id'))) {
- def groovy.util.Node relationshipValue = utils.getChildNode(relationshipData, 'relationship-value')
- if (relationshipValue != null) {
- return relationshipValue.text()
- }
- }
- }
- }
- }
- }
- return null
- }
-
-
- /*
- * Parses VNF parameters passed in on the incoming requests and SDNC parameters returned from SDNC get response
- * and puts them into the format expected by VNF adapter.
- * @param vnfParamsMap - map of VNF parameters passed in the request body
- * @param sdncGetResponse - response string from SDNC GET topology request
- * @param vnfId
- * @param vnfName
- * @param vfModuleId
- * @param vfModuleName
- * @param vfModuleIndex - can be null
- * @return a String of key/value entries for vfModuleParams
- */
-
-
- protected String buildVfModuleParams(Map<String, String> vnfParamsMap, String sdncGetResponse, String vnfId, String vnfName,
- String vfModuleId, String vfModuleName, String vfModuleIndex, String environmentContext, String workloadContext) {
-
- //Get SDNC Response Data
-
- String data = utils.getNodeXml(sdncGetResponse, "response-data")
- data = data.replaceAll("<", "<")
- data = data.replaceAll(">", ">")
-
- String serviceData = utils.getNodeXml(data, "service-data")
- serviceData = utils.removeXmlPreamble(serviceData)
- serviceData = utils.removeXmlNamespaces(serviceData)
- String vnfRequestInfo = utils.getNodeXml(serviceData, "vnf-request-information")
- String oldVnfId = utils.getNodeXml(vnfRequestInfo, "vnf-id")
- oldVnfId = utils.removeXmlPreamble(oldVnfId)
- oldVnfId = utils.removeXmlNamespaces(oldVnfId)
- serviceData = serviceData.replace(oldVnfId, "")
- def vnfId1 = utils.getNodeText1(serviceData, "vnf-id")
-
- Map<String, String> paramsMap = new HashMap<String, String>()
-
- if (vfModuleIndex != null) {
- paramsMap.put("vf_module_index", "${vfModuleIndex}")
- }
-
- // Add-on data
- paramsMap.put("vnf_id", "${vnfId}")
- paramsMap.put("vnf_name", "${vnfName}")
- paramsMap.put("vf_module_id", "${vfModuleId}")
- paramsMap.put("vf_module_name", "${vfModuleName}")
- paramsMap.put("environment_context", "${environmentContext}")
- paramsMap.put("workload_context", "${workloadContext}")
-
- InputSource source = new InputSource(new StringReader(data));
- DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
- docFactory.setNamespaceAware(true)
- DocumentBuilder docBuilder = docFactory.newDocumentBuilder()
- Document responseXml = docBuilder.parse(source)
-
-
- // Availability Zones Data
-
- NodeList aZonesList = responseXml.getElementsByTagNameNS("*", "availability-zones")
- String aZonePosition = "0"
- for (int z = 0; z < aZonesList.getLength(); z++) {
- Node node = aZonesList.item(z)
- if (node.getNodeType() == Node.ELEMENT_NODE) {
- Element eElement = (Element) node
- String aZoneValue = utils.getElementText(eElement, "availability-zone")
- aZonePosition = z.toString()
- paramsMap.put("availability_zone_${aZonePosition}", "${aZoneValue}")
- }
- }
-
- // Map of network-roles and network-tags from vm-networks
-
- NodeList vmNetworksListGlobal = responseXml.getElementsByTagNameNS("*", "vm-networks")
- Map<String, String> networkRoleMap = new HashMap<String, String>()
- for(int n = 0; n < vmNetworksListGlobal.getLength(); n++){
- Node nodeNetworkKey = vmNetworksListGlobal.item(n)
- if (nodeNetworkKey.getNodeType() == Node.ELEMENT_NODE) {
- Element eElementNetworkKey = (Element) nodeNetworkKey
- String networkRole = utils.getElementText(eElementNetworkKey, "network-role")
- String networkRoleValue = utils.getElementText(eElementNetworkKey, "network-role-tag")
- if (networkRoleValue.isEmpty()) {
- networkRoleValue = networkRole
- }
- networkRoleMap.put(networkRole, networkRoleValue)
- }
- }
-
- // VNF Networks Data
-
- StringBuilder sbNet = new StringBuilder()
-
- NodeList vnfNetworkList = responseXml.getElementsByTagNameNS("*", "vnf-networks")
- for (int x = 0; x < vnfNetworkList.getLength(); x++) {
- Node node = vnfNetworkList.item(x)
- if (node.getNodeType() == Node.ELEMENT_NODE) {
- Element eElement = (Element) node
- String vnfNetworkKey = utils.getElementText(eElement, "network-role-tag")
- String networkRole = utils.getElementText(eElement, "network-role")
- if (vnfNetworkKey.isEmpty()) {
- vnfNetworkKey = networkRoleMap.get(networkRole)
- if (vnfNetworkKey == null || vnfNetworkKey.isEmpty()) {
- vnfNetworkKey = networkRole
- }
- }
- String vnfNetworkNeutronIdValue = utils.getElementText(eElement, "neutron-id")
- String vnfNetworkNetNameValue = utils.getElementText(eElement, "network-name")
- String vnfNetworkSubNetIdValue = utils.getElementText(eElement, "subnet-id")
- String vnfNetworkV6SubNetIdValue = utils.getElementText(eElement, "ipv6-subnet-id")
- String vnfNetworkNetFqdnValue = utils.getElementText(eElement, "contrail-network-fqdn")
- paramsMap.put("${vnfNetworkKey}_net_id", "${vnfNetworkNeutronIdValue}")
- paramsMap.put("${vnfNetworkKey}_net_name", "${vnfNetworkNetNameValue}")
- paramsMap.put("${vnfNetworkKey}_subnet_id", "${vnfNetworkSubNetIdValue}")
- paramsMap.put("${vnfNetworkKey}_v6_subnet_id", "${vnfNetworkV6SubNetIdValue}")
- paramsMap.put("${vnfNetworkKey}_net_fqdn", "${vnfNetworkNetFqdnValue}")
-
- NodeList sriovVlanFilterList = eElement.getElementsByTagNameNS("*","sriov-vlan-filter-list")
- StringBuffer sriovFilterBuf = new StringBuffer()
- String values = ""
- for(int i = 0; i < sriovVlanFilterList.getLength(); i++){
- Node node1 = sriovVlanFilterList.item(i)
- if (node1.getNodeType() == Node.ELEMENT_NODE) {
- Element eElement1 = (Element) node1
- String value = utils.getElementText(eElement1, "sriov-vlan-filter")
- if (i != sriovVlanFilterList.getLength() - 1) {
- values = sriovFilterBuf.append(value + ",")
- }
- else {
- values = sriovFilterBuf.append(value);
- }
- }
- }
- if (!values.isEmpty()) {
- paramsMap.put("${vnfNetworkKey}_ATT_VF_VLAN_FILTER", "${values}")
- }
- }
- }
-
- // VNF-VMS Data
-
- def key
- def value
- def networkKey
- def networkValue
- def floatingIPKey
- def floatingIPKeyValue
- def floatingIPV6Key
- def floatingIPV6KeyValue
- StringBuilder sb = new StringBuilder()
-
- NodeList vmsList = responseXml.getElementsByTagNameNS("*","vnf-vms")
- for (int x = 0; x < vmsList.getLength(); x++) {
- Node node = vmsList.item(x)
- if (node.getNodeType() == Node.ELEMENT_NODE) {
- Element eElement = (Element) node
- key = utils.getElementText(eElement, "vm-type")
- String values
- String position = "0"
- StringBuilder sb1 = new StringBuilder()
- NodeList valueList = eElement.getElementsByTagNameNS("*","vm-names")
- NodeList vmNetworksList = eElement.getElementsByTagNameNS("*","vm-networks")
- for(int i = 0; i < valueList.getLength(); i++){
- Node node1 = valueList.item(i)
- if (node1.getNodeType() == Node.ELEMENT_NODE) {
- Element eElement1 = (Element) node1
- value = utils.getElementText(eElement1, "vm-name")
- if (i != valueList.getLength() - 1) {
- values = sb1.append(value + ",")
- }
- else {
- values = sb1.append(value);
- }
- position = i.toString()
- paramsMap.put("${key}_name_${position}", "${value}")
- }
- }
- for(int n = 0; n < vmNetworksList.getLength(); n++){
- String floatingIpKeyValueStr = ""
- String floatingIpV6KeyValueStr = ""
- Node nodeNetworkKey = vmNetworksList.item(n)
- if (nodeNetworkKey.getNodeType() == Node.ELEMENT_NODE) {
- Element eElementNetworkKey = (Element) nodeNetworkKey
- String ipAddressValues
- String ipV6AddressValues
- String networkPosition = "0"
- StringBuilder sb2 = new StringBuilder()
- StringBuilder sb3 = new StringBuilder()
- StringBuilder sb4 = new StringBuilder()
- networkKey = utils.getElementText(eElementNetworkKey, "network-role-tag")
- if (networkKey.isEmpty()) {
- networkKey = utils.getElementText(eElementNetworkKey, "network-role")
- }
- floatingIPKey = key + '_' + networkKey + '_floating_ip'
- floatingIPKeyValue = utils.getElementText(eElementNetworkKey, "floating-ip")
- if(!floatingIPKeyValue.isEmpty()){
- paramsMap.put("$floatingIPKey", "$floatingIPKeyValue")
- }
- floatingIPV6Key = key + '_' + networkKey + '_floating_v6_ip'
- floatingIPV6KeyValue = utils.getElementText(eElementNetworkKey, "floating-ip-v6")
- if(!floatingIPV6KeyValue.isEmpty()){
- paramsMap.put("$floatingIPV6Key", "$floatingIPV6KeyValue")
- }
- NodeList networkIpsList = eElementNetworkKey.getElementsByTagNameNS("*","network-ips")
- for(int a = 0; a < networkIpsList.getLength(); a++){
- Node ipAddress = networkIpsList.item(a)
- if (ipAddress.getNodeType() == Node.ELEMENT_NODE) {
- Element eElementIpAddress = (Element) ipAddress
- String ipAddressValue = utils.getElementText(eElementIpAddress, "ip-address")
- if (a != networkIpsList.getLength() - 1) {
- ipAddressValues = sb2.append(ipAddressValue + ",")
- }
- else {
- ipAddressValues = sb2.append(ipAddressValue);
- }
- networkPosition = a.toString()
- paramsMap.put("${key}_${networkKey}_ip_${networkPosition}", "${ipAddressValue}")
- }
- }
-
- paramsMap.put("${key}_${networkKey}_ips", "${ipAddressValues}")
-
- NodeList interfaceRoutePrefixesList = eElementNetworkKey.getElementsByTagNameNS("*","interface-route-prefixes")
- String interfaceRoutePrefixValues = sb3.append("[")
-
- for(int a = 0; a < interfaceRoutePrefixesList.getLength(); a++){
- Node interfaceRoutePrefix = interfaceRoutePrefixesList.item(a)
- if (interfaceRoutePrefix.getNodeType() == Node.ELEMENT_NODE) {
- Element eElementInterfaceRoutePrefix = (Element) interfaceRoutePrefix
- String interfaceRoutePrefixValue = utils.getElementText(eElementInterfaceRoutePrefix, "interface-route-prefix-cidr")
- if (interfaceRoutePrefixValue == null || interfaceRoutePrefixValue.isEmpty()) {
- interfaceRoutePrefixValue = utils.getElementText(eElementInterfaceRoutePrefix, "interface-route-prefix")
- }
- if (a != interfaceRoutePrefixesList.getLength() - 1) {
- interfaceRoutePrefixValues = sb3.append("{\"interface_route_table_routes_route_prefix\": \"" + interfaceRoutePrefixValue + "\"}" + ",")
- }
- else {
- interfaceRoutePrefixValues = sb3.append("{\"interface_route_table_routes_route_prefix\": \"" + interfaceRoutePrefixValue + "\"}")
- }
- }
- }
- interfaceRoutePrefixValues = sb3.append("]")
- if (interfaceRoutePrefixesList.getLength() > 0) {
- paramsMap.put("${key}_${networkKey}_route_prefixes", "${interfaceRoutePrefixValues}")
- }
-
- NodeList networkIpsV6List = eElementNetworkKey.getElementsByTagNameNS("*","network-ips-v6")
- for(int a = 0; a < networkIpsV6List.getLength(); a++){
- Node ipV6Address = networkIpsV6List.item(a)
- if (ipV6Address.getNodeType() == Node.ELEMENT_NODE) {
- Element eElementIpV6Address = (Element) ipV6Address
- String ipV6AddressValue = utils.getElementText(eElementIpV6Address, "ip-address-ipv6")
- if (a != networkIpsV6List.getLength() - 1) {
- ipV6AddressValues = sb4.append(ipV6AddressValue + ",")
- }
- else {
- ipV6AddressValues = sb4.append(ipV6AddressValue);
- }
- networkPosition = a.toString()
- paramsMap.put("${key}_${networkKey}_v6_ip_${networkPosition}", "${ipV6AddressValue}")
- }
- }
- paramsMap.put("${key}_${networkKey}_v6_ips", "${ipV6AddressValues}")
- }
- }
- paramsMap.put("${key}_names", "${values}")
- }
- }
- //SDNC Response Params
- String sdncResponseParams = ""
- List<String> sdncResponseParamsToSkip = ["vnf_id", "vf_module_id", "vnf_name", "vf_module_name"]
- String vnfParamsChildNodes = utils.getChildNodes(data, "vnf-parameters")
- if(vnfParamsChildNodes == null || vnfParamsChildNodes.length() < 1){
- // No SDNC params
- }else{
- NodeList paramsList = responseXml.getElementsByTagNameNS("*", "vnf-parameters")
- for (int z = 0; z < paramsList.getLength(); z++) {
- Node node = paramsList.item(z)
- Element eElement = (Element) node
- String vnfParameterName = utils.getElementText(eElement, "vnf-parameter-name")
- if (!sdncResponseParamsToSkip.contains(vnfParameterName)) {
- String vnfParameterValue = utils.getElementText(eElement, "vnf-parameter-value")
- paramsMap.put("${vnfParameterName}", "${vnfParameterValue}")
- }
- }
- }
-
- // Parameters received from the request should overwrite any parameters received from SDNC
- if (vnfParamsMap != null) {
- for (Map.Entry<String, String> entry : vnfParamsMap.entrySet()) {
- String vnfKey = entry.getKey()
- String vnfValue = entry.getValue()
- paramsMap.put("$vnfKey", "$vnfValue")
- }
- }
-
- StringBuilder sbParams = new StringBuilder()
- def vfModuleParams = ""
- for (Map.Entry<String, String> entry : paramsMap.entrySet()) {
- String paramsXml
- String paramName = entry.getKey()
- String paramValue = entry.getValue()
- paramsXml =
- """<entry>
- <key>${paramName}</key>
- <value>${paramValue}</value>
- </entry>
- """
-
- vfModuleParams = sbParams.append(paramsXml)
- }
-
- return vfModuleParams
-
- }
-
-
- /*
- * Parses VNF parameters passed in on the incoming requests and SDNC parameters returned from SDNC get response
- * for both VNF and VF Module
- * and puts them into the format expected by VNF adapter.
- * @param vnfParamsMap - map of VNF parameters passed in the request body
- * @param vnfSdncGetResponse - response string from SDNC GET VNF topology request
- * @param vfmoduleSdncGetResponse - response string from SDNC GET VF Module topology request
- * @param vnfId
- * @param vnfName
- * @param vfModuleId
- * @param vfModuleName
- * @param vfModuleIndex - can be null
- * @return a String of key/value entries for vfModuleParams
- */
-
- protected String buildVfModuleParamsFromCombinedTopologies(Map<String, String> vnfParamsMap, String vnfSdncGetResponse, String vfmoduleSdncGetResponse, String vnfId, String vnfName,
- String vfModuleId, String vfModuleName, String vfModuleIndex, String environmentContext, String workloadContext) {
-
- // Set up initial parameters
-
- Map<String, String> paramsMap = new HashMap<String, String>()
-
- if (vfModuleIndex != null) {
- paramsMap.put("vf_module_index", "${vfModuleIndex}")
- }
-
- // Add-on data
- paramsMap.put("vnf_id", "${vnfId}")
- paramsMap.put("vnf_name", "${vnfName}")
- paramsMap.put("vf_module_id", "${vfModuleId}")
- paramsMap.put("vf_module_name", "${vfModuleName}")
- paramsMap.put("environment_context","${environmentContext}")
- paramsMap.put("workload_context", "${workloadContext}")
-
- //Get SDNC Response Data for VNF
-
- String vnfData = utils.getNodeXml(vnfSdncGetResponse, "response-data")
- vnfData = vnfData.replaceAll("<", "<")
- vnfData = vnfData.replaceAll(">", ">")
-
- String vnfTopology = utils.getNodeXml(vnfData, "vnf-topology")
- vnfTopology = utils.removeXmlPreamble(vnfTopology)
- vnfTopology = utils.removeXmlNamespaces(vnfTopology)
-
- InputSource sourceVnf = new InputSource(new StringReader(vnfData));
- DocumentBuilderFactory docFactoryVnf = DocumentBuilderFactory.newInstance();
- docFactoryVnf.setNamespaceAware(true)
- DocumentBuilder docBuilderVnf = docFactoryVnf.newDocumentBuilder()
- Document responseXmlVnf = docBuilderVnf.parse(sourceVnf)
-
- // Availability Zones Data
-
- NodeList aZonesList = responseXmlVnf.getElementsByTagNameNS("*", "availability-zones")
- String aZonePosition = "0"
- for (int z = 0; z < aZonesList.getLength(); z++) {
- Node node = aZonesList.item(z)
- if (node.getNodeType() == Node.ELEMENT_NODE) {
- Element eElement = (Element) node
- String aZoneValue = utils.getElementText(eElement, "availability-zone")
- aZonePosition = z.toString()
- paramsMap.put("availability_zone_${aZonePosition}", "${aZoneValue}")
- }
- }
-
- //Get SDNC Response Data for VF Module
-
- String vfModuleData = utils.getNodeXml(vfmoduleSdncGetResponse, "response-data")
- vfModuleData = vfModuleData.replaceAll("<", "<")
- vfModuleData = vfModuleData.replaceAll(">", ">")
-
- String vfModuleTopology = utils.getNodeXml(vfModuleData, "vf-module-topology")
- vfModuleTopology = utils.removeXmlPreamble(vfModuleTopology)
- vfModuleTopology = utils.removeXmlNamespaces(vfModuleTopology)
- String vfModuleTopologyIdentifier = utils.getNodeXml(vfModuleTopology, "vf-module-topology-identifier")
-
- InputSource sourceVfModule = new InputSource(new StringReader(vfModuleData));
- DocumentBuilderFactory docFactoryVfModule = DocumentBuilderFactory.newInstance();
- docFactoryVfModule.setNamespaceAware(true)
- DocumentBuilder docBuilderVfModule = docFactoryVfModule.newDocumentBuilder()
- Document responseXmlVfModule = docBuilderVfModule.parse(sourceVfModule)
-
- // Map of network-roles and network-tags from vm-networks
-
- NodeList vmNetworksListGlobal = responseXmlVfModule.getElementsByTagNameNS("*", "vm-networks")
- Map<String, String> networkRoleMap = new HashMap<String, String>()
- for(int n = 0; n < vmNetworksListGlobal.getLength(); n++){
- Node nodeNetworkKey = vmNetworksListGlobal.item(n)
- if (nodeNetworkKey.getNodeType() == Node.ELEMENT_NODE) {
- Element eElementNetworkKey = (Element) nodeNetworkKey
- String networkRole = utils.getElementText(eElementNetworkKey, "network-role")
- String networkRoleValue = utils.getElementText(eElementNetworkKey, "network-role-tag")
- if (networkRoleValue.isEmpty()) {
- networkRoleValue = networkRole
- }
- networkRoleMap.put(networkRole, networkRoleValue)
- }
- }
-
- // VNF Networks Data
-
- StringBuilder sbNet = new StringBuilder()
-
- NodeList vnfNetworkList = responseXmlVnf.getElementsByTagNameNS("*", "vnf-networks")
- for (int x = 0; x < vnfNetworkList.getLength(); x++) {
- Node node = vnfNetworkList.item(x)
- if (node.getNodeType() == Node.ELEMENT_NODE) {
- Element eElement = (Element) node
- String vnfNetworkKey = utils.getElementText(eElement, "network-role-tag")
- String networkRole = utils.getElementText(eElement, "network-role")
- if (vnfNetworkKey.isEmpty()) {
- vnfNetworkKey = networkRoleMap.get(networkRole)
- if (vnfNetworkKey == null || vnfNetworkKey.isEmpty()) {
- vnfNetworkKey = networkRole
- }
- }
- String vnfNetworkNeutronIdValue = utils.getElementText(eElement, "neutron-id")
- String vnfNetworkNetNameValue = utils.getElementText(eElement, "network-name")
- String vnfNetworkSubNetIdValue = utils.getElementText(eElement, "subnet-id")
- String vnfNetworkV6SubNetIdValue = utils.getElementText(eElement, "ipv6-subnet-id")
- String vnfNetworkNetFqdnValue = utils.getElementText(eElement, "contrail-network-fqdn")
- paramsMap.put("${vnfNetworkKey}_net_id", "${vnfNetworkNeutronIdValue}")
- paramsMap.put("${vnfNetworkKey}_net_name", "${vnfNetworkNetNameValue}")
- paramsMap.put("${vnfNetworkKey}_subnet_id", "${vnfNetworkSubNetIdValue}")
- paramsMap.put("${vnfNetworkKey}_v6_subnet_id", "${vnfNetworkV6SubNetIdValue}")
- paramsMap.put("${vnfNetworkKey}_net_fqdn", "${vnfNetworkNetFqdnValue}")
-
- NodeList sriovVlanFilterList = eElement.getElementsByTagNameNS("*","sriov-vlan-filter-list")
- StringBuffer sriovFilterBuf = new StringBuffer()
- String values = ""
- for(int i = 0; i < sriovVlanFilterList.getLength(); i++){
- Node node1 = sriovVlanFilterList.item(i)
- if (node1.getNodeType() == Node.ELEMENT_NODE) {
- Element eElement1 = (Element) node1
- String value = utils.getElementText(eElement1, "sriov-vlan-filter")
- if (i != sriovVlanFilterList.getLength() - 1) {
- values = sriovFilterBuf.append(value + ",")
- }
- else {
- values = sriovFilterBuf.append(value);
- }
- }
- }
- if (!values.isEmpty()) {
- paramsMap.put("${vnfNetworkKey}_ATT_VF_VLAN_FILTER", "${values}")
- }
- }
- }
-
-
-
- // VMS Data
-
- def key
- def value
- def networkKey
- def networkValue
- def floatingIPKey
- def floatingIPKeyValue
- def floatingIPV6Key
- def floatingIPV6KeyValue
- StringBuilder sb = new StringBuilder()
-
- NodeList vmsList = responseXmlVfModule.getElementsByTagNameNS("*","vm")
- for (int x = 0; x < vmsList.getLength(); x++) {
- Node node = vmsList.item(x)
- if (node.getNodeType() == Node.ELEMENT_NODE) {
- Element eElement = (Element) node
- key = utils.getElementText(eElement, "vm-type")
- String values
- String position = "0"
- StringBuilder sb1 = new StringBuilder()
- NodeList valueList = eElement.getElementsByTagNameNS("*","vm-names")
- NodeList vmNetworksList = eElement.getElementsByTagNameNS("*","vm-networks")
- for(int i = 0; i < valueList.getLength(); i++){
- Node node1 = valueList.item(i)
- if (node1.getNodeType() == Node.ELEMENT_NODE) {
- Element eElement1 = (Element) node1
- value = utils.getElementText(eElement1, "vm-name")
- if (i != valueList.getLength() - 1) {
- values = sb1.append(value + ",")
- }
- else {
- values = sb1.append(value);
- }
- position = i.toString()
- paramsMap.put("${key}_name_${position}", "${value}")
- }
- }
- for(int n = 0; n < vmNetworksList.getLength(); n++){
- String floatingIpKeyValueStr = ""
- String floatingIpV6KeyValueStr = ""
- Node nodeNetworkKey = vmNetworksList.item(n)
- if (nodeNetworkKey.getNodeType() == Node.ELEMENT_NODE) {
- Element eElementNetworkKey = (Element) nodeNetworkKey
- String ipAddressValues
- String ipV6AddressValues
- String networkPosition = "0"
- StringBuilder sb2 = new StringBuilder()
- StringBuilder sb3 = new StringBuilder()
- StringBuilder sb4 = new StringBuilder()
- networkKey = utils.getElementText(eElementNetworkKey, "network-role-tag")
- if (networkKey.isEmpty()) {
- networkKey = utils.getElementText(eElementNetworkKey, "network-role")
- }
- floatingIPKey = key + '_' + networkKey + '_floating_ip'
- floatingIPKeyValue = utils.getElementText(eElementNetworkKey, "floating-ip")
- if(!floatingIPKeyValue.isEmpty()){
- paramsMap.put("$floatingIPKey", "$floatingIPKeyValue")
- }
- floatingIPV6Key = key + '_' + networkKey + '_floating_v6_ip'
- floatingIPV6KeyValue = utils.getElementText(eElementNetworkKey, "floating-ip-v6")
- if(!floatingIPV6KeyValue.isEmpty()){
- paramsMap.put("$floatingIPV6Key", "$floatingIPV6KeyValue")
- }
- NodeList networkIpsList = eElementNetworkKey.getElementsByTagNameNS("*","network-ips")
- for(int a = 0; a < networkIpsList.getLength(); a++){
- Node ipAddress = networkIpsList.item(a)
- if (ipAddress.getNodeType() == Node.ELEMENT_NODE) {
- Element eElementIpAddress = (Element) ipAddress
- String ipAddressValue = utils.getElementText(eElementIpAddress, "ip-address")
- if (a != networkIpsList.getLength() - 1) {
- ipAddressValues = sb2.append(ipAddressValue + ",")
- }
- else {
- ipAddressValues = sb2.append(ipAddressValue);
- }
- networkPosition = a.toString()
- paramsMap.put("${key}_${networkKey}_ip_${networkPosition}", "${ipAddressValue}")
- }
- }
-
- paramsMap.put("${key}_${networkKey}_ips", "${ipAddressValues}")
-
- NodeList interfaceRoutePrefixesList = eElementNetworkKey.getElementsByTagNameNS("*","interface-route-prefixes")
- String interfaceRoutePrefixValues = sb3.append("[")
-
- for(int a = 0; a < interfaceRoutePrefixesList.getLength(); a++){
- Node interfaceRoutePrefix = interfaceRoutePrefixesList.item(a)
- if (interfaceRoutePrefix.getNodeType() == Node.ELEMENT_NODE) {
- Element eElementInterfaceRoutePrefix = (Element) interfaceRoutePrefix
- String interfaceRoutePrefixValue = utils.getElementText(eElementInterfaceRoutePrefix, "interface-route-prefix-cidr")
- if (interfaceRoutePrefixValue == null || interfaceRoutePrefixValue.isEmpty()) {
- interfaceRoutePrefixValue = utils.getElementText(eElementInterfaceRoutePrefix, "interface-route-prefix")
- }
- if (a != interfaceRoutePrefixesList.getLength() - 1) {
- interfaceRoutePrefixValues = sb3.append("{\"interface_route_table_routes_route_prefix\": \"" + interfaceRoutePrefixValue + "\"}" + ",")
- }
- else {
- interfaceRoutePrefixValues = sb3.append("{\"interface_route_table_routes_route_prefix\": \"" + interfaceRoutePrefixValue + "\"}")
- }
- }
- }
- interfaceRoutePrefixValues = sb3.append("]")
- if (interfaceRoutePrefixesList.getLength() > 0) {
- paramsMap.put("${key}_${networkKey}_route_prefixes", "${interfaceRoutePrefixValues}")
- }
-
- NodeList networkIpsV6List = eElementNetworkKey.getElementsByTagNameNS("*","network-ips-v6")
- for(int a = 0; a < networkIpsV6List.getLength(); a++){
- Node ipV6Address = networkIpsV6List.item(a)
- if (ipV6Address.getNodeType() == Node.ELEMENT_NODE) {
- Element eElementIpV6Address = (Element) ipV6Address
- String ipV6AddressValue = utils.getElementText(eElementIpV6Address, "ip-address-ipv6")
- if (a != networkIpsV6List.getLength() - 1) {
- ipV6AddressValues = sb4.append(ipV6AddressValue + ",")
- }
- else {
- ipV6AddressValues = sb4.append(ipV6AddressValue);
- }
- networkPosition = a.toString()
- paramsMap.put("${key}_${networkKey}_v6_ip_${networkPosition}", "${ipV6AddressValue}")
- }
- }
- paramsMap.put("${key}_${networkKey}_v6_ips", "${ipV6AddressValues}")
- }
- }
- paramsMap.put("${key}_names", "${values}")
- }
- }
- //SDNC Response Params
- List<String> sdncResponseParamsToSkip = ["vnf_id", "vf_module_id", "vnf_name", "vf_module_name"]
-
- String vnfParamsChildNodes = utils.getChildNodes(vnfData, "param")
- if(vnfParamsChildNodes == null || vnfParamsChildNodes.length() < 1){
- // No SDNC params for VNF
- }else{
- NodeList paramsList = responseXmlVnf.getElementsByTagNameNS("*", "param")
- for (int z = 0; z < paramsList.getLength(); z++) {
- Node node = paramsList.item(z)
- Element eElement = (Element) node
- String vnfParameterName = utils.getElementText(eElement, "name")
- if (!sdncResponseParamsToSkip.contains(vnfParameterName)) {
- String vnfParameterValue = utils.getElementText(eElement, "value")
- paramsMap.put("${vnfParameterName}", "${vnfParameterValue}")
- }
- }
- }
-
- String vfModuleParamsChildNodes = utils.getChildNodes(vfModuleData, "param")
- if(vfModuleParamsChildNodes == null || vfModuleParamsChildNodes.length() < 1){
- // No SDNC params for VF Module
- }else{
- NodeList paramsList = responseXmlVfModule.getElementsByTagNameNS("*", "param")
- for (int z = 0; z < paramsList.getLength(); z++) {
- Node node = paramsList.item(z)
- Element eElement = (Element) node
- String vnfParameterName = utils.getElementText(eElement, "name")
- if (!sdncResponseParamsToSkip.contains(vnfParameterName)) {
- String vnfParameterValue = utils.getElementText(eElement, "value")
- paramsMap.put("${vnfParameterName}", "${vnfParameterValue}")
- }
- }
- }
-
- // Parameters received from the request should overwrite any parameters received from SDNC
- if (vnfParamsMap != null) {
- for (Map.Entry<String, String> entry : vnfParamsMap.entrySet()) {
- String vnfKey = entry.getKey()
- String vnfValue = entry.getValue()
- paramsMap.put("$vnfKey", "$vnfValue")
- }
- }
-
- StringBuilder sbParams = new StringBuilder()
- def vfModuleParams = ""
- for (Map.Entry<String, String> entry : paramsMap.entrySet()) {
- String paramsXml
- String paramName = entry.getKey()
- String paramValue = entry.getValue()
- paramsXml =
- """<entry>
- <key>${paramName}</key>
- <value>${paramValue}</value>
- </entry>
- """
-
- vfModuleParams = sbParams.append(paramsXml)
- }
-
- return vfModuleParams
-
- }
-
-
- /*
- * VBNG specific method that parses VNF parameters passed in on the
- * incoming requests and SDNC parameters returned from SDNC get response
- * and puts them into the format expected by VNF adapter.
- * @param vnfParamsMap - map of VNF parameters passed in the request body
- * @param sdncGetResponse - response string from SDNC GET topology request
- * @param vnfId
- * @param vnfName
- * @param vfModuleId
- * @param vfModuleName
- * @return a String of key/value entries for vfModuleParams
- */
-
- protected String buildVfModuleParamsVbng(String vnfParams, String sdncGetResponse, String vnfId, String vnfName,
- String vfModuleId, String vfModuleName) {
-
- //Get SDNC Response Data
-
- String data = utils.getNodeXml(sdncGetResponse, "response-data")
- data = data.replaceAll("<", "<")
- data = data.replaceAll(">", ">")
-
-
-
- // Add-on data
- String vnfInfo =
- """<entry>
- <key>vnf_id</key>
- <value>${vnfId}</value>
- </entry>
- <entry>
- <key>vnf_name</key>
- <value>${vnfName}</value>
- </entry>
- <entry>
- <key>vf_module_id</key>
- <value>${vfModuleId}</value>
- </entry>
- <entry>
- <key>vf_module_name</key>
- <value>${vfModuleName}</value>
- </entry>"""
-
- utils.logAudit("vnfInfo: " + vnfInfo)
- InputSource source = new InputSource(new StringReader(data));
- DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
- docFactory.setNamespaceAware(true)
- DocumentBuilder docBuilder = docFactory.newDocumentBuilder()
- Document responseXml = docBuilder.parse(source)
-
-
- // Availability Zones Data
- String aZones = ""
- StringBuilder sbAZone = new StringBuilder()
- NodeList aZonesList = responseXml.getElementsByTagNameNS("*", "availability-zones")
- String aZonePosition = "0"
- for (int z = 0; z < aZonesList.getLength(); z++) {
- Node node = aZonesList.item(z)
- if (node.getNodeType() == Node.ELEMENT_NODE) {
- Element eElement = (Element) node
- String aZoneValue = utils.getElementText(eElement, "availability-zone")
- aZonePosition = z.toString()
- String aZoneXml =
- """<entry>
- <key>availability_zone_${aZonePosition}</key>
- <value>${aZoneValue}</value>
- </entry>"""
- aZones = sbAZone.append(aZoneXml)
- }
- }
-
- // Map of network-roles and network-tags from vm-networks
-
- NodeList vmNetworksListGlobal = responseXml.getElementsByTagNameNS("*", "vm-networks")
- Map<String, String> networkRoleMap = new HashMap<String, String>()
- for(int n = 0; n < vmNetworksListGlobal.getLength(); n++){
- Node nodeNetworkKey = vmNetworksListGlobal.item(n)
- if (nodeNetworkKey.getNodeType() == Node.ELEMENT_NODE) {
- Element eElementNetworkKey = (Element) nodeNetworkKey
- String networkRole = utils.getElementText(eElementNetworkKey, "network-role")
- String networkRoleValue = utils.getElementText(eElementNetworkKey, "network-role-tag")
- if (networkRoleValue.isEmpty()) {
- networkRoleValue = networkRole
- }
- networkRoleMap.put(networkRole, networkRoleValue)
- }
- }
-
- // VNF Networks Data
- String vnfNetworkNetId = ""
- String vnfNetworkNetName = ""
- String vnfNetworkSubNetId = ""
- String vnfNetworkV6SubNetId = ""
- String vnfNetworkNetFqdn = ""
- String vnfNetworksSriovVlanFilters = ""
- StringBuilder sbNet = new StringBuilder()
- StringBuilder sbNet2 = new StringBuilder()
- StringBuilder sbNet3 = new StringBuilder()
- StringBuilder sbNet4 = new StringBuilder()
- StringBuilder sbNet5 = new StringBuilder()
- StringBuilder sbNet6 = new StringBuilder()
- NodeList vnfNetworkList = responseXml.getElementsByTagNameNS("*", "vnf-networks")
- for (int x = 0; x < vnfNetworkList.getLength(); x++) {
- Node node = vnfNetworkList.item(x)
- if (node.getNodeType() == Node.ELEMENT_NODE) {
- Element eElement = (Element) node
- String vnfNetworkKey = utils.getElementText(eElement, "network-role-tag")
- String networkRole = utils.getElementText(eElement, "network-role")
- if (vnfNetworkKey.isEmpty()) {
- vnfNetworkKey = networkRoleMap.get(networkRole)
- if (vnfNetworkKey == null || vnfNetworkKey.isEmpty()) {
- vnfNetworkKey = networkRole
- }
- }
- String vnfNetworkNeutronIdValue = utils.getElementText(eElement, "neutron-id")
- String vnfNetworkNetNameValue = utils.getElementText(eElement, "network-name")
- String vnfNetworkSubNetIdValue = utils.getElementText(eElement, "subnet-id")
- String vnfNetworkV6SubNetIdValue = utils.getElementText(eElement, "ipv6-subnet-id")
- String vnfNetworkNetFqdnValue = utils.getElementText(eElement, "contrail-network-fqdn")
- String vnfNetworkNetIdXml =
- """<entry>
- <key>${vnfNetworkKey}_net_id</key>
- <value>${vnfNetworkNeutronIdValue}</value>
- </entry>"""
- vnfNetworkNetId = sbNet.append(vnfNetworkNetIdXml)
- String vnfNetworkNetNameXml =
- """<entry>
- <key>${vnfNetworkKey}_net_name</key>
- <value>${vnfNetworkNetNameValue}</value>
- </entry>"""
- vnfNetworkNetName = sbNet2.append(vnfNetworkNetNameXml)
- String vnfNetworkSubNetIdXml =
- """<entry>
- <key>${vnfNetworkKey}_subnet_id</key>
- <value>${vnfNetworkSubNetIdValue}</value>
- </entry>"""
- vnfNetworkSubNetId = sbNet3.append(vnfNetworkSubNetIdXml)
- String vnfNetworkV6SubNetIdXml =
- """<entry>
- <key>${vnfNetworkKey}_v6_subnet_id</key>
- <value>${vnfNetworkV6SubNetIdValue}</value>
- </entry>"""
- vnfNetworkV6SubNetId = sbNet5.append(vnfNetworkV6SubNetIdXml)
- String vnfNetworkNetFqdnXml =
- """<entry>
- <key>${vnfNetworkKey}_net_fqdn</key>
- <value>${vnfNetworkNetFqdnValue}</value>
- </entry>"""
- vnfNetworkNetFqdn = sbNet4.append(vnfNetworkNetFqdnXml)
-
- NodeList sriovVlanFilterList = eElement.getElementsByTagNameNS("*","sriov-vlan-filter-list")
- StringBuffer sriovFilterBuf = new StringBuffer()
- String values = ""
- for(int i = 0; i < sriovVlanFilterList.getLength(); i++){
- Node node1 = sriovVlanFilterList.item(i)
- if (node1.getNodeType() == Node.ELEMENT_NODE) {
- Element eElement1 = (Element) node1
- String value = utils.getElementText(eElement1, "sriov-vlan-filter")
- if (i != sriovVlanFilterList.getLength() - 1) {
- values = sriovFilterBuf.append(value + ",")
- }
- else {
- values = sriovFilterBuf.append(value);
- }
- }
- }
- if (!values.isEmpty()) {
- String vnfNetworkSriovVlanFilterXml =
- """<entry>
- <key>${vnfNetworkKey}_ATT_VF_VLAN_FILTER</key>
- <value>${values}</value>
- </entry>"""
- vnfNetworksSriovVlanFilters = sbNet6.append(vnfNetworkSriovVlanFilterXml)
- }
- }
- }
-
- // VNF-VMS Data
- String vnfVMS = ""
- String vnfVMSPositions = ""
- String vmNetworks = ""
- String vmNetworksPositions = ""
- String vmNetworksPositionsV6 = ""
- String interfaceRoutePrefixes = ""
- def key
- def value
- def networkKey
- def networkValue
- def floatingIPKey
- def floatingIPKeyValue
- def floatingIPV6Key
- def floatingIPV6KeyValue
- StringBuilder sb = new StringBuilder()
- StringBuilder sbPositions = new StringBuilder()
- StringBuilder sbVmNetworks = new StringBuilder()
- StringBuilder sbNetworksPositions = new StringBuilder()
- StringBuilder sbInterfaceRoutePrefixes = new StringBuilder()
- StringBuilder sbNetworksPositionsV6 = new StringBuilder()
-
- NodeList vmsList = responseXml.getElementsByTagNameNS("*","vnf-vms")
- for (int x = 0; x < vmsList.getLength(); x++) {
- Node node = vmsList.item(x)
- if (node.getNodeType() == Node.ELEMENT_NODE) {
- Element eElement = (Element) node
- key = utils.getElementText(eElement, "vm-type")
- String values
- String position = "0"
- StringBuilder sb1 = new StringBuilder()
- NodeList valueList = eElement.getElementsByTagNameNS("*","vm-names")
- NodeList vmNetworksList = eElement.getElementsByTagNameNS("*","vm-networks")
- for(int i = 0; i < valueList.getLength(); i++){
- Node node1 = valueList.item(i)
- if (node1.getNodeType() == Node.ELEMENT_NODE) {
- Element eElement1 = (Element) node1
- value = utils.getElementText(eElement1, "vm-name")
- if (i != valueList.getLength() - 1) {
- values = sb1.append(value + ",")
- }
- else {
- values = sb1.append(value);
- }
- position = i.toString()
- String vnfPositionXml =
- """<entry>
- <key>${key}_name_${position}</key>
- <value>${value}</value>
- </entry>"""
- vnfVMSPositions = sbPositions.append(vnfPositionXml)
- }
- }
- for(int n = 0; n < vmNetworksList.getLength(); n++){
- String floatingIpKeyValueStr = ""
- String floatingIpV6KeyValueStr = ""
- Node nodeNetworkKey = vmNetworksList.item(n)
- if (nodeNetworkKey.getNodeType() == Node.ELEMENT_NODE) {
- Element eElementNetworkKey = (Element) nodeNetworkKey
- String ipAddressValues
- String ipV6AddressValues
- String networkPosition = "0"
- StringBuilder sb2 = new StringBuilder()
- StringBuilder sb3 = new StringBuilder()
- StringBuilder sb4 = new StringBuilder()
- networkKey = utils.getElementText(eElementNetworkKey, "network-role-tag")
- if (networkKey.isEmpty()) {
- networkKey = utils.getElementText(eElementNetworkKey, "network-role")
- }
- floatingIPKey = key + '_' + networkKey + '_floating_ip'
- floatingIPKeyValue = utils.getElementText(eElementNetworkKey, "floating-ip")
- if(!floatingIPKeyValue.isEmpty()){
- floatingIpKeyValueStr = """<entry>
- <key>$floatingIPKey</key>
- <value>$floatingIPKeyValue</value>
- </entry>"""
- }
- floatingIPV6Key = key + '_' + networkKey + '_floating_v6_ip'
- floatingIPV6KeyValue = utils.getElementText(eElementNetworkKey, "floating-ip-v6")
- if(!floatingIPV6KeyValue.isEmpty()){
- floatingIpV6KeyValueStr = """<entry>
- <key>$floatingIPV6Key</key>
- <value>$floatingIPV6KeyValue</value>
- </entry>"""
- }
- NodeList networkIpsList = eElementNetworkKey.getElementsByTagNameNS("*","network-ips")
- for(int a = 0; a < networkIpsList.getLength(); a++){
- Node ipAddress = networkIpsList.item(a)
- if (ipAddress.getNodeType() == Node.ELEMENT_NODE) {
- Element eElementIpAddress = (Element) ipAddress
- String ipAddressValue = utils.getElementText(eElementIpAddress, "ip-address")
- if (a != networkIpsList.getLength() - 1) {
- ipAddressValues = sb2.append(ipAddressValue + ",")
- }
- else {
- ipAddressValues = sb2.append(ipAddressValue);
- }
- networkPosition = a.toString()
- String vmNetworksPositionsXml =
- """<entry>
- <key>${key}_${networkKey}_ip_${networkPosition}</key>
- <value>${ipAddressValue}</value>
- </entry>"""
- vmNetworksPositions = sbNetworksPositions.append(vmNetworksPositionsXml)
- }
- }
- vmNetworksPositions = sbNetworksPositions.append(floatingIpKeyValueStr).append(floatingIpV6KeyValueStr)
-
- String vmNetworksXml =
- """<entry>
- <key>${key}_${networkKey}_ips</key>
- <value>${ipAddressValues}</value>
- </entry>"""
- vmNetworks = sbVmNetworks.append(vmNetworksXml)
-
- NodeList interfaceRoutePrefixesList = eElementNetworkKey.getElementsByTagNameNS("*","interface-route-prefixes")
- String interfaceRoutePrefixValues = sb3.append("[")
-
- for(int a = 0; a < interfaceRoutePrefixesList.getLength(); a++){
- Node interfaceRoutePrefix = interfaceRoutePrefixesList.item(a)
- if (interfaceRoutePrefix.getNodeType() == Node.ELEMENT_NODE) {
- Element eElementInterfaceRoutePrefix = (Element) interfaceRoutePrefix
- String interfaceRoutePrefixValue = utils.getElementText(eElementInterfaceRoutePrefix, "interface-route-prefix-cidr")
- if (interfaceRoutePrefixValue == null || interfaceRoutePrefixValue.isEmpty()) {
- interfaceRoutePrefixValue = utils.getElementText(eElementInterfaceRoutePrefix, "interface-route-prefix")
- }
- if (a != interfaceRoutePrefixesList.getLength() - 1) {
- interfaceRoutePrefixValues = sb3.append("{\"interface_route_table_routes_route_prefix\": \"" + interfaceRoutePrefixValue + "\"}" + ",")
- }
- else {
- interfaceRoutePrefixValues = sb3.append("{\"interface_route_table_routes_route_prefix\": \"" + interfaceRoutePrefixValue + "\"}")
- }
- }
- }
- interfaceRoutePrefixValues = sb3.append("]")
- if (interfaceRoutePrefixesList.getLength() > 0) {
- String interfaceRoutePrefixesXml =
- """<entry>
- <key>${key}_${networkKey}_route_prefixes</key>
- <value>${interfaceRoutePrefixValues}</value>
- </entry>"""
- interfaceRoutePrefixes = sbInterfaceRoutePrefixes.append(interfaceRoutePrefixesXml)
- }
-
- NodeList networkIpsV6List = eElementNetworkKey.getElementsByTagNameNS("*","network-ips-v6")
- for(int a = 0; a < networkIpsV6List.getLength(); a++){
- Node ipV6Address = networkIpsV6List.item(a)
- if (ipV6Address.getNodeType() == Node.ELEMENT_NODE) {
- Element eElementIpV6Address = (Element) ipV6Address
- String ipV6AddressValue = utils.getElementText(eElementIpV6Address, "ip-address-ipv6")
- if (a != networkIpsV6List.getLength() - 1) {
- ipV6AddressValues = sb4.append(ipV6AddressValue + ",")
- }
- else {
- ipV6AddressValues = sb4.append(ipV6AddressValue);
- }
- networkPosition = a.toString()
- String vmNetworksPositionsV6Xml =
- """<entry>
- <key>${key}_${networkKey}_v6_ip_${networkPosition}</key>
- <value>${ipV6AddressValue}</value>
- </entry>"""
- vmNetworksPositionsV6 = sbNetworksPositionsV6.append(vmNetworksPositionsV6Xml)
- }
- }
- String vmNetworksV6Xml =
- """<entry>
- <key>${key}_${networkKey}_v6_ips</key>
- <value>${ipV6AddressValues}</value>
- </entry>"""
- vmNetworks = sbVmNetworks.append(vmNetworksV6Xml)
- }
- }
- String vnfXml =
- """<entry>
- <key>${key}_names</key>
- <value>${values}</value>
- </entry>"""
- vnfVMS = sb.append(vnfXml)
- }
- }
- //SDNC Response Params
- String sdncResponseParams = ""
- List<String> sdncResponseParamsToSkip = ["vnf_id", "vf_module_id", "vnf_name", "vf_module_name"]
- String vnfParamsChildNodes = utils.getChildNodes(data, "vnf-parameters")
- if(vnfParamsChildNodes == null || vnfParamsChildNodes.length() < 1){
- // No SDNC params
- }else{
- NodeList paramsList = responseXml.getElementsByTagNameNS("*", "vnf-parameters")
- for (int z = 0; z < paramsList.getLength(); z++) {
- Node node = paramsList.item(z)
- Element eElement = (Element) node
- String vnfParameterName = utils.getElementText(eElement, "vnf-parameter-name")
- if (!sdncResponseParamsToSkip.contains(vnfParameterName)) {
- String vnfParameterValue = utils.getElementText(eElement, "vnf-parameter-value")
- String paraEntry =
- """<entry>
- <key>${vnfParameterName}</key>
- <value>${vnfParameterValue}</value>
- </entry>"""
- sdncResponseParams = sb.append(paraEntry)
- }
- }
- }
-
-
- def vfModuleParams = """
- ${vnfInfo}
- ${aZones}
- ${vnfNetworkNetId}
- ${vnfNetworkNetName}
- ${vnfNetworkSubNetId}
- ${vnfNetworkV6SubNetId}
- ${vnfNetworkNetFqdn}
- ${vnfNetworksSriovVlanFilters}
- ${vnfVMS}
- ${vnfVMSPositions}
- ${vmNetworks}
- ${vmNetworksPositions}
- ${vmNetworksPositionsV6}
- ${interfaceRoutePrefixes}
- ${vnfParams}
- ${sdncResponseParams}"""
-
- return vfModuleParams
-
- }
-
+/*- + * ============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.common.scripts; + +import java.io.ObjectInputStream.BlockDataInputStream + +import java.io.ObjectInputStream.BlockDataInputStream + +//import groovy.util.Node; + +import javax.xml.parsers.DocumentBuilder +import javax.xml.parsers.DocumentBuilderFactory + +import org.apache.commons.lang3.* +import org.w3c.dom.Document +import org.w3c.dom.Element +import org.w3c.dom.Node +import org.w3c.dom.NodeList +import org.xml.sax.InputSource +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + + + + +public abstract class VfModuleBase extends AbstractServiceTaskProcessor { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VfModuleBase.class); + + + protected XmlParser xmlParser = new XmlParser() + + /** + * Get the XmlParser. + * + * @return the XmlParser. + */ + protected XmlParser getXmlParser() { + return xmlParser + } + + /** + * Find the VF Module with specified ID in the specified Generic VF. If no such + * VF Module is found, null is returned. + * + * @param genericVnf The Generic VNF in which to search for the specified VF Moduel. + * @param vfModuleId The ID of the VF Module for which to search. + * @return a VFModule object for the found VF Module or null if no VF Module is found. + */ + protected VfModule findVfModule(String genericVnf, String vfModuleId) { + + def genericVnfNode = xmlParser.parseText(genericVnf) + def vfModulesNode = utils.getChildNode(genericVnfNode, 'vf-modules') + if (vfModulesNode == null) { + return null + } + def vfModuleList = utils.getIdenticalChildren(vfModulesNode, 'vf-module') + for (vfModuleNode in vfModuleList) { + def vfModuleIdNode = utils.getChildNode(vfModuleNode, 'vf-module-id') + if ((vfModuleIdNode != null) && (vfModuleIdNode.text().equals(vfModuleId))) { + return new VfModule(vfModuleNode, (vfModuleList.size() == 1)) + } + } + return null + } + + /** + * Transform all '*_network' parameter specifications from the incoming '*-params' root + * element to a corresponding list of 'vnf-networks' specifications (typically used when + * invoking the VNF Rest Adpater). Each element in '*-params' whose name attribute ends + * with '_network' is used to create an 'vnf-networks' element. + * + * @param paramsNode A Node representing a '*-params' element. + * @return a String of 'vnf-networks' elements, one for each 'param' element whose name + * attribute ends with '_network'. + */ + protected String transformNetworkParamsToVnfNetworks(String paramsRootXml) { + if ((paramsRootXml == null) || (paramsRootXml.isEmpty())) { + return '' + } + def String vnfNetworks = '' + try { + paramsRootXml = utils.removeXmlNamespaces(paramsRootXml) + def paramsNode = xmlParser.parseText(paramsRootXml) + def params = utils.getIdenticalChildren(paramsNode, 'param') + for (param in params) { + def String attrName = (String) param.attribute('name') + if (attrName.endsWith('_network')) { + def networkRole = attrName.substring(0, (attrName.length()-'_network'.length())) + def networkName = param.text() + String vnfNetwork = """ + <vnf-networks> + <network-role>${MsoUtils.xmlEscape(networkRole)}</network-role> + <network-name>${MsoUtils.xmlEscape(networkName)}</network-name> + </vnf-networks> + """ + vnfNetworks = vnfNetworks + vnfNetwork + } + } + } catch (Exception e) { + msoLogger.warn(MessageEnum.BPMN_GENERAL_WARNING, 'Exception transforming network params to vnfNetworks', "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, 'Exception is: \n' + e); + } + return vnfNetworks + } + + /** + * Transform the parameter specifications from the incoming '*-params' root element to + * a corresponding list of 'entry's (typically used when invoking the VNF Rest Adpater). + * Each element in '*-params' is used to create an 'entry' element. + * + * @param paramsNode A Node representing a '*-params' element. + * @return a String of 'entry' elements, one for each 'param' element. + */ + protected String transformParamsToEntries(String paramsRootXml) { + if ((paramsRootXml == null) || (paramsRootXml.isEmpty())) { + return '' + } + def String entries = '' + try { + paramsRootXml = utils.removeXmlNamespaces(paramsRootXml) + def paramsNode = xmlParser.parseText(paramsRootXml) + def params = utils.getIdenticalChildren(paramsNode, 'param') + for (param in params) { + def key = (String) param.attribute('name') + if (key == null) { + key = '' + } + def value = (String) param.text() + String entry = """ + <entry> + <key>${MsoUtils.xmlEscape(key)}</key> + <value>${MsoUtils.xmlEscape(value)}</value> + </entry> + """ + entries = entries + entry + } + } catch (Exception e) { + msoLogger.warn(MessageEnum.BPMN_GENERAL_WARNING, 'Exception transforming params to entries', "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, 'Exception transforming params to entries', e); + } + return entries + } + + /** + * Transform the parameter specifications from the incoming '*-params' root element to + * a corresponding list of 'entry's (typically used when invoking the VNF Rest Adpater). + * Each element in '*-params' is used to create an 'entry' element. + * + * @param paramsNode A Node representing a '*-params' element. + * @return a String of 'entry' elements, one for each 'param' element. + */ + protected String transformVolumeParamsToEntries(String paramsRootXml) { + if ((paramsRootXml == null) || (paramsRootXml.isEmpty())) { + return '' + } + def String entries = '' + try { + paramsRootXml = utils.removeXmlNamespaces(paramsRootXml) + def paramsNode = xmlParser.parseText(paramsRootXml) + def params = utils.getIdenticalChildren(paramsNode, 'param') + for (param in params) { + def key = (String) param.attribute('name') + if (key == null) { + key = '' + } + if ( !(key in ['vnf_id', 'vnf_name', 'vf_module_id', 'vf_module_name'])) { + def value = (String) param.text() + String entry = """ + <entry> + <key>${MsoUtils.xmlEscape(key)}</key> + <value>${MsoUtils.xmlEscape(value)}</value> + </entry> + """ + entries = entries + entry + } + } + } catch (Exception e) { + msoLogger.warn(MessageEnum.BPMN_GENERAL_WARNING, 'Exception transforming params to entries', "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, 'Exception transforming params to entries', e); + } + return entries + } + + /** + * Extract the Tenant Id from the Volume Group information returned by AAI. + * + * @param volumeGroupXml Volume Group XML returned by AAI. + * @return the Tenant Id extracted from the Volume Group information. 'null' is returned if + * the Tenant Id is missing or could not otherwise be extracted. + */ + protected String getTenantIdFromVolumeGroup(String volumeGroupXml) { + def groovy.util.Node volumeGroupNode = xmlParser.parseText(volumeGroupXml) + def groovy.util.Node relationshipList = utils.getChildNode(volumeGroupNode, 'relationship-list') + if (relationshipList != null) { + def groovy.util.NodeList relationships = utils.getIdenticalChildren(relationshipList, 'relationship') + for (groovy.util.Node relationship in relationships) { + def groovy.util.Node relatedTo = utils.getChildNode(relationship, 'related-to') + if ((relatedTo != null) && (relatedTo.text().equals('tenant'))) { + def groovy.util.NodeList relationshipDataList = utils.getIdenticalChildren(relationship, 'relationship-data') + for (groovy.util.Node relationshipData in relationshipDataList) { + def groovy.util.Node relationshipKey = utils.getChildNode(relationshipData, 'relationship-key') + if ((relationshipKey != null) && (relationshipKey.text().equals('tenant.tenant-id'))) { + def groovy.util.Node relationshipValue = utils.getChildNode(relationshipData, 'relationship-value') + if (relationshipValue != null) { + return relationshipValue.text() + } + } + } + } + } + } + return null + } + + + /* + * Parses VNF parameters passed in on the incoming requests and SDNC parameters returned from SDNC get response + * and puts them into the format expected by VNF adapter. + * @param vnfParamsMap - map of VNF parameters passed in the request body + * @param sdncGetResponse - response string from SDNC GET topology request + * @param vnfId + * @param vnfName + * @param vfModuleId + * @param vfModuleName + * @param vfModuleIndex - can be null + * @return a String of key/value entries for vfModuleParams + */ + + + protected String buildVfModuleParams(Map<String, String> vnfParamsMap, String sdncGetResponse, String vnfId, String vnfName, + String vfModuleId, String vfModuleName, String vfModuleIndex, String environmentContext, String workloadContext) { + + //Get SDNC Response Data + + String data = utils.getNodeXml(sdncGetResponse, "response-data") + + String serviceData = utils.getNodeXml(data, "service-data") + serviceData = utils.removeXmlPreamble(serviceData) + serviceData = utils.removeXmlNamespaces(serviceData) + String vnfRequestInfo = utils.getNodeXml(serviceData, "vnf-request-information") + String oldVnfId = utils.getNodeXml(vnfRequestInfo, "vnf-id") + oldVnfId = utils.removeXmlPreamble(oldVnfId) + oldVnfId = utils.removeXmlNamespaces(oldVnfId) + serviceData = serviceData.replace(oldVnfId, "") + def vnfId1 = utils.getNodeText(serviceData, "vnf-id") + + Map<String, String> paramsMap = new HashMap<String, String>() + + if (vfModuleIndex != null) { + paramsMap.put("vf_module_index", "${vfModuleIndex}") + } + + // Add-on data + paramsMap.put("vnf_id", "${vnfId}") + paramsMap.put("vnf_name", "${vnfName}") + paramsMap.put("vf_module_id", "${vfModuleId}") + paramsMap.put("vf_module_name", "${vfModuleName}") + paramsMap.put("environment_context", "${environmentContext}") + paramsMap.put("workload_context", "${workloadContext}") + + InputSource source = new InputSource(new StringReader(data)); + DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); + docFactory.setNamespaceAware(true) + DocumentBuilder docBuilder = docFactory.newDocumentBuilder() + Document responseXml = docBuilder.parse(source) + + + // Availability Zones Data + + NodeList aZonesList = responseXml.getElementsByTagNameNS("*", "availability-zones") + String aZonePosition = "0" + for (int z = 0; z < aZonesList.getLength(); z++) { + Node node = aZonesList.item(z) + if (node.getNodeType() == Node.ELEMENT_NODE) { + Element eElement = (Element) node + String aZoneValue = utils.getElementText(eElement, "availability-zone") + aZonePosition = z.toString() + paramsMap.put("availability_zone_${aZonePosition}", "${aZoneValue}") + } + } + + // Map of network-roles and network-tags from vm-networks + + NodeList vmNetworksListGlobal = responseXml.getElementsByTagNameNS("*", "vm-networks") + Map<String, String> networkRoleMap = new HashMap<String, String>() + for(int n = 0; n < vmNetworksListGlobal.getLength(); n++){ + Node nodeNetworkKey = vmNetworksListGlobal.item(n) + if (nodeNetworkKey.getNodeType() == Node.ELEMENT_NODE) { + Element eElementNetworkKey = (Element) nodeNetworkKey + String networkRole = utils.getElementText(eElementNetworkKey, "network-role") + String networkRoleValue = utils.getElementText(eElementNetworkKey, "network-role-tag") + if (networkRoleValue.isEmpty()) { + networkRoleValue = networkRole + } + networkRoleMap.put(networkRole, networkRoleValue) + } + } + + // VNF Networks Data + + StringBuilder sbNet = new StringBuilder() + + NodeList vnfNetworkList = responseXml.getElementsByTagNameNS("*", "vnf-networks") + for (int x = 0; x < vnfNetworkList.getLength(); x++) { + Node node = vnfNetworkList.item(x) + if (node.getNodeType() == Node.ELEMENT_NODE) { + Element eElement = (Element) node + String vnfNetworkKey = utils.getElementText(eElement, "network-role-tag") + String networkRole = utils.getElementText(eElement, "network-role") + if (vnfNetworkKey.isEmpty()) { + vnfNetworkKey = networkRoleMap.get(networkRole) + if (vnfNetworkKey == null || vnfNetworkKey.isEmpty()) { + vnfNetworkKey = networkRole + } + } + String vnfNetworkNeutronIdValue = utils.getElementText(eElement, "neutron-id") + String vnfNetworkNetNameValue = utils.getElementText(eElement, "network-name") + String vnfNetworkSubNetIdValue = utils.getElementText(eElement, "subnet-id") + String vnfNetworkV6SubNetIdValue = utils.getElementText(eElement, "ipv6-subnet-id") + String vnfNetworkNetFqdnValue = utils.getElementText(eElement, "contrail-network-fqdn") + paramsMap.put("${vnfNetworkKey}_net_id", "${vnfNetworkNeutronIdValue}") + paramsMap.put("${vnfNetworkKey}_net_name", "${vnfNetworkNetNameValue}") + paramsMap.put("${vnfNetworkKey}_subnet_id", "${vnfNetworkSubNetIdValue}") + paramsMap.put("${vnfNetworkKey}_v6_subnet_id", "${vnfNetworkV6SubNetIdValue}") + paramsMap.put("${vnfNetworkKey}_net_fqdn", "${vnfNetworkNetFqdnValue}") + + NodeList sriovVlanFilterList = eElement.getElementsByTagNameNS("*","sriov-vlan-filter-list") + StringBuffer sriovFilterBuf = new StringBuffer() + String values = "" + for(int i = 0; i < sriovVlanFilterList.getLength(); i++){ + Node node1 = sriovVlanFilterList.item(i) + if (node1.getNodeType() == Node.ELEMENT_NODE) { + Element eElement1 = (Element) node1 + String value = utils.getElementText(eElement1, "sriov-vlan-filter") + if (i != sriovVlanFilterList.getLength() - 1) { + values = sriovFilterBuf.append(value + ",") + } + else { + values = sriovFilterBuf.append(value); + } + } + } + if (!values.isEmpty()) { + paramsMap.put("${vnfNetworkKey}_ATT_VF_VLAN_FILTER", "${values}") + } + } + } + + // VNF-VMS Data + + def key + def value + def networkKey + def networkValue + def floatingIPKey + def floatingIPKeyValue + def floatingIPV6Key + def floatingIPV6KeyValue + StringBuilder sb = new StringBuilder() + + NodeList vmsList = responseXml.getElementsByTagNameNS("*","vnf-vms") + for (int x = 0; x < vmsList.getLength(); x++) { + Node node = vmsList.item(x) + if (node.getNodeType() == Node.ELEMENT_NODE) { + Element eElement = (Element) node + key = utils.getElementText(eElement, "vm-type") + String values + String position = "0" + StringBuilder sb1 = new StringBuilder() + NodeList valueList = eElement.getElementsByTagNameNS("*","vm-names") + NodeList vmNetworksList = eElement.getElementsByTagNameNS("*","vm-networks") + for(int i = 0; i < valueList.getLength(); i++){ + Node node1 = valueList.item(i) + if (node1.getNodeType() == Node.ELEMENT_NODE) { + Element eElement1 = (Element) node1 + value = utils.getElementText(eElement1, "vm-name") + if (i != valueList.getLength() - 1) { + values = sb1.append(value + ",") + } + else { + values = sb1.append(value); + } + position = i.toString() + paramsMap.put("${key}_name_${position}", "${value}") + } + } + for(int n = 0; n < vmNetworksList.getLength(); n++){ + String floatingIpKeyValueStr = "" + String floatingIpV6KeyValueStr = "" + Node nodeNetworkKey = vmNetworksList.item(n) + if (nodeNetworkKey.getNodeType() == Node.ELEMENT_NODE) { + Element eElementNetworkKey = (Element) nodeNetworkKey + String ipAddressValues + String ipV6AddressValues + String networkPosition = "0" + StringBuilder sb2 = new StringBuilder() + StringBuilder sb3 = new StringBuilder() + StringBuilder sb4 = new StringBuilder() + networkKey = utils.getElementText(eElementNetworkKey, "network-role-tag") + if (networkKey.isEmpty()) { + networkKey = utils.getElementText(eElementNetworkKey, "network-role") + } + floatingIPKey = key + '_' + networkKey + '_floating_ip' + floatingIPKeyValue = utils.getElementText(eElementNetworkKey, "floating-ip") + if(!floatingIPKeyValue.isEmpty()){ + paramsMap.put("$floatingIPKey", "$floatingIPKeyValue") + } + floatingIPV6Key = key + '_' + networkKey + '_floating_v6_ip' + floatingIPV6KeyValue = utils.getElementText(eElementNetworkKey, "floating-ip-v6") + if(!floatingIPV6KeyValue.isEmpty()){ + paramsMap.put("$floatingIPV6Key", "$floatingIPV6KeyValue") + } + NodeList networkIpsList = eElementNetworkKey.getElementsByTagNameNS("*","network-ips") + for(int a = 0; a < networkIpsList.getLength(); a++){ + Node ipAddress = networkIpsList.item(a) + if (ipAddress.getNodeType() == Node.ELEMENT_NODE) { + Element eElementIpAddress = (Element) ipAddress + String ipAddressValue = utils.getElementText(eElementIpAddress, "ip-address") + if (a != networkIpsList.getLength() - 1) { + ipAddressValues = sb2.append(ipAddressValue + ",") + } + else { + ipAddressValues = sb2.append(ipAddressValue); + } + networkPosition = a.toString() + paramsMap.put("${key}_${networkKey}_ip_${networkPosition}", "${ipAddressValue}") + } + } + + paramsMap.put("${key}_${networkKey}_ips", "${ipAddressValues}") + + NodeList interfaceRoutePrefixesList = eElementNetworkKey.getElementsByTagNameNS("*","interface-route-prefixes") + String interfaceRoutePrefixValues = sb3.append("[") + + for(int a = 0; a < interfaceRoutePrefixesList.getLength(); a++){ + Node interfaceRoutePrefix = interfaceRoutePrefixesList.item(a) + if (interfaceRoutePrefix.getNodeType() == Node.ELEMENT_NODE) { + Element eElementInterfaceRoutePrefix = (Element) interfaceRoutePrefix + String interfaceRoutePrefixValue = utils.getElementText(eElementInterfaceRoutePrefix, "interface-route-prefix-cidr") + if (interfaceRoutePrefixValue == null || interfaceRoutePrefixValue.isEmpty()) { + interfaceRoutePrefixValue = utils.getElementText(eElementInterfaceRoutePrefix, "interface-route-prefix") + } + if (a != interfaceRoutePrefixesList.getLength() - 1) { + interfaceRoutePrefixValues = sb3.append("{\"interface_route_table_routes_route_prefix\": \"" + interfaceRoutePrefixValue + "\"}" + ",") + } + else { + interfaceRoutePrefixValues = sb3.append("{\"interface_route_table_routes_route_prefix\": \"" + interfaceRoutePrefixValue + "\"}") + } + } + } + interfaceRoutePrefixValues = sb3.append("]") + if (interfaceRoutePrefixesList.getLength() > 0) { + paramsMap.put("${key}_${networkKey}_route_prefixes", "${interfaceRoutePrefixValues}") + } + + NodeList networkIpsV6List = eElementNetworkKey.getElementsByTagNameNS("*","network-ips-v6") + for(int a = 0; a < networkIpsV6List.getLength(); a++){ + Node ipV6Address = networkIpsV6List.item(a) + if (ipV6Address.getNodeType() == Node.ELEMENT_NODE) { + Element eElementIpV6Address = (Element) ipV6Address + String ipV6AddressValue = utils.getElementText(eElementIpV6Address, "ip-address-ipv6") + if (a != networkIpsV6List.getLength() - 1) { + ipV6AddressValues = sb4.append(ipV6AddressValue + ",") + } + else { + ipV6AddressValues = sb4.append(ipV6AddressValue); + } + networkPosition = a.toString() + paramsMap.put("${key}_${networkKey}_v6_ip_${networkPosition}", "${ipV6AddressValue}") + } + } + paramsMap.put("${key}_${networkKey}_v6_ips", "${ipV6AddressValues}") + } + } + paramsMap.put("${key}_names", "${values}") + } + } + //SDNC Response Params + String sdncResponseParams = "" + List<String> sdncResponseParamsToSkip = ["vnf_id", "vf_module_id", "vnf_name", "vf_module_name"] + String vnfParamsChildNodes = utils.getChildNodes(data, "vnf-parameters") + if(vnfParamsChildNodes == null || vnfParamsChildNodes.length() < 1){ + // No SDNC params + }else{ + NodeList paramsList = responseXml.getElementsByTagNameNS("*", "vnf-parameters") + for (int z = 0; z < paramsList.getLength(); z++) { + Node node = paramsList.item(z) + Element eElement = (Element) node + String vnfParameterName = utils.getElementText(eElement, "vnf-parameter-name") + if (!sdncResponseParamsToSkip.contains(vnfParameterName)) { + String vnfParameterValue = utils.getElementText(eElement, "vnf-parameter-value") + paramsMap.put("${vnfParameterName}", "${vnfParameterValue}") + } + } + } + + // Parameters received from the request should overwrite any parameters received from SDNC + if (vnfParamsMap != null) { + for (Map.Entry<String, String> entry : vnfParamsMap.entrySet()) { + String vnfKey = entry.getKey() + String vnfValue = entry.getValue() + paramsMap.put("$vnfKey", "$vnfValue") + } + } + + StringBuilder sbParams = new StringBuilder() + def vfModuleParams = "" + for (Map.Entry<String, String> entry : paramsMap.entrySet()) { + String paramsXml + String paramName = entry.getKey() + String paramValue = entry.getValue() + paramsXml = + """<entry> + <key>${MsoUtils.xmlEscape(paramName)}</key> + <value>${MsoUtils.xmlEscape(paramValue)}</value> + </entry> + """ + + vfModuleParams = sbParams.append(paramsXml) + } + + return vfModuleParams + + } + + + /* + * Parses VNF parameters passed in on the incoming requests and SDNC parameters returned from SDNC get response + * for both VNF and VF Module + * and puts them into the format expected by VNF adapter. + * @param vnfParamsMap - map of VNF parameters passed in the request body + * @param vnfSdncGetResponse - response string from SDNC GET VNF topology request + * @param vfmoduleSdncGetResponse - response string from SDNC GET VF Module topology request + * @param vnfId + * @param vnfName + * @param vfModuleId + * @param vfModuleName + * @param vfModuleIndex - can be null + * @return a String of key/value entries for vfModuleParams + */ + + protected String buildVfModuleParamsFromCombinedTopologies(Map<String, String> vnfParamsMap, String vnfSdncGetResponse, String vfmoduleSdncGetResponse, String vnfId, String vnfName, + String vfModuleId, String vfModuleName, String vfModuleIndex, String environmentContext, String workloadContext) { + + // Set up initial parameters + + Map<String, String> paramsMap = new HashMap<String, String>() + + if (vfModuleIndex != null) { + paramsMap.put("vf_module_index", "${vfModuleIndex}") + } + + // Add-on data + paramsMap.put("vnf_id", "${vnfId}") + paramsMap.put("vnf_name", "${vnfName}") + paramsMap.put("vf_module_id", "${vfModuleId}") + paramsMap.put("vf_module_name", "${vfModuleName}") + paramsMap.put("environment_context","${environmentContext}") + paramsMap.put("workload_context", "${workloadContext}") + + //Get SDNC Response Data for VNF + + String vnfData = utils.getNodeXml(vnfSdncGetResponse, "response-data") + + String vnfTopology = utils.getNodeXml(vnfData, "vnf-topology") + vnfTopology = utils.removeXmlPreamble(vnfTopology) + vnfTopology = utils.removeXmlNamespaces(vnfTopology) + + InputSource sourceVnf = new InputSource(new StringReader(vnfData)); + DocumentBuilderFactory docFactoryVnf = DocumentBuilderFactory.newInstance(); + docFactoryVnf.setNamespaceAware(true) + DocumentBuilder docBuilderVnf = docFactoryVnf.newDocumentBuilder() + Document responseXmlVnf = docBuilderVnf.parse(sourceVnf) + + // Availability Zones Data + + NodeList aZonesList = responseXmlVnf.getElementsByTagNameNS("*", "availability-zones") + String aZonePosition = "0" + for (int z = 0; z < aZonesList.getLength(); z++) { + Node node = aZonesList.item(z) + if (node.getNodeType() == Node.ELEMENT_NODE) { + Element eElement = (Element) node + String aZoneValue = utils.getElementText(eElement, "availability-zone") + aZonePosition = z.toString() + paramsMap.put("availability_zone_${aZonePosition}", "${aZoneValue}") + } + } + + //Get SDNC Response Data for VF Module + + String vfModuleData = utils.getNodeXml(vfmoduleSdncGetResponse, "response-data") + + String vfModuleTopology = utils.getNodeXml(vfModuleData, "vf-module-topology") + vfModuleTopology = utils.removeXmlPreamble(vfModuleTopology) + vfModuleTopology = utils.removeXmlNamespaces(vfModuleTopology) + String vfModuleTopologyIdentifier = utils.getNodeXml(vfModuleTopology, "vf-module-topology-identifier") + + InputSource sourceVfModule = new InputSource(new StringReader(vfModuleData)); + DocumentBuilderFactory docFactoryVfModule = DocumentBuilderFactory.newInstance(); + docFactoryVfModule.setNamespaceAware(true) + DocumentBuilder docBuilderVfModule = docFactoryVfModule.newDocumentBuilder() + Document responseXmlVfModule = docBuilderVfModule.parse(sourceVfModule) + + // Map of network-roles and network-tags from vm-networks + + NodeList vmNetworksListGlobal = responseXmlVfModule.getElementsByTagNameNS("*", "vm-networks") + Map<String, String> networkRoleMap = new HashMap<String, String>() + for(int n = 0; n < vmNetworksListGlobal.getLength(); n++){ + Node nodeNetworkKey = vmNetworksListGlobal.item(n) + if (nodeNetworkKey.getNodeType() == Node.ELEMENT_NODE) { + Element eElementNetworkKey = (Element) nodeNetworkKey + String networkRole = utils.getElementText(eElementNetworkKey, "network-role") + String networkRoleValue = utils.getElementText(eElementNetworkKey, "network-role-tag") + if (networkRoleValue.isEmpty()) { + networkRoleValue = networkRole + } + networkRoleMap.put(networkRole, networkRoleValue) + } + } + + // VNF Networks Data + + StringBuilder sbNet = new StringBuilder() + + NodeList vnfNetworkList = responseXmlVnf.getElementsByTagNameNS("*", "vnf-networks") + for (int x = 0; x < vnfNetworkList.getLength(); x++) { + Node node = vnfNetworkList.item(x) + if (node.getNodeType() == Node.ELEMENT_NODE) { + Element eElement = (Element) node + String vnfNetworkKey = utils.getElementText(eElement, "network-role-tag") + String networkRole = utils.getElementText(eElement, "network-role") + if (vnfNetworkKey.isEmpty()) { + vnfNetworkKey = networkRoleMap.get(networkRole) + if (vnfNetworkKey == null || vnfNetworkKey.isEmpty()) { + vnfNetworkKey = networkRole + } + } + String vnfNetworkNeutronIdValue = utils.getElementText(eElement, "neutron-id") + String vnfNetworkNetNameValue = utils.getElementText(eElement, "network-name") + String vnfNetworkSubNetIdValue = utils.getElementText(eElement, "subnet-id") + String vnfNetworkV6SubNetIdValue = utils.getElementText(eElement, "ipv6-subnet-id") + String vnfNetworkNetFqdnValue = utils.getElementText(eElement, "contrail-network-fqdn") + paramsMap.put("${vnfNetworkKey}_net_id", "${vnfNetworkNeutronIdValue}") + paramsMap.put("${vnfNetworkKey}_net_name", "${vnfNetworkNetNameValue}") + paramsMap.put("${vnfNetworkKey}_subnet_id", "${vnfNetworkSubNetIdValue}") + paramsMap.put("${vnfNetworkKey}_v6_subnet_id", "${vnfNetworkV6SubNetIdValue}") + paramsMap.put("${vnfNetworkKey}_net_fqdn", "${vnfNetworkNetFqdnValue}") + + NodeList sriovVlanFilterList = eElement.getElementsByTagNameNS("*","sriov-vlan-filter-list") + StringBuffer sriovFilterBuf = new StringBuffer() + String values = "" + for(int i = 0; i < sriovVlanFilterList.getLength(); i++){ + Node node1 = sriovVlanFilterList.item(i) + if (node1.getNodeType() == Node.ELEMENT_NODE) { + Element eElement1 = (Element) node1 + String value = utils.getElementText(eElement1, "sriov-vlan-filter") + if (i != sriovVlanFilterList.getLength() - 1) { + values = sriovFilterBuf.append(value + ",") + } + else { + values = sriovFilterBuf.append(value); + } + } + } + if (!values.isEmpty()) { + paramsMap.put("${vnfNetworkKey}_ATT_VF_VLAN_FILTER", "${values}") + } + } + } + + + + // VMS Data + + def key + def value + def networkKey + def networkValue + def floatingIPKey + def floatingIPKeyValue + def floatingIPV6Key + def floatingIPV6KeyValue + StringBuilder sb = new StringBuilder() + + NodeList vmsList = responseXmlVfModule.getElementsByTagNameNS("*","vm") + for (int x = 0; x < vmsList.getLength(); x++) { + Node node = vmsList.item(x) + if (node.getNodeType() == Node.ELEMENT_NODE) { + Element eElement = (Element) node + key = utils.getElementText(eElement, "vm-type") + String values + String position = "0" + StringBuilder sb1 = new StringBuilder() + NodeList valueList = eElement.getElementsByTagNameNS("*","vm-names") + NodeList vmNetworksList = eElement.getElementsByTagNameNS("*","vm-networks") + for(int i = 0; i < valueList.getLength(); i++){ + Node node1 = valueList.item(i) + if (node1.getNodeType() == Node.ELEMENT_NODE) { + Element eElement1 = (Element) node1 + value = utils.getElementText(eElement1, "vm-name") + if (i != valueList.getLength() - 1) { + values = sb1.append(value + ",") + } + else { + values = sb1.append(value); + } + position = i.toString() + paramsMap.put("${key}_name_${position}", "${value}") + } + } + for(int n = 0; n < vmNetworksList.getLength(); n++){ + String floatingIpKeyValueStr = "" + String floatingIpV6KeyValueStr = "" + Node nodeNetworkKey = vmNetworksList.item(n) + if (nodeNetworkKey.getNodeType() == Node.ELEMENT_NODE) { + Element eElementNetworkKey = (Element) nodeNetworkKey + String ipAddressValues + String ipV6AddressValues + String networkPosition = "0" + StringBuilder sb2 = new StringBuilder() + StringBuilder sb3 = new StringBuilder() + StringBuilder sb4 = new StringBuilder() + networkKey = utils.getElementText(eElementNetworkKey, "network-role-tag") + if (networkKey.isEmpty()) { + networkKey = utils.getElementText(eElementNetworkKey, "network-role") + } + floatingIPKey = key + '_' + networkKey + '_floating_ip' + floatingIPKeyValue = utils.getElementText(eElementNetworkKey, "floating-ip") + if(!floatingIPKeyValue.isEmpty()){ + paramsMap.put("$floatingIPKey", "$floatingIPKeyValue") + } + floatingIPV6Key = key + '_' + networkKey + '_floating_v6_ip' + floatingIPV6KeyValue = utils.getElementText(eElementNetworkKey, "floating-ip-v6") + if(!floatingIPV6KeyValue.isEmpty()){ + paramsMap.put("$floatingIPV6Key", "$floatingIPV6KeyValue") + } + NodeList networkIpsList = eElementNetworkKey.getElementsByTagNameNS("*","network-ips") + for(int a = 0; a < networkIpsList.getLength(); a++){ + Node ipAddress = networkIpsList.item(a) + if (ipAddress.getNodeType() == Node.ELEMENT_NODE) { + Element eElementIpAddress = (Element) ipAddress + String ipAddressValue = utils.getElementText(eElementIpAddress, "ip-address") + if (a != networkIpsList.getLength() - 1) { + ipAddressValues = sb2.append(ipAddressValue + ",") + } + else { + ipAddressValues = sb2.append(ipAddressValue); + } + networkPosition = a.toString() + paramsMap.put("${key}_${networkKey}_ip_${networkPosition}", "${ipAddressValue}") + } + } + + paramsMap.put("${key}_${networkKey}_ips", "${ipAddressValues}") + + NodeList interfaceRoutePrefixesList = eElementNetworkKey.getElementsByTagNameNS("*","interface-route-prefixes") + String interfaceRoutePrefixValues = sb3.append("[") + + for(int a = 0; a < interfaceRoutePrefixesList.getLength(); a++){ + Node interfaceRoutePrefix = interfaceRoutePrefixesList.item(a) + if (interfaceRoutePrefix.getNodeType() == Node.ELEMENT_NODE) { + Element eElementInterfaceRoutePrefix = (Element) interfaceRoutePrefix + String interfaceRoutePrefixValue = utils.getElementText(eElementInterfaceRoutePrefix, "interface-route-prefix-cidr") + if (interfaceRoutePrefixValue == null || interfaceRoutePrefixValue.isEmpty()) { + interfaceRoutePrefixValue = utils.getElementText(eElementInterfaceRoutePrefix, "interface-route-prefix") + } + if (a != interfaceRoutePrefixesList.getLength() - 1) { + interfaceRoutePrefixValues = sb3.append("{\"interface_route_table_routes_route_prefix\": \"" + interfaceRoutePrefixValue + "\"}" + ",") + } + else { + interfaceRoutePrefixValues = sb3.append("{\"interface_route_table_routes_route_prefix\": \"" + interfaceRoutePrefixValue + "\"}") + } + } + } + interfaceRoutePrefixValues = sb3.append("]") + if (interfaceRoutePrefixesList.getLength() > 0) { + paramsMap.put("${key}_${networkKey}_route_prefixes", "${interfaceRoutePrefixValues}") + } + + NodeList networkIpsV6List = eElementNetworkKey.getElementsByTagNameNS("*","network-ips-v6") + for(int a = 0; a < networkIpsV6List.getLength(); a++){ + Node ipV6Address = networkIpsV6List.item(a) + if (ipV6Address.getNodeType() == Node.ELEMENT_NODE) { + Element eElementIpV6Address = (Element) ipV6Address + String ipV6AddressValue = utils.getElementText(eElementIpV6Address, "ip-address-ipv6") + if (a != networkIpsV6List.getLength() - 1) { + ipV6AddressValues = sb4.append(ipV6AddressValue + ",") + } + else { + ipV6AddressValues = sb4.append(ipV6AddressValue); + } + networkPosition = a.toString() + paramsMap.put("${key}_${networkKey}_v6_ip_${networkPosition}", "${ipV6AddressValue}") + } + } + paramsMap.put("${key}_${networkKey}_v6_ips", "${ipV6AddressValues}") + } + } + paramsMap.put("${key}_names", "${values}") + } + } + //SDNC Response Params + List<String> sdncResponseParamsToSkip = ["vnf_id", "vf_module_id", "vnf_name", "vf_module_name"] + + String vnfParamsChildNodes = utils.getChildNodes(vnfData, "param") + if(vnfParamsChildNodes == null || vnfParamsChildNodes.length() < 1){ + // No SDNC params for VNF + }else{ + NodeList paramsList = responseXmlVnf.getElementsByTagNameNS("*", "param") + for (int z = 0; z < paramsList.getLength(); z++) { + Node node = paramsList.item(z) + Element eElement = (Element) node + String vnfParameterName = utils.getElementText(eElement, "name") + if (!sdncResponseParamsToSkip.contains(vnfParameterName)) { + String vnfParameterValue = utils.getElementText(eElement, "value") + paramsMap.put("${vnfParameterName}", "${vnfParameterValue}") + } + } + } + + String vfModuleParamsChildNodes = utils.getChildNodes(vfModuleData, "param") + if(vfModuleParamsChildNodes == null || vfModuleParamsChildNodes.length() < 1){ + // No SDNC params for VF Module + }else{ + NodeList paramsList = responseXmlVfModule.getElementsByTagNameNS("*", "param") + for (int z = 0; z < paramsList.getLength(); z++) { + Node node = paramsList.item(z) + Element eElement = (Element) node + String vnfParameterName = utils.getElementText(eElement, "name") + if (!sdncResponseParamsToSkip.contains(vnfParameterName)) { + String vnfParameterValue = utils.getElementText(eElement, "value") + paramsMap.put("${vnfParameterName}", "${vnfParameterValue}") + } + } + } + + // Parameters received from the request should overwrite any parameters received from SDNC + if (vnfParamsMap != null) { + for (Map.Entry<String, String> entry : vnfParamsMap.entrySet()) { + String vnfKey = entry.getKey() + String vnfValue = entry.getValue() + paramsMap.put("$vnfKey", "$vnfValue") + } + } + + StringBuilder sbParams = new StringBuilder() + def vfModuleParams = "" + for (Map.Entry<String, String> entry : paramsMap.entrySet()) { + String paramsXml + String paramName = entry.getKey() + String paramValue = entry.getValue() + paramsXml = + """<entry> + <key>${MsoUtils.xmlEscape(paramName)}</key> + <value>${MsoUtils.xmlEscape(paramValue)}</value> + </entry> + """ + + vfModuleParams = sbParams.append(paramsXml) + } + + return vfModuleParams + + } + + + /* + * VBNG specific method that parses VNF parameters passed in on the + * incoming requests and SDNC parameters returned from SDNC get response + * and puts them into the format expected by VNF adapter. + * @param vnfParamsMap - map of VNF parameters passed in the request body + * @param sdncGetResponse - response string from SDNC GET topology request + * @param vnfId + * @param vnfName + * @param vfModuleId + * @param vfModuleName + * @return a String of key/value entries for vfModuleParams + */ + + protected String buildVfModuleParamsVbng(String vnfParams, String sdncGetResponse, String vnfId, String vnfName, + String vfModuleId, String vfModuleName) { + + //Get SDNC Response Data + + String data = utils.getNodeXml(sdncGetResponse, "response-data") + + + + // Add-on data + String vnfInfo = + """<entry> + <key>vnf_id</key> + <value>${MsoUtils.xmlEscape(vnfId)}</value> + </entry> + <entry> + <key>vnf_name</key> + <value>${MsoUtils.xmlEscape(vnfName)}</value> + </entry> + <entry> + <key>vf_module_id</key> + <value>${MsoUtils.xmlEscape(vfModuleId)}</value> + </entry> + <entry> + <key>vf_module_name</key> + <value>${MsoUtils.xmlEscape(vfModuleName)}</value> + </entry>""" + + msoLogger.debug("vnfInfo: " + vnfInfo) + InputSource source = new InputSource(new StringReader(data)); + DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); + docFactory.setNamespaceAware(true) + DocumentBuilder docBuilder = docFactory.newDocumentBuilder() + Document responseXml = docBuilder.parse(source) + + + // Availability Zones Data + String aZones = "" + StringBuilder sbAZone = new StringBuilder() + NodeList aZonesList = responseXml.getElementsByTagNameNS("*", "availability-zones") + String aZonePosition = "0" + for (int z = 0; z < aZonesList.getLength(); z++) { + Node node = aZonesList.item(z) + if (node.getNodeType() == Node.ELEMENT_NODE) { + Element eElement = (Element) node + String aZoneValue = utils.getElementText(eElement, "availability-zone") + aZonePosition = z.toString() + String aZoneXml = + """<entry> + <key>availability_zone_${MsoUtils.xmlEscape(aZonePosition)}</key> + <value>${MsoUtils.xmlEscape(aZoneValue)}</value> + </entry>""" + aZones = sbAZone.append(aZoneXml) + } + } + + // Map of network-roles and network-tags from vm-networks + + NodeList vmNetworksListGlobal = responseXml.getElementsByTagNameNS("*", "vm-networks") + Map<String, String> networkRoleMap = new HashMap<String, String>() + for(int n = 0; n < vmNetworksListGlobal.getLength(); n++){ + Node nodeNetworkKey = vmNetworksListGlobal.item(n) + if (nodeNetworkKey.getNodeType() == Node.ELEMENT_NODE) { + Element eElementNetworkKey = (Element) nodeNetworkKey + String networkRole = utils.getElementText(eElementNetworkKey, "network-role") + String networkRoleValue = utils.getElementText(eElementNetworkKey, "network-role-tag") + if (networkRoleValue.isEmpty()) { + networkRoleValue = networkRole + } + networkRoleMap.put(networkRole, networkRoleValue) + } + } + + // VNF Networks Data + String vnfNetworkNetId = "" + String vnfNetworkNetName = "" + String vnfNetworkSubNetId = "" + String vnfNetworkV6SubNetId = "" + String vnfNetworkNetFqdn = "" + String vnfNetworksSriovVlanFilters = "" + StringBuilder sbNet = new StringBuilder() + StringBuilder sbNet2 = new StringBuilder() + StringBuilder sbNet3 = new StringBuilder() + StringBuilder sbNet4 = new StringBuilder() + StringBuilder sbNet5 = new StringBuilder() + StringBuilder sbNet6 = new StringBuilder() + NodeList vnfNetworkList = responseXml.getElementsByTagNameNS("*", "vnf-networks") + for (int x = 0; x < vnfNetworkList.getLength(); x++) { + Node node = vnfNetworkList.item(x) + if (node.getNodeType() == Node.ELEMENT_NODE) { + Element eElement = (Element) node + String vnfNetworkKey = utils.getElementText(eElement, "network-role-tag") + String networkRole = utils.getElementText(eElement, "network-role") + if (vnfNetworkKey.isEmpty()) { + vnfNetworkKey = networkRoleMap.get(networkRole) + if (vnfNetworkKey == null || vnfNetworkKey.isEmpty()) { + vnfNetworkKey = networkRole + } + } + String vnfNetworkNeutronIdValue = utils.getElementText(eElement, "neutron-id") + String vnfNetworkNetNameValue = utils.getElementText(eElement, "network-name") + String vnfNetworkSubNetIdValue = utils.getElementText(eElement, "subnet-id") + String vnfNetworkV6SubNetIdValue = utils.getElementText(eElement, "ipv6-subnet-id") + String vnfNetworkNetFqdnValue = utils.getElementText(eElement, "contrail-network-fqdn") + String vnfNetworkNetIdXml = + """<entry> + <key>${MsoUtils.xmlEscape(vnfNetworkKey)}_net_id</key> + <value>${MsoUtils.xmlEscape(vnfNetworkNeutronIdValue)}</value> + </entry>""" + vnfNetworkNetId = sbNet.append(vnfNetworkNetIdXml) + String vnfNetworkNetNameXml = + """<entry> + <key>${MsoUtils.xmlEscape(vnfNetworkKey)}_net_name</key> + <value>${MsoUtils.xmlEscape(vnfNetworkNetNameValue)}</value> + </entry>""" + vnfNetworkNetName = sbNet2.append(vnfNetworkNetNameXml) + String vnfNetworkSubNetIdXml = + """<entry> + <key>${MsoUtils.xmlEscape(vnfNetworkKey)}_subnet_id</key> + <value>${MsoUtils.xmlEscape(vnfNetworkSubNetIdValue)}</value> + </entry>""" + vnfNetworkSubNetId = sbNet3.append(vnfNetworkSubNetIdXml) + String vnfNetworkV6SubNetIdXml = + """<entry> + <key>${MsoUtils.xmlEscape(vnfNetworkKey)}_v6_subnet_id</key> + <value>${MsoUtils.xmlEscape(vnfNetworkV6SubNetIdValue)}</value> + </entry>""" + vnfNetworkV6SubNetId = sbNet5.append(vnfNetworkV6SubNetIdXml) + String vnfNetworkNetFqdnXml = + """<entry> + <key>${MsoUtils.xmlEscape(vnfNetworkKey)}_net_fqdn</key> + <value>${MsoUtils.xmlEscape(vnfNetworkNetFqdnValue)}</value> + </entry>""" + vnfNetworkNetFqdn = sbNet4.append(vnfNetworkNetFqdnXml) + + NodeList sriovVlanFilterList = eElement.getElementsByTagNameNS("*","sriov-vlan-filter-list") + StringBuffer sriovFilterBuf = new StringBuffer() + String values = "" + for(int i = 0; i < sriovVlanFilterList.getLength(); i++){ + Node node1 = sriovVlanFilterList.item(i) + if (node1.getNodeType() == Node.ELEMENT_NODE) { + Element eElement1 = (Element) node1 + String value = utils.getElementText(eElement1, "sriov-vlan-filter") + if (i != sriovVlanFilterList.getLength() - 1) { + values = sriovFilterBuf.append(value + ",") + } + else { + values = sriovFilterBuf.append(value); + } + } + } + if (!values.isEmpty()) { + String vnfNetworkSriovVlanFilterXml = + """<entry> + <key>${MsoUtils.xmlEscape(vnfNetworkKey)}_ATT_VF_VLAN_FILTER</key> + <value>${MsoUtils.xmlEscape(values)}</value> + </entry>""" + vnfNetworksSriovVlanFilters = sbNet6.append(vnfNetworkSriovVlanFilterXml) + } + } + } + + // VNF-VMS Data + String vnfVMS = "" + String vnfVMSPositions = "" + String vmNetworks = "" + String vmNetworksPositions = "" + String vmNetworksPositionsV6 = "" + String interfaceRoutePrefixes = "" + def key + def value + def networkKey + def networkValue + def floatingIPKey + def floatingIPKeyValue + def floatingIPV6Key + def floatingIPV6KeyValue + StringBuilder sb = new StringBuilder() + StringBuilder sbPositions = new StringBuilder() + StringBuilder sbVmNetworks = new StringBuilder() + StringBuilder sbNetworksPositions = new StringBuilder() + StringBuilder sbInterfaceRoutePrefixes = new StringBuilder() + StringBuilder sbNetworksPositionsV6 = new StringBuilder() + + NodeList vmsList = responseXml.getElementsByTagNameNS("*","vnf-vms") + for (int x = 0; x < vmsList.getLength(); x++) { + Node node = vmsList.item(x) + if (node.getNodeType() == Node.ELEMENT_NODE) { + Element eElement = (Element) node + key = utils.getElementText(eElement, "vm-type") + String values + String position = "0" + StringBuilder sb1 = new StringBuilder() + NodeList valueList = eElement.getElementsByTagNameNS("*","vm-names") + NodeList vmNetworksList = eElement.getElementsByTagNameNS("*","vm-networks") + for(int i = 0; i < valueList.getLength(); i++){ + Node node1 = valueList.item(i) + if (node1.getNodeType() == Node.ELEMENT_NODE) { + Element eElement1 = (Element) node1 + value = utils.getElementText(eElement1, "vm-name") + if (i != valueList.getLength() - 1) { + values = sb1.append(value + ",") + } + else { + values = sb1.append(value); + } + position = i.toString() + String vnfPositionXml = + """<entry> + <key>${MsoUtils.xmlEscape(key)}_name_${MsoUtils.xmlEscape(position)}</key> + <value>${MsoUtils.xmlEscape(value)}</value> + </entry>""" + nfVMSPositions = sbPositions.append(vnfPositionXml) + } + } + for(int n = 0; n < vmNetworksList.getLength(); n++){ + String floatingIpKeyValueStr = "" + String floatingIpV6KeyValueStr = "" + Node nodeNetworkKey = vmNetworksList.item(n) + if (nodeNetworkKey.getNodeType() == Node.ELEMENT_NODE) { + Element eElementNetworkKey = (Element) nodeNetworkKey + String ipAddressValues + String ipV6AddressValues + String networkPosition = "0" + StringBuilder sb2 = new StringBuilder() + StringBuilder sb3 = new StringBuilder() + StringBuilder sb4 = new StringBuilder() + networkKey = utils.getElementText(eElementNetworkKey, "network-role-tag") + if (networkKey.isEmpty()) { + networkKey = utils.getElementText(eElementNetworkKey, "network-role") + } + floatingIPKey = key + '_' + networkKey + '_floating_ip' + floatingIPKeyValue = utils.getElementText(eElementNetworkKey, "floating-ip") + if(!floatingIPKeyValue.isEmpty()){ + floatingIpKeyValueStr = """<entry> + <key>$floatingIPKey</key> + <value>$floatingIPKeyValue</value> + </entry>""" + } + floatingIPV6Key = key + '_' + networkKey + '_floating_v6_ip' + floatingIPV6KeyValue = utils.getElementText(eElementNetworkKey, "floating-ip-v6") + if(!floatingIPV6KeyValue.isEmpty()){ + floatingIpV6KeyValueStr = """<entry> + <key>$floatingIPV6Key</key> + <value>$floatingIPV6KeyValue</value> + </entry>""" + } + NodeList networkIpsList = eElementNetworkKey.getElementsByTagNameNS("*","network-ips") + for(int a = 0; a < networkIpsList.getLength(); a++){ + Node ipAddress = networkIpsList.item(a) + if (ipAddress.getNodeType() == Node.ELEMENT_NODE) { + Element eElementIpAddress = (Element) ipAddress + String ipAddressValue = utils.getElementText(eElementIpAddress, "ip-address") + if (a != networkIpsList.getLength() - 1) { + ipAddressValues = sb2.append(ipAddressValue + ",") + } + else { + ipAddressValues = sb2.append(ipAddressValue); + } + networkPosition = a.toString() + String vmNetworksPositionsXml = + """<entry> + <key>${MsoUtils.xmlEscape(key)}_${MsoUtils.xmlEscape(networkKey)}_ip_${MsoUtils.xmlEscape(networkPosition)}</key> + <value>${MsoUtils.xmlEscape(ipAddressValue)}</value> + </entry>""" + vmNetworksPositions = sbNetworksPositions.append(vmNetworksPositionsXml) + } + } + vmNetworksPositions = sbNetworksPositions.append(floatingIpKeyValueStr).append(floatingIpV6KeyValueStr) + + String vmNetworksXml = + """<entry> + <key>${MsoUtils.xmlEscape(key)}_${MsoUtils.xmlEscape(networkKey)}_ips</key> + <value>${MsoUtils.xmlEscape(ipAddressValues)}</value> + </entry>""" + vmNetworks = sbVmNetworks.append(vmNetworksXml) + + NodeList interfaceRoutePrefixesList = eElementNetworkKey.getElementsByTagNameNS("*","interface-route-prefixes") + String interfaceRoutePrefixValues = sb3.append("[") + + for(int a = 0; a < interfaceRoutePrefixesList.getLength(); a++){ + Node interfaceRoutePrefix = interfaceRoutePrefixesList.item(a) + if (interfaceRoutePrefix.getNodeType() == Node.ELEMENT_NODE) { + Element eElementInterfaceRoutePrefix = (Element) interfaceRoutePrefix + String interfaceRoutePrefixValue = utils.getElementText(eElementInterfaceRoutePrefix, "interface-route-prefix-cidr") + if (interfaceRoutePrefixValue == null || interfaceRoutePrefixValue.isEmpty()) { + interfaceRoutePrefixValue = utils.getElementText(eElementInterfaceRoutePrefix, "interface-route-prefix") + } + if (a != interfaceRoutePrefixesList.getLength() - 1) { + interfaceRoutePrefixValues = sb3.append("{\"interface_route_table_routes_route_prefix\": \"" + interfaceRoutePrefixValue + "\"}" + ",") + } + else { + interfaceRoutePrefixValues = sb3.append("{\"interface_route_table_routes_route_prefix\": \"" + interfaceRoutePrefixValue + "\"}") + } + } + } + interfaceRoutePrefixValues = sb3.append("]") + if (interfaceRoutePrefixesList.getLength() > 0) { + String interfaceRoutePrefixesXml = + """<entry> + <key>${MsoUtils.xmlEscape(key)}_${MsoUtils.xmlEscape(networkKey)}_route_prefixes</key> + <value>${MsoUtils.xmlEscape(interfaceRoutePrefixValues)}</value> + </entry>""" + interfaceRoutePrefixes = sbInterfaceRoutePrefixes.append(interfaceRoutePrefixesXml) + } + + NodeList networkIpsV6List = eElementNetworkKey.getElementsByTagNameNS("*","network-ips-v6") + for(int a = 0; a < networkIpsV6List.getLength(); a++){ + Node ipV6Address = networkIpsV6List.item(a) + if (ipV6Address.getNodeType() == Node.ELEMENT_NODE) { + Element eElementIpV6Address = (Element) ipV6Address + String ipV6AddressValue = utils.getElementText(eElementIpV6Address, "ip-address-ipv6") + if (a != networkIpsV6List.getLength() - 1) { + ipV6AddressValues = sb4.append(ipV6AddressValue + ",") + } + else { + ipV6AddressValues = sb4.append(ipV6AddressValue); + } + networkPosition = a.toString() + String vmNetworksPositionsV6Xml = + """<entry> + <key>${MsoUtils.xmlEscape(key)}_${MsoUtils.xmlEscape(networkKey)}_v6_ip_${MsoUtils.xmlEscape(networkPosition)}</key> + <value>${MsoUtils.xmlEscape(ipV6AddressValue)}</value> + </entry>""" + vmNetworksPositionsV6 = sbNetworksPositionsV6.append(vmNetworksPositionsV6Xml) + } + } + String vmNetworksV6Xml = + """<entry> + <key>${MsoUtils.xmlEscape(key)}_${MsoUtils.xmlEscape(networkKey)}_v6_ips</key> + <value>${MsoUtils.xmlEscape(ipV6AddressValues)}</value> + </entry>""" + vmNetworks = sbVmNetworks.append(vmNetworksV6Xml) + } + } + String vnfXml = + """<entry> + <key>${MsoUtils.xmlEscape(key)}_names</key> + <value>${MsoUtils.xmlEscape(values)}</value> + </entry>""" + vnfVMS = sb.append(vnfXml) + } + } + //SDNC Response Params + String sdncResponseParams = "" + List<String> sdncResponseParamsToSkip = ["vnf_id", "vf_module_id", "vnf_name", "vf_module_name"] + String vnfParamsChildNodes = utils.getChildNodes(data, "vnf-parameters") + if(vnfParamsChildNodes == null || vnfParamsChildNodes.length() < 1){ + // No SDNC params + }else{ + NodeList paramsList = responseXml.getElementsByTagNameNS("*", "vnf-parameters") + for (int z = 0; z < paramsList.getLength(); z++) { + Node node = paramsList.item(z) + Element eElement = (Element) node + String vnfParameterName = utils.getElementText(eElement, "vnf-parameter-name") + if (!sdncResponseParamsToSkip.contains(vnfParameterName)) { + String vnfParameterValue = utils.getElementText(eElement, "vnf-parameter-value") + String paraEntry = + """<entry> + <key>${MsoUtils.xmlEscape(vnfParameterName)}</key> + <value>${MsoUtils.xmlEscape(vnfParameterValue)}</value> + </entry>""" + sdncResponseParams = sb.append(paraEntry) + } + } + } + + + def vfModuleParams = """ + ${vnfInfo} + ${aZones} + ${vnfNetworkNetId} + ${vnfNetworkNetName} + ${vnfNetworkSubNetId} + ${vnfNetworkV6SubNetId} + ${vnfNetworkNetFqdn} + ${vnfNetworksSriovVlanFilters} + ${vnfVMS} + ${vnfVMSPositions} + ${vmNetworks} + ${vmNetworksPositions} + ${vmNetworksPositionsV6} + ${interfaceRoutePrefixes} + ${vnfParams} + ${sdncResponseParams}""" + + return vfModuleParams + + } + }
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VidUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VidUtils.groovy index 2a8dd95c33..6e09837274 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VidUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VidUtils.groovy @@ -1,548 +1,553 @@ -/*-
- * ============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.common.scripts
-
-import groovy.json.JsonBuilder
-import groovy.json.JsonSlurper
-
-import org.json.JSONObject
-import org.json.XML
-import org.openecomp.mso.bpmn.core.xml.XmlTool
-
-class VidUtils {
-
- public MsoUtils utils = new MsoUtils()
- private AbstractServiceTaskProcessor taskProcessor
-
- public VidUtils(AbstractServiceTaskProcessor taskProcessor) {
- this.taskProcessor = taskProcessor
- }
-
- /**
- * Create a volume-request XML using a JSON string
- * @param jsonReq - JSON request from VID
- * @param action
- * @return
- */
- public String createXmlVolumeRequest(String jsonReq, String action, String serviceInstanceId) {
- def jsonSlurper = new JsonSlurper()
- try{
- Map reqMap = jsonSlurper.parseText(jsonReq)
- return createXmlVolumeRequest(reqMap, action, serviceInstanceId)
- }
- catch(Exception e) {
- throw e
- }
- }
-
- /**
- * Create a volume-request XML using a map
- * @param requestMap - map created from VID JSON
- * @param action
- * @param serviceInstanceId
- * @return
- */
- public String createXmlVolumeRequest(Map requestMap, String action, String serviceInstanceId) {
- createXmlVolumeRequest(requestMap, action, serviceInstanceId, '')
- }
-
-
- /**
- * Create a volume-request XML using a map
- * @param requestMap
- * @param action
- * @param serviceInstanceId
- * @param volumeGroupId
- * @return
- */
- public String createXmlVolumeRequest(Map requestMap, String action, String serviceInstanceId, String volumeGroupId) {
- def vnfType = ''
- def serviceName = ''
- def modelCustomizationName = ''
- def asdcServiceModelVersion = ''
-
- def suppressRollback = requestMap.requestDetails.requestInfo.suppressRollback
-
- def backoutOnFailure = ""
- if(suppressRollback != null){
- if ( suppressRollback == true) {
- backoutOnFailure = "false"
- } else if ( suppressRollback == false) {
- backoutOnFailure = "true"
- }
- }
-
- def volGrpName = requestMap.requestDetails.requestInfo?.instanceName ?: ''
- def serviceId = requestMap.requestDetails.requestParameters?.serviceId ?: ''
- def relatedInstanceList = requestMap.requestDetails.relatedInstanceList
- relatedInstanceList.each {
- if (it.relatedInstance.modelInfo?.modelType == 'service') {
- serviceName = it.relatedInstance.modelInfo?.modelName
- asdcServiceModelVersion = it.relatedInstance.modelInfo?.modelVersion
- }
- if (it.relatedInstance.modelInfo?.modelType == 'vnf') {
- modelCustomizationName = it.relatedInstance.modelInfo?.modelInstanceName
- }
- }
-
- vnfType = serviceName + '/' + modelCustomizationName
-
- def userParams = requestMap.requestDetails?.requestParameters?.userParams
- def userParamsNode = ''
- if(userParams != null) {
- userParamsNode = buildUserParams(userParams)
- }
- def modelCustomizationId = requestMap.requestDetails?.modelInfo?.modelCustomizationUuid ?: ''
-
- def xmlReq = """
- <volume-request xmlns="http://www.w3.org/2001/XMLSchema">
- <request-info>
- <action>${action}</action>
- <source>${requestMap.requestDetails.requestInfo.source}</source>
- <service-instance-id>${serviceInstanceId}</service-instance-id>
- </request-info>
- <volume-inputs>
- <volume-group-id>${volumeGroupId}</volume-group-id>
- <volume-group-name>${volGrpName}</volume-group-name>
- <vnf-type>${vnfType}</vnf-type>
- <vf-module-model-name>${requestMap.requestDetails.modelInfo.modelName}</vf-module-model-name>
- <asdc-service-model-version>${asdcServiceModelVersion}</asdc-service-model-version>
- <aic-cloud-region>${requestMap.requestDetails.cloudConfiguration.lcpCloudRegionId}</aic-cloud-region>
- <tenant-id>${requestMap.requestDetails.cloudConfiguration.tenantId}</tenant-id>
- <service-id>${serviceId}</service-id>
- <backout-on-failure>${backoutOnFailure}</backout-on-failure>
- <model-customization-id>${modelCustomizationId}</model-customization-id>
- </volume-inputs>
- <volume-params>
- $userParamsNode
- </volume-params>
- </volume-request>
- """
- // return a pretty-print of the volume-request xml without the preamble
- return groovy.xml.XmlUtil.serialize(xmlReq.normalize().replaceAll("\t", "").replaceAll("\n", "")).replaceAll("(<\\?[^<]*\\?>\\s*[\\r\\n]*)?", "")
- }
-
- /**
- * A common method that can be used to build volume-params node from a map.
- * @param Map userParams
- * @return
- */
- public String buildUserParams(userParams) {
- if (userParams == null) return ""
- def xml = ""
- def key = ""
- def value = ""
- userParams.each {it ->
- key = it.name.replaceAll(/\B[A-Z]/) { '_' + it }.toLowerCase()
- value = it.value
- xml += "<param name=\"${key}\">${value}</param>"
- }
-
- return xml
- }
-
- /**
- * A common method that can be used to extract 'requestDetails'
- * @param String json
- * @return String json requestDetails
- */
- @Deprecated
- public getJsonRequestDetails(String jsonInput) {
- String rtn = ""
- if (jsonInput.isEmpty() || jsonInput == null) {
- return rtn
- } else {
- def jsonMapObject = new JsonSlurper().parseText(jsonInput)
- if (jsonMapObject instanceof Map) {
- String jsonString = new JsonBuilder(jsonMapObject.requestDetails)
- rtn = '{'+"requestDetails"+":"+jsonString+'}'
- return rtn
- } else {
- return rtn
- }
- }
- }
-
- /**
- * A common method that can be used to extract 'requestDetails' in Xml
- * @param String json
- * @return String xml requestDetails
- */
- @Deprecated
- public getJsonRequestDetailstoXml(String jsonInput) {
- String rtn = null
- def jsonString = getJsonRequestDetails(jsonInput)
- if (jsonString == null) {
- return rtn
- } else {
- JSONObject jsonObj = new JSONObject(jsonString)
- return XmlTool.normalize(XML.toString(jsonObj))
- }
- }
-
- /**
- * Create a network-request XML using a map
- * @param execution
- * @param xmlRequestDetails - requestDetails in xml
- * @return
- * Note: See latest version: createXmlNetworkRequestInstance()
- */
-
- public String createXmlNetworkRequestInfra(execution, def networkJsonIncoming) {
-
- def requestId = execution.getVariable("requestId")
- def serviceInstanceId = execution.getVariable("serviceInstanceId")
- def requestAction = execution.getVariable("requestAction")
- def networkId = (execution.getVariable("networkId")) != null ? execution.getVariable("networkId") : ""
-
- def jsonSlurper = new JsonSlurper()
- try {
- Map reqMap = jsonSlurper.parseText(networkJsonIncoming)
- def instanceName = reqMap.requestDetails.requestInfo.instanceName
- def modelCustomizationId = reqMap.requestDetails.modelInfo.modelCustomizationId
- if (modelCustomizationId == null) {
- modelCustomizationId = reqMap.requestDetails.modelInfo.modelCustomizationUuid !=null ?
- reqMap.requestDetails.modelInfo.modelCustomizationUuid : ""
- }
- def modelName = reqMap.requestDetails.modelInfo.modelName
- def lcpCloudRegionId = reqMap.requestDetails.cloudConfiguration.lcpCloudRegionId
- def tenantId = reqMap.requestDetails.cloudConfiguration.tenantId
- def serviceId = reqMap.requestDetails.requestInfo.productFamilyId
- def suppressRollback = reqMap.requestDetails.requestInfo.suppressRollback.toString()
- def backoutOnFailure = "true"
- if(suppressRollback != null){
- if (suppressRollback == true || suppressRollback == "true") {
- backoutOnFailure = "false"
- } else if (suppressRollback == false || suppressRollback == "false") {
- backoutOnFailure = "true"
- }
- }
-
- //def userParams = reqMap.requestDetails.requestParameters.userParams
- //def userParamsNode = buildUserParams(userParams)
- def userParams = reqMap.requestDetails?.requestParameters?.userParams
- def userParamsNode = ''
- if(userParams != null) {
- userParamsNode = buildUserParams(userParams)
- }
-
- //'sdncVersion' = current, '1610' (non-RPC SDNC) or '1702' (RPC SDNC)
- def sdncVersion = execution.getVariable("sdncVersion")
-
- def xmlReq = """
- <network-request xmlns="http://www.w3.org/2001/XMLSchema">
- <request-info>
- <request-id>${requestId}</request-id>
- <action>${requestAction}</action>
- <source>VID</source>
- <service-instance-id>${serviceInstanceId}</service-instance-id>
- </request-info>
- <network-inputs>
- <network-id>${networkId}</network-id>
- <network-name>${instanceName}</network-name>
- <network-type>${modelName}</network-type>
- <modelCustomizationId>${modelCustomizationId}</modelCustomizationId>
- <aic-cloud-region>${lcpCloudRegionId}</aic-cloud-region>
- <tenant-id>${tenantId}</tenant-id>
- <service-id>${serviceId}</service-id>
- <backout-on-failure>${backoutOnFailure}</backout-on-failure>
- <sdncVersion>${sdncVersion}</sdncVersion>
- </network-inputs>
- <network-params>
- ${userParamsNode}
- </network-params>
- </network-request>
- """
- // return a pretty-print of the volume-request xml without the preamble
- return groovy.xml.XmlUtil.serialize(xmlReq.normalize().replaceAll("\t", "").replaceAll("\n", "")).replaceAll("(<\\?[^<]*\\?>\\s*[\\r\\n]*)?", "")
-
- } catch(Exception e) {
- throw e
- }
- }
-
- /**
- * Create a network-request XML using a map,
- * @param execution
- * @return
- */
- public String createXmlNetworkRequestInstance(execution) {
-
- def networkModelUuid = ""
- def networkModelName = ""
- def networkModelVersion = ""
- def networkModelCustomizationUuid = ""
- def networkModelInvariantUuid = ""
-
- // verify the DB Catalog response JSON structure
- def networkModelInfo = execution.getVariable("networkModelInfo")
- def jsonSlurper = new JsonSlurper()
- if (networkModelInfo != null) {
- try {
- Map modelMap = jsonSlurper.parseText(networkModelInfo)
- if (modelMap != null) {
- if (networkModelInfo.contains("modelUuid")) {
- networkModelUuid = modelMap.modelUuid !=null ? modelMap.modelUuid : ""
- }
- if (networkModelInfo.contains("modelName")) {
- networkModelName = modelMap.modelName !=null ? modelMap.modelName : ""
- }
- if (networkModelInfo.contains("modelVersion")) {
- networkModelVersion = modelMap.modelVersion !=null ? modelMap.modelVersion : ""
- }
- if (networkModelInfo.contains("modelCustomizationUuid")) {
- networkModelCustomizationUuid = modelMap.modelCustomizationUuid !=null ? modelMap.modelCustomizationUuid : ""
- }
- if (networkModelInfo.contains("modelInvariantUuid")) {
- networkModelInvariantUuid = modelMap.modelInvariantUuid !=null ? modelMap.modelInvariantUuid : ""
- }
- }
- } catch (Exception ex) {
- throw ex
- }
- }
-
- def serviceModelUuid = ""
- def serviceModelName = ""
- def serviceModelVersion = ""
- def serviceModelCustomizationUuid = ""
- def serviceModelInvariantUuid = ""
-
- // verify the DB Catalog response JSON structure
- def serviceModelInfo = execution.getVariable("serviceModelInfo")
- def jsonServiceSlurper = new JsonSlurper()
- if (serviceModelInfo != null) {
- try {
- Map modelMap = jsonServiceSlurper.parseText(serviceModelInfo)
- if (modelMap != null) {
- if (serviceModelInfo.contains("modelUuid")) {
- serviceModelUuid = modelMap.modelUuid !=null ? modelMap.modelUuid : ""
- }
- if (serviceModelInfo.contains("modelName")) {
- serviceModelName = modelMap.modelName !=null ? modelMap.modelName : ""
- }
- if (serviceModelInfo.contains("modelVersion")) {
- serviceModelVersion = modelMap.modelVersion !=null ? modelMap.modelVersion : ""
- }
- if (serviceModelInfo.contains("modelCustomizationUuid")) {
- serviceModelCustomizationUuid = modelMap.modelCustomizationUuid !=null ? modelMap.modelCustomizationUuid : ""
- }
- if (serviceModelInfo.contains("modelInvariantUuid")) {
- serviceModelInvariantUuid = modelMap.modelInvariantUuid !=null ? modelMap.modelInvariantUuid : ""
- }
- }
- } catch (Exception ex) {
- throw ex
- }
- }
-
-
- def subscriptionServiceType = execution.getVariable("subscriptionServiceType") != null ? execution.getVariable("subscriptionServiceType") : ""
- def globalSubscriberId = execution.getVariable("globalSubscriberId") != null ? execution.getVariable("globalSubscriberId") : ""
- def requestId = execution.getVariable("msoRequestId")
- def serviceInstanceId = execution.getVariable("serviceInstanceId") != null ? execution.getVariable("serviceInstanceId") : ""
- def networkId = (execution.getVariable("networkId")) != null ? execution.getVariable("networkId") : "" // optional
- def networkName = execution.getVariable("networkName") != null ? execution.getVariable("networkName") : "" // optional
- def aicCloudReqion = execution.getVariable("lcpCloudRegionId") != null ? execution.getVariable("lcpCloudRegionId") : ""
- def tenantId = execution.getVariable("tenantId") != null ? execution.getVariable("tenantId") : ""
- def serviceId = execution.getVariable("productFamilyId") != null ? execution.getVariable("productFamilyId") : ""
- def failIfExist = execution.getVariable("failIfExists") != null ? execution.getVariable("failIfExists") : ""
- def suppressRollback = execution.getVariable("disableRollback")
- def backoutOnFailure = "true"
- if(suppressRollback != null){
- if (suppressRollback == true || suppressRollback == "true") {
- backoutOnFailure = "false"
- } else if (suppressRollback == false || suppressRollback == "false") {
- backoutOnFailure = "true"
- }
- }
-
- //'sdncVersion' = current, '1610' (non-RPC SDNC) or '1702' (RPC SDNC)
- def sdncVersion = execution.getVariable("sdncVersion")
-
- def source = "VID"
- def action = execution.getVariable("action")
-
- def userParamsNode = ""
- def userParams = execution.getVariable("networkInputParams")
- if(userParams != null) {
- userParamsNode = buildUserParams(userParams)
- }
-
- def xmlReq = """
- <network-request xmlns="http://www.w3.org/2001/XMLSchema">
- <request-info>
- <request-id>${requestId}</request-id>
- <action>${action}</action>
- <source>${source}</source>
- <service-instance-id>${serviceInstanceId}</service-instance-id>
- </request-info>
- <network-inputs>
- <network-id>${networkId}</network-id>
- <network-name>${networkName}</network-name>
- <network-type>${networkModelName}</network-type>
- <subscription-service-type>${subscriptionServiceType}</subscription-service-type>
- <global-customer-id>${globalSubscriberId}</global-customer-id>
- <aic-cloud-region>${aicCloudReqion}</aic-cloud-region>
- <tenant-id>${tenantId}</tenant-id>
- <service-id>${serviceId}</service-id>
- <backout-on-failure>${backoutOnFailure}</backout-on-failure>
- <failIfExist>${failIfExist}</failIfExist>
- <networkModelInfo>
- <modelName>${networkModelName}</modelName>
- <modelUuid>${networkModelUuid}</modelUuid>
- <modelInvariantUuid>${networkModelInvariantUuid}</modelInvariantUuid>
- <modelVersion>${networkModelVersion}</modelVersion>
- <modelCustomizationUuid>${networkModelCustomizationUuid}</modelCustomizationUuid>
- </networkModelInfo>
- <serviceModelInfo>
- <modelName>${serviceModelName}</modelName>
- <modelUuid>${serviceModelUuid}</modelUuid>
- <modelInvariantUuid>${serviceModelInvariantUuid}</modelInvariantUuid>
- <modelVersion>${serviceModelVersion}</modelVersion>
- <modelCustomizationUuid>${serviceModelCustomizationUuid}</modelCustomizationUuid>
-
- </serviceModelInfo>
- <sdncVersion>${sdncVersion}</sdncVersion>
- </network-inputs>
- <network-params>
- ${userParamsNode}
- </network-params>
- </network-request>
- """
- // return a pretty-print of the volume-request xml without the preamble
- return groovy.xml.XmlUtil.serialize(xmlReq.normalize().replaceAll("\t", "").replaceAll("\n", "")).replaceAll("(<\\?[^<]*\\?>\\s*[\\r\\n]*)?", "")
-
- }
-
- /**
- * Create a vnf-request XML using a map
- * @param requestMap - map created from VID JSON
- * @param action
- * @return
- */
- public String createXmlVfModuleRequest(execution, Map requestMap, String action, String serviceInstanceId) {
-
- //def relatedInstanceList = requestMap.requestDetails.relatedInstanceList
-
- //relatedInstanceList.each {
- // if (it.relatedInstance.modelInfo.modelType == 'vnf') {
- // vnfType = it.relatedInstance.modelInfo.modelName
- // vnfId = it.relatedInstance.modelInfo.modelInvariantId
- // }
- //}
-
- def vnfName = ''
- def asdcServiceModelInfo = ''
-
- def relatedInstanceList = requestMap.requestDetails?.relatedInstanceList
-
-
- if (relatedInstanceList != null) {
- relatedInstanceList.each {
- if (it.relatedInstance.modelInfo?.modelType == 'service') {
- asdcServiceModelInfo = it.relatedInstance.modelInfo?.modelVersion
- }
- if (it.relatedInstance.modelInfo.modelType == 'vnf') {
- vnfName = it.relatedInstance.instanceName ?: ''
- }
- }
- }
-
- def vnfType = execution.getVariable('vnfType')
- def vnfId = execution.getVariable('vnfId')
-
- def vfModuleId = execution.getVariable('vfModuleId')
- def volumeGroupId = execution.getVariable('volumeGroupId')
- def userParams = requestMap.requestDetails?.requestParameters?.userParams
-
-
- def userParamsNode = ''
- if(userParams != null) {
- userParamsNode = buildUserParams(userParams)
- }
-
- def isBaseVfModule = "false"
- if (execution.getVariable('isBaseVfModule') == true) {
- isBaseVfModule = "true"
- }
-
- def requestId = execution.getVariable("mso-request-id")
- def vfModuleName = requestMap.requestDetails?.requestInfo?.instanceName ?: ''
- def vfModuleModelName = requestMap.requestDetails?.modelInfo?.modelName ?: ''
- def suppressRollback = requestMap.requestDetails?.requestInfo?.suppressRollback
-
- def backoutOnFailure = ""
- if(suppressRollback != null){
- if ( suppressRollback == true) {
- backoutOnFailure = "false"
- } else if ( suppressRollback == false) {
- backoutOnFailure = "true"
- }
- }
-
- def serviceId = requestMap.requestDetails?.requestParameters?.serviceId ?: ''
- def aicCloudRegion = requestMap.requestDetails?.cloudConfiguration?.lcpCloudRegionId ?: ''
- def tenantId = requestMap.requestDetails?.cloudConfiguration?.tenantId ?: ''
- def personaModelId = requestMap.requestDetails?.modelInfo?.modelInvariantUuid ?: ''
- def personaModelVersion = requestMap.requestDetails?.modelInfo?.modelUuid ?: ''
- def modelCustomizationId = requestMap.requestDetails?.modelInfo?.modelCustomizationUuid ?: ''
-
- def xmlReq = """
- <vnf-request>
- <request-info>
- <request-id>${requestId}</request-id>
- <action>${action}</action>
- <source>VID</source>
- <!-- new 1610 field -->
- <service-instance-id>${serviceInstanceId}</service-instance-id>
- </request-info>
- <vnf-inputs>
- <!-- not in use in 1610 -->
- <vnf-name>${vnfName}</vnf-name>
- <vnf-type>${vnfType}</vnf-type>
- <vnf-id>${vnfId}</vnf-id>
- <volume-group-id>${volumeGroupId}</volume-group-id>
- <vf-module-id>${vfModuleId}</vf-module-id>
- <vf-module-name>${vfModuleName}</vf-module-name>
- <vf-module-model-name>${vfModuleModelName}</vf-module-model-name>
- <model-customization-id>${modelCustomizationId}</model-customization-id>
- <is-base-vf-module>${isBaseVfModule}</is-base-vf-module>
- <asdc-service-model-version>${asdcServiceModelInfo}</asdc-service-model-version>
- <aic-cloud-region>${aicCloudRegion}</aic-cloud-region>
- <tenant-id>${tenantId}</tenant-id>
- <service-id>${serviceId}</service-id>
- <backout-on-failure>${backoutOnFailure}</backout-on-failure>
- <persona-model-id>${personaModelId}</persona-model-id>
- <persona-model-version>${personaModelVersion}</persona-model-version>
- </vnf-inputs>
- <vnf-params>
- $userParamsNode
- </vnf-params>
- </vnf-request>
- """
-
- // return a pretty-print of the volume-request xml without the preamble
- return groovy.xml.XmlUtil.serialize(xmlReq.normalize().replaceAll("\t", "").replaceAll("\n", "")).replaceAll("(<\\?[^<]*\\?>\\s*[\\r\\n]*)?", "")
- }
-
-
-}
+/*- + * ============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.common.scripts + +import groovy.json.JsonBuilder +import groovy.json.JsonSlurper + +import org.json.JSONObject +import org.json.XML +import org.onap.so.bpmn.core.xml.XmlTool +import org.onap.so.logger.MsoLogger +import org.onap.so.logger.MessageEnum + + +class VidUtils { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VidUtils.class); + + public MsoUtils utils = new MsoUtils() + private AbstractServiceTaskProcessor taskProcessor + + public VidUtils(AbstractServiceTaskProcessor taskProcessor) { + this.taskProcessor = taskProcessor + } + + /** + * Create a volume-request XML using a JSON string + * @param jsonReq - JSON request from VID + * @param action + * @return + */ + public String createXmlVolumeRequest(String jsonReq, String action, String serviceInstanceId) { + def jsonSlurper = new JsonSlurper() + try{ + Map reqMap = jsonSlurper.parseText(jsonReq) + return createXmlVolumeRequest(reqMap, action, serviceInstanceId) + } + catch(Exception e) { + throw e + } + } + + /** + * Create a volume-request XML using a map + * @param requestMap - map created from VID JSON + * @param action + * @param serviceInstanceId + * @return + */ + public String createXmlVolumeRequest(Map requestMap, String action, String serviceInstanceId) { + createXmlVolumeRequest(requestMap, action, serviceInstanceId, '') + } + + + /** + * Create a volume-request XML using a map + * @param requestMap + * @param action + * @param serviceInstanceId + * @param volumeGroupId + * @return + */ + public String createXmlVolumeRequest(Map requestMap, String action, String serviceInstanceId, String volumeGroupId) { + def vnfType = '' + def serviceName = '' + def modelCustomizationName = '' + def asdcServiceModelVersion = '' + + def suppressRollback = requestMap.requestDetails.requestInfo.suppressRollback + + def backoutOnFailure = "" + if(suppressRollback != null){ + if ( suppressRollback == true) { + backoutOnFailure = "false" + } else if ( suppressRollback == false) { + backoutOnFailure = "true" + } + } + + def volGrpName = requestMap.requestDetails.requestInfo?.instanceName ?: '' + def serviceId = requestMap.requestDetails.requestParameters?.serviceId ?: '' + def relatedInstanceList = requestMap.requestDetails.relatedInstanceList + relatedInstanceList.each { + if (it.relatedInstance.modelInfo?.modelType == 'service') { + serviceName = it.relatedInstance.modelInfo?.modelName + asdcServiceModelVersion = it.relatedInstance.modelInfo?.modelVersion + } + if (it.relatedInstance.modelInfo?.modelType == 'vnf') { + modelCustomizationName = it.relatedInstance.modelInfo?.modelInstanceName + } + } + + vnfType = serviceName + '/' + modelCustomizationName + + def userParams = requestMap.requestDetails?.requestParameters?.userParams + def userParamsNode = '' + if(userParams != null) { + userParamsNode = buildUserParams(userParams) + } + def modelCustomizationId = requestMap.requestDetails?.modelInfo?.modelCustomizationUuid ?: '' + + def xmlReq = """ + <volume-request xmlns="http://www.w3.org/2001/XMLSchema"> + <request-info> + <action>${MsoUtils.xmlEscape(action)}</action> + <source>${MsoUtils.xmlEscape(requestMap.requestDetails.requestInfo.source)}</source> + <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> + </request-info> + <volume-inputs> + <volume-group-id>${MsoUtils.xmlEscape(volumeGroupId)}</volume-group-id> + <volume-group-name>${MsoUtils.xmlEscape(volGrpName)}</volume-group-name> + <vnf-type>${MsoUtils.xmlEscape(vnfType)}</vnf-type> + <vf-module-model-name>${MsoUtils.xmlEscape(requestMap.requestDetails.modelInfo.modelName)}</vf-module-model-name> + <asdc-service-model-version>${MsoUtils.xmlEscape(asdcServiceModelVersion)}</asdc-service-model-version> + <aic-cloud-region>${MsoUtils.xmlEscape(requestMap.requestDetails.cloudConfiguration.lcpCloudRegionId)}</aic-cloud-region> + <tenant-id>${MsoUtils.xmlEscape(requestMap.requestDetails.cloudConfiguration.tenantId)}</tenant-id> + <service-id>${MsoUtils.xmlEscape(serviceId)}</service-id> + <backout-on-failure>${MsoUtils.xmlEscape(backoutOnFailure)}</backout-on-failure> + <model-customization-id>${MsoUtils.xmlEscape(modelCustomizationId)}</model-customization-id> + </volume-inputs> + <volume-params> + $userParamsNode + </volume-params> + </volume-request> + """ + // return a pretty-print of the volume-request xml without the preamble + return groovy.xml.XmlUtil.serialize(xmlReq.normalize().replaceAll("\t", "").replaceAll("\n", "")).replaceAll("(<\\?[^<]*\\?>\\s*[\\r\\n]*)?", "") + } + + /** + * A common method that can be used to build volume-params node from a map. + * @param Map userParams + * @return + */ + public String buildUserParams(userParams) { + if (userParams == null) return "" + def xml = "" + def key = "" + def value = "" + userParams.each {it -> + key = it.name.replaceAll(/\B[A-Z]/) { '_' + it }.toLowerCase() + value = it.value + xml += "<param name=\"${key}\">${MsoUtils.xmlEscape(value)}</param>" + } + + return xml + } + + /** + * A common method that can be used to extract 'requestDetails' + * @param String json + * @return String json requestDetails + */ + @Deprecated + public getJsonRequestDetails(String jsonInput) { + String rtn = "" + if (jsonInput.isEmpty() || jsonInput == null) { + return rtn + } else { + def jsonMapObject = new JsonSlurper().parseText(jsonInput) + if (jsonMapObject instanceof Map) { + String jsonString = new JsonBuilder(jsonMapObject.requestDetails) + rtn = '{'+"requestDetails"+":"+jsonString+'}' + return rtn + } else { + return rtn + } + } + } + + /** + * A common method that can be used to extract 'requestDetails' in Xml + * @param String json + * @return String xml requestDetails + */ + @Deprecated + public getJsonRequestDetailstoXml(String jsonInput) { + String rtn = null + def jsonString = getJsonRequestDetails(jsonInput) + if (jsonString == null) { + return rtn + } else { + JSONObject jsonObj = new JSONObject(jsonString) + return XmlTool.normalize(XML.toString(jsonObj)) + } + } + + /** + * Create a network-request XML using a map + * @param execution + * @param xmlRequestDetails - requestDetails in xml + * @return + * Note: See latest version: createXmlNetworkRequestInstance() + */ + + public String createXmlNetworkRequestInfra(execution, def networkJsonIncoming) { + + def requestId = execution.getVariable("requestId") + def serviceInstanceId = execution.getVariable("serviceInstanceId") + def requestAction = execution.getVariable("requestAction") + def networkId = (execution.getVariable("networkId")) != null ? execution.getVariable("networkId") : "" + + def jsonSlurper = new JsonSlurper() + try { + Map reqMap = jsonSlurper.parseText(networkJsonIncoming) + def instanceName = reqMap.requestDetails.requestInfo.instanceName + def modelCustomizationId = reqMap.requestDetails.modelInfo.modelCustomizationId + if (modelCustomizationId == null) { + modelCustomizationId = reqMap.requestDetails.modelInfo.modelCustomizationUuid !=null ? + reqMap.requestDetails.modelInfo.modelCustomizationUuid : "" + } + def modelName = reqMap.requestDetails.modelInfo.modelName + def lcpCloudRegionId = reqMap.requestDetails.cloudConfiguration.lcpCloudRegionId + def tenantId = reqMap.requestDetails.cloudConfiguration.tenantId + def serviceId = reqMap.requestDetails.requestInfo.productFamilyId + def suppressRollback = reqMap.requestDetails.requestInfo.suppressRollback.toString() + def backoutOnFailure = "true" + if(suppressRollback != null){ + if (suppressRollback == true || suppressRollback == "true") { + backoutOnFailure = "false" + } else if (suppressRollback == false || suppressRollback == "false") { + backoutOnFailure = "true" + } + } + + //def userParams = reqMap.requestDetails.requestParameters.userParams + //def userParamsNode = buildUserParams(userParams) + def userParams = reqMap.requestDetails?.requestParameters?.userParams + def userParamsNode = '' + if(userParams != null) { + userParamsNode = buildUserParams(userParams) + } + + //'sdncVersion' = current, '1610' (non-RPC SDNC) or '1702' (RPC SDNC) + def sdncVersion = execution.getVariable("sdncVersion") + + def xmlReq = """ + <network-request xmlns="http://www.w3.org/2001/XMLSchema"> + <request-info> + <request-id>${MsoUtils.xmlEscape(requestId)}</request-id> + <action>${MsoUtils.xmlEscape(requestAction)}</action> + <source>VID</source> + <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> + </request-info> + <network-inputs> + <network-id>${MsoUtils.xmlEscape(networkId)}</network-id> + <network-name>${MsoUtils.xmlEscape(instanceName)}</network-name> + <network-type>${MsoUtils.xmlEscape(modelName)}</network-type> + <modelCustomizationId>${MsoUtils.xmlEscape(modelCustomizationId)}</modelCustomizationId> + <aic-cloud-region>${MsoUtils.xmlEscape(lcpCloudRegionId)}</aic-cloud-region> + <tenant-id>${MsoUtils.xmlEscape(tenantId)}</tenant-id> + <service-id>${MsoUtils.xmlEscape(serviceId)}</service-id> + <backout-on-failure>${MsoUtils.xmlEscape(backoutOnFailure)}</backout-on-failure> + <sdncVersion>${MsoUtils.xmlEscape(sdncVersion)}</sdncVersion> + </network-inputs> + <network-params> + ${userParamsNode} + </network-params> + </network-request> + """ + // return a pretty-print of the volume-request xml without the preamble + return groovy.xml.XmlUtil.serialize(xmlReq.normalize().replaceAll("\t", "").replaceAll("\n", "")).replaceAll("(<\\?[^<]*\\?>\\s*[\\r\\n]*)?", "") + + } catch(Exception e) { + msoLogger.debug("Error in Vid Utils",e.getCause()) + e.printStackTrace(); + throw e + } + } + + /** + * Create a network-request XML using a map, + * @param execution + * @return + */ + public String createXmlNetworkRequestInstance(execution) { + + def networkModelUuid = "" + def networkModelName = "" + def networkModelVersion = "" + def networkModelCustomizationUuid = "" + def networkModelInvariantUuid = "" + + // verify the DB Catalog response JSON structure + def networkModelInfo = execution.getVariable("networkModelInfo") + def jsonSlurper = new JsonSlurper() + if (networkModelInfo != null) { + try { + Map modelMap = jsonSlurper.parseText(networkModelInfo) + if (modelMap != null) { + if (networkModelInfo.contains("modelUuid")) { + networkModelUuid = modelMap.modelUuid !=null ? modelMap.modelUuid : "" + } + if (networkModelInfo.contains("modelName")) { + networkModelName = modelMap.modelName !=null ? modelMap.modelName : "" + } + if (networkModelInfo.contains("modelVersion")) { + networkModelVersion = modelMap.modelVersion !=null ? modelMap.modelVersion : "" + } + if (networkModelInfo.contains("modelCustomizationUuid")) { + networkModelCustomizationUuid = modelMap.modelCustomizationUuid !=null ? modelMap.modelCustomizationUuid : "" + } + if (networkModelInfo.contains("modelInvariantUuid")) { + networkModelInvariantUuid = modelMap.modelInvariantUuid !=null ? modelMap.modelInvariantUuid : "" + } + } + } catch (Exception ex) { + throw ex + } + } + + def serviceModelUuid = "" + def serviceModelName = "" + def serviceModelVersion = "" + def serviceModelCustomizationUuid = "" + def serviceModelInvariantUuid = "" + + // verify the DB Catalog response JSON structure + def serviceModelInfo = execution.getVariable("serviceModelInfo") + def jsonServiceSlurper = new JsonSlurper() + if (serviceModelInfo != null) { + try { + Map modelMap = jsonServiceSlurper.parseText(serviceModelInfo) + if (modelMap != null) { + if (serviceModelInfo.contains("modelUuid")) { + serviceModelUuid = modelMap.modelUuid !=null ? modelMap.modelUuid : "" + } + if (serviceModelInfo.contains("modelName")) { + serviceModelName = modelMap.modelName !=null ? modelMap.modelName : "" + } + if (serviceModelInfo.contains("modelVersion")) { + serviceModelVersion = modelMap.modelVersion !=null ? modelMap.modelVersion : "" + } + if (serviceModelInfo.contains("modelCustomizationUuid")) { + serviceModelCustomizationUuid = modelMap.modelCustomizationUuid !=null ? modelMap.modelCustomizationUuid : "" + } + if (serviceModelInfo.contains("modelInvariantUuid")) { + serviceModelInvariantUuid = modelMap.modelInvariantUuid !=null ? modelMap.modelInvariantUuid : "" + } + } + } catch (Exception ex) { + throw ex + } + } + + + def subscriptionServiceType = execution.getVariable("subscriptionServiceType") != null ? execution.getVariable("subscriptionServiceType") : "" + def globalSubscriberId = execution.getVariable("globalSubscriberId") != null ? execution.getVariable("globalSubscriberId") : "" + def requestId = execution.getVariable("msoRequestId") + def serviceInstanceId = execution.getVariable("serviceInstanceId") != null ? execution.getVariable("serviceInstanceId") : "" + def networkId = (execution.getVariable("networkId")) != null ? execution.getVariable("networkId") : "" // optional + def networkName = execution.getVariable("networkName") != null ? execution.getVariable("networkName") : "" // optional + def aicCloudReqion = execution.getVariable("lcpCloudRegionId") != null ? execution.getVariable("lcpCloudRegionId") : "" + def tenantId = execution.getVariable("tenantId") != null ? execution.getVariable("tenantId") : "" + def serviceId = execution.getVariable("productFamilyId") != null ? execution.getVariable("productFamilyId") : "" + def failIfExist = execution.getVariable("failIfExists") != null ? execution.getVariable("failIfExists") : "" + def suppressRollback = execution.getVariable("disableRollback") + def backoutOnFailure = "true" + if(suppressRollback != null){ + if (suppressRollback == true || suppressRollback == "true") { + backoutOnFailure = "false" + } else if (suppressRollback == false || suppressRollback == "false") { + backoutOnFailure = "true" + } + } + + //'sdncVersion' = current, '1610' (non-RPC SDNC) or '1702' (RPC SDNC) + def sdncVersion = execution.getVariable("sdncVersion") + + def source = "VID" + def action = execution.getVariable("action") + + def userParamsNode = "" + def userParams = execution.getVariable("networkInputParams") + if(userParams != null) { + userParamsNode = buildUserParams(userParams) + } + + def xmlReq = """ + <network-request xmlns="http://www.w3.org/2001/XMLSchema"> + <request-info> + <request-id>${MsoUtils.xmlEscape(requestId)}</request-id> + <action>${MsoUtils.xmlEscape(action)}</action> + <source>${MsoUtils.xmlEscape(source)}</source> + <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> + </request-info> + <network-inputs> + <network-id>${MsoUtils.xmlEscape(networkId)}</network-id> + <network-name>${MsoUtils.xmlEscape(networkName)}</network-name> + <network-type>${MsoUtils.xmlEscape(networkModelName)}</network-type> + <subscription-service-type>${MsoUtils.xmlEscape(subscriptionServiceType)}</subscription-service-type> + <global-customer-id>${MsoUtils.xmlEscape(globalSubscriberId)}</global-customer-id> + <aic-cloud-region>${MsoUtils.xmlEscape(aicCloudReqion)}</aic-cloud-region> + <tenant-id>${MsoUtils.xmlEscape(tenantId)}</tenant-id> + <service-id>${MsoUtils.xmlEscape(serviceId)}</service-id> + <backout-on-failure>${MsoUtils.xmlEscape(backoutOnFailure)}</backout-on-failure> + <failIfExist>${MsoUtils.xmlEscape(failIfExist)}</failIfExist> + <networkModelInfo> + <modelName>${MsoUtils.xmlEscape(networkModelName)}</modelName> + <modelUuid>${MsoUtils.xmlEscape(networkModelUuid)}</modelUuid> + <modelInvariantUuid>${MsoUtils.xmlEscape(networkModelInvariantUuid)}</modelInvariantUuid> + <modelVersion>${MsoUtils.xmlEscape(networkModelVersion)}</modelVersion> + <modelCustomizationUuid>${MsoUtils.xmlEscape(networkModelCustomizationUuid)}</modelCustomizationUuid> + </networkModelInfo> + <serviceModelInfo> + <modelName>${MsoUtils.xmlEscape(serviceModelName)}</modelName> + <modelUuid>${MsoUtils.xmlEscape(serviceModelUuid)}</modelUuid> + <modelInvariantUuid>${MsoUtils.xmlEscape(serviceModelInvariantUuid)}</modelInvariantUuid> + <modelVersion>${MsoUtils.xmlEscape(serviceModelVersion)}</modelVersion> + <modelCustomizationUuid>${MsoUtils.xmlEscape(serviceModelCustomizationUuid)}</modelCustomizationUuid> + + </serviceModelInfo> + <sdncVersion>${MsoUtils.xmlEscape(sdncVersion)}</sdncVersion> + </network-inputs> + <network-params> + ${userParamsNode} + </network-params> + </network-request> + """ + // return a pretty-print of the volume-request xml without the preamble + return groovy.xml.XmlUtil.serialize(xmlReq.normalize().replaceAll("\t", "").replaceAll("\n", "")).replaceAll("(<\\?[^<]*\\?>\\s*[\\r\\n]*)?", "") + + } + + /** + * Create a vnf-request XML using a map + * @param requestMap - map created from VID JSON + * @param action + * @return + */ + public String createXmlVfModuleRequest(execution, Map requestMap, String action, String serviceInstanceId) { + + //def relatedInstanceList = requestMap.requestDetails.relatedInstanceList + + //relatedInstanceList.each { + // if (it.relatedInstance.modelInfo.modelType == 'vnf') { + // vnfType = it.relatedInstance.modelInfo.modelName + // vnfId = it.relatedInstance.modelInfo.modelInvariantId + // } + //} + + def vnfName = '' + def asdcServiceModelInfo = '' + + def relatedInstanceList = requestMap.requestDetails?.relatedInstanceList + + + if (relatedInstanceList != null) { + relatedInstanceList.each { + if (it.relatedInstance.modelInfo?.modelType == 'service') { + asdcServiceModelInfo = it.relatedInstance.modelInfo?.modelVersion + } + if (it.relatedInstance.modelInfo.modelType == 'vnf') { + vnfName = it.relatedInstance.instanceName ?: '' + } + } + } + + def vnfType = execution.getVariable('vnfType') + def vnfId = execution.getVariable('vnfId') + + def vfModuleId = execution.getVariable('vfModuleId') + def volumeGroupId = execution.getVariable('volumeGroupId') + def userParams = requestMap.requestDetails?.requestParameters?.userParams + + + def userParamsNode = '' + if(userParams != null) { + userParamsNode = buildUserParams(userParams) + } + + def isBaseVfModule = "false" + if (execution.getVariable('isBaseVfModule') == true) { + isBaseVfModule = "true" + } + + def requestId = execution.getVariable("mso-request-id") + def vfModuleName = requestMap.requestDetails?.requestInfo?.instanceName ?: '' + def vfModuleModelName = requestMap.requestDetails?.modelInfo?.modelName ?: '' + def suppressRollback = requestMap.requestDetails?.requestInfo?.suppressRollback + + def backoutOnFailure = "" + if(suppressRollback != null){ + if ( suppressRollback == true) { + backoutOnFailure = "false" + } else if ( suppressRollback == false) { + backoutOnFailure = "true" + } + } + + def serviceId = requestMap.requestDetails?.requestParameters?.serviceId ?: '' + def aicCloudRegion = requestMap.requestDetails?.cloudConfiguration?.lcpCloudRegionId ?: '' + def tenantId = requestMap.requestDetails?.cloudConfiguration?.tenantId ?: '' + def personaModelId = requestMap.requestDetails?.modelInfo?.modelInvariantUuid ?: '' + def personaModelVersion = requestMap.requestDetails?.modelInfo?.modelUuid ?: '' + def modelCustomizationId = requestMap.requestDetails?.modelInfo?.modelCustomizationUuid ?: '' + + def xmlReq = """ + <vnf-request> + <request-info> + <request-id>${MsoUtils.xmlEscape(requestId)}</request-id> + <action>${MsoUtils.xmlEscape(action)}</action> + <source>VID</source> + <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> + </request-info> + <vnf-inputs> + <!-- not in use in 1610 --> + <vnf-name>${MsoUtils.xmlEscape(vnfName)}</vnf-name> + <vnf-type>${MsoUtils.xmlEscape(vnfType)}</vnf-type> + <vnf-id>${MsoUtils.xmlEscape(vnfId)}</vnf-id> + <volume-group-id>${MsoUtils.xmlEscape(volumeGroupId)}</volume-group-id> + <vf-module-id>${MsoUtils.xmlEscape(vfModuleId)}</vf-module-id> + <vf-module-name>${MsoUtils.xmlEscape(vfModuleName)}</vf-module-name> + <vf-module-model-name>${MsoUtils.xmlEscape(vfModuleModelName)}</vf-module-model-name> + <model-customization-id>${MsoUtils.xmlEscape(modelCustomizationId)}</model-customization-id> + <is-base-vf-module>${MsoUtils.xmlEscape(isBaseVfModule)}</is-base-vf-module> + <asdc-service-model-version>${MsoUtils.xmlEscape(asdcServiceModelInfo)}</asdc-service-model-version> + <aic-cloud-region>${MsoUtils.xmlEscape(aicCloudRegion)}</aic-cloud-region> + <tenant-id>${MsoUtils.xmlEscape(tenantId)}</tenant-id> + <service-id>${MsoUtils.xmlEscape(serviceId)}</service-id> + <backout-on-failure>${MsoUtils.xmlEscape(backoutOnFailure)}</backout-on-failure> + <persona-model-id>${MsoUtils.xmlEscape(personaModelId)}</persona-model-id> + <persona-model-version>${MsoUtils.xmlEscape(personaModelVersion)}</persona-model-version> + </vnf-inputs> + <vnf-params> + $userParamsNode + </vnf-params> + </vnf-request> + """ + + // return a pretty-print of the volume-request xml without the preamble + return groovy.xml.XmlUtil.serialize(xmlReq.normalize().replaceAll("\t", "").replaceAll("\n", "")).replaceAll("(<\\?[^<]*\\?>\\s*[\\r\\n]*)?", "") + } + + +} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VnfAdapterRestV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy index 5f2a845ef2..52f45c205c 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VnfAdapterRestV1.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy @@ -1,413 +1,419 @@ -/*-
- * ============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.common.scripts
-
-import org.apache.commons.lang3.*
-import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.openecomp.mso.rest.APIResponse
-import org.openecomp.mso.rest.RESTClient
-import org.openecomp.mso.rest.RESTConfig
-
-class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
-
- ExceptionUtil exceptionUtil = new ExceptionUtil()
-
- // VNF Response Processing
- public void preProcessRequest (DelegateExecution execution) {
- def method = getClass().getSimpleName() + '.preProcessRequest(' +
- 'execution=' + execution.getId() +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- def prefix="VNFREST_"
- execution.setVariable("prefix", prefix)
- setSuccessIndicator(execution, false)
-
- try {
- String request = validateRequest(execution, "mso-request-id")
-
- // Get the request type (the name of the root element) from the request
-
- Node root = new XmlParser().parseText(request)
- String requestType = root.name()
- execution.setVariable(prefix + 'requestType', requestType)
- logDebug(getProcessKey(execution) + ': ' + prefix + 'requestType = ' + requestType, isDebugLogEnabled)
-
- utils.logAudit('VnfAdapterRestV1, request: ' + request)
- // Get the messageId from the request
-
- String messageId = getChildText(root, 'messageId')
-
- if ('rollbackVolumeGroupRequest'.equals(requestType)) {
- messageId = getMessageIdForVolumeGroupRollback(root)
- }
-
- if (messageId == null || messageId.isEmpty()) {
- String msg = getProcessKey(execution) + ': no messageId in ' + requestType
- logError(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
- }
-
- execution.setVariable('VNFAResponse_CORRELATOR', messageId)
- logDebug(getProcessKey(execution) + ': VNFAResponse_CORRELATOR = ' + messageId, isDebugLogEnabled)
-
- // Get the notificationUrl from the request
-
- String notificationUrl = getChildText(root, 'notificationUrl')
-
- if (notificationUrl == null || notificationUrl.isEmpty()) {
- String msg = getProcessKey(execution) + ': no notificationUrl in ' + requestType
- logError(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
- }
-
- execution.setVariable(prefix + 'notificationUrl', notificationUrl)
- logDebug(getProcessKey(execution) + ': ' + prefix + 'notificationUrl = ' + notificationUrl, isDebugLogEnabled)
-
- // Determine the VnfAdapter endpoint
-
- String vnfAdapterEndpoint = execution.getVariable("URN_mso_adapters_vnf_rest_endpoint")
-
- if (vnfAdapterEndpoint == null || vnfAdapterEndpoint.isEmpty()) {
- String msg = getProcessKey(execution) + ': mso:adapters:vnf:rest:endpoint URN mapping is not defined'
- logError(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
- }
-
- while (vnfAdapterEndpoint.endsWith('/')) {
- vnfAdapterEndpoint = vnfAdapterEndpoint.substring(0, vnfAdapterEndpoint.length()-1)
- }
-
- String vnfAdapterMethod = null
- String vnfAdapterUrl = null
- String vnfAdapterRequest = request
-
- if ('createVfModuleRequest'.equals(requestType)) {
- String vnfId = getChildText(root, 'vnfId')
-
- if (vnfId == null || vnfId.isEmpty()) {
- String msg = getProcessKey(execution) + ': no vnfId in ' + requestType
- logError(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
- }
-
- vnfAdapterMethod = 'POST'
- vnfAdapterUrl = vnfAdapterEndpoint + '/' + URLEncoder.encode(vnfId, 'UTF-8') + '/vf-modules'
-
- } else if ('updateVfModuleRequest'.equals(requestType)) {
- String vnfId = getChildText(root, 'vnfId')
-
- if (vnfId == null || vnfId.isEmpty()) {
- String msg = getProcessKey(execution) + ': no vnfId in ' + requestType
- logError(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
- }
-
- String vfModuleId = getChildText(root, 'vfModuleId')
-
- if (vfModuleId == null || vfModuleId.isEmpty()) {
- String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType
- logError(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
- }
-
- vnfAdapterMethod = 'PUT'
- vnfAdapterUrl = vnfAdapterEndpoint + '/' + URLEncoder.encode(vnfId, 'UTF-8') +
- '/vf-modules/' + URLEncoder.encode(vfModuleId, 'UTF-8')
-
- } else if ('deleteVfModuleRequest'.equals(requestType)) {
- String vnfId = getChildText(root, 'vnfId')
-
- if (vnfId == null || vnfId.isEmpty()) {
- String msg = getProcessKey(execution) + ': no vnfId in ' + requestType
- logError(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
- }
-
- String vfModuleId = getChildText(root, 'vfModuleId')
-
- if (vfModuleId == null || vfModuleId.isEmpty()) {
- String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType
- logError(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
- }
-
- vnfAdapterMethod = 'DELETE'
- vnfAdapterUrl = vnfAdapterEndpoint + '/' + URLEncoder.encode(vnfId, 'UTF-8') +
- '/vf-modules/' + URLEncoder.encode(vfModuleId, 'UTF-8')
-
- } else if ('rollbackVfModuleRequest'.equals(requestType)) {
- Node vfModuleRollbackNode = getChild(root, 'vfModuleRollback')
-
- if (vfModuleRollbackNode == null) {
- String msg = getProcessKey(execution) + ': no vfModuleRollback in ' + requestType
- logError(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
- }
-
- String vnfId = getChildText(vfModuleRollbackNode, 'vnfId')
-
- if (vnfId == null || vnfId.isEmpty()) {
- String msg = getProcessKey(execution) + ': no vnfId in ' + requestType
- logError(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
- }
-
- String vfModuleId = getChildText(vfModuleRollbackNode, 'vfModuleId')
-
- if (vfModuleId == null || vfModuleId.isEmpty()) {
- String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType
- logError(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
- }
-
- vnfAdapterMethod = 'DELETE'
- vnfAdapterUrl = vnfAdapterEndpoint + '/' + URLEncoder.encode(vnfId, 'UTF-8') +
- '/vf-modules/' + URLEncoder.encode(vfModuleId, 'UTF-8') + '/rollback'
-
- } else if ('createVolumeGroupRequest'.equals(requestType)) {
- vnfAdapterMethod = 'POST'
- if (vnfAdapterEndpoint.endsWith('v1/vnfs')) {
- vnfAdapterEndpoint = vnfAdapterEndpoint.substring(0, (vnfAdapterEndpoint.length()-'/vnfs'.length()))
- }
- vnfAdapterUrl = vnfAdapterEndpoint + '/volume-groups'
-
- } else if ('updateVolumeGroupRequest'.equals(requestType)) {
- String volumeGroupId = getChildText(root, 'volumeGroupId')
-
- if (volumeGroupId == null || volumeGroupId.isEmpty()) {
- String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType
- logError(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
- }
-
- vnfAdapterMethod = 'PUT'
- if (vnfAdapterEndpoint.endsWith('v1/vnfs')) {
- vnfAdapterEndpoint = vnfAdapterEndpoint.substring(0, (vnfAdapterEndpoint.length()-'/vnfs'.length()))
- }
- vnfAdapterUrl = vnfAdapterEndpoint + '/volume-groups/' + URLEncoder.encode(volumeGroupId, 'UTF-8')
-
- } else if ('deleteVolumeGroupRequest'.equals(requestType)) {
- String volumeGroupId = getChildText(root, 'volumeGroupId')
-
- if (volumeGroupId == null || volumeGroupId.isEmpty()) {
- String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType
- logError(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
- }
-
- vnfAdapterMethod = 'DELETE'
- if (vnfAdapterEndpoint.endsWith('v1/vnfs')) {
- vnfAdapterEndpoint = vnfAdapterEndpoint.substring(0, (vnfAdapterEndpoint.length()-'/vnfs'.length()))
- }
- vnfAdapterUrl = vnfAdapterEndpoint + '/volume-groups/' + URLEncoder.encode(volumeGroupId, 'UTF-8')
-
- } else if ('rollbackVolumeGroupRequest'.equals(requestType)) {
- String volumeGroupId = root.'volumeGroupRollback'.'volumeGroupId'.text()
-
- if (volumeGroupId == null || volumeGroupId.isEmpty()) {
- String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType
- logError(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
- }
-
- vnfAdapterMethod = 'DELETE'
- if (vnfAdapterEndpoint.endsWith('v1/vnfs')) {
- vnfAdapterEndpoint = vnfAdapterEndpoint.substring(0, (vnfAdapterEndpoint.length()-'/vnfs'.length()))
- }
- vnfAdapterUrl = vnfAdapterEndpoint + '/volume-groups/' + URLEncoder.encode(volumeGroupId, 'UTF-8') + '/rollback'
-
- } else {
- String msg = getProcessKey(execution) + ': Unsupported request type: ' + requestType
- logError(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
- }
-
- execution.setVariable(prefix + 'vnfAdapterMethod', vnfAdapterMethod)
- logDebug(getProcessKey(execution) + ': ' + prefix + 'vnfAdapterMethod = ' + vnfAdapterMethod, isDebugLogEnabled)
- execution.setVariable(prefix + 'vnfAdapterUrl', vnfAdapterUrl)
- logDebug(getProcessKey(execution) + ': ' + prefix + 'vnfAdapterUrl = ' + vnfAdapterUrl, isDebugLogEnabled)
- execution.setVariable(prefix + 'vnfAdapterRequest', vnfAdapterRequest)
- logDebug(getProcessKey(execution) + ': ' + prefix + 'vnfAdapterRequest = \n' + vnfAdapterRequest, isDebugLogEnabled)
-
- // Get the Basic Auth credentials for the VnfAdapter
-
- String basicAuthValue = execution.getVariable("URN_mso_adapters_po_auth")
-
- if (basicAuthValue == null || basicAuthValue.isEmpty()) {
- logError(getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined")
- } else {
- logDebug(getProcessKey(execution) + ": Obtained BasicAuth credentials for VnfAdapter:" +
- basicAuthValue, isDebugLogEnabled)
- try {
- def encodedString = utils.getBasicAuth(basicAuthValue, execution.getVariable("URN_mso_msoKey"))
- execution.setVariable(prefix + 'basicAuthHeaderValue', encodedString)
- } catch (IOException ex) {
- logError(getProcessKey(execution) + ": Unable to encode BasicAuth credentials for VnfAdapter")
- }
- }
-
- } catch (BpmnError e) {
- logDebug(" Rethrowing MSOWorkflowException", isDebugLogEnabled)
- throw e
- } catch (Exception e) {
- String msg = 'Caught exception in ' + method + ": " + e
- logError(msg)
- logDebug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
- }
- }
-
- public String getMessageIdForVolumeGroupRollback(Node root) {
- return root.'volumeGroupRollback'.'messageId'.text()
- }
-
- /**
- * This method is used instead of an HTTP Connector task because the
- * connector does not allow DELETE with a body.
- */
- public void sendRequestToVnfAdapter(DelegateExecution execution) {
- def method = getClass().getSimpleName() + '.sendRequestToVnfAdapter(' +
- 'execution=' + execution.getId() +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- String prefix = execution.getVariable('prefix')
-
- try {
- String vnfAdapterMethod = execution.getVariable(prefix + 'vnfAdapterMethod')
- String vnfAdapterUrl = execution.getVariable(prefix + 'vnfAdapterUrl')
- String vnfAdapterRequest = execution.getVariable(prefix + 'vnfAdapterRequest')
-
- RESTConfig config = new RESTConfig(vnfAdapterUrl)
- RESTClient client = new RESTClient(config).
- addHeader("Content-Type", "application/xml").
- addAuthorizationHeader(execution.getVariable(prefix + "basicAuthHeaderValue"));
-
- APIResponse response;
-
- if ("GET".equals(vnfAdapterMethod)) {
- response = client.httpGet()
- } else if ("PUT".equals(vnfAdapterMethod)) {
- response = client.httpPut(vnfAdapterRequest)
- } else if ("POST".equals(vnfAdapterMethod)) {
- response = client.httpPost(vnfAdapterRequest)
- } else if ("DELETE".equals(vnfAdapterMethod)) {
- response = client.httpDelete(vnfAdapterRequest)
- } else {
- String msg = 'Unsupported HTTP method "' + vnfAdapterMethod + '" in ' + method + ": " + e
- logError(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
- }
-
- execution.setVariable(prefix + "vnfAdapterStatusCode", response.getStatusCode())
- execution.setVariable(prefix + "vnfAdapterResponse", response.getResponseBodyAsString())
- } catch (BpmnError e) {
- throw e
- } catch (Exception e) {
- String msg = 'Caught exception in ' + method + ": " + e
- logError(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
- }
- }
-
- public void processCallback(DelegateExecution execution){
- def method = getClass().getSimpleName() + '.processCallback(' +
- 'execution=' + execution.getId() +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- String callback = execution.getVariable('VNFAResponse_MESSAGE')
-
- try {
- logDebug(getProcessKey(execution) + ": received callback:\n" + callback, isDebugLogEnabled)
-
- // The XML callback is available to the calling flow in any case,
- // even if a WorkflowException is generated.
- execution.setVariable(getProcessKey(execution) + 'Response', callback)
- // TODO: Should deprecate use of processKey+Response variable for the response. Will use "WorkflowResponse" instead.
- execution.setVariable("WorkflowResponse", callback)
-
- Node root = new XmlParser().parseText(callback)
- if (root.name().endsWith('Exception')) {
- vnfAdapterWorkflowException(execution, callback)
- }
- } catch (Exception e) {
- e.printStackTrace()
- callback = callback == null || String.valueOf(callback).isEmpty() ? "NONE" : callback
- String msg = "Received error from VnfAdapter: " + callback
- logDebug(getProcessKey(execution) + ': ' + msg, isDebugLogEnabled)
- exceptionUtil.buildWorkflowException(execution, 7020, msg)
- }
- }
-
- /**
- * Tries to parse the response as XML to extract the information to create
- * a WorkflowException. If the response cannot be parsed, a more generic
- * WorkflowException is created.
- */
- public void vnfAdapterWorkflowException(DelegateExecution execution, Object response) {
- try {
- Node root = new XmlParser().parseText(response)
- String category = getChildText(root, "category")
- category = category == null || category.isEmpty() ? "" : " category='" + category + "'"
- String message = getChildText(root, "message")
- message = message == null || message.isEmpty() ? "" : " message='" + message + "'"
- String rolledBack = getChildText(root, "rolledBack")
- rolledBack = rolledBack == null || rolledBack.isEmpty() ? "" : " rolledBack='" + rolledBack + "'"
- exceptionUtil.buildWorkflowException(execution, 7020, "Received " + root.name() +
- " from VnfAdapter:" + category + message + rolledBack);
- } catch (Exception e) {
- response = response == null || String.valueOf(response).isEmpty() ? "NONE" : response
- exceptionUtil.buildWorkflowException(execution, 7020, "Received error from VnfAdapter: " + response)
- }
- }
-
- /**
- * Gets the named child of the specified node.
- * @param node the node
- * @param name the child name
- * @return the child node, or null if no such child exists
- */
- private Node getChild(Node node, String name) {
- for (Node child : node.children()) {
- if (child.name() == name) {
- return child
- }
- }
- return null
- }
-
- /**
- * Gets the text of the named child of the specified node.
- * @param node the node
- * @param name the child name
- * @return the child node text, or null if no such child exists
- */
- private String getChildText(Node node, String name) {
- Node child = getChild(node, name)
- return child == null ? null : child.text()
- }
-}
+/*- + * ============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.common.scripts + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.rest.APIResponse +import org.onap.so.rest.RESTClient +import org.onap.so.rest.RESTConfig +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + + + +class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VnfAdapterRestV1.class); + + + ExceptionUtil exceptionUtil = new ExceptionUtil() + + // VNF Response Processing + public void preProcessRequest (DelegateExecution execution) { + def method = getClass().getSimpleName() + '.preProcessRequest(' + + 'execution=' + execution.getId() + + ')' + msoLogger.trace('Entered ' + method) + + def prefix="VNFREST_" + execution.setVariable("prefix", prefix) + setSuccessIndicator(execution, false) + + try { + String request = validateRequest(execution, "mso-request-id") + + // Get the request type (the name of the root element) from the request + + Node root = new XmlParser().parseText(request) + String requestType = root.name() + execution.setVariable(prefix + 'requestType', requestType) + msoLogger.debug(getProcessKey(execution) + ': ' + prefix + 'requestType = ' + requestType) + + msoLogger.debug('VnfAdapterRestV1, request: ' + request) + // Get the messageId from the request + + String messageId = getChildText(root, 'messageId') + + if ('rollbackVolumeGroupRequest'.equals(requestType)) { + messageId = getMessageIdForVolumeGroupRollback(root) + } + + if (messageId == null || messageId.isEmpty()) { + String msg = getProcessKey(execution) + ': no messageId in ' + requestType + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + + execution.setVariable('VNFAResponse_CORRELATOR', messageId) + msoLogger.debug(getProcessKey(execution) + ': VNFAResponse_CORRELATOR = ' + messageId) + + // Get the notificationUrl from the request + + String notificationUrl = getChildText(root, 'notificationUrl') + + if (notificationUrl == null || notificationUrl.isEmpty()) { + String msg = getProcessKey(execution) + ': no notificationUrl in ' + requestType + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + + execution.setVariable(prefix + 'notificationUrl', notificationUrl) + msoLogger.debug(getProcessKey(execution) + ': ' + prefix + 'notificationUrl = ' + notificationUrl) + + // Determine the VnfAdapter endpoint + + String vnfAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.vnf.rest.endpoint", execution) + + if (vnfAdapterEndpoint == null || vnfAdapterEndpoint.isEmpty()) { + String msg = getProcessKey(execution) + ': mso:adapters:vnf:rest:endpoint URN mapping is not defined' + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + + while (vnfAdapterEndpoint.endsWith('/')) { + vnfAdapterEndpoint = vnfAdapterEndpoint.substring(0, vnfAdapterEndpoint.length()-1) + } + + String vnfAdapterMethod = null + String vnfAdapterUrl = null + String vnfAdapterRequest = request + + if ('createVfModuleRequest'.equals(requestType)) { + String vnfId = getChildText(root, 'vnfId') + + if (vnfId == null || vnfId.isEmpty()) { + String msg = getProcessKey(execution) + ': no vnfId in ' + requestType + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + + vnfAdapterMethod = 'POST' + vnfAdapterUrl = vnfAdapterEndpoint + '/' + URLEncoder.encode(vnfId, 'UTF-8') + '/vf-modules' + + } else if ('updateVfModuleRequest'.equals(requestType)) { + String vnfId = getChildText(root, 'vnfId') + + if (vnfId == null || vnfId.isEmpty()) { + String msg = getProcessKey(execution) + ': no vnfId in ' + requestType + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + + String vfModuleId = getChildText(root, 'vfModuleId') + + if (vfModuleId == null || vfModuleId.isEmpty()) { + String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + + vnfAdapterMethod = 'PUT' + vnfAdapterUrl = vnfAdapterEndpoint + '/' + URLEncoder.encode(vnfId, 'UTF-8') + + '/vf-modules/' + URLEncoder.encode(vfModuleId, 'UTF-8') + + } else if ('deleteVfModuleRequest'.equals(requestType)) { + String vnfId = getChildText(root, 'vnfId') + + if (vnfId == null || vnfId.isEmpty()) { + String msg = getProcessKey(execution) + ': no vnfId in ' + requestType + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + + String vfModuleId = getChildText(root, 'vfModuleId') + + if (vfModuleId == null || vfModuleId.isEmpty()) { + String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + + vnfAdapterMethod = 'DELETE' + vnfAdapterUrl = vnfAdapterEndpoint + '/' + URLEncoder.encode(vnfId, 'UTF-8') + + '/vf-modules/' + URLEncoder.encode(vfModuleId, 'UTF-8') + + } else if ('rollbackVfModuleRequest'.equals(requestType)) { + Node vfModuleRollbackNode = getChild(root, 'vfModuleRollback') + + if (vfModuleRollbackNode == null) { + String msg = getProcessKey(execution) + ': no vfModuleRollback in ' + requestType + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + + String vnfId = getChildText(vfModuleRollbackNode, 'vnfId') + + if (vnfId == null || vnfId.isEmpty()) { + String msg = getProcessKey(execution) + ': no vnfId in ' + requestType + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + + String vfModuleId = getChildText(vfModuleRollbackNode, 'vfModuleId') + + if (vfModuleId == null || vfModuleId.isEmpty()) { + String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + + vnfAdapterMethod = 'DELETE' + vnfAdapterUrl = vnfAdapterEndpoint + '/' + URLEncoder.encode(vnfId, 'UTF-8') + + '/vf-modules/' + URLEncoder.encode(vfModuleId, 'UTF-8') + '/rollback' + + } else if ('createVolumeGroupRequest'.equals(requestType)) { + vnfAdapterMethod = 'POST' + if (vnfAdapterEndpoint.endsWith('v1/vnfs')) { + vnfAdapterEndpoint = vnfAdapterEndpoint.substring(0, (vnfAdapterEndpoint.length()-'/vnfs'.length())) + } + vnfAdapterUrl = vnfAdapterEndpoint + '/volume-groups' + + } else if ('updateVolumeGroupRequest'.equals(requestType)) { + String volumeGroupId = getChildText(root, 'volumeGroupId') + + if (volumeGroupId == null || volumeGroupId.isEmpty()) { + String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + + vnfAdapterMethod = 'PUT' + if (vnfAdapterEndpoint.endsWith('v1/vnfs')) { + vnfAdapterEndpoint = vnfAdapterEndpoint.substring(0, (vnfAdapterEndpoint.length()-'/vnfs'.length())) + } + vnfAdapterUrl = vnfAdapterEndpoint + '/volume-groups/' + URLEncoder.encode(volumeGroupId, 'UTF-8') + + } else if ('deleteVolumeGroupRequest'.equals(requestType)) { + String volumeGroupId = getChildText(root, 'volumeGroupId') + + if (volumeGroupId == null || volumeGroupId.isEmpty()) { + String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + + vnfAdapterMethod = 'DELETE' + if (vnfAdapterEndpoint.endsWith('v1/vnfs')) { + vnfAdapterEndpoint = vnfAdapterEndpoint.substring(0, (vnfAdapterEndpoint.length()-'/vnfs'.length())) + } + vnfAdapterUrl = vnfAdapterEndpoint + '/volume-groups/' + URLEncoder.encode(volumeGroupId, 'UTF-8') + + } else if ('rollbackVolumeGroupRequest'.equals(requestType)) { + String volumeGroupId = getVolumeGroupIdFromRollbackRequest(root) + + if (volumeGroupId == null || volumeGroupId.isEmpty()) { + String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + + vnfAdapterMethod = 'DELETE' + if (vnfAdapterEndpoint.endsWith('v1/vnfs')) { + vnfAdapterEndpoint = vnfAdapterEndpoint.substring(0, (vnfAdapterEndpoint.length()-'/vnfs'.length())) + } + vnfAdapterUrl = vnfAdapterEndpoint + '/volume-groups/' + URLEncoder.encode(volumeGroupId, 'UTF-8') + '/rollback' + + } else { + String msg = getProcessKey(execution) + ': Unsupported request type: ' + requestType + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + + execution.setVariable(prefix + 'vnfAdapterMethod', vnfAdapterMethod) + msoLogger.debug(getProcessKey(execution) + ': ' + prefix + 'vnfAdapterMethod = ' + vnfAdapterMethod) + execution.setVariable(prefix + 'vnfAdapterUrl', vnfAdapterUrl) + msoLogger.debug(getProcessKey(execution) + ': ' + prefix + 'vnfAdapterUrl = ' + vnfAdapterUrl) + execution.setVariable(prefix + 'vnfAdapterRequest', vnfAdapterRequest) + msoLogger.debug(getProcessKey(execution) + ': ' + prefix + 'vnfAdapterRequest = \n' + vnfAdapterRequest) + + // Get the Basic Auth credentials for the VnfAdapter + + String basicAuthValue = UrnPropertiesReader.getVariable("mso.adapters.po.auth", execution) + + if (basicAuthValue == null || basicAuthValue.isEmpty()) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + } else { + try { + def encodedString = utils.getBasicAuth(basicAuthValue, UrnPropertiesReader.getVariable("mso.msoKey", execution)) + execution.setVariable(prefix + 'basicAuthHeaderValue', encodedString) + } catch (IOException ex) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, getProcessKey(execution) + ": Unable to encode BasicAuth credentials for VnfAdapter", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + } + } + + } catch (BpmnError e) { + msoLogger.debug(" Rethrowing MSOWorkflowException") + throw e + } catch (Exception e) { + String msg = 'Caught exception in ' + method + ": " + e + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + } + + public String getVolumeGroupIdFromRollbackRequest(Node root) { + return root.'volumeGroupRollback'.'volumeGroupId'.text() + } + + public String getMessageIdForVolumeGroupRollback(Node root) { + return root.'volumeGroupRollback'.'messageId'.text() + } + + /** + * This method is used instead of an HTTP Connector task because the + * connector does not allow DELETE with a body. + */ + public void sendRequestToVnfAdapter(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.sendRequestToVnfAdapter(' + + 'execution=' + execution.getId() + + ')' + msoLogger.trace('Entered ' + method) + + String prefix = execution.getVariable('prefix') + + try { + String vnfAdapterMethod = execution.getVariable(prefix + 'vnfAdapterMethod') + String vnfAdapterUrl = execution.getVariable(prefix + 'vnfAdapterUrl') + String vnfAdapterRequest = execution.getVariable(prefix + 'vnfAdapterRequest') + + RESTConfig config = new RESTConfig(vnfAdapterUrl) + RESTClient client = new RESTClient(config). + addHeader("Content-Type", "application/xml"). + addAuthorizationHeader(execution.getVariable(prefix + "basicAuthHeaderValue")); + + APIResponse response; + + if ("GET".equals(vnfAdapterMethod)) { + response = client.httpGet() + } else if ("PUT".equals(vnfAdapterMethod)) { + response = client.httpPut(vnfAdapterRequest) + } else if ("POST".equals(vnfAdapterMethod)) { + response = client.httpPost(vnfAdapterRequest) + } else if ("DELETE".equals(vnfAdapterMethod)) { + response = client.httpDelete(vnfAdapterRequest) + } else { + String msg = 'Unsupported HTTP method "' + vnfAdapterMethod + '" in ' + method + ": " + e + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + + execution.setVariable(prefix + "vnfAdapterStatusCode", response.getStatusCode()) + execution.setVariable(prefix + "vnfAdapterResponse", response.getResponseBodyAsString()) + } catch (BpmnError e) { + throw e + } catch (Exception e) { + String msg = 'Caught exception in ' + method + ": " + e + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + } + + public void processCallback(DelegateExecution execution){ + def method = getClass().getSimpleName() + '.processCallback(' + + 'execution=' + execution.getId() + + ')' + msoLogger.trace('Entered ' + method) + + String callback = execution.getVariable('VNFAResponse_MESSAGE') + + try { + msoLogger.debug(getProcessKey(execution) + ": received callback:\n" + callback) + + // The XML callback is available to the calling flow in any case, + // even if a WorkflowException is generated. + execution.setVariable(getProcessKey(execution) + 'Response', callback) + // TODO: Should deprecate use of processKey+Response variable for the response. Will use "WorkflowResponse" instead. + execution.setVariable("WorkflowResponse", callback) + + Node root = new XmlParser().parseText(callback) + if (root.name().endsWith('Exception')) { + vnfAdapterWorkflowException(execution, callback) + } + } catch (Exception e) { + e.printStackTrace() + callback = callback == null || String.valueOf(callback).isEmpty() ? "NONE" : callback + String msg = "Received error from VnfAdapter: " + callback + msoLogger.debug(getProcessKey(execution) + ': ' + msg) + exceptionUtil.buildWorkflowException(execution, 7020, msg) + } + } + + /** + * Tries to parse the response as XML to extract the information to create + * a WorkflowException. If the response cannot be parsed, a more generic + * WorkflowException is created. + */ + public void vnfAdapterWorkflowException(DelegateExecution execution, Object response) { + try { + Node root = new XmlParser().parseText(response) + String category = getChildText(root, "category") + category = category == null || category.isEmpty() ? "" : " category='" + category + "'" + String message = getChildText(root, "message") + message = message == null || message.isEmpty() ? "" : " message='" + message + "'" + String rolledBack = getChildText(root, "rolledBack") + rolledBack = rolledBack == null || rolledBack.isEmpty() ? "" : " rolledBack='" + rolledBack + "'" + exceptionUtil.buildWorkflowException(execution, 7020, "Received " + root.name() + + " from VnfAdapter:" + category + message + rolledBack); + } catch (Exception e) { + response = response == null || String.valueOf(response).isEmpty() ? "NONE" : response + exceptionUtil.buildWorkflowException(execution, 7020, "Received error from VnfAdapter: " + response) + } + } + + /** + * Gets the named child of the specified node. + * @param node the node + * @param name the child name + * @return the child node, or null if no such child exists + */ + private Node getChild(Node node, String name) { + for (Node child : node.children()) { + if (child.name() == name) { + return child + } + } + return null + } + + /** + * Gets the text of the named child of the specified node. + * @param node the node + * @param name the child name + * @return the child node text, or null if no such child exists + */ + private String getChildText(Node node, String name) { + Node child = getChild(node, name) + return child == null ? null : child.text() + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VnfAdapterUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterUtils.groovy index 9c1a472a67..8c979fca0b 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VnfAdapterUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterUtils.groovy @@ -1,86 +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.openecomp.mso.bpmn.common.scripts
-
-import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.delegate.DelegateExecution;
-import org.openecomp.mso.bpmn.core.WorkflowException
-
-class VnfAdapterUtils {
-
- private AbstractServiceTaskProcessor taskProcessor
-
- public VnfAdapterUtils(AbstractServiceTaskProcessor taskProcessor) {
- this.taskProcessor = taskProcessor
- }
-
- ExceptionUtil exceptionUtil = new ExceptionUtil()
-
- public void validateVnfResponse(DelegateExecution execution, String responseVar, String responseCodeVar, String errorResponseVar) {
- def method = getClass().getSimpleName() + '.validateVnfResponse(' +
- 'execution=' + execution.getId() +
- ', responseVar=' + responseVar +
- ', responseCodeVar=' + responseCodeVar +
- ', errorResponseVar=' + errorResponseVar +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled)
-
- try {
- def prefix = execution.getVariable('prefix')
-
- def response = execution.getVariable(responseVar)
- def responseCode = execution.getVariable(responseCodeVar)
- def errorResponse = execution.getVariable(errorResponseVar)
-
- // The following if statement never appears to be true as any VNF Adapter error seems to be stored in 'errorResponse'.
- // Also, the value is stored as a WorkflowException object, not a String. Added the else if to provide the proper
- // functionality but leaving the original code in case it is hit under some circumstances.
- if (response.contains("WorkflowException")) {
- execution.setVariable(prefix + "ErrorResponse", response)
- //execution.setVariable(prefix + "ResponseCode", responseCode)
- taskProcessor.logDebug(" Sub Vnf flow Error WorkflowException Response - " + "\n" + response, isDebugLogEnabled)
- throw new BpmnError("MSOWorkflowException")
- } else if (errorResponse != null && errorResponse instanceof WorkflowException) {
- // Not sure the variables with the associated prefix are still used
- execution.setVariable(prefix + "ErrorResponse", errorResponse.getErrorMessage())
- execution.setVariable(prefix + "ResponseCode", errorResponse.getErrorCode())
- taskProcessor.logDebug("Sub Vnf flow Error WorkflowException " + prefix + "ErrorResponse" + " - " +
- errorResponse.getErrorMessage(), isDebugLogEnabled)
- // this is the important part to ensure we hit the Fallout Handler
- throw new BpmnError("MSOWorkflowException")
- } else if (errorResponse != null && errorResponse instanceof WorkflowException) {
- // Not sure the variables with the associated prefix are still used
- execution.setVariable(prefix + "ErrorResponse", errorResponse.getErrorMessage())
- execution.setVariable(prefix + "ResponseCode", errorResponse.getErrorCode())
- taskProcessor.logDebug("Sub Vnf flow Error WorkflowException " + prefix + "ErrorResponse" + " - " +
- errorResponse.getErrorMessage(), isDebugLogEnabled)
- // this is the important part to ensure we hit the Fallout Handler
- throw new BpmnError("MSOWorkflowException")
- }
- } catch (BpmnError e) {
- throw e;
- } catch (Exception e) {
- taskProcessor.logError('Caught exception in ' + method, e)
- exceptionUtil.buildAndThrowWorkflowException(execution, 5000, 'Internal Error- Unable to validate VNF Response ' + e.getMessage())
- }
- }
-
-}
+/*- + * ============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.common.scripts + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger + + + +class VnfAdapterUtils { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VnfAdapterUtils.class); + + + private AbstractServiceTaskProcessor taskProcessor + + public VnfAdapterUtils(AbstractServiceTaskProcessor taskProcessor) { + this.taskProcessor = taskProcessor + } + + ExceptionUtil exceptionUtil = new ExceptionUtil() + + public void validateVnfResponse(DelegateExecution execution, String responseVar, String responseCodeVar, String errorResponseVar) { + def method = getClass().getSimpleName() + '.validateVnfResponse(' + + 'execution=' + execution.getId() + + ', responseVar=' + responseVar + + ', responseCodeVar=' + responseCodeVar + + ', errorResponseVar=' + errorResponseVar + + ')' + msoLogger.trace('Entered ' + method) + + try { + def prefix = execution.getVariable('prefix') + + def response = execution.getVariable(responseVar) + def responseCode = execution.getVariable(responseCodeVar) + def errorResponse = execution.getVariable(errorResponseVar) + + // The following if statement never appears to be true as any VNF Adapter error seems to be stored in 'errorResponse'. + // Also, the value is stored as a WorkflowException object, not a String. Added the else if to provide the proper + // functionality but leaving the original code in case it is hit under some circumstances. + if (response.contains("WorkflowException")) { + execution.setVariable(prefix + "ErrorResponse", response) + //execution.setVariable(prefix + "ResponseCode", responseCode) + msoLogger.debug(" Sub Vnf flow Error WorkflowException Response - " + "\n" + response) + throw new BpmnError("MSOWorkflowException") + } else if (errorResponse != null && errorResponse instanceof WorkflowException) { + // Not sure the variables with the associated prefix are still used + execution.setVariable(prefix + "ErrorResponse", errorResponse.getErrorMessage()) + execution.setVariable(prefix + "ResponseCode", errorResponse.getErrorCode()) + msoLogger.debug("Sub Vnf flow Error WorkflowException " + prefix + "ErrorResponse" + " - " + errorResponse.getErrorMessage()) + // this is the important part to ensure we hit the Fallout Handler + throw new BpmnError("MSOWorkflowException") + } else if (errorResponse != null && errorResponse instanceof WorkflowException) { + // Not sure the variables with the associated prefix are still used + execution.setVariable(prefix + "ErrorResponse", errorResponse.getErrorMessage()) + execution.setVariable(prefix + "ResponseCode", errorResponse.getErrorCode()) + msoLogger.debug("Sub Vnf flow Error WorkflowException " + prefix + "ErrorResponse" + " - " + errorResponse.getErrorMessage()) + // this is the important part to ensure we hit the Fallout Handler + throw new BpmnError("MSOWorkflowException") + } + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + exceptionUtil.buildAndThrowWorkflowException(execution, 5000, 'Internal Error- Unable to validate VNF Response ' + e.getMessage()) + } + } + +} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericDeleteService.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericDeleteService.groovy deleted file mode 100644 index 8d9defdb86..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericDeleteService.groovy +++ /dev/null @@ -1,309 +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.common.scripts
-
-import static org.apache.commons.lang3.StringUtils.*
-
-import org.apache.commons.lang3.*
-import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.openecomp.mso.rest.APIResponse
-import org.springframework.web.util.UriUtils
-
-
-/**
- * This class supports the GenericDeleteService Sub Flow.
- * This Generic sub flow can be used by any flow for the
- * goal of deleting a Service-Instance or Service-Subscription.
- * The calling flow must set the GENDS_type variable as "service-instance"
- * or "service-subscription".
- *
- * If the resource-version is not provided by the calling flow
- * then this sub flow will query the service-instance or
- * service-subscription, prior to deleting it, in order to
- * obtain this resource version. Upon successful completion of
- * this sub flow the GENDS_SuccessIndicator will be true. A
- * MSOWorkflowException will be thrown if an error occurs within this flow.
- *
- * Please map variables to the corresponding variable names
- * below.
- *
- * Note - if this sub flow receives a Not Found (404) response
- * from AAI at any time this will be considered an acceptable
- * response.
- *
- *
- * Variable Mapping Below
- *
- * In Mapping Variables:
- * For Service-Instance:
- * @param - GENDS_serviceInstanceId
- * @param - GENDS_serviceType
- * @param - GENDS_globalCustomerId
- * @param - GENDS_type
- * @param (Optional) - GENDS_resourceVersion
- *
- * For Service-Subscription:
- * @param - GENDS_serviceType
- * @param - GENDS_globalCustomerId
- * @param - GENDS_type
- * @param (Optional) - GENDS_resourceVersion
- *
- *
- * Out Mapping Variables:
- * @param - GENDS_FoundIndicator
- * @param - WorkflowException
- *
- *
- */
-class GenericDeleteService extends AbstractServiceTaskProcessor{
-
- String Prefix = "GENDS_"
- ExceptionUtil exceptionUtil = new ExceptionUtil()
-
- /**
- * This method validates the incoming variables and
- * determines if the resource version was provided
- *
- * @param - execution
- */
- public void preProcessRequest(DelegateExecution execution) {
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- execution.setVariable("prefix",Prefix)
- utils.log("DEBUG", " *** STARTED GenericDeleteService PreProcessRequest Process*** ", isDebugEnabled)
-
- execution.setVariable("GENDS_resourceVersionProvidedFlag", true)
- execution.setVariable("GENDS_SuccessIndicator", false)
- execution.setVariable("GENDS_FoundIndicator", false)
-
- try{
- // Get Variables
- String globalCustomerId = execution.getVariable("GENDS_globalCustomerId")
- String serviceInstanceId = execution.getVariable("GENDS_serviceInstanceId")
- String serviceType = execution.getVariable("GENDS_serviceType")
- String type = execution.getVariable("GENDS_type")
-
- if(type != null){
- utils.log("DEBUG", "Incoming GENDS_type is: " + type, isDebugEnabled)
- if(isBlank(globalCustomerId) || isBlank(serviceType)){
- utils.log("DEBUG", "Incoming Required Variable is null!", isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Required Variable is Missing or Null!")
- }else{
- utils.log("DEBUG", "Incoming Global Customer Id is: " + globalCustomerId, isDebugEnabled)
- utils.log("DEBUG", "Incoming Service Type is: " + serviceType, isDebugEnabled)
- if(type.equalsIgnoreCase("service-instance")){
- if(isBlank(serviceInstanceId)){
- utils.log("DEBUG", "Incoming Required Variable is null!", isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Required Variable is Missing or Null!")
- }else{
- utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled)
- utils.log("DEBUG", "Preparing Delete Service-Instance Process", isDebugEnabled)
- }
- }else if(type.equalsIgnoreCase("service-subscription")){
- utils.log("DEBUG", "Preparing Delete Service-Subscription Process", isDebugEnabled)
- }else{
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Type is Invalid. Please Specify Type as service-instance or service-subscription")
- }
- }
-
- String resourceVersion = execution.getVariable('GENDS_resourceVersion')
- if(isBlank(resourceVersion)){
- utils.log("DEBUG", "Service Instance Resource Version is NOT Provided", isDebugEnabled)
- execution.setVariable("GENDS_resourceVersionProvidedFlag", false)
- }else{
- utils.log("DEBUG", "Incoming SI Resource Version is: " + resourceVersion, isDebugEnabled)
- }
-
- }else{
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Incoming GENDS_type is null. Variable is Required.")
- }
- }catch(BpmnError b){
- utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled)
- throw b
- }catch(Exception e){
- utils.log("ERROR", " Error encountered within GenericDeleteService PreProcessRequest method!" + e, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in GenericDeleteService PreProcessRequest")
-
- }
- utils.log("DEBUG", "*** COMPLETED GenericDeleteService PreProcessRequest Process ***", isDebugEnabled)
- }
-
- /**
- * This method executes a GET call to AAI for the service instance
- * or service-subscription so that the objects's resource-version
- * can be obtained.
- *
- * @param - execution
- */
- public void getServiceResourceVersion(DelegateExecution execution){
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- execution.setVariable("prefix",Prefix)
- utils.log("DEBUG", " *** STARTED GenericDeleteService GetServiceResourceVersion Process*** ", isDebugEnabled)
- try {
- String serviceType = execution.getVariable("GENDS_serviceType")
- utils.log("DEBUG", " Incoming GENDS_serviceType is: " + serviceType, isDebugEnabled)
- String globalCustomerId = execution.getVariable("GENDS_globalCustomerId")
- utils.log("DEBUG", "Incoming Global Customer Id is: " + globalCustomerId, isDebugEnabled)
- String type = execution.getVariable("GENDS_type")
- String serviceEndpoint = ""
-
- if(type.equalsIgnoreCase("service-instance")){
- String serviceInstanceId = execution.getVariable("GENDS_serviceInstanceId")
- utils.log("DEBUG", " Incoming GENDS_serviceInstanceId is: " + serviceInstanceId, isDebugEnabled)
- serviceEndpoint = UriUtils.encode(globalCustomerId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + UriUtils.encode(serviceInstanceId,"UTF-8")
-
- }else if(type.equalsIgnoreCase("service-subscription")){
- serviceEndpoint = UriUtils.encode(globalCustomerId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8")
- }
-
- String aai_endpoint = execution.getVariable("URN_aai_endpoint")
- AaiUtil aaiUriUtil = new AaiUtil(this)
- String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution)
- logDebug('AAI URI is: ' + aai_uri, isDebugEnabled)
-
- String serviceAaiPath = "${aai_endpoint}${aai_uri}/" + serviceEndpoint
-
- execution.setVariable("GENDS_serviceAaiPath", serviceAaiPath)
- utils.log("DEBUG", "GET Service Instance AAI Path is: " + "\n" + serviceAaiPath, isDebugEnabled)
- utils.logAudit("GenericDeleteService GET AAI Path: " + serviceAaiPath)
-
- APIResponse response = aaiUriUtil.executeAAIGetCall(execution, serviceAaiPath)
- int responseCode = response.getStatusCode()
- execution.setVariable("GENDS_getServiceResponseCode", responseCode)
- utils.log("DEBUG", " GET Service Instance response code is: " + responseCode, isDebugEnabled)
- utils.logAudit("GET Service Instance response code: " + responseCode)
-
- String aaiResponse = response.getResponseBodyAsString()
- aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse)
- aaiResponse = aaiResponse.replaceAll("&", "&")
- execution.setVariable("GENDS_getServiceResponse", aaiResponse)
-
- utils.logAudit("GET Service Instance response : " + aaiResponse)
- //Process Response
- if(responseCode == 200 || responseCode == 202){
- utils.log("DEBUG", "GET Service Received a Good Response: \n" + aaiResponse, isDebugEnabled)
- execution.setVariable("GENDS_SuccessIndicator", true)
- execution.setVariable("GENDS_FoundIndicator", true)
- String resourceVersion = utils.getNodeText1(aaiResponse, "resource-version")
- execution.setVariable("GENDS_resourceVersion", resourceVersion)
- utils.log("DEBUG", type + " Resource Version is: " + resourceVersion, isDebugEnabled)
-
- }else if(responseCode == 404){
- utils.log("DEBUG", "GET Service Received a Not Found (404) Response", isDebugEnabled)
- execution.setVariable("GENDS_SuccessIndicator", true)
- execution.setVariable("WorkflowResponse", " ") // for junits
- }
- else{
- utils.log("DEBUG", " GET Service Received a Bad Response: \n" + aaiResponse, isDebugEnabled)
- exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode)
- throw new BpmnError("MSOWorkflowException")
- }
- }catch(BpmnError b){
- utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled)
- throw b
- }catch(Exception e){
- utils.log("DEBUG", " Error encountered within GenericDeleteService GetServiceResourceVersion method!" + e, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During GetServiceResourceVersion")
- }
- utils.log("DEBUG", " *** COMPLETED GenericDeleteService GetServiceResourceVersion Process*** ", isDebugEnabled)
- }
-
- /**
- * This method executes a DELETE call to AAI for the provided
- * service-instance or service-subscription.
- *
- * @param - execution
- */
- public void deleteServiceObject(DelegateExecution execution){
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- execution.setVariable("prefix",Prefix)
- utils.log("DEBUG", " *** STARTED GenericDeleteService DeleteServiceObject Process*** ", isDebugEnabled)
- try {
- AaiUtil aaiUriUtil = new AaiUtil(this)
- String type = execution.getVariable("GENDS_type")
- String serviceAaiPath = execution.getVariable("GENDS_serviceAaiPath")
- String serviceEndpoint = ""
-
- if(isEmpty(serviceAaiPath)){
- String serviceType = execution.getVariable("GENDS_serviceType")
- utils.log("DEBUG", " Incoming GENDS_serviceType is: " + serviceType, isDebugEnabled)
- String globalCustomerId = execution.getVariable("GENDS_globalCustomerId")
- utils.log("DEBUG", "Incoming Global Customer Id is: " + globalCustomerId, isDebugEnabled)
- if(type.equalsIgnoreCase("service-instance")){
- String serviceInstanceId = execution.getVariable("GENDS_serviceInstanceId")
- utils.log("DEBUG", " Incoming GENDS_serviceInstanceId is: " + serviceInstanceId, isDebugEnabled)
- serviceEndpoint = UriUtils.encode(globalCustomerId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + UriUtils.encode(serviceInstanceId,"UTF-8")
-
- }else if(type.equalsIgnoreCase("service-subscription")){
- serviceEndpoint = UriUtils.encode(globalCustomerId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8")
- }
-
- String aai_endpoint = execution.getVariable("URN_aai_endpoint")
- String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution)
- logDebug('AAI URI is: ' + aai_uri, isDebugEnabled)
-
- serviceAaiPath = "${aai_endpoint}${aai_uri}/" + serviceEndpoint
- }
-
- String resourceVersion = execution.getVariable("GENDS_resourceVersion")
- utils.log("DEBUG", "Incoming Resource Version is: " + resourceVersion, isDebugEnabled)
- if(resourceVersion !=null){
- serviceAaiPath = serviceAaiPath +'?resource-version=' + UriUtils.encode(resourceVersion,"UTF-8")
- }
-
- execution.setVariable("GENDS_deleteServiceAaiPath", serviceAaiPath)
- utils.log("DEBUG", "DELETE Service AAI Path is: " + "\n" + serviceAaiPath, isDebugEnabled)
- utils.logAudit("DELETE Service AAI Path: " + serviceAaiPath)
-
- APIResponse response = aaiUriUtil.executeAAIDeleteCall(execution, serviceAaiPath)
- int responseCode = response.getStatusCode()
- execution.setVariable("GENDS_deleteServiceResponseCode", responseCode)
- utils.log("DEBUG", " DELETE Service response code is: " + responseCode, isDebugEnabled)
- utils.logAudit("DELETE Service Response Code: " + responseCode)
-
- String aaiResponse = response.getResponseBodyAsString()
- aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse)
- execution.setVariable("GENDS_deleteServiceResponse", aaiResponse)
- utils.logAudit("DELETE Service Response: " + aaiResponse)
-
- //Process Response
- if(responseCode == 200 || responseCode == 204){
- utils.log("DEBUG", " DELETE Service Received a Good Response", isDebugEnabled)
- execution.setVariable("GENDS_FoundIndicator", true)
- }else if(responseCode == 404){
- utils.log("DEBUG", " DELETE Service Received a Not Found (404) Response", isDebugEnabled)
- execution.setVariable("GENDS_FoundIndicator", false)
- }else{
- utils.log("DEBUG", "DELETE Service Received a BAD REST Response: \n" + aaiResponse, isDebugEnabled)
- exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode)
- throw new BpmnError("MSOWorkflowException")
- }
- }catch(BpmnError b){
- utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled)
- throw b
- }catch(Exception e){
- utils.log("DEBUG", " Error encountered within GenericDeleteService DeleteServiceObject method!" + e, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During Delete Service Object")
- }
- utils.log("DEBUG", " *** COMPLETED GenericDeleteService DeleteServiceObject Process*** ", isDebugEnabled)
- }
-
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericDeleteVnf.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericDeleteVnf.groovy deleted file mode 100644 index d6a49d9f51..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericDeleteVnf.groovy +++ /dev/null @@ -1,277 +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.common.scripts
-
-import static org.apache.commons.lang3.StringUtils.*
-
-import org.apache.commons.lang3.*
-import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.openecomp.mso.rest.APIResponse
-import org.springframework.web.util.UriUtils
-
-
-/**
- * TODO: Support getting vnf type = vpe
- *
- * This class supports the GenericGetVnf Sub Flow.
- * This Generic sub flow can be used by any flow for accomplishing
- * the goal of getting a Vnf Object (from AAI). The flow currently
- * supports the querying of 2 types of Vnfs, generic-vnf and vce. The
- * type must be provided by the calling flow and the type should
- * be mapped to the variable GENDV_type. The type should either be
- * "generic-vnf" or "vce". If the Vnf Id is not provided by the calling
- * flow then this sub flow will execute the query to get the
- * Vnf using the Vnf Name. Therefore, the calling flow must provide
- * either the Vnf Id or Vnf Name.
- *
- * Upon successful completion of this sub flow the
- * GENDV_SuccessIndicator will be true and the query response payload
- * will be set to GENDV_vnf. An MSOWorkflowException will
- * be thrown upon unsuccessful completion or if an error occurs
- * at any time during this sub flow. Please map variables
- * to the corresponding variable names below.
- *
- * Note - if this sub flow receives a Not Found (404) response
- * from AAI at any time this will be considered an acceptable
- * successful response however the GENDV_FoundIndicator
- * set to false. This will allow the calling flow to distinguish
- * between the two success scenarios, "Success where Vnf is found"
- * and "Success where Vnf is NOT found".
- *
- *
- * Variable Mapping Below
- *
- * In Mapping Variables:
- * @param - GENDV_vnfId
- * @param - GENDV_type
- * @param (Optional) - GENDV_resourceVersion
- *
- *
- * Out Mapping Variables:
- * @param - GENDV_SuccessIndicator
- * @param - GENDV_FoundIndicator
- * @param - WorkflowException
- *
- *
- */
-class GenericDeleteVnf extends AbstractServiceTaskProcessor{
-
- String Prefix = "GENDV_"
- ExceptionUtil exceptionUtil = new ExceptionUtil()
-
- /**
- * This method validates the incoming variables and
- * determines if the resource version was provided
- *
- * @param - execution
- */
- public void preProcessRequest(DelegateExecution execution) {
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- execution.setVariable("prefix",Prefix)
- utils.log("DEBUG", " *** STARTED GenericDeleteVnf PreProcessRequest Process*** ", isDebugEnabled)
-
- execution.setVariable("GENDV_resourceVersionProvided", true)
- execution.setVariable("GENDV_SuccessIndicator", false)
- execution.setVariable("GENDV_FoundIndicator", false)
-
- try{
- // Get Variables
- String vnfId = execution.getVariable("GENDV_vnfId")
- String type = execution.getVariable("GENDV_type")
-
- if(isBlank(type) || isBlank(vnfId)){
- utils.log("ERROR", "Incoming Required Variable is null!", isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Required Variable is Missing or Null!")
- }else{
- utils.log("DEBUG", "Incoming Vnf Id is: " + vnfId, isDebugEnabled)
-
- String resourceVersion = execution.getVariable("GENDV_resourceVersion")
- if(isBlank(resourceVersion)){
- utils.log("DEBUG", "Vnf Resource Version is NOT Provided", isDebugEnabled)
- execution.setVariable("GENDV_resourceVersionProvided", false)
- }else{
- utils.log("DEBUG", "Incoming Vnf Resource Version is: " + resourceVersion, isDebugEnabled)
- }
- }
- }catch(BpmnError b){
- utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled)
- throw b
- }catch(Exception e){
- utils.log("ERROR", " Error encountered within GenericDeleteVnf PreProcessRequest method!" + e, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in GenericDeleteVnf PreProcessRequest")
-
- }
- utils.log("DEBUG", "*** COMPLETED GenericDeleteVnf PreProcessRequest Process ***", isDebugEnabled)
- }
-
- /**
- * This method executes a GET call to AAI for the Vnf
- * so that the Vnf's resource-version can be
- * obtained.
- *
- * @param - execution
- */
- public void getVnfResourceVersion(DelegateExecution execution){
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- execution.setVariable("prefix",Prefix)
- utils.log("DEBUG", " *** STARTED GenericDeleteVnf GetVnfResourceVersion Process*** ", isDebugEnabled)
- try {
- String vnfId = execution.getVariable("GENDV_vnfId")
- String type = execution.getVariable("GENDV_type")
- utils.log("DEBUG", "Type of Vnf Getting is: " + type, isDebugEnabled)
-
- String aai_endpoint = execution.getVariable("URN_aai_endpoint")
- AaiUtil aaiUriUtil = new AaiUtil(this)
-
- //Determine Type of Vnf Querying For
- def aai_uri = ""
- if(type.equals("generic-vnf")){
- aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution)
- }else if(type.equals("vce")){
- aai_uri = aaiUriUtil.getNetworkVceUri(execution)
- }else{
- utils.log("DEBUG", "Invalid Incoming GENDV_type", isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Invalid Incoming GENDV_type")
- }
-
- String getVnfPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8")
-
- execution.setVariable("GENDV_getVnfPath", getVnfPath)
- utils.logAudit("Get Vnf Resource Version Url is: " + getVnfPath)
-
- APIResponse response = aaiUriUtil.executeAAIGetCall(execution, getVnfPath)
- int responseCode = response.getStatusCode()
- execution.setVariable("GENDV_getVnfResponseCode", responseCode)
- utils.log("DEBUG", " GET Vnf response code is: " + responseCode, isDebugEnabled)
-
- utils.logAudit("GenericDeleteVnf Get VNF Response Code: " + responseCode)
- String aaiResponse = response.getResponseBodyAsString()
- aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse)
- execution.setVariable("GENDV_getVnfResponse", aaiResponse)
-
- utils.logAudit("GenericDeleteVnf Get VNF Response: " + aaiResponse)
- //Process Response
- if(responseCode == 200 || responseCode == 202){
- utils.log("DEBUG", "GET Vnf Received a Good Response: \n" + aaiResponse, isDebugEnabled)
- execution.setVariable("GENDV_FoundIndicator", true)
- if(utils.nodeExists(aaiResponse, "resource-version")){
- String resourceVersion = utils.getNodeText1(aaiResponse, "resource-version")
- execution.setVariable("GENDV_resourceVersion", resourceVersion)
- utils.log("DEBUG", "SI Resource Version is: " + resourceVersion, isDebugEnabled)
- }else{
- utils.log("DEBUG", "GET Vnf for Resource Version Response Does NOT Contain a resource-version", isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 400, "Unable to obtain Vnf resource-version. GET Vnf Response Does NOT Contain a resource-version")
- }
-
- }else if(responseCode == 404){
- utils.log("DEBUG", "GET Vnf Received a Not Found (404) Response", isDebugEnabled)
- execution.setVariable("GENDV_SuccessIndicator", true)
- execution.setVariable("WorkflowResponse", " ") // for junits
- }
- else{
- utils.log("DEBUG", " GET Vnf Received a Bad Response: \n" + aaiResponse, isDebugEnabled)
- exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode)
- throw new BpmnError("MSOWorkflowException")
- }
- }catch(BpmnError b){
- utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled)
- throw b
- }catch(Exception e){
- utils.log("DEBUG", " Error encountered within GenericDeleteVnf GetVnfResourceVersion method!" + e, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During GetVnfResourceVersion")
- }
- utils.log("DEBUG", " *** COMPLETED GenericDeleteVnf GetVnfResourceVersion Process*** ", isDebugEnabled)
- }
-
- /**
- * This method executes a DELETE call to AAI for the provided
- * Vnf.
- *
- * @param - execution
- */
- public void deleteVnf(DelegateExecution execution){
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- execution.setVariable("prefix",Prefix)
- utils.log("DEBUG", " *** STARTED GenericDeleteVnf DeleteVnf Process*** ", isDebugEnabled)
- try {
- String vnfId = execution.getVariable("GENDV_vnfId")
- String type = execution.getVariable("GENDV_type")
- utils.log("DEBUG", "Type of Vnf Getting is: " + type, isDebugEnabled)
- String resourceVersion = execution.getVariable("GENDV_resourceVersion")
- utils.log("DEBUG", "Incoming Vnf Resource Version is: " + resourceVersion, isDebugEnabled)
-
- String aai_endpoint = execution.getVariable("URN_aai_endpoint")
- AaiUtil aaiUriUtil = new AaiUtil(this)
-
- //Determine Type of Vnf Querying For
- def aai_uri = ""
- if(type.equals("generic-vnf")){
- aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution)
- }else if(type.equals("vce")){
- aai_uri = aaiUriUtil.getNetworkVceUri(execution)
- }else{
- utils.log("DEBUG", "Invalid Incoming GENDV_type", isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Invalid Incoming GENDV_type")
- }
-
- String deleteVnfPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8") +'?resource-version=' + UriUtils.encode(resourceVersion,"UTF-8")
-
- execution.setVariable("GENDV_deleteVnfPath", deleteVnfPath)
- utils.logAudit("Delete Vnf Url is: " + deleteVnfPath)
-
- APIResponse response = aaiUriUtil.executeAAIDeleteCall(execution, deleteVnfPath)
- int responseCode = response.getStatusCode()
- execution.setVariable("GENDV_deleteVnfResponseCode", responseCode)
- utils.log("DEBUG", " DELETE Vnf response code is: " + responseCode, isDebugEnabled)
-
- utils.logAudit("GenericDeleteVnf Delete VNF Response Code: " + responseCode)
- String aaiResponse = response.getResponseBodyAsString()
- aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse)
- execution.setVariable("GENDV_deleteVnfResponse", aaiResponse)
-
- utils.logAudit("GenericDeleteVnf Delete VNF Response: " + aaiResponse)
- //Process Response
- if(responseCode == 204){
- utils.log("DEBUG", " DELETE Vnf Received a Good Response", isDebugEnabled)
- execution.setVariable("GENDV_FoundIndicator", true)
- }else if(responseCode == 404){
- utils.log("DEBUG", " DELETE Vnf Received a Not Found (404) Response", isDebugEnabled)
- }else if(responseCode == 412){
- utils.log("DEBUG", "DELETE Vnf Received a Resource Version Mismatch Error: \n" + aaiResponse, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 412, "Delete Vnf Received a resource-version Mismatch Error Response from AAI")
- }else{
- utils.log("DEBUG", "DELETE Vnf Received a BAD REST Response: \n" + aaiResponse, isDebugEnabled)
- exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode)
- throw new BpmnError("MSOWorkflowException")
- }
- }catch(BpmnError b){
- utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled)
- throw b
- }catch(Exception e){
- utils.log("DEBUG", " Error encountered within GenericDeleteVnf DeleteVnf method!" + e, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During Delete Vnf")
- }
- utils.log("DEBUG", " *** COMPLETED GenericDeleteVnf DeleteVnf Process*** ", isDebugEnabled)
- }
-
-
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericNotificationService.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericNotificationService.groovy deleted file mode 100644 index 7f3b41d6ec..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericNotificationService.groovy +++ /dev/null @@ -1,21 +0,0 @@ -package org.openecomp.mso.bpmn.common.scripts - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.bpmn.core.json.JsonUtils -import java.text.SimpleDateFormat - -public class GenericNotificationService extends AbstractServiceTaskProcessor { - - - - ExceptionUtil exceptionUtil = new ExceptionUtil() - - public void preProcessRequest (DelegateExecution execution) { - - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericPutVnf.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericPutVnf.groovy deleted file mode 100644 index e814950b94..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericPutVnf.groovy +++ /dev/null @@ -1,172 +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.common.scripts
-
-import static org.apache.commons.lang3.StringUtils.*
-
-import org.apache.commons.lang3.*
-import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.openecomp.mso.rest.APIResponse
-import org.springframework.web.util.UriUtils
-
-/**
- * TODO: Support Putting vnf type = vpe and vce
- *
- * This class supports the GenericPutVnf Sub Flow.
- * This Generic sub flow can be used by any flow for accomplishing
- * the goal of Creating/Updating(PUT) a Vnf Object (in AAI). The flow
- * supports the Creating/Updating of 3 types of Vnfs (generic-vnf, vce, and vpe).
- * The "type" must be provided by the calling flow and this type should
- * be mapped to the variable GENPV_type. The type should either be
- * "generic-vnf", "vce", or "vpe". In addition, the Vnf Id and
- * payload should be provided.
- *
- * Upon successful completion of this sub flow the
- * GENPV_SuccessIndicator. An MSOWorkflowException will
- * be thrown if an error occurs at any time during this
- * sub flow. Please map input variables to the corresponding
- * variable names below.
- *
- *
- * Incoming Required Variables:
- * @param - GENPV_vnfId
- * @param - GENPV_vnfPayload
- * @param - GENPV_type
- *
- *
- * Outgoing Variables:
- * @param - GENPV_SuccessIndicator
- * @param - WorkflowException
- */
-class GenericPutVnf extends AbstractServiceTaskProcessor{
-
- String Prefix = "GENPV_"
- ExceptionUtil exceptionUtil = new ExceptionUtil()
-
- /**
- * This method validates the incoming variables and
- * generates a Vnf Id if one is not provided.
- *
- * @param - execution
- */
- public void preProcessRequest(DelegateExecution execution) {
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- execution.setVariable("prefix",Prefix)
- utils.log("DEBUG", " *** STARTED GenericPutVnf PreProcessRequest Process*** ", isDebugEnabled)
-
- execution.setVariable("GENPV_SuccessIndicator", false)
- execution.setVariable("GENPV_FoundIndicator", false)
-
- try{
- // Get Variables
- String payload = execution.getVariable("GENPV_vnfPayload")
- utils.log("DEBUG", "Incoming Vnf Payload is: " + payload, isDebugEnabled)
- String type = execution.getVariable("GENPV_type")
- utils.log("DEBUG", "Incoming Type of Vnf is: " + type, isDebugEnabled)
-
- if(isBlank(payload) || isBlank(type)){
- utils.log("ERROR", "Incoming Vnf Payload and/or Type is null. These Variables are required!", isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Vnf Payload and/or Type is null. These Variables are required!")
- }else{
- String vnfId = execution.getVariable("GENPV_vnfId")
- if(isBlank(vnfId)){
- vnfId = UUID.randomUUID().toString()
- utils.log("DEBUG", "Generated Vnf Id is: " + vnfId, isDebugEnabled)
- execution.setVariable("GENPV_vnfId", vnfId)
- }else{
- utils.log("DEBUG", "Incoming Vnf Id is: " + vnfId, isDebugEnabled)
- }
- }
- }catch(BpmnError b){
- utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled)
- throw b
- }catch(Exception e){
- utils.log("ERROR", " Error encountered within GenericPutVnf PreProcessRequest method!" + e, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in GenericPutVnf PreProcessRequest")
-
- }
- utils.log("DEBUG", "*** COMPLETED GenericPutVnf PreProcessRequest Process ***", isDebugEnabled)
- }
-
- /**
- * This method executes a Put call to AAI to create
- * or update a Vnf Object using the provided payload
- *
- * @param - execution
- */
- public void putVnf(DelegateExecution execution){
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- execution.setVariable("prefix",Prefix)
- utils.log("DEBUG", " *** STARTED GenericPutVnf PutVnf Process*** ", isDebugEnabled)
- try {
- String vnfId = execution.getVariable("GENPV_vnfId")
- String payload = execution.getVariable("GENPV_vnfPayload")
- String type = execution.getVariable("GENPV_type")
-
- AaiUtil aaiUtil = new AaiUtil(this)
- def aai_uri = ""
- if(type.equals("generic-vnf")){
- aai_uri = aaiUtil.getNetworkGenericVnfUri(execution)
- }else if(type.equals("vce")){
- aai_uri = aaiUtil.getNetworkVceUri(execution)
- }else if(type.equals("vpe")){
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, "GenericPutVnf does not yet support getting type of vnf = vpe")
- }else{
- utils.log("DEBUG", "Invalid Incoming GENGV_type", isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Invalid Incoming GENPV_type")
- }
- utils.log("DEBUG", "Using AAI Uri: " + aai_uri, isDebugEnabled)
-
- String path = "${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8")
- utils.log("DEBUG", "PUT Vnf Endpoint is: " + path, isDebugEnabled)
-
- String putVnfAAIPath = execution.getVariable("URN_aai_endpoint") + path
- execution.setVariable("GENPV_putVnfAAIPath", putVnfAAIPath)
- utils.logAudit("PUT Vnf Url is: " + putVnfAAIPath)
-
- APIResponse apiResponse = aaiUtil.executeAAIPutCall(execution, putVnfAAIPath, payload)
- int responseCode = apiResponse.getStatusCode()
- execution.setVariable("GENPV_putVnfResponseCode", responseCode)
- utils.logAudit("AAI Response Code: " + responseCode)
- String aaiResponse = apiResponse.getResponseBodyAsString()
- aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse)
- execution.setVariable("GENPV_putVnfResponse", aaiResponse)
- utils.logAudit("AAI Response: " + aaiResponse)
-
- if(responseCode == 200 || responseCode == 201){
- utils.log("DEBUG", "PUT Vnf Received a Good Response Code.", isDebugEnabled)
- }else{
- utils.log("DEBUG", "PUT Vnf Received a Bad Response Code. Response Code is: " + responseCode, isDebugEnabled)
- exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode)
- throw new BpmnError("MSOWorkflowException")
- }
- }catch(BpmnError b){
- utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled)
- throw b
- }catch(Exception e){
- utils.log("ERROR", " Error encountered within GenericPutVnf PutVnf method!" + e, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During PutVnf")
- }
- utils.log("DEBUG", " *** COMPLETED GenericPutVnf PutVnf Process*** ", isDebugEnabled)
- }
-
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericUtils.groovy deleted file mode 100644 index baebf794d5..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericUtils.groovy +++ /dev/null @@ -1,20 +0,0 @@ -package org.openecomp.mso.bpmn.common.scripts
-
-import org.apache.commons.lang3.StringUtils;
-
-class GenericUtils extends StringUtils{
-
- @Override
- public static boolean isBlank(final CharSequence cs) {
- int strLen;
- if (cs == null || (strLen = cs.length()) == 0 || cs.equals("null")) {
- return true;
- }
- for (int i = 0; i < strLen; i++) {
- if (!Character.isWhitespace(cs.charAt(i))) {
- return false;
- }
- }
- return true;
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SniroHoming.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SniroHoming.groovy deleted file mode 100755 index 0fdd790137..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SniroHoming.groovy +++ /dev/null @@ -1,274 +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.common.scripts - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution; - -import org.openecomp.mso.bpmn.common.scripts.AaiUtil -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils -import org.openecomp.mso.bpmn.core.domain.InventoryType -import org.openecomp.mso.bpmn.core.domain.Resource -import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition -import org.openecomp.mso.bpmn.core.domain.Subscriber -import org.openecomp.mso.bpmn.core.domain.VnfResource -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.rest.APIResponse -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor - -import org.json.JSONArray -import org.json.JSONObject - -import static org.openecomp.mso.bpmn.common.scripts.GenericUtils.*; - -/** - * This class is contains the scripts used - * by the Homing Subflow building block. The - * subflow attempts to home the provided - * resources by calling sniro. - * - * @author cb645j - * - */ -class SniroHoming extends AbstractServiceTaskProcessor { - - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - SNIROUtils sniroUtils = new SNIROUtils(this) - - /** - * This method validates the incoming variables. - * The method then prepares the sniro request - * and posts it to sniro's rest api. - * - * @param execution - * - * @author cb645j - */ - public void callSniro(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", "HOME_") - utils.log("DEBUG", "*** Started Homing Call Sniro ***", isDebugEnabled) - try { - execution.setVariable("rollbackData", null) - execution.setVariable("rolledBack", false) - - String requestId = execution.getVariable("msoRequestId") - utils.log("DEBUG", "Incoming Request Id is: " + requestId, isDebugEnabled) - String serviceInstanceId = execution.getVariable("serviceInstanceId") - utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled) - ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") - utils.log("DEBUG", "Incoming Service Decomposition is: " + serviceDecomposition, isDebugEnabled) - String subscriberInfo = execution.getVariable("subscriberInfo") - utils.log("DEBUG", "Incoming Subscriber Information is: " + subscriberInfo, isDebugEnabled) - - if (isBlank(requestId) || isBlank(serviceInstanceId) || isBlank(serviceDecomposition.toString()) || isBlank(subscriberInfo)) { - exceptionUtil.buildAndThrowWorkflowException(execution, 4000, "A required input variable is missing or null") - } else { - String subId = jsonUtil.getJsonValue(subscriberInfo, "globalSubscriberId") - String subName = jsonUtil.getJsonValue(subscriberInfo, "subscriberName") - String subCommonSiteId = "" - if (jsonUtil.jsonElementExist(subscriberInfo, "subscriberCommonSiteId")) { - subCommonSiteId = jsonUtil.getJsonValue(subscriberInfo, "subscriberCommonSiteId") - } - Subscriber subscriber = new Subscriber(subId, subName, subCommonSiteId) - - String cloudConfiguration = execution.getVariable("cloudConfiguration") // TODO Currently not being used - String homingParameters = execution.getVariable("homingParameters") - // (aka. request parameters) Should be json format. TODO confirm its json format - - //Authentication - def authHeader = "" - String basicAuth = execution.getVariable("URN_mso_sniro_auth") - String msokey = execution.getVariable("URN_mso_msoKey") - String basicAuthValue = utils.encrypt(basicAuth, msokey) - if (basicAuthValue != null) { - utils.log("DEBUG", "Obtained BasicAuth username and password for SNIRO Adapter: " + basicAuthValue, isDebugEnabled) - try { - authHeader = utils.getBasicAuth(basicAuthValue, msokey) - execution.setVariable("BasicAuthHeaderValue", authHeader) - } catch (Exception ex) { - utils.log("DEBUG", "Unable to encode username and password string: " + ex, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - Unable to encode username and password string") - } - } else { - utils.log("DEBUG", "Unable to obtain BasicAuth - BasicAuth value null", isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - BasicAuth value null") - } - - //Prepare Callback - String timeout = execution.getVariable("timeout") - if (isBlank(timeout)) { - timeout = execution.getVariable("URN_mso_sniro_timeout"); - if (isBlank(timeout)) { - timeout = "PT30M"; - } - } - utils.log("DEBUG", "Async Callback Timeout will be: " + timeout, isDebugEnabled) - - execution.setVariable("timeout", timeout); - execution.setVariable("correlator", requestId); - execution.setVariable("messageType", "SNIROResponse"); - - //Build Request & Call Sniro - String sniroRequest = sniroUtils.buildRequest(execution, requestId, serviceDecomposition, subscriber, homingParameters) - execution.setVariable("sniroRequest", sniroRequest) - utils.log("DEBUG", "SNIRO Request is: " + sniroRequest, isDebugEnabled) - - String endpoint = execution.getVariable("URN_mso_service_agnostic_sniro_endpoint") - String host = execution.getVariable("URN_mso_service_agnostic_sniro_host") - String url = host + endpoint - utils.log("DEBUG", "Posting to Sniro Url: " + url, isDebugEnabled) - - logDebug("URL to be used is: " + url, isDebugEnabled) - - RESTConfig config = new RESTConfig(url) - RESTClient client = new RESTClient(config).addAuthorizationHeader(authHeader).addHeader("Content-Type", "application/json") - APIResponse response = client.httpPost(sniroRequest) - - int responseCode = response.getStatusCode() - execution.setVariable("syncResponseCode", responseCode); - logDebug("SNIRO sync response code is: " + responseCode, isDebugEnabled) - String syncResponse = response.getResponseBodyAsString() - execution.setVariable("syncResponse", syncResponse); - logDebug("SNIRO sync response is: " + syncResponse, isDebugEnabled) - - utils.log("DEBUG", "*** Completed Homing Call Sniro ***", isDebugEnabled) - } - } catch (BpmnError b) { - throw b - } catch (Exception e) { - utils.log("DEBUG", "Error encountered within Homing CallSniro method: " + e, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in Homing CallSniro: " + e.getMessage()) - } - } - - /** - * This method processes the callback response - * and the contained homing solution. It sets - * homing solution assignment and license - * information to the corresponding resources - * - * @param execution - * - * @author cb645j - */ - public void processHomingSolution(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG", "*** Started Homing Process Homing Solution ***", isDebugEnabled) - try { - String response = execution.getVariable("asyncCallbackResponse") - utils.log("DEBUG", "Sniro Async Callback Response is: " + response, isDebugEnabled) - utils.logAudit("Sniro Async Callback Response is: " + response) - - sniroUtils.validateCallbackResponse(execution, response) - String placements = jsonUtil.getJsonValue(response, "solutionInfo.placement") - - ServiceDecomposition decomposition = execution.getVariable("serviceDecomposition") - utils.log("DEBUG", "Service Decomposition: " + decomposition, isDebugEnabled) - - List<Resource> resourceList = decomposition.getServiceResources() - JSONArray arr = new JSONArray(placements) - for (int i = 0; i < arr.length(); i++) { - JSONObject placement = arr.getJSONObject(i) - String jsonServiceResourceId = placement.getString("serviceResourceId") - for (Resource resource : resourceList) { - String serviceResourceId = resource.getResourceId() - if (serviceResourceId.equalsIgnoreCase(jsonServiceResourceId)) { - //match - String inventoryType = placement.getString("inventoryType") - resource.getHomingSolution().setInventoryType(InventoryType.valueOf(inventoryType)) - resource.getHomingSolution().setCloudRegionId(placement.getString("cloudRegionId")) - resource.getHomingSolution().setRehome(placement.getBoolean("isRehome")) - JSONArray assignmentArr = placement.getJSONArray("assignmentInfo") - Map<String, String> assignmentMap = jsonUtil.entryArrayToMap(execution, assignmentArr.toString(), "variableName", "variableValue") - resource.getHomingSolution().setCloudOwner(assignmentMap.get("cloudOwner")) - resource.getHomingSolution().setAicClli(assignmentMap.get("aicClli")) - resource.getHomingSolution().setAicVersion(assignmentMap.get("aicVersion")) - if (inventoryType.equalsIgnoreCase("service")) { - VnfResource vnf = new VnfResource() - vnf.setVnfHostname(assignmentMap.get("vnfHostName")) - resource.getHomingSolution().setVnf(vnf) - resource.getHomingSolution().setServiceInstanceId(placement.getString("serviceInstanceId")) - } - } - } - } - if (JsonUtils.jsonElementExist(response, "solutionInfo.licenseInfo")) { - String licenseInfo = jsonUtil.getJsonValue(response, "solutionInfo.licenseInfo") - JSONArray licenseArr = new JSONArray(licenseInfo) - for (int l = 0; l < licenseArr.length(); l++) { - JSONObject license = licenseArr.getJSONObject(l) - String jsonServiceResourceId = license.getString("serviceResourceId") - for (Resource resource : resourceList) { - String serviceResourceId = resource.getResourceId() - if (serviceResourceId.equalsIgnoreCase(jsonServiceResourceId)) { - //match - String jsonEntitlementPoolList = jsonUtil.getJsonValue(license.toString(), "entitlementPoolList") - List<String> entitlementPoolList = jsonUtil.StringArrayToList(execution, jsonEntitlementPoolList) - resource.getHomingSolution().getLicense().setEntitlementPoolList(entitlementPoolList) - - String jsonLicenseKeyGroupList = jsonUtil.getJsonValue(license.toString(), "licenseKeyGroupList") - List<String> licenseKeyGroupList = jsonUtil.StringArrayToList(execution, jsonLicenseKeyGroupList) - resource.getHomingSolution().getLicense().setLicenseKeyGroupList(licenseKeyGroupList) - } - } - } - } - execution.setVariable("serviceDecomposition", decomposition) - execution.setVariable("homingSolution", placements) //TODO - can be removed as output variable - - utils.log("DEBUG", "*** Completed Homing Process Homing Solution ***", isDebugEnabled) - } catch (BpmnError b) { - throw b - } catch (Exception e) { - utils.log("DEBUG", "Error encountered within Homing ProcessHomingSolution method: " + e, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in Homing ProcessHomingSolution") - } - } - - /** - * This method logs the start of DHVCreateService - * to make debugging easier. - * - * @param - execution - * @author cb645j - */ - public String logStart(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - String requestId = execution.getVariable("testReqId") - if (isBlank(requestId)) { - requestId = execution.getVariable("msoRequestId") - } - execution.setVariable("DHVCS_requestId", requestId) - utils.log("DEBUG", "***** STARTED Homing Subflow for request: " + requestId + " *****", "true") - utils.log("DEBUG", "****** Homing Subflow Global Debug Enabled: " + isDebugEnabled + " *****", "true") - utils.logAudit("***** STARTED Homing Subflow for request: " + requestId + " *****") - } - - /** - * Auto-generated method stub - */ - public void preProcessRequest(DelegateExecution execution) {} - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/PayloadClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/PayloadClient.java index 5a0de6f5e9..d3ddc60d3e 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/PayloadClient.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/PayloadClient.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,26 +18,36 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.appc.payload; - -import org.openecomp.mso.bpmn.appc.payload.beans.*; +package org.onap.so.bpmn.appc.payload; import java.util.Optional; +import org.onap.so.bpmn.appc.payload.beans.ConfigurationParametersHealthCheck; +import org.onap.so.bpmn.appc.payload.beans.ConfigurationParametersQuiesce; +import org.onap.so.bpmn.appc.payload.beans.ConfigurationParametersResumeTraffic; +import org.onap.so.bpmn.appc.payload.beans.ConfigurationParametersUpgrade; +import org.onap.so.bpmn.appc.payload.beans.HealthCheckAction; +import org.onap.so.bpmn.appc.payload.beans.QuiesceTrafficAction; +import org.onap.so.bpmn.appc.payload.beans.RequestParametersHealthCheck; +import org.onap.so.bpmn.appc.payload.beans.ResumeTrafficAction; +import org.onap.so.bpmn.appc.payload.beans.SnapshotAction; +import org.onap.so.bpmn.appc.payload.beans.StartStopAction; +import org.onap.so.bpmn.appc.payload.beans.UpgradeAction; +import org.onap.so.bpmn.core.json.JsonUtils; + import com.fasterxml.jackson.core.JsonProcessingException; -import org.openecomp.mso.bpmn.core.json.JsonUtils; -import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; public class PayloadClient { protected static ObjectMapper mapper = new ObjectMapper(); + private PayloadClient() {} public static Optional<String> upgradeFormat(Optional<String> payload, String vnfName) throws JsonProcessingException{ UpgradeAction payloadResult = new UpgradeAction(); ConfigurationParametersUpgrade configParams = new ConfigurationParametersUpgrade(); - String payloadString = payload.get(); + String payloadString = payload.isPresent() ? payload.get() : ""; String existingSoftware = JsonUtils.getJsonValue(payloadString, "existing-software-version"); String newSoftware = JsonUtils.getJsonValue(payloadString, "new-software-version"); configParams.setExistingSoftwareVersion(existingSoftware); @@ -58,7 +68,7 @@ public class PayloadClient { public static Optional<String> quiesceTrafficFormat(Optional<String> payload, String vnfName) throws JsonProcessingException{ QuiesceTrafficAction payloadResult = new QuiesceTrafficAction(); ConfigurationParametersQuiesce configParams = new ConfigurationParametersQuiesce(); - String payloadString = payload.get(); + String payloadString = payload.isPresent() ? payload.get() : ""; String operationsTimeout = JsonUtils.getJsonValue(payloadString, "operations-timeout"); configParams.setOperationsTimeout(operationsTimeout); configParams.setVnfName(vnfName); @@ -68,7 +78,7 @@ public class PayloadClient { public static Optional<String> startStopFormat(String aicIdentity) throws JsonProcessingException{ StartStopAction payloadResult = new StartStopAction(); - payloadResult.setAICIdentity(aicIdentity); + payloadResult.setAicIdentity(aicIdentity); return Optional.of(mapper.writeValueAsString(payloadResult)); } @@ -90,20 +100,4 @@ public class PayloadClient { return Optional.of(mapper.writeValueAsString(payloadResult)); } - /*public Optional<String> verifySnapshotFormat(Optional<String> payload) throws Exception, JsonProcessingException, JsonMappingException{ - final Snapshot check = mapper.readValue(payload.get(), Snapshot.class); - return Optional.of(mapper.writeValueAsString(check)); - } - - public Optional<String> verifyUpgradeFormat(Optional<String> payload) throws Exception, JsonProcessingException, JsonMappingException{ - final UpdateCheck check = mapper.readValue(payload.get(), UpdateCheck.class); - return Optional.of(mapper.writeValueAsString(check)); - } - - public Optional<String> verifyQuiesceTrafficFormat(Optional<String> payload)throws Exception, JsonProcessingException, JsonMappingException{ - final QuiesceTraffic check = mapper.readValue(payload.get(), QuiesceTraffic.class); - return Optional.of(mapper.writeValueAsString(check)); - } - */ - } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ConfigModifyAction.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigModifyAction.java index 09ad2bf439..3c39a8d66c 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ConfigModifyAction.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigModifyAction.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,42 +18,42 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.appc.payload.beans;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
-"request-parameters",
-"configuration-parameters"
-})
-public class ConfigModifyAction {
-
-@JsonProperty("request-parameters")
-private RequestParametersConfigModify requestParameters;
-@JsonProperty("configuration-parameters")
-private ConfigurationParametersConfigModify configurationParameters;
-
-@JsonProperty("request-parameters")
-public RequestParametersConfigModify getRequestParameters() {
-return requestParameters;
-}
-
-@JsonProperty("request-parameters")
-public void setRequestParameters(RequestParametersConfigModify requestParameters) {
-this.requestParameters = requestParameters;
-}
-
-@JsonProperty("configuration-parameters")
-public ConfigurationParametersConfigModify getConfigurationParameters() {
-return configurationParameters;
-}
-
-@JsonProperty("configuration-parameters")
-public void setConfigurationParameters(ConfigurationParametersConfigModify configurationParameters) {
-this.configurationParameters = configurationParameters;
-}
-
-}
\ No newline at end of file +package org.onap.so.bpmn.appc.payload.beans; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ +"request-parameters", +"configuration-parameters" +}) +public class ConfigModifyAction { + +@JsonProperty("request-parameters") +private RequestParametersConfigModify requestParameters; +@JsonProperty("configuration-parameters") +private ConfigurationParametersConfigModify configurationParameters; + +@JsonProperty("request-parameters") +public RequestParametersConfigModify getRequestParameters() { +return requestParameters; +} + +@JsonProperty("request-parameters") +public void setRequestParameters(RequestParametersConfigModify requestParameters) { +this.requestParameters = requestParameters; +} + +@JsonProperty("configuration-parameters") +public ConfigurationParametersConfigModify getConfigurationParameters() { +return configurationParameters; +} + +@JsonProperty("configuration-parameters") +public void setConfigurationParameters(ConfigurationParametersConfigModify configurationParameters) { +this.configurationParameters = configurationParameters; +} + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ConfigurationParametersConfigModify.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersConfigModify.java index dda7856168..c88169bb80 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ConfigurationParametersConfigModify.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersConfigModify.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,41 +18,41 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.appc.payload.beans;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
-"node0_hostname",
-"node0_backup_router_address"
-})
-public class ConfigurationParametersConfigModify {
-
-@JsonProperty("node0_hostname")
-private String node0Hostname;
-@JsonProperty("node0_backup_router_address")
-private String node0BackupRouterAddress;
-
-@JsonProperty("node0_hostname")
-public String getNode0Hostname() {
-return node0Hostname;
-}
-
-@JsonProperty("node0_hostname")
-public void setNode0Hostname(String node0Hostname) {
-this.node0Hostname = node0Hostname;
-}
-
-@JsonProperty("node0_backup_router_address")
-public String getNode0BackupRouterAddress() {
-return node0BackupRouterAddress;
-}
-
-@JsonProperty("node0_backup_router_address")
-public void setNode0BackupRouterAddress(String node0BackupRouterAddress) {
-this.node0BackupRouterAddress = node0BackupRouterAddress;
-}
-}
\ No newline at end of file +package org.onap.so.bpmn.appc.payload.beans; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ +"node0_hostname", +"node0_backup_router_address" +}) +public class ConfigurationParametersConfigModify { + +@JsonProperty("node0_hostname") +private String node0Hostname; +@JsonProperty("node0_backup_router_address") +private String node0BackupRouterAddress; + +@JsonProperty("node0_hostname") +public String getNode0Hostname() { +return node0Hostname; +} + +@JsonProperty("node0_hostname") +public void setNode0Hostname(String node0Hostname) { +this.node0Hostname = node0Hostname; +} + +@JsonProperty("node0_backup_router_address") +public String getNode0BackupRouterAddress() { +return node0BackupRouterAddress; +} + +@JsonProperty("node0_backup_router_address") +public void setNode0BackupRouterAddress(String node0BackupRouterAddress) { +this.node0BackupRouterAddress = node0BackupRouterAddress; +} +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ConfigurationParametersHealthCheck.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersHealthCheck.java index 000b1bdbf7..a8964f3bc5 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ConfigurationParametersHealthCheck.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersHealthCheck.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.appc.payload.beans; +package org.onap.so.bpmn.appc.payload.beans; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; @@ -42,4 +42,4 @@ return vnfName; public void setVnfName(String vnfName) { this.vnfName = vnfName; } -}
\ No newline at end of file +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ConfigurationParametersQuiesce.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersQuiesce.java index e354d9ca2e..878a136962 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ConfigurationParametersQuiesce.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersQuiesce.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,42 +18,42 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.appc.payload.beans;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
-"vnf_name",
-"operations_timeout"
-})
-public class ConfigurationParametersQuiesce {
-
-@JsonProperty("vnf_name")
-private String vnfName;
-@JsonProperty("operations_timeout")
-private String operationsTimeout;
-
-@JsonProperty("vnf_name")
-public String getVnfName() {
-return vnfName;
-}
-
-@JsonProperty("vnf_name")
-public void setVnfName(String vnfName) {
-this.vnfName = vnfName;
-}
-
-@JsonProperty("operations_timeout")
-public String getOperationsTimeout() {
-return operationsTimeout;
-}
-
-@JsonProperty("operations_timeout")
-public void setOperationsTimeout(String operationsTimeout) {
-this.operationsTimeout = operationsTimeout;
-}
-
-}
\ No newline at end of file +package org.onap.so.bpmn.appc.payload.beans; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ +"vnf_name", +"operations_timeout" +}) +public class ConfigurationParametersQuiesce { + +@JsonProperty("vnf_name") +private String vnfName; +@JsonProperty("operations_timeout") +private String operationsTimeout; + +@JsonProperty("vnf_name") +public String getVnfName() { +return vnfName; +} + +@JsonProperty("vnf_name") +public void setVnfName(String vnfName) { +this.vnfName = vnfName; +} + +@JsonProperty("operations_timeout") +public String getOperationsTimeout() { +return operationsTimeout; +} + +@JsonProperty("operations_timeout") +public void setOperationsTimeout(String operationsTimeout) { +this.operationsTimeout = operationsTimeout; +} + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ConfigurationParametersResumeTraffic.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersResumeTraffic.java index 820618e828..6b5e59f2e0 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ConfigurationParametersResumeTraffic.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersResumeTraffic.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,28 +18,28 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.appc.payload.beans;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
-"vnf_name"
-})
-public class ConfigurationParametersResumeTraffic {
-
-@JsonProperty("vnf_name")
-private String vnfName;
-
-@JsonProperty("vnf_name")
-public String getVnfName() {
-return vnfName;
-}
-
-@JsonProperty("vnf_name")
-public void setVnfName(String vnfName) {
-this.vnfName = vnfName;
-}
-}
\ No newline at end of file +package org.onap.so.bpmn.appc.payload.beans; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ +"vnf_name" +}) +public class ConfigurationParametersResumeTraffic { + +@JsonProperty("vnf_name") +private String vnfName; + +@JsonProperty("vnf_name") +public String getVnfName() { +return vnfName; +} + +@JsonProperty("vnf_name") +public void setVnfName(String vnfName) { +this.vnfName = vnfName; +} +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ConfigurationParametersUpgrade.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersUpgrade.java index 0845e7c37d..ff51b06dbe 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ConfigurationParametersUpgrade.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersUpgrade.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,54 +18,54 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.appc.payload.beans;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
-"vnf_name",
-"existing-software-version",
-"new-software-version"
-})
-public class ConfigurationParametersUpgrade {
-@JsonProperty("vnf_name")
-private String vnfName;
-@JsonProperty("existing-software-version")
-private String existingSoftwareVersion;
-@JsonProperty("new-software-version")
-private String newSoftwareVersion;
-
-@JsonProperty("vnf_name")
-public String getVnfName() {
-return vnfName;
-}
-
-@JsonProperty("vnf_name")
-public void setVnfName(String vnfName) {
-this.vnfName = vnfName;
-}
-
-@JsonProperty("existing-software-version")
-public String getExistingSoftwareVersion() {
-return existingSoftwareVersion;
-}
-
-@JsonProperty("existing-software-version")
-public void setExistingSoftwareVersion(String existingSoftwareVersion) {
-this.existingSoftwareVersion = existingSoftwareVersion;
-}
-
-@JsonProperty("new-software-version")
-public String getNewSoftwareVersion() {
-return newSoftwareVersion;
-}
-
-@JsonProperty("new-software-version")
-public void setNewSoftwareVersion(String newSoftwareVersion) {
-this.newSoftwareVersion = newSoftwareVersion;
-}
-
-}
\ No newline at end of file +package org.onap.so.bpmn.appc.payload.beans; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ +"vnf_name", +"existing-software-version", +"new-software-version" +}) +public class ConfigurationParametersUpgrade { +@JsonProperty("vnf_name") +private String vnfName; +@JsonProperty("existing-software-version") +private String existingSoftwareVersion; +@JsonProperty("new-software-version") +private String newSoftwareVersion; + +@JsonProperty("vnf_name") +public String getVnfName() { +return vnfName; +} + +@JsonProperty("vnf_name") +public void setVnfName(String vnfName) { +this.vnfName = vnfName; +} + +@JsonProperty("existing-software-version") +public String getExistingSoftwareVersion() { +return existingSoftwareVersion; +} + +@JsonProperty("existing-software-version") +public void setExistingSoftwareVersion(String existingSoftwareVersion) { +this.existingSoftwareVersion = existingSoftwareVersion; +} + +@JsonProperty("new-software-version") +public String getNewSoftwareVersion() { +return newSoftwareVersion; +} + +@JsonProperty("new-software-version") +public void setNewSoftwareVersion(String newSoftwareVersion) { +this.newSoftwareVersion = newSoftwareVersion; +} + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/HealthCheckAction.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/HealthCheckAction.java index 53408f1ead..4d194650c4 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/HealthCheckAction.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/HealthCheckAction.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,42 +18,41 @@ * ============LICENSE_END========================================================= */ -
-package org.openecomp.mso.bpmn.appc.payload.beans;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
-"request-parameters",
-"configuration-parameters"
-})
-public class HealthCheckAction {
-
-@JsonProperty("request-parameters")
-private RequestParametersHealthCheck requestParameters;
-@JsonProperty("configuration-parameters")
-private ConfigurationParametersHealthCheck configurationParameters;
-
-@JsonProperty("request-parameters")
-public RequestParametersHealthCheck getRequestParameters() {
-return requestParameters;
-}
-
-@JsonProperty("request-parameters")
-public void setRequestParameters(RequestParametersHealthCheck requestParameters) {
-this.requestParameters = requestParameters;
-}
-
-@JsonProperty("configuration-parameters")
-public ConfigurationParametersHealthCheck getConfigurationParameters() {
-return configurationParameters;
-}
-
-@JsonProperty("configuration-parameters")
-public void setConfigurationParameters(ConfigurationParametersHealthCheck configurationParameters) {
-this.configurationParameters = configurationParameters;
-}
-}
\ No newline at end of file +package org.onap.so.bpmn.appc.payload.beans; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ +"request-parameters", +"configuration-parameters" +}) +public class HealthCheckAction { + +@JsonProperty("request-parameters") +private RequestParametersHealthCheck requestParameters; +@JsonProperty("configuration-parameters") +private ConfigurationParametersHealthCheck configurationParameters; + +@JsonProperty("request-parameters") +public RequestParametersHealthCheck getRequestParameters() { +return requestParameters; +} + +@JsonProperty("request-parameters") +public void setRequestParameters(RequestParametersHealthCheck requestParameters) { +this.requestParameters = requestParameters; +} + +@JsonProperty("configuration-parameters") +public ConfigurationParametersHealthCheck getConfigurationParameters() { +return configurationParameters; +} + +@JsonProperty("configuration-parameters") +public void setConfigurationParameters(ConfigurationParametersHealthCheck configurationParameters) { +this.configurationParameters = configurationParameters; +} +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/QuiesceTrafficAction.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/QuiesceTrafficAction.java index cbe8ee0b91..0b16c6ca90 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/QuiesceTrafficAction.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/QuiesceTrafficAction.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,29 +18,28 @@ * ============LICENSE_END========================================================= */ -
-package org.openecomp.mso.bpmn.appc.payload.beans;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
-"configuration-parameters"
-})
-public class QuiesceTrafficAction {
-
-@JsonProperty("configuration-parameters")
-private ConfigurationParametersQuiesce configurationParameters;
-
-@JsonProperty("configuration-parameters")
-public ConfigurationParametersQuiesce getConfigurationParameters() {
-return configurationParameters;
-}
-
-@JsonProperty("configuration-parameters")
-public void setConfigurationParameters(ConfigurationParametersQuiesce configurationParameters) {
-this.configurationParameters = configurationParameters;
-}
-}
\ No newline at end of file +package org.onap.so.bpmn.appc.payload.beans; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ +"configuration-parameters" +}) +public class QuiesceTrafficAction { + +@JsonProperty("configuration-parameters") +private ConfigurationParametersQuiesce configurationParameters; + +@JsonProperty("configuration-parameters") +public ConfigurationParametersQuiesce getConfigurationParameters() { +return configurationParameters; +} + +@JsonProperty("configuration-parameters") +public void setConfigurationParameters(ConfigurationParametersQuiesce configurationParameters) { +this.configurationParameters = configurationParameters; +} +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/RequestParametersConfigModify.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/RequestParametersConfigModify.java index 41b3314e7c..58c9234d60 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/RequestParametersConfigModify.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/RequestParametersConfigModify.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,29 +18,29 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.appc.payload.beans;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
-"vnf-host-ip-address"
-})
-public class RequestParametersConfigModify {
-
-@JsonProperty("vnf-host-ip-address")
-private String vnfHostIpAddress;
-
-@JsonProperty("vnf-host-ip-address")
-public String getVnfHostIpAddress() {
-return vnfHostIpAddress;
-}
-
-@JsonProperty("vnf-host-ip-address")
-public void setVnfHostIpAddress(String vnfHostIpAddress) {
-this.vnfHostIpAddress = vnfHostIpAddress;
-}
-
-}
\ No newline at end of file +package org.onap.so.bpmn.appc.payload.beans; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ +"vnf-host-ip-address" +}) +public class RequestParametersConfigModify { + +@JsonProperty("vnf-host-ip-address") +private String vnfHostIpAddress; + +@JsonProperty("vnf-host-ip-address") +public String getVnfHostIpAddress() { +return vnfHostIpAddress; +} + +@JsonProperty("vnf-host-ip-address") +public void setVnfHostIpAddress(String vnfHostIpAddress) { +this.vnfHostIpAddress = vnfHostIpAddress; +} + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/RequestParametersHealthCheck.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/RequestParametersHealthCheck.java index dcdb4fb71e..ca87ad6d15 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/RequestParametersHealthCheck.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/RequestParametersHealthCheck.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.appc.payload.beans; +package org.onap.so.bpmn.appc.payload.beans; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; @@ -44,4 +44,4 @@ public void setVnfName(String vnfName) { this.vnfName = vnfName; } -}
\ No newline at end of file +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ResumeTrafficAction.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ResumeTrafficAction.java index de4fe25cd7..b642a376fe 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ResumeTrafficAction.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ResumeTrafficAction.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,28 +18,28 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.appc.payload.beans;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
-"configuration-parameters"
-})
-public class ResumeTrafficAction {
-
-@JsonProperty("configuration-parameters")
-private ConfigurationParametersResumeTraffic configurationParameters;
-
-@JsonProperty("configuration-parameters")
-public ConfigurationParametersResumeTraffic getConfigurationParameters() {
-return configurationParameters;
-}
-
-@JsonProperty("configuration-parameters")
-public void setConfigurationParameters(ConfigurationParametersResumeTraffic configurationParameters) {
-this.configurationParameters = configurationParameters;
-}
-}
\ No newline at end of file +package org.onap.so.bpmn.appc.payload.beans; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ +"configuration-parameters" +}) +public class ResumeTrafficAction { + +@JsonProperty("configuration-parameters") +private ConfigurationParametersResumeTraffic configurationParameters; + +@JsonProperty("configuration-parameters") +public ConfigurationParametersResumeTraffic getConfigurationParameters() { +return configurationParameters; +} + +@JsonProperty("configuration-parameters") +public void setConfigurationParameters(ConfigurationParametersResumeTraffic configurationParameters) { +this.configurationParameters = configurationParameters; +} +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/SnapshotAction.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/SnapshotAction.java index bb74798300..0499e5d6c0 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/SnapshotAction.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/SnapshotAction.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,42 +18,42 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.appc.payload.beans;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
-"vm-id",
-"identity-url"
-})
-public class SnapshotAction {
-
-@JsonProperty("vm-id")
-private String vmId;
-@JsonProperty("identity-url")
-private String identityUrl;
-
-@JsonProperty("vm-id")
-public String getVmId() {
-return vmId;
-}
-
-@JsonProperty("vm-id")
-public void setVmId(String vmId) {
-this.vmId = vmId;
-}
-
-@JsonProperty("identity-url")
-public String getIdentityUrl() {
-return identityUrl;
-}
-
-@JsonProperty("identity-url")
-public void setIdentityUrl(String identityUrl) {
-this.identityUrl = identityUrl;
-}
-
-}
\ No newline at end of file +package org.onap.so.bpmn.appc.payload.beans; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ +"vm-id", +"identity-url" +}) +public class SnapshotAction { + +@JsonProperty("vm-id") +private String vmId; +@JsonProperty("identity-url") +private String identityUrl; + +@JsonProperty("vm-id") +public String getVmId() { +return vmId; +} + +@JsonProperty("vm-id") +public void setVmId(String vmId) { +this.vmId = vmId; +} + +@JsonProperty("identity-url") +public String getIdentityUrl() { +return identityUrl; +} + +@JsonProperty("identity-url") +public void setIdentityUrl(String identityUrl) { +this.identityUrl = identityUrl; +} + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/StartStopAction.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/StartStopAction.java index 988c282076..f2b5b905a5 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/StartStopAction.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/StartStopAction.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,38 +18,28 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.appc.payload.beans;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
- " AICIdentity "
-})
-public class StartStopAction {
-
- @JsonProperty(" AICIdentity ")
- private String aICIdentity;
-
- @JsonProperty(" AICIdentity ")
- public String getAICIdentity() {
- return aICIdentity;
- }
-
- @JsonProperty(" AICIdentity ")
- public void setAICIdentity(String aICIdentity) {
- this.aICIdentity = aICIdentity;
- } +package org.onap.so.bpmn.appc.payload.beans; - public String getaICIdentity() { - return aICIdentity; - } +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ + " AICIdentity " +}) +public class StartStopAction { - public void setaICIdentity(String aICIdentity) { - this.aICIdentity = aICIdentity; + @JsonProperty(" AICIdentity ") + private String aicIdentity; + + @JsonProperty(" AICIdentity ") + public String getAicIdentity() { + return aicIdentity; } -
-}
\ No newline at end of file + @JsonProperty(" AICIdentity ") + public void setAicIdentity(String aicIdentity) { + this.aicIdentity = aicIdentity; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/UpgradeAction.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/UpgradeAction.java index 3486fa73ba..3e07f328ce 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/UpgradeAction.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/UpgradeAction.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,28 +18,28 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.appc.payload.beans;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
-"configuration-parameters"
-})
-public class UpgradeAction {
-
-@JsonProperty("configuration-parameters")
-private ConfigurationParametersUpgrade configurationParameters;
-
-@JsonProperty("configuration-parameters")
-public ConfigurationParametersUpgrade getConfigurationParameters() {
-return configurationParameters;
-}
-
-@JsonProperty("configuration-parameters")
-public void setConfigurationParameters(ConfigurationParametersUpgrade configurationParameters) {
-this.configurationParameters = configurationParameters;
-}
-}
\ No newline at end of file +package org.onap.so.bpmn.appc.payload.beans; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ +"configuration-parameters" +}) +public class UpgradeAction { + +@JsonProperty("configuration-parameters") +private ConfigurationParametersUpgrade configurationParameters; + +@JsonProperty("configuration-parameters") +public ConfigurationParametersUpgrade getConfigurationParameters() { +return configurationParameters; +} + +@JsonProperty("configuration-parameters") +public void setConfigurationParameters(ConfigurationParametersUpgrade configurationParameters) { +this.configurationParameters = configurationParameters; +} +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/ActionPreProcessor.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/ActionPreProcessor.java new file mode 100644 index 0000000000..19ab520c6c --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/ActionPreProcessor.java @@ -0,0 +1,45 @@ +/*- + * ============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.common; + + +import org.camunda.bpm.engine.delegate.DelegateExecution; + +/** + * interface to be extended by the classes, where pre processing is required + */ +public interface ActionPreProcessor { + + /** + * method to bind and return the action + * + * @return + */ + String getAction(); + + /** + * method to preform certain pre processing task before BB execution + * + * @param execution + * @return + */ + boolean process(DelegateExecution execution); +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResourceApplication.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/BuildingBlockExecution.java index 64e5adc091..a2f6637b5b 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResourceApplication.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/BuildingBlockExecution.java @@ -1,46 +1,37 @@ -/*-
- * ============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.common.workflow.service;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.ws.rs.ApplicationPath;
-import javax.ws.rs.core.Application;
-
-@ApplicationPath("/")
-public class WorkflowResourceApplication extends Application {
- private Set<Object> singletons = new HashSet<>();
- private Set<Class<?>> classes = new HashSet<>();
-
- public WorkflowResourceApplication() {
- }
-
- @Override
- public Set<Class<?>> getClasses() {
- return classes;
- }
-
- @Override
- public Set<Object> getSingletons() {
- return singletons;
- }
-}
+/*- + * ============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.common; + +import java.io.Serializable; +import java.util.Map; + +import org.onap.so.bpmn.common.exceptions.RequiredExecutionVariableExeception; +import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; + +public interface BuildingBlockExecution { + + public GeneralBuildingBlock getGeneralBuildingBlock(); + public <T> T getVariable(String key); + public <T> T getRequiredVariable(String key) throws RequiredExecutionVariableExeception; + public void setVariable(String key, Serializable value); + public Map<ResourceKey, String> getLookupMap(); +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/Status.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/DefaultToShortClassNameBeanNameGenerator.java index e9750a2b3b..5a126ffe7d 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/Status.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/DefaultToShortClassNameBeanNameGenerator.java @@ -18,23 +18,16 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.client.adapter.requests.db.entities; +package org.onap.so.bpmn.common; +import org.springframework.beans.factory.config.BeanDefinition; +import org.springframework.context.annotation.AnnotationBeanNameGenerator; +import org.springframework.util.ClassUtils; -/* - * Enum for Status values returned by API Handler to Tail-F -*/ -public enum Status { - PENDING, INPROGRESS, COMPLETED, FAILED, TIMEOUT; - - public boolean isFinished () { - switch (this) { - case COMPLETED: - case FAILED: - case TIMEOUT: - return true; - default: - return false; - } - } +public class DefaultToShortClassNameBeanNameGenerator extends AnnotationBeanNameGenerator { + + @Override + protected String buildDefaultBeanName(BeanDefinition definition) { + return ClassUtils.getShortName(definition.getBeanClassName()); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/DelegateExecutionImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/DelegateExecutionImpl.java new file mode 100644 index 0000000000..ef564c6af4 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/DelegateExecutionImpl.java @@ -0,0 +1,118 @@ +/*- + * ============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.common; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.onap.so.bpmn.common.exceptions.MalformedBuildingBlockInputException; +import org.onap.so.bpmn.common.exceptions.MissingBuildingBlockInputException; +import org.onap.so.bpmn.common.exceptions.RequiredExecutionVariableExeception; +import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; + +public class DelegateExecutionImpl implements BuildingBlockExecution, Serializable { + + private final Map<String, Serializable> seedMap; + private transient DelegateExecution execution; + private static final String INVALID_INPUT_MISSING = "Expected variable of \"%s\" not found in execution"; + private static final String INVALID_INPUT_CLASS_CAST = "Expected variable of \"%s\" was the wrong object type in the execution"; + + private static final String MISSING_MSG = "Execution variable \"gBBInput\" cannot be null when executing building blocks"; + private static final String MALFORMED_MSG = "Execution variable \"gBBInput\" must contain an element of type GeneralBuildingBlock"; + + public DelegateExecutionImpl(Map<String, Serializable> seedMap) { + this.seedMap = seedMap; + } + + public DelegateExecutionImpl(DelegateExecution execution) { + this.seedMap = new HashMap<>(); + execution.getVariables().forEach((key, value) -> { + if (value instanceof Serializable) { + seedMap.put(key, (Serializable)value); + } + }); + /* must occur for junit tests to work */ + this.execution = execution; + } + @Override + public GeneralBuildingBlock getGeneralBuildingBlock() { + try { + GeneralBuildingBlock generalBuildingBlock = (GeneralBuildingBlock) execution.getVariable("gBBInput"); + + if (generalBuildingBlock == null) { + throw new MissingBuildingBlockInputException(MISSING_MSG); + } + + return generalBuildingBlock; + } catch (ClassCastException e) { + throw new MalformedBuildingBlockInputException(MALFORMED_MSG, e); + } + } + + @Override + public <T> T getVariable(String key) { + return this.get(key); + } + + @Override + public <T> T getRequiredVariable(String key) throws RequiredExecutionVariableExeception { + final T result; + + result = this.get(key); + if (result == null) { + throw new RequiredExecutionVariableExeception(String.format(INVALID_INPUT_MISSING, key)); + + } + return result; + } + + @Override + public void setVariable(String key, Serializable value) { + this.execution.setVariable(key, value); + } + + @Override + public Map<ResourceKey, String> getLookupMap() { + return this.get("lookupKeyMap"); + } + + public DelegateExecution getDelegateExecution() { + return this.execution; + } + + public void setDelegateExecution(DelegateExecution execution) { + this.execution = execution; + this.seedMap.forEach((key, value) -> { + if (!execution.hasVariable(key)) { + execution.setVariable(key, value); + } + }); + } + + protected <T> T get(String key) { + final Object value = this.execution.getVariable(key); + + return (T)value; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/InjectExecution.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/InjectExecution.java new file mode 100644 index 0000000000..56b059ec16 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/InjectExecution.java @@ -0,0 +1,34 @@ +/*- + * ============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.common; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.springframework.stereotype.Component; + +@Component +public class InjectExecution { + + public DelegateExecutionImpl execute (DelegateExecution execution, DelegateExecutionImpl impl) { + + impl.setDelegateExecution(execution); + return impl; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/InjectionHelper.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/InjectionHelper.java new file mode 100644 index 0000000000..f1c2c8dda6 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/InjectionHelper.java @@ -0,0 +1,60 @@ +/*- + * ============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.common; + +import org.onap.so.client.aai.AAICommonObjectMapperProvider; +import org.onap.so.client.aai.AAIResourcesClient; +import org.onap.so.client.aai.entities.AAIResultWrapper; +import org.onap.so.client.sdno.SDNOValidator; +import org.onap.so.client.sdno.SDNOValidatorImpl; +import org.springframework.stereotype.Component; + +/* + * This object is intended to be a helper for acquiring classes + * that cannot be acquired via Spring injection. + * + * It brings two benefits: + * + * 1) Enforces acquisition of a new copy of these classes every + * time to help with picking up properties files changes, etc + * 2) The classes are exposed in such a way that mocks of them can + * still be injected when testing the Spring objects that use + * them + */ + +@Component +public class InjectionHelper { + public AAIResourcesClient getAaiClient() { + return new AAIResourcesClient(); + } + + public SDNOValidator getSdnoValidator() { + return new SDNOValidatorImpl(); + } + + public AAICommonObjectMapperProvider getAaiCommonObjectMapperProvider() { + return new AAICommonObjectMapperProvider(); + } + + public AAIResultWrapper getAaiResultWrapper(String json) { + return new AAIResultWrapper(json); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/SpringContextHelper.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/SpringContextHelper.java new file mode 100644 index 0000000000..edc544d939 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/SpringContextHelper.java @@ -0,0 +1,41 @@ +/*- + * ============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.common; + +import org.springframework.beans.BeansException; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.stereotype.Component; + +@Component +public class SpringContextHelper implements ApplicationContextAware { + + private static ApplicationContext context; + + @Override + public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { + context = applicationContext; + } + + public static ApplicationContext getAppContext() { + return context; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/exceptions/MalformedBuildingBlockInputException.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/exceptions/MalformedBuildingBlockInputException.java new file mode 100644 index 0000000000..1da989bfb7 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/exceptions/MalformedBuildingBlockInputException.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.common.exceptions; + +public class MalformedBuildingBlockInputException extends RuntimeException { + private static final long serialVersionUID = -9168146273898271648L; + + public MalformedBuildingBlockInputException() { + super(); + } + + public MalformedBuildingBlockInputException(String message) { + super(message); + } + + public MalformedBuildingBlockInputException(String message, Throwable cause) { + super(message, cause); + } + + public MalformedBuildingBlockInputException(Throwable cause) { + super(cause); + } + + protected MalformedBuildingBlockInputException(String message, Throwable cause, + boolean enableSuppression, + boolean writableStackTrace) { + super(message, cause, enableSuppression, writableStackTrace); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/exceptions/MissingBuildingBlockInputException.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/exceptions/MissingBuildingBlockInputException.java new file mode 100644 index 0000000000..5ad28a5ba0 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/exceptions/MissingBuildingBlockInputException.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.common.exceptions; + +public class MissingBuildingBlockInputException extends RuntimeException { + private static final long serialVersionUID = 7098084383189271401L; + + public MissingBuildingBlockInputException() { + super(); + } + + public MissingBuildingBlockInputException(String message) { + super(message); + } + + public MissingBuildingBlockInputException(String message, Throwable cause) { + super(message, cause); + } + + public MissingBuildingBlockInputException(Throwable cause) { + super(cause); + } + + protected MissingBuildingBlockInputException(String message, Throwable cause, + boolean enableSuppression, + boolean writableStackTrace) { + super(message, cause, enableSuppression, writableStackTrace); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/exceptions/RequiredExecutionVariableExeception.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/exceptions/RequiredExecutionVariableExeception.java new file mode 100644 index 0000000000..8c77bb445e --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/exceptions/RequiredExecutionVariableExeception.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.common.exceptions; + +public class RequiredExecutionVariableExeception extends Exception { + + private static final long serialVersionUID = 5135274986874563746L; + + public RequiredExecutionVariableExeception(String message) { + super(message); + } + + public RequiredExecutionVariableExeception(String message, Throwable t) { + super(message, t); + } + + public RequiredExecutionVariableExeception(Throwable t) { + super(t); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/BpmnIntegerParam.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnIntegerParam.java index 033c6876bd..80479e19c0 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/BpmnIntegerParam.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnIntegerParam.java @@ -17,7 +17,7 @@ * limitations under the License. * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.common.recipe; +package org.onap.so.bpmn.common.recipe; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/BpmnParam.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnParam.java index 4b58b51560..01285cd5ec 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/BpmnParam.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnParam.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.common.recipe; +package org.onap.so.bpmn.common.recipe; import com.fasterxml.jackson.annotation.JsonProperty; /** diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/BpmnRestClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnRestClient.java index 6a17d600cb..bbaebb64dc 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/BpmnRestClient.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnRestClient.java @@ -1,224 +1,205 @@ -/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2018 Huawei Technologies Co., Ltd. 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.common.recipe;
-
-import java.io.IOException;
-import java.security.GeneralSecurityException;
-
-import javax.xml.bind.DatatypeConverter;
-
-import org.apache.http.HttpResponse;
-import org.apache.http.client.ClientProtocolException;
-import org.apache.http.client.HttpClient;
-import org.apache.http.client.config.RequestConfig;
-import org.apache.http.client.methods.HttpPost;
-import org.apache.http.entity.StringEntity;
-import org.apache.http.impl.client.HttpClientBuilder;
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoLogger;
-import org.openecomp.mso.properties.MsoJavaProperties;
-import org.openecomp.mso.properties.MsoPropertiesFactory;
-import org.openecomp.mso.utils.CryptoUtils;
-
-/**
- * Support to call resource recipes from the BPMN workflow.
- * Such as call resource recipe in service workflow.
- * <br>
- * <p>
- * </p>
- *
- * @author
- * @version ONAP Beijing Release 2018-02-27
- */
-public class BpmnRestClient {
-
- public static final String DEFAULT_BPEL_AUTH = "admin:admin";
-
- public static final String ENCRYPTION_KEY = "aa3871669d893c7fb8abbcda31b88b4f";
-
- public static final String CONTENT_TYPE_JSON = "application/json";
-
- public static final String CAMUNDA_AUTH = "camundaAuth";
-
- private static final String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA";
-
- private static MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
-
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
-
- private static boolean noProperties = true;
-
- //because for NS it will take a long time the time out of the resouce will be 2 hours.
- private static final String DEFAULT_TIME_OUT = "7200";
-
- public synchronized static MsoJavaProperties loadMsoProperties() {
- MsoJavaProperties msoProperties;
- try {
- msoProperties = msoPropertiesFactory.getMsoJavaProperties(MSO_PROP_APIHANDLER_INFRA);
- } catch(Exception e) {
- msoLogger.error(MessageEnum.APIH_LOAD_PROPERTIES_FAIL, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.DataError,
- "Exception when loading MSO Properties", e);
- return null;
- }
-
- if(msoProperties != null && msoProperties.size() > 0) {
- noProperties = false;
- msoLogger.info(MessageEnum.APIH_PROPERTY_LOAD_SUC, "", "");
- return msoProperties;
- } else {
- msoLogger.error(MessageEnum.APIH_NO_PROPERTIES, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.DataError,
- "No MSO APIH_INFRA Properties found");
- return null;
- }
- }
-
- public synchronized static final boolean getNoPropertiesState() {
- return noProperties;
- }
-
- /**
- * post the recipe Uri
- * <br>
- *
- * @param recipeUri The request recipe uri
- * @param requestId the request id
- * @param recipeTimeout The recipe time out
- * @param requestAction The request action
- * @param serviceInstanceId The service instance id
- * @param serviceType The service Type
- * @param requestDetails The request Details, these information is from runtime
- * @param recipeParamXsd The recipe params, its from recipe design
- * @return The response of the recipe.
- * @throws ClientProtocolException
- * @throws IOException
- * @since ONAP Beijing Release
- */
- public static HttpResponse post(String recipeUri, String requestId, int recipeTimeout, String requestAction, String serviceInstanceId, String serviceType,
- String requestDetails, String recipeParamXsd) throws ClientProtocolException, IOException {
-
- HttpClient client = HttpClientBuilder.create().build();
-
- HttpPost post = new HttpPost(recipeUri);
- MsoJavaProperties props = loadMsoProperties();
- msoLogger.debug("call the bpmn, url:" + recipeUri);
- String jsonReq = wrapResourceRequest(requestId, recipeTimeout, requestAction, serviceInstanceId, serviceType, requestDetails, recipeParamXsd);
-
- StringEntity input = new StringEntity(jsonReq);
- input.setContentType(CONTENT_TYPE_JSON);
- String encryptedCredentials;
- if(props != null) {
- encryptedCredentials = props.getProperty(CAMUNDA_AUTH, null);
- if(encryptedCredentials != null) {
- String userCredentials = getEncryptedPropValue(encryptedCredentials, DEFAULT_BPEL_AUTH, ENCRYPTION_KEY);
- if(userCredentials != null) {
- post.addHeader("Authorization", "Basic " + DatatypeConverter.printBase64Binary(userCredentials.getBytes()));
- }
- }
- }
- post.setEntity(input);
- return client.execute(post);
- }
-
- /**
- * prepare the resource recipe bpmn request.
- * <br>
- *
- * @param requestId
- * @param recipeTimeout
- * @param requestAction
- * @param serviceInstanceId
- * @param serviceType
- * @param requestDetails
- * @param recipeParams
- * @return
- * @since ONAP Beijing Release
- */
- private static String wrapResourceRequest(String requestId, int recipeTimeout, String requestAction, String serviceInstanceId, String serviceType,
- String requestDetails, String recipeParams) {
- String jsonReq = null;
- if(requestId == null) {
- requestId = "";
- }
- if(requestAction == null) {
- requestAction = "";
- }
- if(serviceInstanceId == null) {
- serviceInstanceId = "";
- }
-
- if(requestDetails == null) {
- requestDetails = "";
- }
-
- try {
- ResourceRecipeRequest recipeRequest = new ResourceRecipeRequest();
- BpmnParam resourceInput = new BpmnParam();
- BpmnParam host = new BpmnParam();
- BpmnParam requestIdInput = new BpmnParam();
- BpmnParam requestActionInput = new BpmnParam();
- BpmnParam serviceInstanceIdInput = new BpmnParam();
- BpmnParam serviceTypeInput = new BpmnParam();
- BpmnParam recipeParamsInput = new BpmnParam();
- BpmnParam recipeTimeoutInput = new BpmnParam();
- recipeTimeoutInput.setValue(DEFAULT_TIME_OUT);
- // host.setValue(parseURL());
- requestIdInput.setValue(requestId);
- requestActionInput.setValue(requestAction);
- serviceInstanceIdInput.setValue(serviceInstanceId);
- serviceTypeInput.setValue(serviceType);
- recipeParamsInput.setValue(recipeParams);
- resourceInput.setValue(requestDetails);
- recipeRequest.setHost(host);
- recipeRequest.setRequestId(requestIdInput);
- recipeRequest.setRequestAction(requestActionInput);
- recipeRequest.setServiceInstanceId(serviceInstanceIdInput);
- recipeRequest.setServiceType(serviceTypeInput);
- recipeRequest.setRecipeParams(recipeParamsInput);
- recipeRequest.setResourceInput(resourceInput);
- recipeRequest.setRecipeTimeout(recipeTimeoutInput);
- jsonReq = recipeRequest.toString();
- msoLogger.debug("request body is " + jsonReq);
- } catch(Exception e) {
- msoLogger.error(MessageEnum.APIH_WARP_REQUEST, "Camunda", "wrapVIDRequest", MsoLogger.ErrorCode.BusinessProcesssError, "Error in APIH Warp request",
- e);
- }
- return jsonReq;
- }
-
- /**
- * <br>
- *
- * @param prop
- * @param defaultValue
- * @param encryptionKey
- * @return
- * @since ONAP Beijing Release
- */
- protected static String getEncryptedPropValue(String prop, String defaultValue, String encryptionKey) {
- try {
- return CryptoUtils.decrypt(prop, encryptionKey);
- } catch(GeneralSecurityException e) {
- msoLogger.debug("Security exception", e);
- }
- return defaultValue;
- }
-
-}
+/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Huawei Technologies Co., Ltd. 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.common.recipe; + +import java.io.IOException; +import java.security.GeneralSecurityException; + +import javax.xml.bind.DatatypeConverter; + +import org.apache.http.HttpResponse; +import org.apache.http.client.ClientProtocolException; +import org.apache.http.client.HttpClient; +import org.apache.http.client.config.RequestConfig; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.HttpClientBuilder; +import org.onap.so.bpmn.core.UrnPropertiesReader; +import org.onap.so.logger.MessageEnum; +import org.onap.so.logger.MsoLogger; +import org.onap.so.utils.CryptoUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * Support to call resource recipes from the BPMN workflow. + * Such as call resource recipe in service workflow. + * <br> + * <p> + * </p> + * + * @author + * @version ONAP Beijing Release 2018-02-27 + */ +@Component +public class BpmnRestClient { + + public static final String DEFAULT_BPEL_AUTH = "admin:admin"; + + public static final String ENCRYPTION_KEY = "aa3871669d893c7fb8abbcda31b88b4f"; + + public static final String CONTENT_TYPE_JSON = "application/json"; + + public static final String CAMUNDA_AUTH = "camundaAuth"; + + private static final String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA"; + @Autowired + private UrnPropertiesReader urnPropertiesReader; + private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, BpmnRestClient.class); + + private static boolean noProperties = true; + + //because for NS it will take a long time the time out of the resouce will be 2 hours. + private static final String DEFAULT_TIME_OUT = "7200"; + + public synchronized final boolean getNoPropertiesState() { + return noProperties; + } + + /** + * post the recipe Uri + * <br> + * + * @param recipeUri The request recipe uri + * @param requestId the request id + * @param recipeTimeout The recipe time out + * @param requestAction The request action + * @param serviceInstanceId The service instance id + * @param serviceType The service Type + * @param requestDetails The request Details, these information is from runtime + * @param recipeParamXsd The recipe params, its from recipe design + * @return The response of the recipe. + * @throws ClientProtocolException + * @throws IOException + * @since ONAP Beijing Release + */ + public HttpResponse post(String recipeUri, String requestId, int recipeTimeout, String requestAction, String serviceInstanceId, String serviceType, + String requestDetails, String recipeParamXsd) throws ClientProtocolException, IOException { + + HttpClient client = HttpClientBuilder.create().build(); + + HttpPost post = new HttpPost(recipeUri); + RequestConfig requestConfig = + RequestConfig.custom().setSocketTimeout(recipeTimeout).setConnectTimeout(recipeTimeout).setConnectionRequestTimeout(recipeTimeout).build(); + post.setConfig(requestConfig); + msoLogger.debug("call the bpmn, url:" + recipeUri); + String jsonReq = wrapResourceRequest(requestId, recipeTimeout, requestAction, serviceInstanceId, serviceType, requestDetails, recipeParamXsd); + + StringEntity input = new StringEntity(jsonReq); + input.setContentType(CONTENT_TYPE_JSON); + String encryptedCredentials; + encryptedCredentials = urnPropertiesReader.getVariable(CAMUNDA_AUTH); + if(encryptedCredentials != null) { + String userCredentials = getEncryptedPropValue(encryptedCredentials, DEFAULT_BPEL_AUTH, ENCRYPTION_KEY); + if(userCredentials != null) { + post.addHeader("Authorization", "Basic " + DatatypeConverter.printBase64Binary(userCredentials.getBytes())); + } + } + + post.setEntity(input); + return client.execute(post); + } + + /** + * prepare the resource recipe bpmn request. + * <br> + * + * @param requestId + * @param recipeTimeout + * @param requestAction + * @param serviceInstanceId + * @param serviceType + * @param requestDetails + * @param recipeParams + * @return + * @since ONAP Beijing Release + */ + private String wrapResourceRequest(String requestId, int recipeTimeout, String requestAction, String serviceInstanceId, String serviceType, + String requestDetails, String recipeParams) { + String jsonReq = null; + if(requestId == null) { + requestId = ""; + } + if(requestAction == null) { + requestAction = ""; + } + if(serviceInstanceId == null) { + serviceInstanceId = ""; + } + + if(requestDetails == null) { + requestDetails = ""; + } + + try { + ResourceRecipeRequest recipeRequest = new ResourceRecipeRequest(); + BpmnParam resourceInput = new BpmnParam(); + BpmnParam host = new BpmnParam(); + BpmnParam requestIdInput = new BpmnParam(); + BpmnParam requestActionInput = new BpmnParam(); + BpmnParam serviceInstanceIdInput = new BpmnParam(); + BpmnParam serviceTypeInput = new BpmnParam(); + BpmnParam recipeParamsInput = new BpmnParam(); + BpmnIntegerParam recipeTimeoutInput = new BpmnIntegerParam(); + recipeTimeoutInput.setValue(recipeTimeout); + // host.setValue(parseURL()); + requestIdInput.setValue(requestId); + requestActionInput.setValue(requestAction); + serviceInstanceIdInput.setValue(serviceInstanceId); + serviceTypeInput.setValue(serviceType); + recipeParamsInput.setValue(recipeParams); + resourceInput.setValue(requestDetails); + recipeRequest.setHost(host); + recipeRequest.setRequestId(requestIdInput); + recipeRequest.setRequestAction(requestActionInput); + recipeRequest.setServiceInstanceId(serviceInstanceIdInput); + recipeRequest.setServiceType(serviceTypeInput); + recipeRequest.setRecipeParams(recipeParamsInput); + recipeRequest.setResourceInput(resourceInput); + recipeRequest.setRecipeTimeout(recipeTimeoutInput); + jsonReq = recipeRequest.toString(); + msoLogger.trace("request body is " + jsonReq); + } catch(Exception e) { + msoLogger.error(MessageEnum.APIH_WARP_REQUEST, "Camunda", "wrapVIDRequest", MsoLogger.ErrorCode.BusinessProcesssError, "Error in APIH Warp request", + e); + } + return jsonReq; + } + + /** + * <br> + * + * @param prop + * @param defaultValue + * @param encryptionKey + * @return + * @since ONAP Beijing Release + */ + protected String getEncryptedPropValue(String prop, String defaultValue, String encryptionKey) { + try { + return CryptoUtils.decrypt(prop, encryptionKey); + } catch(GeneralSecurityException e) { + msoLogger.debug("Security exception", e); + } + return defaultValue; + } + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/ResourceInput.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/ResourceInput.java index 42547faa1e..4c345babc8 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/ResourceInput.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/ResourceInput.java @@ -17,10 +17,10 @@ * limitations under the License. * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.common.recipe; +package org.onap.so.bpmn.common.recipe; -import org.openecomp.mso.bpmn.core.domain.ModelInfo; -import org.openecomp.mso.logger.MsoLogger; +import org.onap.so.bpmn.core.domain.ModelInfo; +import org.onap.so.logger.MsoLogger; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; @@ -42,7 +42,7 @@ import com.fasterxml.jackson.databind.SerializationFeature; @JsonRootName("variables") public class ResourceInput { - private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL); + private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL, ResourceInput.class); @JsonProperty("resourceInstanceName") private String resourceInstanceName; diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/ResourceRecipeRequest.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/ResourceRecipeRequest.java index 3ec43e10ae..4c6edfa099 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/ResourceRecipeRequest.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/ResourceRecipeRequest.java @@ -18,9 +18,9 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.common.recipe; +package org.onap.so.bpmn.common.recipe; -import org.openecomp.mso.logger.MsoLogger; +import org.onap.so.logger.MsoLogger; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; @@ -37,7 +37,7 @@ import com.fasterxml.jackson.databind.SerializationFeature; @JsonRootName("variables") public class ResourceRecipeRequest { - private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL); + private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL, ResourceRecipeRequest.class); @JsonProperty("resourceInput") private BpmnParam resourceInput; @@ -61,7 +61,7 @@ public class ResourceRecipeRequest { private BpmnParam recipeParams; @JsonProperty("mso-service-request-timeout") - private BpmnParam recipeTimeout; + private BpmnIntegerParam recipeTimeout; @JsonProperty("resourceInput") public BpmnParam getResourceInput() { @@ -134,12 +134,12 @@ public class ResourceRecipeRequest { } @JsonProperty("mso-service-request-timeout") - public BpmnParam getRecipeTimeout() { + public BpmnIntegerParam getRecipeTimeout() { return recipeTimeout; } @JsonProperty("mso-service-request-timeout") - public void setRecipeTimeout(BpmnParam recipeTimeout) { + public void setRecipeTimeout(BpmnIntegerParam recipeTimeout) { this.recipeTimeout = recipeTimeout; } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/resource/ResourceRequestBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java index d1ec60a1cd..ca2da772fb 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/resource/ResourceRequestBuilder.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.common.resource; +package org.onap.so.bpmn.common.resource; import java.io.File; import java.io.IOException; @@ -30,11 +30,9 @@ import java.util.Map; import java.util.Optional; import javax.ws.rs.core.Response; +import javax.ws.rs.core.UriBuilder; import org.camunda.bpm.engine.runtime.Execution; -import org.jboss.resteasy.client.jaxrs.ResteasyClient; -import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder; -import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget; import org.onap.sdc.tosca.parser.api.ISdcCsarHelper; import org.onap.sdc.tosca.parser.exceptions.SdcToscaParserException; import org.onap.sdc.tosca.parser.impl.SdcToscaParserFactory; @@ -42,10 +40,12 @@ import org.onap.sdc.toscaparser.api.NodeTemplate; import org.onap.sdc.toscaparser.api.Property; import org.onap.sdc.toscaparser.api.functions.GetInput; import org.onap.sdc.toscaparser.api.parameters.Input; -import org.openecomp.mso.bpmn.core.PropertyConfiguration; -import org.openecomp.mso.bpmn.core.json.JsonUtils; -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoLogger; +import org.onap.so.bpmn.core.UrnPropertiesReader; +import org.onap.so.bpmn.core.json.JsonUtils; +import org.onap.so.client.HttpClient; +import org.onap.so.logger.MessageEnum; +import org.onap.so.logger.MsoLogger; +import org.onap.so.utils.TargetEntity; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; @@ -59,9 +59,8 @@ public class ResourceRequestBuilder { public static String SERVICE_URL_TOSCA_CSAR = "/v3/serviceToscaCsar?serviceModelUuid="; - private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); + private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, ResourceRequestBuilder.class); - static JsonUtils jsonUtil = new JsonUtils(); /** @@ -72,7 +71,7 @@ public class ResourceRequestBuilder { * "requestInputs":{K,V} * } * <br> - * + * * @param execution Execution context * @param serviceUuid The service template uuid * @param resourceCustomizationUuid The resource customization uuid @@ -82,7 +81,7 @@ public class ResourceRequestBuilder { */ @SuppressWarnings("unchecked") public static String buildResourceRequestParameters(Execution execution, String serviceUuid, String resourceCustomizationUuid, String serviceParameters) { - List<String> resourceList = jsonUtil.StringArrayToList(execution, (String)JsonUtils.getJsonValue(serviceParameters, "resources")); + List<String> resourceList = jsonUtil.StringArrayToList(execution, (String)JsonUtils.getJsonValue(serviceParameters, "resources")); //Get the right location str for resource. default is an empty array. String locationConstraints ="[]"; String resourceInputsFromUui = ""; @@ -127,6 +126,7 @@ public class ResourceRequestBuilder { throws SdcToscaParserException { Map<String, Object> resouceRequest = new HashMap<>(); + String csarpath = null; try { csarpath = getCsarFromUuid(serviceUuid); @@ -183,12 +183,10 @@ public class ResourceRequestBuilder { } private static String getCsarFromUuid(String uuid) throws Exception { - - ResteasyClient client = new ResteasyClientBuilder().build(); - Map<String, String> properties = PropertyConfiguration.getInstance().getProperties("mso.bpmn.urn.properties"); - String catalogEndPoint = properties.get("mso.catalog.db.endpoint"); - ResteasyWebTarget target = client.target(catalogEndPoint + SERVICE_URL_TOSCA_CSAR + uuid); - Response response = target.request().get(); + String catalogEndPoint = UrnPropertiesReader.getVariable("mso.catalog.db.endpoint"); + HttpClient client = new HttpClient(UriBuilder.fromUri(catalogEndPoint + SERVICE_URL_TOSCA_CSAR + uuid).build().toURL(), "application/json", TargetEntity.CATALOG_DB); + + Response response = client.get(); String value = response.readEntity(String.class); HashMap<String, String> map = new Gson().fromJson(value, new TypeToken<HashMap<String, String>>() {}.getType()); diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoHandler.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/CryptoHandler.java index 13cff65018..093dac39c3 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoHandler.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/CryptoHandler.java @@ -1,68 +1,68 @@ -/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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.common.util;
-import java.io.IOException;
-import java.security.GeneralSecurityException;
-import org.openecomp.mso.logger.MsoLogger;
-import java.util.Properties;
-
-public class CryptoHandler implements ICryptoHandler {
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
-
- private static String msoKey = "aa3871669d893c7fb8abbcda31b88b4f";
- private static String msoAaiEncryptedPwd;
-
- @Override
- public String getMsoAaiPassword() {
- Properties keyProp = new Properties ();
- try {
- keyProp.load (Thread.currentThread ().getContextClassLoader ().getResourceAsStream ("urn.properties"));
- msoAaiEncryptedPwd =(String) keyProp.get ("mso.AaiEncrypted.Pwd");
- return CryptoUtils.decrypt(msoAaiEncryptedPwd, msoKey);
- } catch (GeneralSecurityException | IOException e) {
- LOGGER.debug("GeneralSecurityException :",e);
- return null;
- }
- }
-
-
- @Override
- public String encryptMsoPassword(String plainMsoPwd) {
- try {
- return CryptoUtils.encrypt(plainMsoPwd, msoKey);
- } catch (GeneralSecurityException e) {
- LOGGER.debug("GeneralSecurityException :",e);
- return null;
- }
- }
-
- @Override
- public String decryptMsoPassword(String encryptedPwd) {
- try {
- return CryptoUtils.decrypt(encryptedPwd, msoKey);
- } catch (GeneralSecurityException e) {
- LOGGER.debug("GeneralSecurityException :",e);
- return null;
- }
- }
-
-}
+/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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.common.util; +import java.io.IOException; +import java.security.GeneralSecurityException; +import java.util.Properties; +import org.onap.so.utils.CryptoUtils; + +import org.onap.so.logger.MsoLogger; + +public class CryptoHandler implements ICryptoHandler { + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CryptoHandler.class); + private static final String GENERAL_SECURITY_EXCEPTION_PREFIX = "GeneralSecurityException :"; + private static final String MSO_KEY = "aa3871669d893c7fb8abbcda31b88b4f"; + private static final String PROPERTY_KEY = "mso.AaiEncrypted.Pwd"; + + @Override + public String getMsoAaiPassword() { + Properties keyProp = new Properties (); + try { + keyProp.load (Thread.currentThread ().getContextClassLoader ().getResourceAsStream ("urn.properties")); + return CryptoUtils.decrypt((String) keyProp.get(PROPERTY_KEY), MSO_KEY); + } catch (GeneralSecurityException | IOException e) { + LOGGER.error(GENERAL_SECURITY_EXCEPTION_PREFIX + e.getMessage(), e); + return null; + } + } + + + @Override + public String encryptMsoPassword(String plainMsoPwd) { + try { + return CryptoUtils.encrypt(plainMsoPwd, MSO_KEY); + } catch (GeneralSecurityException e) { + LOGGER.error(GENERAL_SECURITY_EXCEPTION_PREFIX + e.getMessage(), e); + return null; + } + } + + @Override + public String decryptMsoPassword(String encryptedPwd) { + try { + return CryptoUtils.decrypt(encryptedPwd, MSO_KEY); + } catch (GeneralSecurityException e) { + LOGGER.error(GENERAL_SECURITY_EXCEPTION_PREFIX + e.getMessage(), e); + return null; + } + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/ICryptoHandler.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/ICryptoHandler.java index acf92f5aa8..6314a849d2 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/ICryptoHandler.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/ICryptoHandler.java @@ -1,27 +1,27 @@ -/*-
- * ============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.common.util;
-
-public interface ICryptoHandler {
- public String getMsoAaiPassword();
- public String encryptMsoPassword(String plainPwd);
- public String decryptMsoPassword(String encryptedPwd);
-}
+/*- + * ============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.common.util; + +public interface ICryptoHandler { + public String getMsoAaiPassword(); + public String encryptMsoPassword(String plainPwd); + public String decryptMsoPassword(String encryptedPwd); +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowCallbackResponse.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowCallbackResponse.java index 25669d7625..13d2126805 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowCallbackResponse.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowCallbackResponse.java @@ -1,52 +1,52 @@ -/*-
- * ============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.common.workflow.service;
-
-/**
- * @version 1.0
- * Workflow Response bean to generate workflow response in JSON format
- */
-public class WorkflowCallbackResponse {
-
- private String response;
- private int statusCode;
- private String message;
-
- public String getResponse() {
- return response;
- }
- public void setResponse(String response) {
- this.response = response;
- }
- public int getStatusCode() {
- return statusCode;
- }
- public void setStatusCode(int statusCode) {
- this.statusCode = statusCode;
- }
- public String getMessage() {
- return message;
- }
- public void setMessage(String message) {
- this.message = message;
- }
-
-}
+/*- + * ============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.common.workflow.context; + + +/** + * @version 1.0 + * Workflow Response bean to generate workflow response in JSON format + */ +public class WorkflowCallbackResponse { + + private String response; + private int statusCode; + private String message; + + public String getResponse() { + return response; + } + public void setResponse(String response) { + this.response = response; + } + public int getStatusCode() { + return statusCode; + } + public void setStatusCode(int statusCode) { + this.statusCode = statusCode; + } + public String getMessage() { + return message; + } + public void setMessage(String message) { + this.message = message; + } + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowContext.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContext.java index fc0ba44974..3ec7773791 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowContext.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContext.java @@ -1,96 +1,98 @@ -/*-
- * ============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.common.workflow.service;
-
-import java.util.concurrent.Delayed;
-import java.util.concurrent.TimeUnit;
-
-import org.jboss.resteasy.spi.AsynchronousResponse;
-
-/**
- * @version 1.0
- * Workflow context object used to send timeout response, if workflow instance does not write the response in time
- */
-public class WorkflowContext implements Delayed {
- private final String processKey;
- private final String requestId;
- private final AsynchronousResponse asynchronousResponse;
- private final long startTime;
- private final long timeout;
-
- public WorkflowContext(String processKey, String requestId,
- AsynchronousResponse asynchronousResponse, long timeout) {
- this.processKey = processKey;
- this.requestId = requestId;
- this.asynchronousResponse = asynchronousResponse;
- this.timeout = timeout;
- this.startTime = System.currentTimeMillis();
- }
-
- public String getRequestId() {
- return requestId;
- }
-
- public String getProcessKey() {
- return processKey;
- }
-
- public AsynchronousResponse getAsynchronousResponse() {
- return asynchronousResponse;
- }
-
- public long getTimeout() {
- return timeout;
- }
-
- public long getStartTime() {
- return startTime;
- }
-
- /**
- * Required implementation by Delay queue
- * Returns the elapsed time for this context
- */
- @Override
- public long getDelay(TimeUnit unit) {
- // 0 or negative means this object is considered to be expired
- return unit.convert(startTime + timeout - System.currentTimeMillis(), unit);
- }
-
- /**
- * Required implementation by Delay queue
- * Compares the object to determine whether the object can be marked as expired
- */
- @Override
- public int compareTo(Delayed object) {
- WorkflowContext that = (WorkflowContext) object;
- long thisEndTime = startTime + timeout;
- long thatEndTime = that.startTime + that.timeout;
-
- if (thisEndTime < thatEndTime) {
- return -1;
- } else if (thisEndTime > thatEndTime) {
- return 1;
- } else {
- return 0;
- }
- }
-}
+package org.onap.so.bpmn.common.workflow.context; +/*- + * ============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========================================================= + */ + + + +import java.util.concurrent.Delayed; +import java.util.concurrent.TimeUnit; + + +/** + * @version 1.0 + * Workflow context object used to send timeout response, if workflow instance does not write the response in time + */ +public class WorkflowContext implements Delayed { + private final String processKey; + private final String requestId; + + private final long startTime; + private final long timeout; + + private final WorkflowResponse workflowResponse; + + public WorkflowContext(String processKey, String requestId, long timeout, WorkflowResponse workflowResponse) { + this.processKey = processKey; + this.requestId = requestId; + this.timeout = timeout; + this.startTime = System.currentTimeMillis(); + this.workflowResponse = workflowResponse; + } + + public String getRequestId() { + return requestId; + } + + public String getProcessKey() { + return processKey; + } + + + public long getTimeout() { + return timeout; + } + + public long getStartTime() { + return startTime; + } + + public WorkflowResponse getWorkflowResponse() { + return workflowResponse; + } + + /** + * Required implementation by Delay queue + * Returns the elapsed time for this context + */ + @Override + public long getDelay(TimeUnit unit) { + // 0 or negative means this object is considered to be expired + return unit.convert(startTime + timeout - System.currentTimeMillis(), unit); + } + + /** + * Required implementation by Delay queue + * Compares the object to determine whether the object can be marked as expired + */ + @Override + public int compareTo(Delayed object) { + WorkflowContext that = (WorkflowContext) object; + long thisEndTime = startTime + timeout; + long thatEndTime = that.startTime + that.timeout; + + if (thisEndTime < thatEndTime) { + return -1; + } else if (thisEndTime > thatEndTime) { + return 1; + } else { + return 0; + } + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowContextHolder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContextHolder.java index 4dfae8b2a3..39c32de77d 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowContextHolder.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContextHolder.java @@ -1,3 +1,4 @@ +package org.onap.so.bpmn.common.workflow.context; /*- * ============LICENSE_START======================================================= * ONAP - SO @@ -18,29 +19,30 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.common.workflow.service; + import java.util.concurrent.DelayQueue; import java.util.concurrent.TimeUnit; -import javax.ws.rs.core.Response; - -import org.jboss.resteasy.spi.AsynchronousResponse; -import org.slf4j.MDC; - -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoLogger; +import org.onap.so.logger.MessageEnum; +import org.onap.so.logger.MsoLogger; +import org.springframework.stereotype.Component; /** * Workflow Context Holder instance which can be accessed elsewhere either in groovy scripts or Java * @version 1.0 * */ + +@Component public class WorkflowContextHolder { - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); + private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,WorkflowContextHolder.class); private static final String logMarker = "[WORKFLOW-CONTEXT-HOLDER]"; private static WorkflowContextHolder instance = null; + + + private long defaultContextTimeout=60000; /** * Delay Queue which holds workflow context holder objects @@ -97,70 +99,34 @@ public class WorkflowContextHolder { * @param callbackResponse * @return */ - public Response processCallback(String processKey, String processInstanceId, - String requestId, WorkflowCallbackResponse callbackResponse) { + public void processCallback(String processKey, String processInstanceId, + String requestId, WorkflowCallbackResponse callbackResponse) { WorkflowResponse workflowResponse = new WorkflowResponse(); - WorkflowContext workflowContext = getWorkflowContext(requestId); - - if (workflowContext == null) { - msoLogger.debug("Unable to correlate workflow context for request id: " + requestId - + ":processInstance Id:" + processInstanceId - + ":process key:" + processKey); - workflowResponse.setMessage("Fail"); - workflowResponse.setMessageCode(400); - workflowResponse.setContent("Unable to correlate workflow context, bad request. Request Id: " + requestId); - return Response.serverError().entity(workflowResponse).build(); - } - - responseQueue.remove(workflowContext); - - msoLogger.debug("Using callback response for request id: " + requestId); - workflowResponse.setContent(callbackResponse.getResponse()); - workflowResponse.setProcessInstanceId(processInstanceId); + workflowResponse.setResponse(callbackResponse.getResponse()); + workflowResponse.setProcessInstanceID(processInstanceId); workflowResponse.setMessageCode(callbackResponse.getStatusCode()); workflowResponse.setMessage(callbackResponse.getMessage()); - sendWorkflowResponseToClient(processKey, workflowContext, workflowResponse); - return Response.ok().entity(workflowResponse).build(); - } - - /** - * Send the response to client asynchronously when invoked by the BPMN process - * @param processKey - * @param workflowContext - * @param workflowResponse - */ - private void sendWorkflowResponseToClient(String processKey, WorkflowContext workflowContext, - WorkflowResponse workflowResponse) { - msoLogger.debug(logMarker + "Sending the response for request id: " + workflowContext.getRequestId()); - recordEvents(processKey, workflowResponse, workflowContext.getStartTime()); - Response response = Response.status(workflowResponse.getMessageCode()).entity(workflowResponse).build(); - AsynchronousResponse asyncResp = workflowContext.getAsynchronousResponse(); - asyncResp.setResponse(response); + WorkflowContext context = new WorkflowContext(processKey, requestId, defaultContextTimeout,workflowResponse); + put(context); } + /** * Timeout thread which monitors the delay queue for expired context and send timeout response * to client - *git review -R + * * */ private class TimeoutThread extends Thread { + @Override public void run() { while (!isInterrupted()) { try { WorkflowContext requestObject = responseQueue.take(); + MsoLogger.setLogContext(requestObject.getRequestId(), null); msoLogger.debug("Time remaining for request id: " + requestObject.getRequestId() + ":" + requestObject.getDelay(TimeUnit.MILLISECONDS)); msoLogger.debug("Preparing timeout response for " + requestObject.getProcessKey() + ":" + ":" + requestObject.getRequestId()); - WorkflowResponse response = new WorkflowResponse(); - response.setMessage("Fail"); - response.setContent("Request timedout, request id:" + requestObject.getRequestId()); - //response.setProcessInstanceID(requestObject.getProcessInstance().getProcessInstanceId()); - recordEvents(requestObject.getProcessKey(), response, requestObject.getStartTime()); - response.setMessageCode(500); - Response result = Response.status(500).entity(response).build(); - requestObject.getAsynchronousResponse().setResponse(result); - msoLogger.debug("Sending timeout response for request id:" + requestObject.getRequestId() + ":response:" + response); } catch (InterruptedException e) { - break; + Thread.currentThread().interrupt(); } catch (Exception e) { msoLogger.debug("WorkflowContextHolder timeout thread caught exception: " + e); msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(), @@ -168,21 +134,7 @@ public class WorkflowContextHolder { } } - msoLogger.debug("WorkflowContextHolder timeout thread interrupted, quitting"); } } - - private static void recordEvents(String processKey, WorkflowResponse response, - long startTime) { - - msoLogger.recordMetricEvent ( startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, - logMarker + response.getMessage() + " for processKey: " - + processKey + " with content: " + response.getContent(), "BPMN", MDC.get(processKey), null); - - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, logMarker - + response.getMessage() + " for processKey: " - + processKey + " with content: " + response.getContent()); - - } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResponse.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowResponse.java index 02702e3b3c..f5aa0b33c6 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResponse.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowResponse.java @@ -1,97 +1,78 @@ -/*-
- * ============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.common.workflow.service;
-
-import java.util.Map;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-/**
- * A synchronous response from a workflow.
- */
-public class WorkflowResponse {
-
- @JsonProperty("processInstanceId")
- private String processInstanceId;
-
- @JsonProperty("messageCode")
- private int messageCode;
-
- @JsonProperty("message")
- private String message;
-
- @JsonProperty("variables")
- private Map<String,String> variables;
-
- @JsonProperty("content")
- private String content;
-
- public String getProcessInstanceId() {
- return processInstanceId;
- }
-
- public void setProcessInstanceId(String processInstanceId) {
- this.processInstanceId = processInstanceId;
- }
-
- public int getMessageCode() {
- return messageCode;
- }
-
- public void setMessageCode(int messageCode) {
- this.messageCode = messageCode;
- }
-
- public String getMessage() {
- return message;
- }
-
- public void setMessage(String message) {
- this.message = message;
- }
-
- public Map<String,String> getVariables() {
- return variables;
- }
-
- public void setVariables(Map<String,String> variables) {
- this.variables = variables;
- }
-
- public String getContent() {
- return content;
- }
-
- public void setContent(String content) {
- this.content = content;
- }
-
- @Override
- public String toString() {
- return getClass().getSimpleName() + "["
- + "processInstanceId=" + processInstanceId
- + ",messageCode=" + messageCode
- + ",message=" + message
- + ",variables=" + variables
- + ",content=" + content
- + "]";
- }
-}
\ No newline at end of file +/*- + * ============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.common.workflow.context; + +import java.util.Map; + +/** + * @version 1.0 + * Synchronous workflow response bean + * + */ + +public class WorkflowResponse { + + private String response; + private String message; + private String processInstanceID; + private Map<String,String> variables; + private int messageCode; + + public String getResponse() { + return response; + } + public void setResponse(String response) { + this.response = response; + } + public String getMessage() { + return message; + } + public void setMessage(String message) { + this.message = message; + } + public String getProcessInstanceID() { + return processInstanceID; + } + public void setProcessInstanceID(String pID) { + this.processInstanceID = pID; + } + public Map<String, String> getVariables() { + return variables; + } + public void setVariables(Map<String, String> variables) { + this.variables = variables; + } + public void setMessageCode(int messageCode) { + this.messageCode = messageCode; + } + + public int getMessageCode() { + return messageCode; + } + + @Override + public String toString() { + return "WorkflowResponse [response=" + response + ", message=" + message + ", processInstanceID=" + + processInstanceID + ", variables=" + variables + ", messageCode=" + messageCode + "]"; + } + + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/MsoRequestsDbExceptionBean.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/Metadata.java index f566418ade..1f83c3135e 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/MsoRequestsDbExceptionBean.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/Metadata.java @@ -18,31 +18,23 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.client.adapter.requests.db.entities; - +package org.onap.so.bpmn.servicedecomposition; import java.io.Serializable; - -/** - * Jax-WS Fault Bean for MsoRequestsDB Exception - */ -public class MsoRequestsDbExceptionBean implements Serializable { - - private static final long serialVersionUID = 1360000062602372639L; - - private String message; - - public MsoRequestsDbExceptionBean () {} - - public MsoRequestsDbExceptionBean (String message) { - this.message = message; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } +import java.util.ArrayList; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Metadatum; + +public class Metadata implements Serializable{ + + private static final long serialVersionUID = 4981393122007858950L; + + @JsonProperty("metadatum") + private List<Metadatum> metadatum = new ArrayList<Metadatum>(); + + public List<Metadatum> getMetadatum() { + return metadatum; + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/ShallowCopy.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/ShallowCopy.java new file mode 100644 index 0000000000..1263e7ba7c --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/ShallowCopy.java @@ -0,0 +1,48 @@ +/*- + * ============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.servicedecomposition; + +import com.fasterxml.jackson.databind.ObjectMapper; + +import javax.persistence.Id; +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +public interface ShallowCopy<T> { + default T shallowCopyId() { + try { + T obj = (T) this.getClass().newInstance(); + for (Field field : this.getClass().getDeclaredFields()) { + if (field.isAnnotationPresent(Id.class)) { + String fieldName = Character.toUpperCase(field.getName().charAt(0)) + field.getName().substring(1); + Method setter = this.getClass().getMethod("set" + fieldName, field.getType()); + Method getter = this.getClass().getMethod("get" + fieldName, null); + setter.invoke(obj, getter.invoke(this, null)); + } + } + return obj; + }catch(Exception e){ + throw new RuntimeException(e); + } + + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/AllottedResource.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/AllottedResource.java new file mode 100644 index 0000000000..775d80db75 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/AllottedResource.java @@ -0,0 +1,129 @@ +/*- + * ============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.servicedecomposition.bbobjects; + +import java.io.Serializable; + +import javax.persistence.Id; + +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; +import org.onap.so.bpmn.servicedecomposition.homingobjects.SolutionCandidates; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoAllottedResource; +import org.onap.so.db.catalog.beans.OrchestrationStatus; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.commons.lang3.builder.EqualsBuilder; + +@JsonRootName("allotted-resource") +public class AllottedResource extends SolutionCandidates implements Serializable, ShallowCopy<AllottedResource> { + + private static final long serialVersionUID = 8674239064804424306L; + + @Id + @JsonProperty("id") + private String id; + @JsonProperty("target-network-role") + private String targetNetworkRole; + @JsonProperty("self-link") + private String selflink; + @JsonProperty("orchestration-status") + private OrchestrationStatus orchestrationStatus; + @JsonProperty("operational-status") + private String operationalStatus; + @JsonProperty("type") + private String type; + @JsonProperty("role") + private String role; + @JsonProperty("model-info-allotted-resource") + private ModelInfoAllottedResource modelInfoAllottedResource; + @JsonProperty("service-instance") + private ServiceInstance parentServiceInstance; + + public ModelInfoAllottedResource getModelInfoAllottedResource() { + return modelInfoAllottedResource; + } + public void setModelInfoAllottedResource(ModelInfoAllottedResource modelInfoAllottedResource) { + this.modelInfoAllottedResource = modelInfoAllottedResource; + } + public String getId() { + return id; + } + public void setId(String id) { + this.id = id; + } + public String getTargetNetworkRole() { + return targetNetworkRole; + } + public void setTargetNetworkRole(String targetNetworkRole) { + this.targetNetworkRole = targetNetworkRole; + } + public String getSelflink() { + return selflink; + } + public void setSelflink(String selflink) { + this.selflink = selflink; + } + public String getOperationalStatus() { + return operationalStatus; + } + public void setOperationalStatus(String operationalStatus) { + this.operationalStatus = operationalStatus; + } + public OrchestrationStatus getOrchestrationStatus() { + return orchestrationStatus; + } + public void setOrchestrationStatus(OrchestrationStatus orchestrationStatus) { + this.orchestrationStatus = orchestrationStatus; + } + public String getType() { + return type; + } + public void setType(String type) { + this.type = type; + } + public String getRole() { + return role; + } + public void setRole(String role) { + this.role = role; + } + public ServiceInstance getParentServiceInstance() { + return parentServiceInstance; + } + public void setParentServiceInstance(ServiceInstance parentServiceInstance) { + this.parentServiceInstance = parentServiceInstance; + } + @Override + public boolean equals(final Object other) { + if (!(other instanceof AllottedResource)) { + return false; + } + AllottedResource castOther = (AllottedResource) other; + return new EqualsBuilder().append(id, castOther.id).isEquals(); + } + @Override + public int hashCode() { + return new HashCodeBuilder().append(id).toHashCode(); + } + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/CloudRegion.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/CloudRegion.java new file mode 100644 index 0000000000..f39253e6aa --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/CloudRegion.java @@ -0,0 +1,104 @@ +/*- + * ============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.servicedecomposition.bbobjects; + +import java.io.Serializable; + +import javax.persistence.Id; + +import com.fasterxml.jackson.annotation.JsonProperty; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; + +public class CloudRegion implements Serializable, ShallowCopy<CloudRegion> { + + private static final long serialVersionUID = 680593168655326021L; + + @Id + @JsonProperty("lcp-cloud-region-id") + private String lcpCloudRegionId; + @Id + @JsonProperty("cloud-owner") + private String cloudOwner; + @JsonProperty("tenant-id") + private String tenantId; + @JsonProperty("complex") + private String complex; + @JsonProperty("cloud-region-version") + private String cloudRegionVersion; + + public String getLcpCloudRegionId() { + return lcpCloudRegionId; + } + public void setLcpCloudRegionId(String lcpCloudRegionId) { + this.lcpCloudRegionId = lcpCloudRegionId; + } + public String getTenantId() { + return tenantId; + } + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + public String getCloudOwner() { + return cloudOwner; + } + public void setCloudOwner(String cloudOwner) { + this.cloudOwner = cloudOwner; + } + /** + * i.e. aic version + */ + public String getCloudRegionVersion() { + return cloudRegionVersion; + } + /** + * i.e. aic version + */ + public void setCloudRegionVersion(String cloudRegionVersion) { + this.cloudRegionVersion = cloudRegionVersion; + } + /** + * i.e. aic clli, physical location id, site id + */ + public String getComplex() { + return complex; + } + /** + * i.e. aic clli, physical location id, site id + */ + public void setComplex(String complex) { + this.complex = complex; + } + @Override + public boolean equals(final Object other) { + if (!(other instanceof CloudRegion)) { + return false; + } + CloudRegion castOther = (CloudRegion) other; + return new EqualsBuilder().append(lcpCloudRegionId, castOther.lcpCloudRegionId) + .append(cloudOwner, castOther.cloudOwner).isEquals(); + } + @Override + public int hashCode() { + return new HashCodeBuilder().append(lcpCloudRegionId).append(cloudOwner).toHashCode(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Collection.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Collection.java new file mode 100644 index 0000000000..6bbdb1ed67 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Collection.java @@ -0,0 +1,97 @@ +/*- + * ============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.servicedecomposition.bbobjects; + +import java.io.Serializable; +import javax.persistence.Id; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoCollection; +import org.onap.so.db.catalog.beans.OrchestrationStatus; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; + + +@JsonRootName("collection") +public class Collection implements Serializable, ShallowCopy<Collection> { + + private static final long serialVersionUID = 6389915895863066288L; + + @Id + @JsonProperty("id") + private String id; + @JsonProperty("model-info-collection") + private ModelInfoCollection modelInfoCollection; + @JsonProperty("instance-group") + private InstanceGroup instanceGroup; + @JsonProperty("orchestration-status") + private OrchestrationStatus orchestrationStatus; + @JsonProperty("name") + private String name; + + public String getId() { + return id; + } + public void setId(String id) { + this.id = id; + } + public ModelInfoCollection getModelInfoCollection() { + return modelInfoCollection; + } + public void setModelInfoCollection(ModelInfoCollection modelInfoCollection) { + this.modelInfoCollection = modelInfoCollection; + } + public InstanceGroup getInstanceGroup() { + return instanceGroup; + } + public void setInstanceGroup(InstanceGroup instanceGroup) { + this.instanceGroup = instanceGroup; + } + public OrchestrationStatus getOrchestrationStatus() { + return orchestrationStatus; + } + public void setOrchestrationStatus(OrchestrationStatus orchestrationStatus) { + this.orchestrationStatus = orchestrationStatus; + } + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + @Override + public boolean equals(final Object other) { + if (!(other instanceof Collection)) { + return false; + } + Collection castOther = (Collection) other; + return new EqualsBuilder().append(id, castOther.id).isEquals(); + } + @Override + public int hashCode() { + return new HashCodeBuilder().append(id).toHashCode(); + } + + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Configuration.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Configuration.java new file mode 100644 index 0000000000..bcff93c5af --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Configuration.java @@ -0,0 +1,230 @@ +/*- + * ============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.servicedecomposition.bbobjects; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.Metadata; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoConfiguration; +import org.onap.so.db.catalog.beans.OrchestrationStatus; + +import javax.persistence.Id; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; + +@JsonRootName("configuration") +public class Configuration implements Serializable, ShallowCopy<Configuration> { + private static final long serialVersionUID = 4525487672816730299L; + + @Id + @JsonProperty("configuration-id") + private String configurationId; + @JsonProperty("orchestration-status") + private OrchestrationStatus orchestrationStatus; + @JsonProperty("tunnel-bandwidth") + private String tunnelBandwidth; + @JsonProperty("vendor-allowed-max-bandwidth") + private String vendorAllowedMaxBandwidth; + @JsonProperty("management-option") + private String managementOption; + @JsonProperty("configuration-name") + private String configurationName; + @JsonProperty("configuration-type") + private String configurationType; + @JsonProperty("configuration-sub-type") + private String configurationSubType; + @JsonProperty("operational-status") + private String operationalStatus; + @JsonProperty("configuration-selflink") + private String configurationSelflink; + @JsonProperty("metadata") + private Metadata metadata; + @JsonProperty("forwarder-evcs") + private List<ForwarderEvc> forwarderEvcs = new ArrayList<ForwarderEvc>(); + @JsonProperty("evcs") + private List<Evc> evcs = new ArrayList<Evc>(); + @JsonProperty("model-info-configuration") + private ModelInfoConfiguration modelInfoConfiguration; + + @JsonProperty("related-configuration") + private Configuration relatedConfiguration; + + @JsonProperty("l3-network") + private L3Network network; + + @JsonProperty("l-interface") + private LInterface lInterface; + + public ModelInfoConfiguration getModelInfoConfiguration() { + return modelInfoConfiguration; + } + + public void setModelInfoConfiguration(ModelInfoConfiguration modelInfoConfiguration) { + this.modelInfoConfiguration = modelInfoConfiguration; + } + + public List<ForwarderEvc> getForwarderEvcs() { + return forwarderEvcs; + } + + public List<Evc> getEvcs() { + return evcs; + } + + public String getConfigurationId() { + return configurationId; + } + + public void setConfigurationId(String configurationId) { + this.configurationId = configurationId; + } + + public String getManagementOption() { + return managementOption; + } + + public void setManagementOption(String managementOption) { + this.managementOption = managementOption; + } + + public String getConfigurationName() { + return configurationName; + } + + public void setConfigurationName(String configurationName) { + this.configurationName = configurationName; + } + + public String getConfigurationType() { + return configurationType; + } + + public void setConfigurationType(String configurationType) { + this.configurationType = configurationType; + } + + public String getConfigurationSubType() { + return configurationSubType; + } + + public void setConfigurationSubType(String configurationSubType) { + this.configurationSubType = configurationSubType; + } + + public String getOperationalStatus() { + return operationalStatus; + } + + public void setOperationalStatus(String operationalStatus) { + this.operationalStatus = operationalStatus; + } + + public String getConfigurationSelflink() { + return configurationSelflink; + } + + public void setConfigurationSelflink(String configurationSelflink) { + this.configurationSelflink = configurationSelflink; + } + + public OrchestrationStatus getOrchestrationStatus() { + return orchestrationStatus; + } + + public void setOrchestrationStatus(OrchestrationStatus orchestrationStatus) { + this.orchestrationStatus = orchestrationStatus; + } + + public String getTunnelBandwidth() { + return tunnelBandwidth; + } + + public void setTunnelBandwidth(String tunnelBandwidth) { + this.tunnelBandwidth = tunnelBandwidth; + } + + public String getVendorAllowedMaxBandwidth() { + return vendorAllowedMaxBandwidth; + } + + public void setVendorAllowedMaxBandwidth(String vendorAllowedMaxBandwidth) { + this.vendorAllowedMaxBandwidth = vendorAllowedMaxBandwidth; + } + + public Metadata getMetadata() { + return metadata; + } + + public void setMetadata(Metadata metadata) { + this.metadata = metadata; + } + + public Configuration getRelatedConfiguration() { + return relatedConfiguration; + } + + public void setRelatedConfiguration(Configuration relatedConfiguration) { + this.relatedConfiguration = relatedConfiguration; + } + + public void setForwarderEvcs(List<ForwarderEvc> forwarderEvcs) { + this.forwarderEvcs = forwarderEvcs; + } + + public void setEvcs(List<Evc> evcs) { + this.evcs = evcs; + } + + public L3Network getNetwork() { + return network; + } + + public void setNetwork(L3Network network) { + this.network = network; + } + + public LInterface getlInterface() { + return lInterface; + } + + public void setlInterface(LInterface lInterface) { + this.lInterface = lInterface; + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof Configuration)) { + return false; + } + Configuration castOther = (Configuration) other; + return new EqualsBuilder().append(configurationId, castOther.configurationId).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(configurationId).toHashCode(); + } + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/CtagAssignment.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/CtagAssignment.java new file mode 100644 index 0000000000..937c79be1d --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/CtagAssignment.java @@ -0,0 +1,65 @@ +/*- + * ============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.servicedecomposition.bbobjects; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; + +import javax.persistence.Id; + +@JsonRootName("ctag-assignment") +public class CtagAssignment implements Serializable, ShallowCopy<CtagAssignment> { + + private static final long serialVersionUID = 2314290576523243571L; + + @Id + @JsonProperty("vlan-id-inner") + private long vlanIdInner; + + public long getVlanIdInner() { + return vlanIdInner; + } + + public void setVlanIdInner(long vlanIdInner) { + this.vlanIdInner = vlanIdInner; + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof CtagAssignment)) { + return false; + } + CtagAssignment castOther = (CtagAssignment) other; + return new EqualsBuilder().append(vlanIdInner, castOther.vlanIdInner).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(vlanIdInner).toHashCode(); + } + + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Customer.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Customer.java new file mode 100644 index 0000000000..985f51035c --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Customer.java @@ -0,0 +1,99 @@ +/*- + * ============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.servicedecomposition.bbobjects; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import javax.persistence.Id; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; + +@JsonRootName("customer") +public class Customer implements Serializable, ShallowCopy<Customer> { + + private static final long serialVersionUID = 2006599484099139618L; + + @Id + @JsonProperty("global-customer-id") + private String globalCustomerId; + @JsonProperty("subscriber-name") + private String subscriberName; + @JsonProperty("subscriber-type") + private String subscriberType; + @JsonProperty("subscriber-common-site-id") + private String subscriberCommonSiteId; + @JsonProperty("service-subscription") + private ServiceSubscription serviceSubscription; + @JsonProperty("vpn-bindings") + private List<VpnBinding> vpnBindings = new ArrayList<>(); + + 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; + } + public String getSubscriberType() { + return subscriberType; + } + public void setSubscriberType(String subscriberType) { + this.subscriberType = subscriberType; + } + public String getSubscriberCommonSiteId() { + return subscriberCommonSiteId; + } + public void setSubscriberCommonSiteId(String subscriberCommonSiteId) { + this.subscriberCommonSiteId = subscriberCommonSiteId; + } + public ServiceSubscription getServiceSubscription() { + return serviceSubscription; + } + public void setServiceSubscription(ServiceSubscription serviceSubscription) { + this.serviceSubscription = serviceSubscription; + } + public List<VpnBinding> getVpnBindings() { + return vpnBindings; + } + @Override + public boolean equals(final Object other) { + if (!(other instanceof Customer)) { + return false; + } + Customer castOther = (Customer) other; + return new EqualsBuilder().append(globalCustomerId, castOther.globalCustomerId).isEquals(); + } + @Override + public int hashCode() { + return new HashCodeBuilder().append(globalCustomerId).toHashCode(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Entitlement.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Entitlement.java new file mode 100644 index 0000000000..fdcb59d3c3 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Entitlement.java @@ -0,0 +1,70 @@ +/*- + * ============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.servicedecomposition.bbobjects; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; + +import javax.persistence.Id; + +@JsonRootName("entitlement") +public class Entitlement implements Serializable, ShallowCopy<Entitlement>{ + + private static final long serialVersionUID = 5186878328988717088L; + + @Id + @JsonProperty("group-uuid") + private String groupUuid; + @Id + @JsonProperty("resource-uuid") + private String resourceUuid; + + public String getGroupUuid() { + return groupUuid; + } + public void setGroupUuid(String groupUuid) { + this.groupUuid = groupUuid; + } + public String getResourceUuid() { + return resourceUuid; + } + public void setResourceUuid(String resourceUuid) { + this.resourceUuid = resourceUuid; + } + @Override + public boolean equals(final Object other) { + if (!(other instanceof Entitlement)) { + return false; + } + Entitlement castOther = (Entitlement) other; + return new EqualsBuilder().append(groupUuid, castOther.groupUuid).append(resourceUuid, castOther.resourceUuid) + .isEquals(); + } + @Override + public int hashCode() { + return new HashCodeBuilder().append(groupUuid).append(resourceUuid).toHashCode(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Evc.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Evc.java new file mode 100644 index 0000000000..3ef0f71386 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Evc.java @@ -0,0 +1,164 @@ +/*- + * ============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.servicedecomposition.bbobjects; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; + +import javax.persistence.Id; + +@JsonRootName("evc") +public class Evc implements Serializable, ShallowCopy<Evc> { + + private static final long serialVersionUID = -3556506672371317659L; + + @Id + @JsonProperty("evc-id") + private String evcId; + @JsonProperty("forwarding-path-topology") + private String forwardingPathTopology; + @JsonProperty("cir-value") + private String cirValue; + @JsonProperty("cir-units") + private String cirUnits; + @JsonProperty("connection-diversity-group-id") + private String connectionDiversityGroupId; + @JsonProperty("service-hours") + private String serviceHours; + @JsonProperty("esp-evc-circuit-id") + private String espEvcCircuitId; + @JsonProperty("esp-evc-cir-value") + private String espEvcCirValue; + @JsonProperty("esp-evc-cir-units") + private String espEvcCirUnits; + @JsonProperty("esp-itu-code") + private String espItuCode; + @JsonProperty("collector-pop-clli") + private String collectorPopClli; + @JsonProperty("inter-connect-type-ingress") + private String interConnectTypeIngress; + @JsonProperty("tagmode-access-ingress") + private String tagmodeAccessIngress; + @JsonProperty("tagmode-access-egress") + private String tagmodeAccessEgress; + + public String getEvcId() { + return evcId; + } + public void setEvcId(String evcId) { + this.evcId = evcId; + } + public String getForwardingPathTopology() { + return forwardingPathTopology; + } + public void setForwardingPathTopology(String forwardingPathTopology) { + this.forwardingPathTopology = forwardingPathTopology; + } + public String getCirValue() { + return cirValue; + } + public void setCirValue(String cirValue) { + this.cirValue = cirValue; + } + public String getCirUnits() { + return cirUnits; + } + public void setCirUnits(String cirUnits) { + this.cirUnits = cirUnits; + } + public String getConnectionDiversityGroupId() { + return connectionDiversityGroupId; + } + public void setConnectionDiversityGroupId(String connectionDiversityGroupId) { + this.connectionDiversityGroupId = connectionDiversityGroupId; + } + public String getServiceHours() { + return serviceHours; + } + public void setServiceHours(String serviceHours) { + this.serviceHours = serviceHours; + } + public String getEspEvcCircuitId() { + return espEvcCircuitId; + } + public void setEspEvcCircuitId(String espEvcCircuitId) { + this.espEvcCircuitId = espEvcCircuitId; + } + public String getEspEvcCirValue() { + return espEvcCirValue; + } + public void setEspEvcCirValue(String espEvcCirValue) { + this.espEvcCirValue = espEvcCirValue; + } + public String getEspEvcCirUnits() { + return espEvcCirUnits; + } + public void setEspEvcCirUnits(String espEvcCirUnits) { + this.espEvcCirUnits = espEvcCirUnits; + } + public String getEspItuCode() { + return espItuCode; + } + public void setEspItuCode(String espItuCode) { + this.espItuCode = espItuCode; + } + public String getCollectorPopClli() { + return collectorPopClli; + } + public void setCollectorPopClli(String collectorPopClli) { + this.collectorPopClli = collectorPopClli; + } + public String getInterConnectTypeIngress() { + return interConnectTypeIngress; + } + public void setInterConnectTypeIngress(String interConnectTypeIngress) { + this.interConnectTypeIngress = interConnectTypeIngress; + } + public String getTagmodeAccessIngress() { + return tagmodeAccessIngress; + } + public void setTagmodeAccessIngress(String tagmodeAccessIngress) { + this.tagmodeAccessIngress = tagmodeAccessIngress; + } + public String getTagmodeAccessEgress() { + return tagmodeAccessEgress; + } + public void setTagmodeAccessEgress(String tagmodeAccessEgress) { + this.tagmodeAccessEgress = tagmodeAccessEgress; + } + @Override + public boolean equals(final Object other) { + if (!(other instanceof Evc)) { + return false; + } + Evc castOther = (Evc) other; + return new EqualsBuilder().append(evcId, castOther.evcId).isEquals(); + } + @Override + public int hashCode() { + return new HashCodeBuilder().append(evcId).toHashCode(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ForwarderEvc.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ForwarderEvc.java new file mode 100644 index 0000000000..70f7d5af42 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ForwarderEvc.java @@ -0,0 +1,103 @@ +/*- + * ============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.servicedecomposition.bbobjects; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; + +import javax.persistence.Id; + +@JsonRootName("forwarder-evc") +public class ForwarderEvc implements Serializable, ShallowCopy<ForwarderEvc> { + + private static final long serialVersionUID = 3822241337439817708L; + + @Id + @JsonProperty("forwarder-evc-id") + private String forwarderEvcId; + @JsonProperty("circuit-id") + private String circuitId; + @JsonProperty("ivlan") + private String ivlan; + @JsonProperty("svlan") + private String svlan; + @JsonProperty("cvlan") + private String cvlan; + + public String getForwarderEvcId() { + return forwarderEvcId; + } + + public void setForwarderEvcId(String forwarderEvcId) { + this.forwarderEvcId = forwarderEvcId; + } + + public String getCircuitId() { + return circuitId; + } + + public void setCircuitId(String circuitId) { + this.circuitId = circuitId; + } + + public String getIvlan() { + return ivlan; + } + + public void setIvlan(String ivlan) { + this.ivlan = ivlan; + } + + public String getSvlan() { + return svlan; + } + + public void setSvlan(String svlan) { + this.svlan = svlan; + } + + public String getCvlan() { + return cvlan; + } + + public void setCvlan(String cvlan) { + this.cvlan = cvlan; + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof ForwarderEvc)) { + return false; + } + ForwarderEvc castOther = (ForwarderEvc) other; + return new EqualsBuilder().append(forwarderEvcId, castOther.forwarderEvcId).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(forwarderEvcId).toHashCode(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/GenericVnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/GenericVnf.java new file mode 100644 index 0000000000..218763a006 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/GenericVnf.java @@ -0,0 +1,510 @@ +/*- + * ============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.servicedecomposition.bbobjects; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.persistence.Id; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; +import org.onap.so.bpmn.servicedecomposition.generalobjects.License; +import org.onap.so.bpmn.servicedecomposition.homingobjects.SolutionInfo; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf; +import org.onap.so.db.catalog.beans.OrchestrationStatus; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("generic-vnf") +public class GenericVnf implements Serializable, ShallowCopy<GenericVnf> { + + private static final long serialVersionUID = -5107610336831330403L; + + @Id + @JsonProperty("vnf-id") + private String vnfId; + @JsonProperty("vnf-name") + private String vnfName; + @JsonProperty("vnf-type") + private String vnfType; + @JsonProperty("orchestration-status") + private OrchestrationStatus orchestrationStatus; + @JsonProperty("vf-modules") + private List<VfModule> vfModules = new ArrayList<>(); + @JsonProperty("volume-groups") + private List<VolumeGroup> volumeGroups = new ArrayList<>(); + @JsonProperty("line-of-business") + private LineOfBusiness lineOfBusiness; + @JsonProperty("platform") + private Platform platform; + @JsonProperty("cascaded") + private boolean cascaded; + @JsonProperty("cloud-params") + private Map<String, String> cloudParams = new HashMap<>(); + @JsonProperty("cloud-context") + private CloudRegion cloudRegion; + @JsonProperty("solution") + private SolutionInfo solution; + @JsonProperty("vnf-name-2") + private String vnfName2; + @JsonProperty("service-id") + private String serviceId; + @JsonProperty("regional-resource-zone") + private String regionalResourceZone; + @JsonProperty("prov-status") + private String provStatus; + @JsonProperty("operational-status") + private String operationalStatus; + @JsonProperty("equipment-role") + private String equipmentRole; + @JsonProperty("management-option") + private String managementOption; + @JsonProperty("ipv4-oam-address") + private String ipv4OamAddress; + @JsonProperty("ipv4-loopback0-address") + private String ipv4Loopback0Address; + @JsonProperty("nm-lan-v6-address") + private String nmLanV6Address; + @JsonProperty("management-v6-address") + private String managementV6Address; + @JsonProperty("vcpu") + private Long vcpu; + @JsonProperty("vcpu-units") + private String vcpuUnits; + @JsonProperty("vmemory") + private Long vmemory; + @JsonProperty("vmemory-units") + private String vmemoryUnits; + @JsonProperty("vdisk") + private Long vdisk; + @JsonProperty("vdisk-units") + private String vdiskUnits; + @JsonProperty("in-maint") + private boolean inMaint; + @JsonProperty("is-closed-loop-disabled") + private boolean isClosedLoopDisabled; + @JsonProperty("summary-status") + private String summaryStatus; + @JsonProperty("encrypted-access-flag") + private Boolean encryptedAccessFlag; + @JsonProperty("as-number") + private String asNumber; + @JsonProperty("regional-resource-subzone") + private String regionalResourceSubzone; + @JsonProperty("self-link") + private String selflink; + @JsonProperty("ipv4-oam-gateway-address") + private String ipv4OamGatewayAddress; + @JsonProperty("ipv4-oam-gateway-address-prefix-length") + private Integer ipv4OamGatewayAddressPrefixLength; + @JsonProperty("vlan-id-outer") + private Long vlanIdOuter; + @JsonProperty("nm-profile-name") + private String nmProfileName; + @JsonProperty("l-interfaces") + private List<LInterface> lInterfaces = new ArrayList<>(); + @JsonProperty("lag-interfaces") + private List<LagInterface> lagInterfaces = new ArrayList<>(); + @JsonProperty("license") + private License license; + @JsonProperty("entitlements") //TODO remove, duplicated + private List<Entitlement> entitlements = new ArrayList<>(); + @JsonProperty("model-info-generic-vnf") + private ModelInfoGenericVnf modelInfoGenericVnf; + @JsonProperty("instance-groups") + private List<InstanceGroup> instanceGroups = new ArrayList<InstanceGroup>(); + @JsonProperty("call-homing") + private boolean callHoming; + + + public List<InstanceGroup> getInstanceGroups() { + return instanceGroups; + } + + public List<VolumeGroup> getVolumeGroups() { + return volumeGroups; + } + + public ModelInfoGenericVnf getModelInfoGenericVnf() { + return modelInfoGenericVnf; + } + + public void setModelInfoGenericVnf(ModelInfoGenericVnf modelInfoGenericVnf) { + this.modelInfoGenericVnf = modelInfoGenericVnf; + } + + public String getVnfName2() { + return vnfName2; + } + + public void setVnfName2(String vnfName2) { + this.vnfName2 = vnfName2; + } + + public String getServiceId() { + return serviceId; + } + + public void setServiceId(String serviceId) { + this.serviceId = serviceId; + } + + public String getRegionalResourceZone() { + return regionalResourceZone; + } + + public void setRegionalResourceZone(String regionalResourceZone) { + this.regionalResourceZone = regionalResourceZone; + } + + public String getProvStatus() { + return provStatus; + } + + public void setProvStatus(String provStatus) { + this.provStatus = provStatus; + } + + public String getOperationalStatus() { + return operationalStatus; + } + + public void setOperationalStatus(String operationalStatus) { + this.operationalStatus = operationalStatus; + } + + public String getEquipmentRole() { + return equipmentRole; + } + + public void setEquipmentRole(String equipmentRole) { + this.equipmentRole = equipmentRole; + } + + public String getManagementOption() { + return managementOption; + } + + public void setManagementOption(String managementOption) { + this.managementOption = managementOption; + } + + public String getIpv4OamAddress() { + return ipv4OamAddress; + } + + public void setIpv4OamAddress(String ipv4OamAddress) { + this.ipv4OamAddress = ipv4OamAddress; + } + + public String getIpv4Loopback0Address() { + return ipv4Loopback0Address; + } + + public void setIpv4Loopback0Address(String ipv4Loopback0Address) { + this.ipv4Loopback0Address = ipv4Loopback0Address; + } + + public String getNmLanV6Address() { + return nmLanV6Address; + } + + public void setNmLanV6Address(String nmLanV6Address) { + this.nmLanV6Address = nmLanV6Address; + } + + public String getManagementV6Address() { + return managementV6Address; + } + + public void setManagementV6Address(String managementV6Address) { + this.managementV6Address = managementV6Address; + } + + public Long getVcpu() { + return vcpu; + } + + public void setVcpu(Long vcpu) { + this.vcpu = vcpu; + } + + public String getVcpuUnits() { + return vcpuUnits; + } + + public void setVcpuUnits(String vcpuUnits) { + this.vcpuUnits = vcpuUnits; + } + + public List<LInterface> getlInterfaces() { + return lInterfaces; + } + + public List<LagInterface> getLagInterfaces() { + return lagInterfaces; + } + + public List<Entitlement> getEntitlements() { + return entitlements; + } + + public List<VfModule> getVfModules() { + return vfModules; + } + + public Long getVmemory() { + return vmemory; + } + + public void setVmemory(Long vmemory) { + this.vmemory = vmemory; + } + + public String getVmemoryUnits() { + return vmemoryUnits; + } + + public void setVmemoryUnits(String vmemoryUnits) { + this.vmemoryUnits = vmemoryUnits; + } + + public Long getVdisk() { + return vdisk; + } + + public void setVdisk(Long vdisk) { + this.vdisk = vdisk; + } + + public String getVdiskUnits() { + return vdiskUnits; + } + + public void setVdiskUnits(String vdiskUnits) { + this.vdiskUnits = vdiskUnits; + } + + public boolean isInMaint() { + return inMaint; + } + + public void setInMaint(boolean inMaint) { + this.inMaint = inMaint; + } + + public boolean isClosedLoopDisabled() { + return isClosedLoopDisabled; + } + + public void setClosedLoopDisabled(boolean isClosedLoopDisabled) { + this.isClosedLoopDisabled = isClosedLoopDisabled; + } + + public String getSummaryStatus() { + return summaryStatus; + } + + public void setSummaryStatus(String summaryStatus) { + this.summaryStatus = summaryStatus; + } + + public Boolean getEncryptedAccessFlag() { + return encryptedAccessFlag; + } + + public void setEncryptedAccessFlag(Boolean encryptedAccessFlag) { + this.encryptedAccessFlag = encryptedAccessFlag; + } + + public String getAsNumber() { + return asNumber; + } + + public void setAsNumber(String asNumber) { + this.asNumber = asNumber; + } + + public String getRegionalResourceSubzone() { + return regionalResourceSubzone; + } + + public void setRegionalResourceSubzone(String regionalResourceSubzone) { + this.regionalResourceSubzone = regionalResourceSubzone; + } + + public License getLicense() { + return license; + } + + public void setLicense(License license) { + this.license = license; + } + + public String getSelflink() { + return selflink; + } + + public void setSelflink(String selflink) { + this.selflink = selflink; + } + + public String getIpv4OamGatewayAddress() { + return ipv4OamGatewayAddress; + } + + public void setIpv4OamGatewayAddress(String ipv4OamGatewayAddress) { + this.ipv4OamGatewayAddress = ipv4OamGatewayAddress; + } + + public Integer getIpv4OamGatewayAddressPrefixLength() { + return ipv4OamGatewayAddressPrefixLength; + } + + public void setIpv4OamGatewayAddressPrefixLength(Integer ipv4OamGatewayAddressPrefixLength) { + this.ipv4OamGatewayAddressPrefixLength = ipv4OamGatewayAddressPrefixLength; + } + + public Long getVlanIdOuter() { + return vlanIdOuter; + } + + public void setVlanIdOuter(Long vlanIdOuter) { + this.vlanIdOuter = vlanIdOuter; + } + + public String getNmProfileName() { + return nmProfileName; + } + + public void setNmProfileName(String nmProfileName) { + this.nmProfileName = nmProfileName; + } + + public String getVnfId() { + return vnfId; + } + + public void setVnfId(String vnfId) { + this.vnfId = vnfId; + } + + public String getVnfName() { + return vnfName; + } + + public void setVnfName(String vnfName) { + this.vnfName = vnfName; + } + + public String getVnfType() { + return vnfType; + } + + public void setVnfType(String vnfType) { + this.vnfType = vnfType; + } + + public OrchestrationStatus getOrchestrationStatus() { + return orchestrationStatus; + } + + public void setOrchestrationStatus(OrchestrationStatus orchestrationStatus) { + this.orchestrationStatus = orchestrationStatus; + } + + public LineOfBusiness getLineOfBusiness() { + return lineOfBusiness; + } + + public void setLineOfBusiness(LineOfBusiness lineOfBusiness) { + this.lineOfBusiness = lineOfBusiness; + } + + public Platform getPlatform() { + return platform; + } + + public void setPlatform(Platform platform) { + this.platform = platform; + } + + public boolean isCascaded() { + return cascaded; + } + + public void setCascaded(boolean cascaded) { + this.cascaded = cascaded; + } + + public Map<String, String> getCloudParams() { + return cloudParams; + } + + public void setCloudParams(Map<String, String> cloudParams) { + this.cloudParams = cloudParams; + } + + public SolutionInfo getSolution() { + return solution; + } + + public void setSolution(SolutionInfo solution) { + this.solution = solution; + } + + public CloudRegion getCloudRegion() { + return cloudRegion; + } + + public void setCloudRegion(CloudRegion cloudRegion) { + this.cloudRegion = cloudRegion; + } + + public boolean isCallHoming() { + return callHoming; + } + + public void setCallHoming(boolean callHoming) { + this.callHoming = callHoming; + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof GenericVnf)) { + return false; + } + GenericVnf castOther = (GenericVnf) other; + return new EqualsBuilder().append(vnfId, castOther.vnfId).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(vnfId).toHashCode(); + } + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/HostRoute.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/HostRoute.java new file mode 100644 index 0000000000..75356ac9db --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/HostRoute.java @@ -0,0 +1,84 @@ +/*- + * ============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.servicedecomposition.bbobjects; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; + +import javax.persistence.Id; + +@JsonRootName("host-route") +public class HostRoute implements Serializable, ShallowCopy<HostRoute>{ + + private static final long serialVersionUID = -2468793257174064133L; + + @Id + @JsonProperty("host-route-id") + private String hostRouteId; + @JsonProperty("route-prefix") + private String routePrefix; + @JsonProperty("next-hop") + private String nextHop; + @JsonProperty("next-hop-type") + private String nextHopType; + + public String getHostRouteId() { + return hostRouteId; + } + public void setHostRouteId(String hostRouteId) { + this.hostRouteId = hostRouteId; + } + public String getRoutePrefix() { + return routePrefix; + } + public void setRoutePrefix(String routePrefix) { + this.routePrefix = routePrefix; + } + public String getNextHop() { + return nextHop; + } + public void setNextHop(String nextHop) { + this.nextHop = nextHop; + } + public String getNextHopType() { + return nextHopType; + } + public void setNextHopType(String nextHopType) { + this.nextHopType = nextHopType; + } + @Override + public boolean equals(final Object other) { + if (!(other instanceof HostRoute)) { + return false; + } + HostRoute castOther = (HostRoute) other; + return new EqualsBuilder().append(hostRouteId, castOther.hostRouteId).isEquals(); + } + @Override + public int hashCode() { + return new HashCodeBuilder().append(hostRouteId).toHashCode(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/InstanceGroup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/InstanceGroup.java new file mode 100644 index 0000000000..deb8c8e393 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/InstanceGroup.java @@ -0,0 +1,104 @@ +/*- + * ============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.servicedecomposition.bbobjects; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import javax.persistence.Id; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("instance-group") +public class InstanceGroup implements Serializable, ShallowCopy<InstanceGroup> { + + private static final long serialVersionUID = -2330859693128099141L; + + @Id + @JsonProperty("id") + private String id; + @JsonProperty("description") + private String description; + @JsonProperty("resource-version") + private String resourceVersion; + @JsonProperty("instance-group-name") + private String instanceGroupName; + @JsonProperty("model-info-instance-group") + private ModelInfoInstanceGroup modelInfoInstanceGroup; + @JsonProperty("instance-group-function") + private String instanceGroupFunction; + + public String getId() { + return id; + } + public void setId(String id) { + this.id = id; + } + public String getDescription() { + return description; + } + public void setDescription(String description) { + this.description = description; + } + public String getResourceVersion() { + return resourceVersion; + } + public void setResourceVersion(String resourceVersion) { + this.resourceVersion = resourceVersion; + } + public String getInstanceGroupName() { + return instanceGroupName; + } + public void setInstanceGroupName(String instanceGroupName) { + this.instanceGroupName = instanceGroupName; + } + public ModelInfoInstanceGroup getModelInfoInstanceGroup() { + return modelInfoInstanceGroup; + } + public void setModelInfoInstanceGroup(ModelInfoInstanceGroup modelInfoInstanceGroup) { + this.modelInfoInstanceGroup = modelInfoInstanceGroup; + } + public String getInstanceGroupFunction() { + return instanceGroupFunction; + } + public void setInstanceGroupFunction(String instanceGroupFunction) { + this.instanceGroupFunction = instanceGroupFunction; + } + @Override + public boolean equals(final Object other) { + if (!(other instanceof InstanceGroup)) { + return false; + } + InstanceGroup castOther = (InstanceGroup) other; + return new EqualsBuilder().append(id, castOther.id).isEquals(); + } + @Override + public int hashCode() { + return new HashCodeBuilder().append(id).toHashCode(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3InterfaceIpv4AddressList.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3InterfaceIpv4AddressList.java new file mode 100644 index 0000000000..55b8a752b6 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3InterfaceIpv4AddressList.java @@ -0,0 +1,108 @@ +/*- + * ============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.servicedecomposition.bbobjects; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; + +import javax.persistence.Id; + +@JsonRootName("l3-interface-ipv4-address-list") +public class L3InterfaceIpv4AddressList implements Serializable, ShallowCopy<L3InterfaceIpv4AddressList>{ + + private static final long serialVersionUID = -1566884527411610879L; + + @Id + @JsonProperty("l3-interface-ipv4-address") + private String l3InterfaceIpv4Address; + @JsonProperty("l3-interface-ipv4-prefix-length") + private Long l3InterfaceIpv4PrefixLength; + @JsonProperty("vlan-id-inner") + private Long vlanIdInner; + @JsonProperty("vlan-id-outer") + private Long vlanIdOuter; + @JsonProperty("is-floating") + private Boolean isFloating; + @JsonProperty("neutron-network-id") + private String neutronNetworkId; + @JsonProperty("neutron-subnet-id") + private String neutronSubnetId; + + public String getL3InterfaceIpv4Address() { + return l3InterfaceIpv4Address; + } + public void setL3InterfaceIpv4Address(String l3InterfaceIpv4Address) { + this.l3InterfaceIpv4Address = l3InterfaceIpv4Address; + } + public Long getL3InterfaceIpv4PrefixLength() { + return l3InterfaceIpv4PrefixLength; + } + public void setL3InterfaceIpv4PrefixLength(Long l3InterfaceIpv4PrefixLength) { + this.l3InterfaceIpv4PrefixLength = l3InterfaceIpv4PrefixLength; + } + public Long getVlanIdInner() { + return vlanIdInner; + } + public void setVlanIdInner(Long vlanIdInner) { + this.vlanIdInner = vlanIdInner; + } + public Long getVlanIdOuter() { + return vlanIdOuter; + } + public void setVlanIdOuter(Long vlanIdOuter) { + this.vlanIdOuter = vlanIdOuter; + } + public Boolean getIsFloating() { + return isFloating; + } + public void setIsFloating(Boolean isFloating) { + this.isFloating = isFloating; + } + public String getNeutronNetworkId() { + return neutronNetworkId; + } + public void setNeutronNetworkId(String neutronNetworkId) { + this.neutronNetworkId = neutronNetworkId; + } + public String getNeutronSubnetId() { + return neutronSubnetId; + } + public void setNeutronSubnetId(String neutronSubnetId) { + this.neutronSubnetId = neutronSubnetId; + } + @Override + public boolean equals(final Object other) { + if (!(other instanceof L3InterfaceIpv4AddressList)) { + return false; + } + L3InterfaceIpv4AddressList castOther = (L3InterfaceIpv4AddressList) other; + return new EqualsBuilder().append(l3InterfaceIpv4Address, castOther.l3InterfaceIpv4Address).isEquals(); + } + @Override + public int hashCode() { + return new HashCodeBuilder().append(l3InterfaceIpv4Address).toHashCode(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3InterfaceIpv6AddressList.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3InterfaceIpv6AddressList.java new file mode 100644 index 0000000000..209c64762f --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3InterfaceIpv6AddressList.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.servicedecomposition.bbobjects; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; + +import javax.persistence.Id; + +@JsonRootName("l3-interface-ipv6-address-list") +public class L3InterfaceIpv6AddressList implements Serializable, ShallowCopy<L3InterfaceIpv6AddressList> { + + private static final long serialVersionUID = -414901751774739052L; + + @Id + @JsonProperty("l3-interface-ipv6-address") + private String l3InterfaceIpv6Address; + @JsonProperty("l3-interface-ipv6-prefix-length") + private Long l3InterfaceIpv6PrefixLength; + @JsonProperty("vlan-id-inner") + private Long vlanIdInner; + @JsonProperty("vlan-id-outer") + private Long vlanIdOuter; + @JsonProperty("is-floating") + private Boolean isFloating; + @JsonProperty("neutron-network-id") + private String neutronNetworkId; + @JsonProperty("neutron-subnet-id") + private String neutronSubnetId; + + public String getL3InterfaceIpv6Address() { + return l3InterfaceIpv6Address; + } + + public void setL3InterfaceIpv6Address(String l3InterfaceIpv6Address) { + this.l3InterfaceIpv6Address = l3InterfaceIpv6Address; + } + + public Long getL3InterfaceIpv6PrefixLength() { + return l3InterfaceIpv6PrefixLength; + } + + public void setL3InterfaceIpv6PrefixLength(Long l3InterfaceIpv6PrefixLength) { + this.l3InterfaceIpv6PrefixLength = l3InterfaceIpv6PrefixLength; + } + + public Long getVlanIdInner() { + return vlanIdInner; + } + + public void setVlanIdInner(Long vlanIdInner) { + this.vlanIdInner = vlanIdInner; + } + + public Long getVlanIdOuter() { + return vlanIdOuter; + } + + public void setVlanIdOuter(Long vlanIdOuter) { + this.vlanIdOuter = vlanIdOuter; + } + + public Boolean getIsFloating() { + return isFloating; + } + + public void setIsFloating(Boolean isFloating) { + this.isFloating = isFloating; + } + + public String getNeutronNetworkId() { + return neutronNetworkId; + } + + public void setNeutronNetworkId(String neutronNetworkId) { + this.neutronNetworkId = neutronNetworkId; + } + + public String getNeutronSubnetId() { + return neutronSubnetId; + } + + public void setNeutronSubnetId(String neutronSubnetId) { + this.neutronSubnetId = neutronSubnetId; + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof L3InterfaceIpv6AddressList)) { + return false; + } + L3InterfaceIpv6AddressList castOther = (L3InterfaceIpv6AddressList) other; + return new EqualsBuilder().append(l3InterfaceIpv6Address, castOther.l3InterfaceIpv6Address).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(l3InterfaceIpv6Address).toHashCode(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3Network.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3Network.java new file mode 100644 index 0000000000..51cd998073 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3Network.java @@ -0,0 +1,269 @@ +/*- + * ============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.servicedecomposition.bbobjects; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.persistence.Id; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork; +import org.onap.so.db.catalog.beans.OrchestrationStatus; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("l3Network") +public class L3Network implements Serializable, ShallowCopy<L3Network> { + + private static final long serialVersionUID = 4434492567957111317L; + + @Id + @JsonProperty("network-id") + private String networkId; + @JsonProperty("cascaded") + private boolean cascaded; + @JsonProperty("cloud-params") + private Map<String, String> cloudParams = new HashMap<>(); + @JsonProperty("network-name") + private String networkName; + @JsonProperty("neutron-network-id") + private String neutronNetworkId; + @JsonProperty("network-type") + private String networkType; + @JsonProperty("network-technology") + private String networkTechnology; + @JsonProperty("network-role") + private String networkRole; + @JsonProperty("is-bound-to-vpn") + private boolean isBoundToVpn; + @JsonProperty("service-id") + private String serviceId; + @JsonProperty("network-role-instance") + private Long networkRoleInstance; + @JsonProperty("orchestration-status") + private OrchestrationStatus orchestrationStatus; + @JsonProperty("heat-stack-id") + private String heatStackId; + @JsonProperty("contrail-network-fqdn") + private String contrailNetworkFqdn; + @JsonProperty("network-policies") + private List<NetworkPolicy> networkPolicies = new ArrayList<>(); + @JsonProperty("contrail-network-route-table-references") + private List<RouteTableReference> contrailNetworkRouteTableReferences = new ArrayList<>(); + @JsonProperty("widget-model-id") + private String widgetModelId; + @JsonProperty("widget-model-version") + private String widgetModelVersion; + @JsonProperty("physical-network-name") + private String physicalNetworkName; + @JsonProperty("is-provider-network") + private boolean isProviderNetwork; + @JsonProperty("is-shared-network") + private boolean isSharedNetwork; + @JsonProperty("is-external-network") + private boolean isExternalNetwork; + @JsonProperty("self-link") + private String selflink; + @JsonProperty("operational-status") + private String operationalStatus; + @JsonProperty("subnets") + private List<Subnet> subnets = new ArrayList<>(); + @JsonProperty("ctag-assignments") + private List<CtagAssignment> ctagAssignments = new ArrayList<>(); + @JsonProperty("segmentation-assignments") + private List<SegmentationAssignment> segmentationAssignments = new ArrayList<>(); + @JsonProperty("model-info-network") + private ModelInfoNetwork modelInfoNetwork; + + public ModelInfoNetwork getModelInfoNetwork() { + return modelInfoNetwork; + } + public void setModelInfoNetwork(ModelInfoNetwork modelInfoNetwork) { + this.modelInfoNetwork = modelInfoNetwork; + } + public String getNeutronNetworkId() { + return neutronNetworkId; + } + public void setNeutronNetworkId(String neutronNetworkId) { + this.neutronNetworkId = neutronNetworkId; + } + public String getNetworkId() { + return networkId; + } + public void setNetworkId(String networkId) { + this.networkId = networkId; + } + public String getNetworkName() { + return networkName; + } + public void setNetworkName(String networkName) { + this.networkName = networkName; + } + public String getNetworkType() { + return networkType; + } + public void setNetworkType(String networkType) { + this.networkType = networkType; + } + public String getNetworkTechnology() { + return networkTechnology; + } + public void setNetworkTechnology(String networkTechnology) { + this.networkTechnology = networkTechnology; + } + public String getNetworkRole() { + return networkRole; + } + public void setNetworkRole(String networkRole) { + this.networkRole = networkRole; + } + public boolean isBoundToVpn() { + return isBoundToVpn; + } + public void setIsBoundToVpn(boolean isBoundToVpn) { + this.isBoundToVpn = isBoundToVpn; + } + public String getServiceId() { + return serviceId; + } + public void setServiceId(String serviceId) { + this.serviceId = serviceId; + } + public Long getNetworkRoleInstance() { + return networkRoleInstance; + } + public void setNetworkRoleInstance(Long networkRoleInstance) { + this.networkRoleInstance = networkRoleInstance; + } + public OrchestrationStatus getOrchestrationStatus() { + return orchestrationStatus; + } + public void setOrchestrationStatus(OrchestrationStatus orchestrationStatus) { + this.orchestrationStatus = orchestrationStatus; + } + public String getHeatStackId() { + return heatStackId; + } + public void setHeatStackId(String heatStackId) { + this.heatStackId = heatStackId; + } + public String getContrailNetworkFqdn() { + return contrailNetworkFqdn; + } + public void setContrailNetworkFqdn(String contrailNetworkFqdn) { + this.contrailNetworkFqdn = contrailNetworkFqdn; + } + public List<NetworkPolicy> getNetworkPolicies() { + return networkPolicies; + } + public List<RouteTableReference> getContrailNetworkRouteTableReferences() { + return contrailNetworkRouteTableReferences; + } + public String getWidgetModelId() { + return widgetModelId; + } + public void setWidgetModelId(String widgetModelId) { + this.widgetModelId = widgetModelId; + } + public String getWidgetModelVersion() { + return widgetModelVersion; + } + public void setWidgetModelVersion(String widgetModelVersion) { + this.widgetModelVersion = widgetModelVersion; + } + public String getPhysicalNetworkName() { + return physicalNetworkName; + } + public void setPhysicalNetworkName(String physicalNetworkName) { + this.physicalNetworkName = physicalNetworkName; + } + public boolean isProviderNetwork() { + return isProviderNetwork; + } + public void setIsProviderNetwork(boolean isProviderNetwork) { + this.isProviderNetwork = isProviderNetwork; + } + public boolean isSharedNetwork() { + return isSharedNetwork; + } + public void setIsSharedNetwork(boolean isSharedNetwork) { + this.isSharedNetwork = isSharedNetwork; + } + public boolean isExternalNetwork() { + return isExternalNetwork; + } + public void setIsExternalNetwork(boolean isExternalNetwork) { + this.isExternalNetwork = isExternalNetwork; + } + public String getSelflink() { + return selflink; + } + public void setSelflink(String selflink) { + this.selflink = selflink; + } + public String getOperationalStatus() { + return operationalStatus; + } + public void setOperationalStatus(String operationalStatus) { + this.operationalStatus = operationalStatus; + } + + public List<Subnet> getSubnets() { + return subnets; + } + public List<CtagAssignment> getCtagAssignments() { + return ctagAssignments; + } + public List<SegmentationAssignment> getSegmentationAssignments() { + return segmentationAssignments; + } + public boolean isCascaded() { + return cascaded; + } + public void setIsCascaded(boolean cascaded) { + this.cascaded = cascaded; + } + public Map<String, String> getCloudParams() { + return cloudParams; + } + public void setCloudParams(Map<String, String> cloudParams) { + this.cloudParams = cloudParams; + } + @Override + public boolean equals(final Object other) { + if (!(other instanceof L3Network)) { + return false; + } + L3Network castOther = (L3Network) other; + return new EqualsBuilder().append(networkId, castOther.networkId).isEquals(); + } + @Override + public int hashCode() { + return new HashCodeBuilder().append(networkId).toHashCode(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LInterface.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LInterface.java new file mode 100644 index 0000000000..4bba39ee62 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LInterface.java @@ -0,0 +1,191 @@ +/*- + * ============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.servicedecomposition.bbobjects; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; + +import javax.persistence.Id; + +@JsonRootName("l-interface") +public class LInterface implements Serializable, ShallowCopy<LInterface>{ + + private static final long serialVersionUID = 5629921809747079453L; + + @Id + @JsonProperty("interface-name") + private String interfaceName; + @JsonProperty("interface-role") + private String interfaceRole; + @JsonProperty("v6-wan-link-ip") + private String v6WanLinkIp; + @JsonProperty("self-link") + private String selflink; + @JsonProperty("interface-id") + private String interfaceId; + @JsonProperty("macaddr") + private String macaddr; + @JsonProperty("network-name") + private String networkName; + @JsonProperty("management-option") + private String managementOption; + @JsonProperty("interface-description") + private String interfaceDescription; + @JsonProperty("is-port-mirrored") + private boolean isPortMirrored; + @JsonProperty("in-maint") + private boolean inMaint; + @JsonProperty("prov-status") + private String provStatus; + @JsonProperty("is-ip-unnumbered") + private boolean isIpUnnumbered; + @JsonProperty("allowed-address-pairs") + private String allowedAddressPairs; + @JsonProperty("vlans") + private List<Vlan> vlans = new ArrayList<Vlan>(); + @JsonProperty("sriov-vfs") + private List<SriovVf> sriovVfs = new ArrayList<SriovVf>(); + @JsonProperty("l-interfaces") + private List<LInterface> lInterfaces = new ArrayList<LInterface>(); + @JsonProperty("l3-interface-ipv4-address-list") + private List<L3InterfaceIpv4AddressList> l3InterfaceIpv4AddressList = new ArrayList<L3InterfaceIpv4AddressList>(); + @JsonProperty("l3-interface-ipv6-address-list") + private List<L3InterfaceIpv6AddressList> l3InterfaceIpv6AddressList = new ArrayList<L3InterfaceIpv6AddressList>(); + + public String getInterfaceName() { + return interfaceName; + } + public void setInterfaceName(String interfaceName) { + this.interfaceName = interfaceName; + } + public String getInterfaceRole() { + return interfaceRole; + } + public void setInterfaceRole(String interfaceRole) { + this.interfaceRole = interfaceRole; + } + public String getV6WanLinkIp() { + return v6WanLinkIp; + } + public void setV6WanLinkIp(String v6WanLinkIp) { + this.v6WanLinkIp = v6WanLinkIp; + } + public String getSelflink() { + return selflink; + } + public void setSelflink(String selflink) { + this.selflink = selflink; + } + public String getInterfaceId() { + return interfaceId; + } + public void setInterfaceId(String interfaceId) { + this.interfaceId = interfaceId; + } + public String getMacaddr() { + return macaddr; + } + public void setMacaddr(String macaddr) { + this.macaddr = macaddr; + } + public String getNetworkName() { + return networkName; + } + public void setNetworkName(String networkName) { + this.networkName = networkName; + } + public String getManagementOption() { + return managementOption; + } + public void setManagementOption(String managementOption) { + this.managementOption = managementOption; + } + public String getInterfaceDescription() { + return interfaceDescription; + } + public void setInterfaceDescription(String interfaceDescription) { + this.interfaceDescription = interfaceDescription; + } + public boolean isPortMirrored() { + return isPortMirrored; + } + public void setPortMirrored(boolean isPortMirrored) { + this.isPortMirrored = isPortMirrored; + } + public boolean isInMaint() { + return inMaint; + } + public void setInMaint(boolean inMaint) { + this.inMaint = inMaint; + } + public String getProvStatus() { + return provStatus; + } + public void setProvStatus(String provStatus) { + this.provStatus = provStatus; + } + public boolean isIpUnnumbered() { + return isIpUnnumbered; + } + public void setIpUnnumbered(boolean isIpUnnumbered) { + this.isIpUnnumbered = isIpUnnumbered; + } + public String getAllowedAddressPairs() { + return allowedAddressPairs; + } + public void setAllowedAddressPairs(String allowedAddressPairs) { + this.allowedAddressPairs = allowedAddressPairs; + } + public List<Vlan> getVlans() { + return vlans; + } + public List<SriovVf> getSriovVfs() { + return sriovVfs; + } + public List<LInterface> getlInterfaces() { + return lInterfaces; + } + public List<L3InterfaceIpv4AddressList> getL3InterfaceIpv4AddressList() { + return l3InterfaceIpv4AddressList; + } + public List<L3InterfaceIpv6AddressList> getL3InterfaceIpv6AddressList() { + return l3InterfaceIpv6AddressList; + } + @Override + public boolean equals(final Object other) { + if (!(other instanceof LInterface)) { + return false; + } + LInterface castOther = (LInterface) other; + return new EqualsBuilder().append(interfaceName, castOther.interfaceName).isEquals(); + } + @Override + public int hashCode() { + return new HashCodeBuilder().append(interfaceName).toHashCode(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LagInterface.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LagInterface.java new file mode 100644 index 0000000000..8a3248e92c --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LagInterface.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.servicedecomposition.bbobjects; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; + +import javax.persistence.Id; + +@JsonRootName("lag-interface") +public class LagInterface implements Serializable, ShallowCopy<LagInterface>{ + + private static final long serialVersionUID = -7493461787172382640L; + + @Id + @JsonProperty("interface-name") + private String interfaceName; + @JsonProperty("interface-description") + private String interfaceDescription; + @JsonProperty("speed-value") + private String speedValue; + @JsonProperty("speed-units") + private String speedUnits; + @JsonProperty("interface-id") + private String interfaceId; + @JsonProperty("interface-role") + private String interfaceRole; + @JsonProperty("prov-status") + private String provStatus; + @JsonProperty("in-maint") + private boolean inMaint; + @JsonProperty("l-interfaces") + private List<LInterface> lInterfaces = new ArrayList<>(); + + public String getInterfaceName() { + return interfaceName; + } + public void setInterfaceName(String interfaceName) { + this.interfaceName = interfaceName; + } + public String getInterfaceDescription() { + return interfaceDescription; + } + public void setInterfaceDescription(String interfaceDescription) { + this.interfaceDescription = interfaceDescription; + } + public String getSpeedValue() { + return speedValue; + } + public void setSpeedValue(String speedValue) { + this.speedValue = speedValue; + } + public String getSpeedUnits() { + return speedUnits; + } + public void setSpeedUnits(String speedUnits) { + this.speedUnits = speedUnits; + } + public String getInterfaceId() { + return interfaceId; + } + public void setInterfaceId(String interfaceId) { + this.interfaceId = interfaceId; + } + public String getInterfaceRole() { + return interfaceRole; + } + public void setInterfaceRole(String interfaceRole) { + this.interfaceRole = interfaceRole; + } + public String getProvStatus() { + return provStatus; + } + public void setProvStatus(String provStatus) { + this.provStatus = provStatus; + } + public boolean isInMaint() { + return inMaint; + } + public void setInMaint(boolean inMaint) { + this.inMaint = inMaint; + } + public List<LInterface> getlInterfaces() { + return lInterfaces; + } + @Override + public boolean equals(final Object other) { + if (!(other instanceof LagInterface)) { + return false; + } + LagInterface castOther = (LagInterface) other; + return new EqualsBuilder().append(interfaceName, castOther.interfaceName).isEquals(); + } + @Override + public int hashCode() { + return new HashCodeBuilder().append(interfaceName).toHashCode(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LineOfBusiness.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LineOfBusiness.java new file mode 100644 index 0000000000..5868da563c --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LineOfBusiness.java @@ -0,0 +1,63 @@ +/*- + * ============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.servicedecomposition.bbobjects; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; + +import javax.persistence.Id; + +@JsonRootName("line-of-business") +public class LineOfBusiness implements Serializable, ShallowCopy<LineOfBusiness> { + + private static final long serialVersionUID = -7697815326894443926L; + + @Id + @JsonProperty("line-of-business-name") + private String lineOfBusinessName; + + public String getLineOfBusinessName() { + return lineOfBusinessName; + } + + public void setLineOfBusinessName(String lineOfBusinessName) { + this.lineOfBusinessName = lineOfBusinessName; + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof LineOfBusiness)) { + return false; + } + LineOfBusiness castOther = (LineOfBusiness) other; + return new EqualsBuilder().append(lineOfBusinessName, castOther.lineOfBusinessName).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(lineOfBusinessName).toHashCode(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Metadatum.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Metadatum.java new file mode 100644 index 0000000000..2e7d278901 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Metadatum.java @@ -0,0 +1,66 @@ +/*- + * ============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.servicedecomposition.bbobjects; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; + +import javax.persistence.Id; + +public class Metadatum implements Serializable, ShallowCopy<Metadatum>{ + + private static final long serialVersionUID = -2259570072414712965L; + + @Id + @JsonProperty("metaname") + private String metaname; + @JsonProperty("metaval") + private String metaval; + + public String getMetaname() { + return metaname; + } + public void setMetaname(String metaname) { + this.metaname = metaname; + } + public String getMetaval() { + return metaval; + } + public void setMetaval(String metaval) { + this.metaval = metaval; + } + @Override + public boolean equals(final Object other) { + if (!(other instanceof Metadatum)) { + return false; + } + Metadatum castOther = (Metadatum) other; + return new EqualsBuilder().append(metaname, castOther.metaname).isEquals(); + } + @Override + public int hashCode() { + return new HashCodeBuilder().append(metaname).toHashCode(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/NetworkPolicy.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/NetworkPolicy.java new file mode 100644 index 0000000000..a920a585cb --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/NetworkPolicy.java @@ -0,0 +1,91 @@ +/*- + * ============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.servicedecomposition.bbobjects; + +import java.io.Serializable; + +import javax.persistence.Id; + +import com.fasterxml.jackson.annotation.JsonProperty; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; + +public class NetworkPolicy implements Serializable, ShallowCopy<NetworkPolicy>{ + + private static final long serialVersionUID = 8925599588239522447L; + + @Id + @JsonProperty("network-policy-id") + private String networkPolicyId; + @JsonProperty("network-policy-fqdn") + private String networkPolicyFqdn; + @JsonProperty("heat-stack-id") + private String heatStackId; + @JsonProperty("resource-version") + private String resourceVersion; + + public String getNetworkPolicyId() { + return this.networkPolicyId; + } + + public void setNetworkPolicyId(String networkPolicyId) { + this.networkPolicyId = networkPolicyId; + } + + public String getNetworkPolicyFqdn() { + return this.networkPolicyFqdn; + } + + public void setNetworkPolicyFqdn(String networkPolicyFqdn) { + this.networkPolicyFqdn = networkPolicyFqdn; + } + + public String getHeatStackId() { + return this.heatStackId; + } + + public void setHeatStackId(String heatStackId) { + this.heatStackId = heatStackId; + } + + public String getResourceVersion() { + return this.resourceVersion; + } + + public void setResourceVersion(String resourceVersion) { + this.resourceVersion = resourceVersion; + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof NetworkPolicy)) { + return false; + } + NetworkPolicy castOther = (NetworkPolicy) other; + return new EqualsBuilder().append(networkPolicyId, castOther.networkPolicyId).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(networkPolicyId).toHashCode(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/OwningEntity.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/OwningEntity.java new file mode 100644 index 0000000000..e28e41ed46 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/OwningEntity.java @@ -0,0 +1,68 @@ +/*- + * ============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.servicedecomposition.bbobjects; + +import java.io.Serializable; + +import javax.persistence.Id; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; + +@JsonRootName("owning-entity") +public class OwningEntity implements Serializable, ShallowCopy<OwningEntity> { + + private static final long serialVersionUID = -6565917570694869603L; + + @Id + @JsonProperty("owning-entity-id") + private String owningEntityId; + @JsonProperty("owning-entity-name") + private String owningEntityName; + + public String getOwningEntityId() { + return owningEntityId; + } + public void setOwningEntityId(String owningEntityId) { + this.owningEntityId = owningEntityId; + } + public String getOwningEntityName() { + return owningEntityName; + } + public void setOwningEntityName(String owningEntityName) { + this.owningEntityName = owningEntityName; + } + @Override + public boolean equals(final Object other) { + if (!(other instanceof OwningEntity)) { + return false; + } + OwningEntity castOther = (OwningEntity) other; + return new EqualsBuilder().append(owningEntityId, castOther.owningEntityId).isEquals(); + } + @Override + public int hashCode() { + return new HashCodeBuilder().append(owningEntityId).toHashCode(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/PServer.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/PServer.java new file mode 100644 index 0000000000..498d096e65 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/PServer.java @@ -0,0 +1,83 @@ +/*- + * ============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.servicedecomposition.bbobjects; + + +import com.fasterxml.jackson.annotation.JsonProperty; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import javax.persistence.Id; + +import org.apache.commons.lang3.builder.EqualsBuilder; + + +public class PServer implements Serializable, ShallowCopy<PServer> { + + private static final long serialVersionUID = 1378547515775540874L; + + @Id + @JsonProperty("pserver-id") + private String pserverId; + @JsonProperty("hostname") + private String hostname; + @JsonProperty("physical-links") + private List<PhysicalLink> physicalLinks = new ArrayList<PhysicalLink>(); //TODO techincally there is a pInterface between (pserver <--> physical-link) but dont really need that pojo + + public String getPserverId(){ + return pserverId; + } + + public void setPserverId(String pserverId){ + this.pserverId = pserverId; + } + + public String getHostname(){ + return hostname; + } + + public void setHostname(String hostname){ + this.hostname = hostname; + } + + public List<PhysicalLink> getPhysicalLinks(){ + return physicalLinks; + } + + @Override + public boolean equals(final Object other){ + if(!(other instanceof PServer)){ + return false; + } + PServer castOther = (PServer) other; + return new EqualsBuilder().append(pserverId, castOther.pserverId).isEquals(); + } + + @Override + public int hashCode(){ + return new HashCodeBuilder().append(pserverId).toHashCode(); + } + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/PhysicalLink.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/PhysicalLink.java new file mode 100644 index 0000000000..4f54139386 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/PhysicalLink.java @@ -0,0 +1,149 @@ +/*- + * ============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.servicedecomposition.bbobjects; + +import java.io.Serializable; + +import javax.persistence.Id; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("physical-link") +public class PhysicalLink implements Serializable, ShallowCopy<PhysicalLink> { + + private static final long serialVersionUID = -6378347998443741227L; + + @Id + @JsonProperty("link-name") + private String linkName; + @JsonProperty("interface-name") + private String interfaceName; + @JsonProperty("service-provider-name") + private String serviceProviderName; + @JsonProperty("circuit-id") + private String circuitId; + @JsonProperty("management-option") + private String managementOption; + @JsonProperty("bandwidth-up") + private int bandwidthUp; + @JsonProperty("bandwidth-down") + private int bandwidthDown; + @JsonProperty("bandwidth-units") + private String bandwidthUnits; + @JsonProperty("wan-port") + private String wanPort; + + + public String getLinkName(){ + return linkName; + } + + public void setLinkName(String linkName){ + this.linkName = linkName; + } + + public String getInterfaceName(){ + return interfaceName; + } + + public void setInterfaceName(String interfaceName){ + this.interfaceName = interfaceName; + } + + + public String getServiceProviderName(){ + return serviceProviderName; + } + + + public void setServiceProviderName(String serviceProviderName){ + this.serviceProviderName = serviceProviderName; + } + + public String getCircuitId(){ + return circuitId; + } + + public void setCircuitId(String circuitId){ + this.circuitId = circuitId; + } + + public String getManagementOption(){ + return managementOption; + } + + public void setManagementOption(String managementOption){ + this.managementOption = managementOption; + } + + public int getBandwidthUp(){ + return bandwidthUp; + } + + public void setBandwidthUp(int bandwidthUp){ + this.bandwidthUp = bandwidthUp; + } + + public int getBandwidthDown(){ + return bandwidthDown; + } + + public void setBandwidthDown(int bandwidthDown){ + this.bandwidthDown = bandwidthDown; + } + + public String getBandwidthUnits(){ + return bandwidthUnits; + } + + public void setBandwidthUnits(String bandwidthUnits){ + this.bandwidthUnits = bandwidthUnits; + } + + public String getWanPort(){ + return wanPort; + } + + public void setWanPort(String wanPort){ + this.wanPort = wanPort; + } + + + @Override + public boolean equals(final Object other){ + if(!(other instanceof PhysicalLink)){ + return false; + } + PhysicalLink castOther = (PhysicalLink) other; + return new EqualsBuilder().append(linkName, castOther.linkName).isEquals(); + } + + @Override + public int hashCode(){ + return new HashCodeBuilder().append(linkName).toHashCode(); + } + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Platform.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Platform.java new file mode 100644 index 0000000000..642417fa56 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Platform.java @@ -0,0 +1,63 @@ +/*- + * ============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.servicedecomposition.bbobjects; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; + +import javax.persistence.Id; + +@JsonRootName("platform") +public class Platform implements Serializable, ShallowCopy<Platform> { + + private static final long serialVersionUID = -9127507763010448699L; + + @Id + @JsonProperty("platform-name") + private String platformName; + + public String getPlatformName() { + return platformName; + } + + public void setPlatformName(String platformName) { + this.platformName = platformName; + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof Platform)) { + return false; + } + Platform castOther = (Platform) other; + return new EqualsBuilder().append(platformName, castOther.platformName).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(platformName).toHashCode(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Pnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Pnf.java new file mode 100644 index 0000000000..2ec4108343 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Pnf.java @@ -0,0 +1,116 @@ +/*- + * ============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.servicedecomposition.bbobjects; + +import java.io.Serializable; + +import javax.persistence.Id; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.db.catalog.beans.OrchestrationStatus; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; + +@JsonRootName("pnf") +public class Pnf implements Serializable, ShallowCopy<Pnf> { + + private static final long serialVersionUID = -2544848120774529501L; + + @Id + @JsonProperty("pnf-id") + private String pnfId; + + @JsonProperty("pnf-name") + private String pnfName; + + @JsonProperty("role") + private String role; + + @JsonProperty("orchestration-status") + private OrchestrationStatus orchestrationStatus; + + @JsonProperty("cloud-region") + private CloudRegion cloudRegion; + + + public String getPnfId() { + return pnfId; + } + + public void setPnfId(String pnfId) { + this.pnfId = pnfId; + } + + public String getPnfName() { + return pnfName; + } + + public void setPnfName(String pnfName) { + this.pnfName = pnfName; + } + + /** + * Distinguishes Primary or Secondary + */ + public String getRole() { + return role; + } + + /** + * Distinguishes Primary or Secondary + */ + public void setRole(String role) { + this.role = role; + } + + public OrchestrationStatus getOrchestrationStatus() { + return orchestrationStatus; + } + + public void setOrchestrationStatus(OrchestrationStatus orchestrationStatus) { + this.orchestrationStatus = orchestrationStatus; + } + + public CloudRegion getCloudRegion() { + return cloudRegion; + } + + public void setCloudRegion(CloudRegion cloudRegion) { + this.cloudRegion = cloudRegion; + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof Pnf)) { + return false; + } + Pnf castOther = (Pnf) other; + return new EqualsBuilder().append(pnfId, castOther.pnfId).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(pnfId).toHashCode(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Project.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Project.java new file mode 100644 index 0000000000..a815f6af1a --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Project.java @@ -0,0 +1,63 @@ +/*- + * ============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.servicedecomposition.bbobjects; + +import java.io.Serializable; + +import javax.persistence.Id; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; + +@JsonRootName("project") +public class Project implements Serializable, ShallowCopy<Project> { + + private static final long serialVersionUID = 2449880559554533585L; + + @Id + @JsonProperty("project-name") + private String projectName; + + public String getProjectName() { + return projectName; + } + + public void setProjectName(String projectName) { + this.projectName = projectName; + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof Project)) { + return false; + } + Project castOther = (Project) other; + return new EqualsBuilder().append(projectName, castOther.projectName).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(projectName).toHashCode(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/RouteTableReference.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/RouteTableReference.java new file mode 100644 index 0000000000..0d8c3201bc --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/RouteTableReference.java @@ -0,0 +1,74 @@ +/*- + * ============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.servicedecomposition.bbobjects; + +import java.io.Serializable; + +import javax.persistence.Id; + +import com.fasterxml.jackson.annotation.JsonProperty; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; + +public class RouteTableReference implements Serializable, ShallowCopy<RouteTableReference> { + + private static final long serialVersionUID = -698474994443040491L; + + @Id + @JsonProperty("route-table-reference-id") + private String routeTableReferenceId; + @JsonProperty("route-table-reference-fqdn") + private String routeTableReferenceFqdn; + @JsonProperty("resource-version") + private String resourceVersion; + + public String getRouteTableReferenceId() { + return routeTableReferenceId; + } + public void setRouteTableReferenceId(String routeTableReferenceId) { + this.routeTableReferenceId = routeTableReferenceId; + } + public String getRouteTableReferenceFqdn() { + return routeTableReferenceFqdn; + } + public void setRouteTableReferenceFqdn(String routeTableReferenceFqdn) { + this.routeTableReferenceFqdn = routeTableReferenceFqdn; + } + public String getResourceVersion() { + return resourceVersion; + } + public void setResourceVersion(String resourceVersion) { + this.resourceVersion = resourceVersion; + } + @Override + public boolean equals(final Object other) { + if (!(other instanceof RouteTableReference)) { + return false; + } + RouteTableReference castOther = (RouteTableReference) other; + return new EqualsBuilder().append(routeTableReferenceId, castOther.routeTableReferenceId).isEquals(); + } + @Override + public int hashCode() { + return new HashCodeBuilder().append(routeTableReferenceId).toHashCode(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/RouteTarget.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/RouteTarget.java new file mode 100644 index 0000000000..fc97306cfe --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/RouteTarget.java @@ -0,0 +1,84 @@ +/*- + * ============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.servicedecomposition.bbobjects; + +import java.io.Serializable; + +import javax.persistence.Id; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; + +@JsonRootName("route-target") +public class RouteTarget implements Serializable, ShallowCopy<RouteTarget> { + private static final long serialVersionUID = -4635525992843470461L; + + @Id + @JsonProperty("global-route-target") + protected String globalRouteTarget; + @Id + @JsonProperty("route-target-role") + protected String routeTargetRole; + @JsonProperty("resource-version") + protected String resourceVersion; + + public String getGlobalRouteTarget() { + return globalRouteTarget; + } + + public void setGlobalRouteTarget(String value) { + this.globalRouteTarget = value; + } + + public String getRouteTargetRole() { + return routeTargetRole; + } + + public void setRouteTargetRole(String value) { + this.routeTargetRole = value; + } + + public String getResourceVersion() { + return resourceVersion; + } + + public void setResourceVersion(String value) { + this.resourceVersion = value; + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof RouteTarget)) { + return false; + } + RouteTarget castOther = (RouteTarget) other; + return new EqualsBuilder().append(globalRouteTarget, castOther.globalRouteTarget) + .append(routeTargetRole, castOther.routeTargetRole).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(globalRouteTarget).append(routeTargetRole).toHashCode(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/SegmentationAssignment.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/SegmentationAssignment.java new file mode 100644 index 0000000000..a299f1ef42 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/SegmentationAssignment.java @@ -0,0 +1,60 @@ +/*- + * ============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.servicedecomposition.bbobjects; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; + +import javax.persistence.Id; + +@JsonRootName("segmentation-assignment") +public class SegmentationAssignment implements Serializable, ShallowCopy<SegmentationAssignment>{ + + private static final long serialVersionUID = 5751570091375657521L; + + @Id + @JsonProperty("segmentation-id") + private String segmentationId; + + public String getSegmentationId() { + return segmentationId; + } + public void setSegmentationId(String segmentationId) { + this.segmentationId = segmentationId; + } + @Override + public boolean equals(final Object other) { + if (!(other instanceof SegmentationAssignment)) { + return false; + } + SegmentationAssignment castOther = (SegmentationAssignment) other; + return new EqualsBuilder().append(segmentationId, castOther.segmentationId).isEquals(); + } + @Override + public int hashCode() { + return new HashCodeBuilder().append(segmentationId).toHashCode(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceInstance.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceInstance.java new file mode 100644 index 0000000000..259a988262 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceInstance.java @@ -0,0 +1,206 @@ +/*- + * ============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.servicedecomposition.bbobjects; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import javax.persistence.Id; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.Metadata; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance; +import org.onap.so.db.catalog.beans.OrchestrationStatus; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; +import org.onap.so.bpmn.servicedecomposition.homingobjects.SolutionInfo; + +@JsonRootName("service-instance") +public class ServiceInstance implements Serializable, ShallowCopy<ServiceInstance> { + + private static final long serialVersionUID = -1843348234891739356L; + + @Id + @JsonProperty("service-instance-id") + private String serviceInstanceId; + @JsonProperty("service-instance-name") + private String serviceInstanceName; + @JsonProperty("orchestration-status") + private OrchestrationStatus orchestrationStatus; + @JsonProperty("owning-entity") + private OwningEntity owningEntity; + @JsonProperty("project") + private Project project; + @JsonProperty("collection") + private Collection collection; + @JsonProperty("vnfs") + private List<GenericVnf> vnfs = new ArrayList<>(); + @JsonProperty("pnfs") + private List<Pnf> pnfs = new ArrayList<>(); + @JsonProperty("allotted-resources") + private List<AllottedResource> allottedResources = new ArrayList<>(); + @JsonProperty("networks") + private List<L3Network> networks = new ArrayList<>(); + @JsonProperty("vpn-bonding-links") + private List<VpnBondingLink> vpnBondingLinks = new ArrayList<>(); + @JsonProperty("vhn-portal-url") + private String vhnPortalUrl; + @JsonProperty("service-instance-location-id") + private String serviceInstanceLocationId; + @JsonProperty("selflink") + private String selflink; + @JsonProperty("metadata") + private Metadata metadata; + @JsonProperty("configurations") + private List<Configuration> configurations = new ArrayList<>(); + @JsonProperty("solution-info") + private SolutionInfo solutionInfo; + @JsonProperty("model-info-service-instance") + private ModelInfoServiceInstance modelInfoServiceInstance; + + public List<GenericVnf> getVnfs() { + return vnfs; + } + public List<AllottedResource> getAllottedResources() { + return allottedResources; + } + public List<L3Network> getNetworks() { + return networks; + } + public ModelInfoServiceInstance getModelInfoServiceInstance() { + return modelInfoServiceInstance; + } + public void setModelInfoServiceInstance(ModelInfoServiceInstance modelInfoServiceInstance) { + this.modelInfoServiceInstance = modelInfoServiceInstance; + } + public List<Configuration> getConfigurations() { + return configurations; + } + public void setConfigurations(List<Configuration> configurations) { + this.configurations = configurations; + } + public String getVhnPortalUrl() { + return vhnPortalUrl; + } + + public void setVhnPortalUrl(String vhnPortalUrl) { + this.vhnPortalUrl = vhnPortalUrl; + } + + public String getServiceInstanceLocationId() { + return serviceInstanceLocationId; + } + + public void setServiceInstanceLocationId(String serviceInstanceLocationId) { + this.serviceInstanceLocationId = serviceInstanceLocationId; + } + + public String getSelflink() { + return selflink; + } + + public void setSelflink(String selflink) { + this.selflink = selflink; + } + + public Metadata getMetadata() { + return metadata; + } + + public void setMetadata(Metadata metadata) { + this.metadata = metadata; + } + + public String getServiceInstanceId() { + return serviceInstanceId; + } + + public void setServiceInstanceId(String serviceInstanceId) { + this.serviceInstanceId = serviceInstanceId; + } + + public String getServiceInstanceName() { + return serviceInstanceName; + } + + public void setServiceInstanceName(String serviceInstanceName) { + this.serviceInstanceName = serviceInstanceName; + } + + public OrchestrationStatus getOrchestrationStatus() { + return orchestrationStatus; + } + + public void setOrchestrationStatus(OrchestrationStatus orchestrationStatus) { + this.orchestrationStatus = orchestrationStatus; + } + + public OwningEntity getOwningEntity() { + return owningEntity; + } + + public void setOwningEntity(OwningEntity owningEntity) { + this.owningEntity = owningEntity; + } + + public Project getProject() { + return project; + } + + public void setProject(Project project) { + this.project = project; + } + + public Collection getCollection() { + return collection; + } + public void setCollection(Collection collection) { + this.collection = collection; + } + public List<VpnBondingLink> getVpnBondingLinks() { + return vpnBondingLinks; + } + public List<Pnf> getPnfs() { + return pnfs; + } + public SolutionInfo getSolutionInfo() { + return solutionInfo; + } + public void setSolutionInfo(SolutionInfo solutionInfo) { + this.solutionInfo = solutionInfo; + } + @Override + public boolean equals(final Object other) { + if (!(other instanceof ServiceInstance)) { + return false; + } + ServiceInstance castOther = (ServiceInstance) other; + return new EqualsBuilder().append(serviceInstanceId, castOther.serviceInstanceId).isEquals(); + } + @Override + public int hashCode() { + return new HashCodeBuilder().append(serviceInstanceId).toHashCode(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceProxy.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceProxy.java new file mode 100644 index 0000000000..fa076770d7 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceProxy.java @@ -0,0 +1,108 @@ +/*- + * ============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.servicedecomposition.bbobjects; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; +import org.onap.so.bpmn.servicedecomposition.homingobjects.SolutionCandidates; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceProxy; + +import java.io.Serializable; +import javax.persistence.Id; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; + +@JsonRootName("service-proxy") +public class ServiceProxy extends SolutionCandidates implements Serializable, ShallowCopy<ServiceProxy> { + private static final long serialVersionUID = 1491890223056651430L; + + @Id + @JsonProperty("id") + private String id; + + @JsonProperty("type") + private String type; + + @JsonProperty("service-instance") + private ServiceInstance serviceInstance; + + @JsonProperty("model-info-service-proxy") + private ModelInfoServiceProxy modelInfoServiceProxy; + + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + /** + * Way to identify the type of proxy + * i.e. "infrastructure", "transport", etc. + */ + public String getType() { + return type; + } + + /** + * Way to identify the type of proxy + * i.e. "infrastructure", "transport", etc. + */ + public void setType(String type) { + this.type = type; + } + + public ServiceInstance getServiceInstance() { + return serviceInstance; + } + + public void setServiceInstance(ServiceInstance serviceInstance) { + this.serviceInstance = serviceInstance; + } + + public ModelInfoServiceProxy getModelInfoServiceProxy() { + return modelInfoServiceProxy; + } + + public void setModelInfoServiceProxy(ModelInfoServiceProxy modelInfoServiceProxy) { + this.modelInfoServiceProxy = modelInfoServiceProxy; + } + + @Override + public boolean equals(final Object other){ + if(!(other instanceof ServiceProxy)){ + return false; + } + ServiceProxy castOther = (ServiceProxy) other; + return new EqualsBuilder().append(id, castOther.id).isEquals(); + } + + @Override + public int hashCode(){ + return new HashCodeBuilder().append(id).toHashCode(); + } + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceSubscription.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceSubscription.java new file mode 100644 index 0000000000..56f95516b1 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceSubscription.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.servicedecomposition.bbobjects; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; + +import javax.persistence.Id; + +@JsonRootName("service-subscription") +public class ServiceSubscription implements Serializable, ShallowCopy<ServiceSubscription>{ + + private static final long serialVersionUID = 9064449329296611436L; + + @Id + @JsonProperty("service-type") + private String serviceType; + @JsonProperty("temp-ub-sub-account-id") + private String tempUbSubAccountId; + @JsonProperty("service-instances") + private List<ServiceInstance> serviceInstances = new ArrayList<ServiceInstance>(); + + public String getServiceType() { + return serviceType; + } + public void setServiceType(String serviceType) { + this.serviceType = serviceType; + } + public String getTempUbSubAccountId() { + return tempUbSubAccountId; + } + public void setTempUbSubAccountId(String tempUbSubAccountId) { + this.tempUbSubAccountId = tempUbSubAccountId; + } + public List<ServiceInstance> getServiceInstances() { + return serviceInstances; + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof ServiceSubscription)) { + return false; + } + ServiceSubscription castOther = (ServiceSubscription) other; + return new EqualsBuilder().append(serviceType, castOther.serviceType).isEquals(); + } + @Override + public int hashCode() { + return new HashCodeBuilder().append(serviceType).toHashCode(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/SriovVf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/SriovVf.java new file mode 100644 index 0000000000..fcea22819e --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/SriovVf.java @@ -0,0 +1,156 @@ +/*- + * ============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.servicedecomposition.bbobjects; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; + +import javax.persistence.Id; + +@JsonRootName("sriov-vf") +public class SriovVf implements Serializable, ShallowCopy<SriovVf>{ + + private static final long serialVersionUID = -7790331637399859914L; + + @Id + @JsonProperty("pci-id") + private String pciId; + @JsonProperty("vf-vlan-filter") + private String vfVlanFilter; + @JsonProperty("vf-mac-filter") + private String vfMacFilter; + @JsonProperty("vf-vlan-strip") + private Boolean vfVlanStrip; + @JsonProperty("vf-vlan-anti-spoof-check") + private Boolean vfVlanAntiSpoofCheck; + @JsonProperty("vf-mac-anti-spoof-check") + private Boolean vfMacAntiSpoofCheck; + @JsonProperty("vf-mirrors") + private String vfMirrors; + @JsonProperty("vf-broadcast-allow") + private Boolean vfBroadcastAllow; + @JsonProperty("vf-unknown-multicast-allow") + private Boolean vfUnknownMulticastAllow; + @JsonProperty("vf-unknown-unicast-allow") + private Boolean vfUnknownUnicastAllow; + @JsonProperty("vf-insert-stag") + private Boolean vfInsertStag; + @JsonProperty("vf-link-status") + private String vfLinkStatus; + @JsonProperty("neutron-network-id") + private String neutronNetworkId; + + public String getPciId() { + return pciId; + } + public void setPciId(String pciId) { + this.pciId = pciId; + } + public String getVfVlanFilter() { + return vfVlanFilter; + } + public void setVfVlanFilter(String vfVlanFilter) { + this.vfVlanFilter = vfVlanFilter; + } + public String getVfMacFilter() { + return vfMacFilter; + } + public void setVfMacFilter(String vfMacFilter) { + this.vfMacFilter = vfMacFilter; + } + public Boolean getVfVlanStrip() { + return vfVlanStrip; + } + public void setVfVlanStrip(Boolean vfVlanStrip) { + this.vfVlanStrip = vfVlanStrip; + } + public Boolean getVfVlanAntiSpoofCheck() { + return vfVlanAntiSpoofCheck; + } + public void setVfVlanAntiSpoofCheck(Boolean vfVlanAntiSpoofCheck) { + this.vfVlanAntiSpoofCheck = vfVlanAntiSpoofCheck; + } + public Boolean getVfMacAntiSpoofCheck() { + return vfMacAntiSpoofCheck; + } + public void setVfMacAntiSpoofCheck(Boolean vfMacAntiSpoofCheck) { + this.vfMacAntiSpoofCheck = vfMacAntiSpoofCheck; + } + public String getVfMirrors() { + return vfMirrors; + } + public void setVfMirrors(String vfMirrors) { + this.vfMirrors = vfMirrors; + } + public Boolean getVfBroadcastAllow() { + return vfBroadcastAllow; + } + public void setVfBroadcastAllow(Boolean vfBroadcastAllow) { + this.vfBroadcastAllow = vfBroadcastAllow; + } + public Boolean getVfUnknownMulticastAllow() { + return vfUnknownMulticastAllow; + } + public void setVfUnknownMulticastAllow(Boolean vfUnknownMulticastAllow) { + this.vfUnknownMulticastAllow = vfUnknownMulticastAllow; + } + public Boolean getVfUnknownUnicastAllow() { + return vfUnknownUnicastAllow; + } + public void setVfUnknownUnicastAllow(Boolean vfUnknownUnicastAllow) { + this.vfUnknownUnicastAllow = vfUnknownUnicastAllow; + } + public Boolean getVfInsertStag() { + return vfInsertStag; + } + public void setVfInsertStag(Boolean vfInsertStag) { + this.vfInsertStag = vfInsertStag; + } + public String getVfLinkStatus() { + return vfLinkStatus; + } + public void setVfLinkStatus(String vfLinkStatus) { + this.vfLinkStatus = vfLinkStatus; + } + public String getNeutronNetworkId() { + return neutronNetworkId; + } + public void setNeutronNetworkId(String neutronNetworkId) { + this.neutronNetworkId = neutronNetworkId; + } + @Override + public boolean equals(final Object other) { + if (!(other instanceof SriovVf)) { + return false; + } + SriovVf castOther = (SriovVf) other; + return new EqualsBuilder().append(pciId, castOther.pciId).isEquals(); + } + @Override + public int hashCode() { + return new HashCodeBuilder().append(pciId).toHashCode(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Subnet.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Subnet.java new file mode 100644 index 0000000000..cb23f3a3b9 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Subnet.java @@ -0,0 +1,173 @@ +/*- + * ============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.servicedecomposition.bbobjects; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.db.catalog.beans.OrchestrationStatus; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; + +import javax.persistence.Id; + +@JsonRootName("subnet") +public class Subnet implements Serializable, ShallowCopy<Subnet>{ + + private static final long serialVersionUID = -6789344717555598319L; + + @Id + @JsonProperty("subnet-id") + private String subnetId; + @JsonProperty("subnet-name") + private String subnetName; + @JsonProperty("neutron-subnet-id") + private String neutronSubnetId; + @JsonProperty("gateway-address") + private String gatewayAddress; + @JsonProperty("network-start-address") + private String networkStartAddress; + @JsonProperty("cidr-mask") + private String cidrMask; + @JsonProperty("ip-version") + private String ipVersion; + @JsonProperty("orchestration-status") + private OrchestrationStatus orchestrationStatus; + @JsonProperty("dhcp-enabled") + private boolean dhcpEnabled; + @JsonProperty("dhcp-start") + private String dhcpStart; + @JsonProperty("dhcp-end") + private String dhcpEnd; + @JsonProperty("subnet-role") + private String subnetRole; + @JsonProperty("ip-assignment-direction") + private String ipAssignmentDirection; + @JsonProperty("subnet-sequence") + private Integer subnetSequence; + @JsonProperty("host-routes") + private List<HostRoute> hostRoutes = new ArrayList<>(); + + public String getSubnetId() { + return subnetId; + } + public void setSubnetId(String subnetId) { + this.subnetId = subnetId; + } + public String getSubnetName() { + return subnetName; + } + public void setSubnetName(String subnetName) { + this.subnetName = subnetName; + } + public String getNeutronSubnetId() { + return neutronSubnetId; + } + public void setNeutronSubnetId(String neutronSubnetId) { + this.neutronSubnetId = neutronSubnetId; + } + public String getGatewayAddress() { + return gatewayAddress; + } + public void setGatewayAddress(String gatewayAddress) { + this.gatewayAddress = gatewayAddress; + } + public String getNetworkStartAddress() { + return networkStartAddress; + } + public void setNetworkStartAddress(String networkStartAddress) { + this.networkStartAddress = networkStartAddress; + } + public String getCidrMask() { + return cidrMask; + } + public void setCidrMask(String cidrMask) { + this.cidrMask = cidrMask; + } + public String getIpVersion() { + return ipVersion; + } + public void setIpVersion(String ipVersion) { + this.ipVersion = ipVersion; + } + public OrchestrationStatus getOrchestrationStatus() { + return orchestrationStatus; + } + public void setOrchestrationStatus(OrchestrationStatus orchestrationStatus) { + this.orchestrationStatus = orchestrationStatus; + } + public boolean isDhcpEnabled() { + return dhcpEnabled; + } + public void setDhcpEnabled(boolean dhcpEnabled) { + this.dhcpEnabled = dhcpEnabled; + } + public String getDhcpStart() { + return dhcpStart; + } + public void setDhcpStart(String dhcpStart) { + this.dhcpStart = dhcpStart; + } + public String getDhcpEnd() { + return dhcpEnd; + } + public void setDhcpEnd(String dhcpEnd) { + this.dhcpEnd = dhcpEnd; + } + public String getSubnetRole() { + return subnetRole; + } + public void setSubnetRole(String subnetRole) { + this.subnetRole = subnetRole; + } + public String getIpAssignmentDirection() { + return ipAssignmentDirection; + } + public void setIpAssignmentDirection(String ipAssignmentDirection) { + this.ipAssignmentDirection = ipAssignmentDirection; + } + public Integer getSubnetSequence() { + return subnetSequence; + } + public void setSubnetSequence(Integer subnetSequence) { + this.subnetSequence = subnetSequence; + } + public List<HostRoute> getHostRoutes() { + return hostRoutes; + } + @Override + public boolean equals(final Object other) { + if (!(other instanceof Subnet)) { + return false; + } + Subnet castOther = (Subnet) other; + return new EqualsBuilder().append(subnetId, castOther.subnetId).isEquals(); + } + @Override + public int hashCode() { + return new HashCodeBuilder().append(subnetId).toHashCode(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VfModule.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VfModule.java new file mode 100644 index 0000000000..fba78d7a87 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VfModule.java @@ -0,0 +1,137 @@ +/*- + * ============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.servicedecomposition.bbobjects; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; + +import javax.persistence.Id; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule; +import org.onap.so.db.catalog.beans.OrchestrationStatus; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; + +@JsonRootName("vf-module") +public class VfModule implements Serializable, ShallowCopy<VfModule> { + + private static final long serialVersionUID = 6570087672008609773L; + + @Id + @JsonProperty("vf-module-id") + private String vfModuleId; + @JsonProperty("vf-module-name") + private String vfModuleName; + @JsonProperty("orchestration-status") + private OrchestrationStatus orchestrationStatus; + @JsonProperty("cloud-params") + private Map<String, String> cloudParams = new HashMap<>(); + @JsonProperty("cascaded") + private boolean cascaded; + @JsonProperty("heat-stack-id") + private String heatStackId; + @JsonProperty("contrail-service-instance-fqdn") + private String contrailServiceInstanceFqdn; + @JsonProperty("module-index") + private Integer moduleIndex; + @JsonProperty("selflink") + private String selflink; + @JsonProperty("model-info-vf-module") + private ModelInfoVfModule modelInfoVfModule; + + public ModelInfoVfModule getModelInfoVfModule() { + return modelInfoVfModule; + } + public void setModelInfoVfModule(ModelInfoVfModule modelInfoVfModule) { + this.modelInfoVfModule = modelInfoVfModule; + } + public String getHeatStackId() { + return heatStackId; + } + public void setHeatStackId(String heatStackId) { + this.heatStackId = heatStackId; + } + public String getContrailServiceInstanceFqdn() { + return contrailServiceInstanceFqdn; + } + public void setContrailServiceInstanceFqdn(String contrailServiceInstanceFqdn) { + this.contrailServiceInstanceFqdn = contrailServiceInstanceFqdn; + } + public Integer getModuleIndex() { + return moduleIndex; + } + public void setModuleIndex(Integer moduleIndex) { + this.moduleIndex = moduleIndex; + } + public String getSelflink() { + return selflink; + } + public void setSelflink(String selflink) { + this.selflink = selflink; + } + public String getVfModuleId() { + return vfModuleId; + } + public void setVfModuleId(String vfModuleId) { + this.vfModuleId = vfModuleId; + } + public String getVfModuleName() { + return vfModuleName; + } + public void setVfModuleName(String vfModuleName) { + this.vfModuleName = vfModuleName; + } + public OrchestrationStatus getOrchestrationStatus() { + return orchestrationStatus; + } + public void setOrchestrationStatus(OrchestrationStatus orchestrationStatus) { + this.orchestrationStatus = orchestrationStatus; + } + public Map<String, String> getCloudParams() { + return cloudParams; + } + public void setCloudParams(Map<String, String> cloudParams) { + this.cloudParams = cloudParams; + } + public boolean isCascaded() { + return cascaded; + } + public void setCascaded(boolean cascaded) { + this.cascaded = cascaded; + } + @Override + public boolean equals(final Object other) { + if (!(other instanceof VfModule)) { + return false; + } + VfModule castOther = (VfModule) other; + return new EqualsBuilder().append(vfModuleId, castOther.vfModuleId).isEquals(); + } + @Override + public int hashCode() { + return new HashCodeBuilder().append(vfModuleId).toHashCode(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Vlan.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Vlan.java new file mode 100644 index 0000000000..65eeedc44c --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Vlan.java @@ -0,0 +1,162 @@ +/*- + * ============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.servicedecomposition.bbobjects; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.db.catalog.beans.OrchestrationStatus; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; + +import javax.persistence.Id; + +@JsonRootName("vlan") +public class Vlan implements Serializable, ShallowCopy<Vlan>{ + + private static final long serialVersionUID = 1260512753640402946L; + + @Id + @JsonProperty("vlan-interface") + private String vlanInterface; + @JsonProperty("vlan-id-inner") + private Long vlanIdInner; + @JsonProperty("vlan-id-outer") + private Long vlanIdOuter; + @JsonProperty("speed-value") + private String speedValue; + @JsonProperty("speed-units") + private String speedUnits; + @JsonProperty("vlan-description") + private String vlanDescription; + @JsonProperty("backdoor-connection") + private String backdoorConnection; + @JsonProperty("vpn-key") + private String vpnKey; + @JsonProperty("orchestration-status") + private OrchestrationStatus orchestrationStatus; + @JsonProperty("in-maint") + private boolean inMaint; + @JsonProperty("prov-status") + private String provStatus; + @JsonProperty("is-ip-unnumbered") + private boolean isIpUnnumbered; + @JsonProperty("l3-interface-ipv4-address-list") + private List<L3InterfaceIpv4AddressList> l3InterfaceIpv4AddressList = new ArrayList<L3InterfaceIpv4AddressList>(); + @JsonProperty("l3-interface-ipv6-address-list") + private List<L3InterfaceIpv6AddressList> l3InterfaceIpv6AddressList = new ArrayList<L3InterfaceIpv6AddressList>(); + + public String getVlanInterface() { + return vlanInterface; + } + public void setVlanInterface(String vlanInterface) { + this.vlanInterface = vlanInterface; + } + public Long getVlanIdInner() { + return vlanIdInner; + } + public void setVlanIdInner(Long vlanIdInner) { + this.vlanIdInner = vlanIdInner; + } + public Long getVlanIdOuter() { + return vlanIdOuter; + } + public void setVlanIdOuter(Long vlanIdOuter) { + this.vlanIdOuter = vlanIdOuter; + } + public String getSpeedValue() { + return speedValue; + } + public void setSpeedValue(String speedValue) { + this.speedValue = speedValue; + } + public String getSpeedUnits() { + return speedUnits; + } + public void setSpeedUnits(String speedUnits) { + this.speedUnits = speedUnits; + } + public String getVlanDescription() { + return vlanDescription; + } + public void setVlanDescription(String vlanDescription) { + this.vlanDescription = vlanDescription; + } + public String getBackdoorConnection() { + return backdoorConnection; + } + public void setBackdoorConnection(String backdoorConnection) { + this.backdoorConnection = backdoorConnection; + } + public String getVpnKey() { + return vpnKey; + } + public void setVpnKey(String vpnKey) { + this.vpnKey = vpnKey; + } + public OrchestrationStatus getOrchestrationStatus() { + return orchestrationStatus; + } + public void setOrchestrationStatus(OrchestrationStatus orchestrationStatus) { + this.orchestrationStatus = orchestrationStatus; + } + public boolean isInMaint() { + return inMaint; + } + public void setInMaint(boolean inMaint) { + this.inMaint = inMaint; + } + public String getProvStatus() { + return provStatus; + } + public void setProvStatus(String provStatus) { + this.provStatus = provStatus; + } + public boolean isIpUnnumbered() { + return isIpUnnumbered; + } + public void setIpUnnumbered(boolean isIpUnnumbered) { + this.isIpUnnumbered = isIpUnnumbered; + } + public List<L3InterfaceIpv4AddressList> getL3InterfaceIpv4AddressList() { + return l3InterfaceIpv4AddressList; + } + public List<L3InterfaceIpv6AddressList> getL3InterfaceIpv6AddressList() { + return l3InterfaceIpv6AddressList; + } + @Override + public boolean equals(final Object other) { + if (!(other instanceof Vlan)) { + return false; + } + Vlan castOther = (Vlan) other; + return new EqualsBuilder().append(vlanInterface, castOther.vlanInterface).isEquals(); + } + @Override + public int hashCode() { + return new HashCodeBuilder().append(vlanInterface).toHashCode(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VolumeGroup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VolumeGroup.java new file mode 100644 index 0000000000..565a151077 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VolumeGroup.java @@ -0,0 +1,121 @@ +/*- + * ============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.servicedecomposition.bbobjects; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; + +import javax.persistence.Id; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule; +import org.onap.so.db.catalog.beans.OrchestrationStatus; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; + +@JsonRootName("volume-group") +public class VolumeGroup implements Serializable, ShallowCopy<VolumeGroup> { + + private static final long serialVersionUID = 870124265764370922L; + + @Id + @JsonProperty("volume-group-id") + private String volumeGroupId; + @JsonProperty("volume-group-name") + private String volumeGroupName; + @JsonProperty("vnf-type") + private String vnfType; + @JsonProperty("orchestration-status") + private OrchestrationStatus orchestrationStatus; + @JsonProperty("cloud-params") + private Map<String, String> cloudParams = new HashMap<>(); + @JsonProperty("cascaded") + private boolean cascaded; + @JsonProperty("heat-stack-id") + private String heatStackId; + @JsonProperty("model-info-vf-module") + private ModelInfoVfModule modelInfoVfModule; + + public ModelInfoVfModule getModelInfoVfModule() { + return modelInfoVfModule; + } + public void setModelInfoVfModule(ModelInfoVfModule modelInfoVfModule) { + this.modelInfoVfModule = modelInfoVfModule; + } + public String getHeatStackId() { + return heatStackId; + } + public void setHeatStackId(String heatStackId) { + this.heatStackId = heatStackId; + } + public String getVolumeGroupId() { + return volumeGroupId; + } + public void setVolumeGroupId(String volumeGroupId) { + this.volumeGroupId = volumeGroupId; + } + public String getVolumeGroupName() { + return volumeGroupName; + } + public void setVolumeGroupName(String volumeGroupName) { + this.volumeGroupName = volumeGroupName; + } + public String getVnfType() { + return vnfType; + } + public void setVnfType(String vnfType) { + this.vnfType = vnfType; + } + public OrchestrationStatus getOrchestrationStatus() { + return orchestrationStatus; + } + public void setOrchestrationStatus(OrchestrationStatus orchestrationStatus) { + this.orchestrationStatus = orchestrationStatus; + } + public Map<String, String> getCloudParams() { + return cloudParams; + } + public void setCloudParams(Map<String, String> cloudParams) { + this.cloudParams = cloudParams; + } + public boolean isCascaded() { + return cascaded; + } + public void setCascaded(boolean cascaded) { + this.cascaded = cascaded; + } + @Override + public boolean equals(final Object other) { + if (!(other instanceof VolumeGroup)) { + return false; + } + VolumeGroup castOther = (VolumeGroup) other; + return new EqualsBuilder().append(volumeGroupId, castOther.volumeGroupId).isEquals(); + } + @Override + public int hashCode() { + return new HashCodeBuilder().append(volumeGroupId).toHashCode(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VpnBinding.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VpnBinding.java new file mode 100644 index 0000000000..36e1af443c --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VpnBinding.java @@ -0,0 +1,141 @@ +/*- + * ============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.servicedecomposition.bbobjects; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import javax.persistence.Id; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; + + +@JsonRootName("vpn-binding") +public class VpnBinding implements Serializable, ShallowCopy<VpnBinding> { + private static final long serialVersionUID = 3283413795353486924L; + + @Id + @JsonProperty("vpn-id") + private String vpnId; + @JsonProperty("vpn-name") + private String vpnName; + @JsonProperty("vpn-platform") + private String vpnPlatform; + @JsonProperty("vpn-type") + private String vpnType; + @JsonProperty("vpn-region") + private String vpnRegion; + @JsonProperty("customer-vpn-id") + private String customerVpnId; + @JsonProperty("route-distinguisher") + private String routeDistinguisher; + @JsonProperty("resource-version") + private String resourceVersion; + @JsonProperty("route-targets") + private List<RouteTarget> routeTargets = new ArrayList<>(); + + public String getVpnId() { + return vpnId; + } + + public void setVpnId(String value) { + this.vpnId = value; + } + + public String getVpnName() { + return vpnName; + } + + public void setVpnName(String value) { + this.vpnName = value; + } + + public String getVpnPlatform() { + return vpnPlatform; + } + + public void setVpnPlatform(String value) { + this.vpnPlatform = value; + } + + public String getVpnType() { + return vpnType; + } + + public void setVpnType(String value) { + this.vpnType = value; + } + + public String getVpnRegion() { + return vpnRegion; + } + + public void setVpnRegion(String value) { + this.vpnRegion = value; + } + + public String getCustomerVpnId() { + return customerVpnId; + } + + public void setCustomerVpnId(String value) { + this.customerVpnId = value; + } + + public String getRouteDistinguisher() { + return routeDistinguisher; + } + + public void setRouteDistinguisher(String value) { + this.routeDistinguisher = value; + } + + public String getResourceVersion() { + return resourceVersion; + } + + public void setResourceVersion(String value) { + this.resourceVersion = value; + } + + public List<RouteTarget> getRouteTargets() { + return routeTargets; + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof VpnBinding)) { + return false; + } + VpnBinding castOther = (VpnBinding) other; + return new EqualsBuilder().append(vpnId, castOther.vpnId).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(vpnId).toHashCode(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VpnBondingLink.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VpnBondingLink.java new file mode 100644 index 0000000000..dec3d48203 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VpnBondingLink.java @@ -0,0 +1,166 @@ +/*- + * ============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.servicedecomposition.bbobjects; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +import javax.persistence.Id; + +import static org.apache.commons.lang3.StringUtils.*; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; + +@JsonRootName("vpn-bonding-link") +public class VpnBondingLink implements Serializable, ShallowCopy<VpnBondingLink> { + + private static final long serialVersionUID = -8355973761714642727L; + + @Id + @JsonProperty("vpn-bonding-link-id") + private String vpnBondingLinkId; + + @JsonProperty("configurations") + private List<Configuration> configurations = new ArrayList<Configuration>(); + + @JsonProperty("service-proxies") + private List<ServiceProxy> serviceProxies = new ArrayList<ServiceProxy>(); + + public String getVpnBondingLinkId() { + return vpnBondingLinkId; + } + + public void setVpnBondingLinkId(String vpnBondingLinkId) { + this.vpnBondingLinkId = vpnBondingLinkId; + } + + public List<Configuration> getConfigurations() { + return configurations; + } + + public List<ServiceProxy> getServiceProxies() { + return serviceProxies; + } + + public ServiceProxy getServiceProxy(String id) { + ServiceProxy serviceProxy = null; + for(ServiceProxy s : serviceProxies){ + if(s.getId().equals(id)){ + serviceProxy = s; + } + } + return serviceProxy; + } + + //TODO temp solution until references are updated to use getConfigurationByType + public Configuration getVnrConfiguration() { + Configuration configuration = null; + for(Configuration c:configurations){ + if(containsIgnoreCase(c.getConfigurationType(), "vlan") || containsIgnoreCase(c.getConfigurationType(), "vnr")){ + configuration = c; + } + } + return configuration; + } + + //TODO temp solution until references are updatedd + public void setVnrConfiguration(Configuration vnrConfiguration) { + if(vnrConfiguration.getConfigurationType() == null){ + vnrConfiguration.setConfigurationType("vlan"); + } + configurations.add(vnrConfiguration); + } + + //TODO temp solution until references are updated to use getConfigurationByType + public Configuration getVrfConfiguration() { + Configuration configuration = null; + for(Configuration c:configurations){ + if(containsIgnoreCase(c.getConfigurationType(), "vrf")){ + configuration = c; + } + } + return configuration; + } + + //TODO temp solution until references are updated + public void setVrfConfiguration(Configuration vrfConfiguration) { + if(vrfConfiguration.getConfigurationType() == null){ + vrfConfiguration.setConfigurationType("vrf"); + } + configurations.add(vrfConfiguration); + } + + //TODO temp solution until references are updated to use getServiceProxyByType + public ServiceProxy getInfrastructureServiceProxy() { + ServiceProxy serviceProxy = null; + for(ServiceProxy sp:serviceProxies){ + if(sp.getType().equals("infrastructure")){ + serviceProxy = sp; + } + } + return serviceProxy; + } + + //TODO temp solution until references are updated + public void setInfrastructureServiceProxy(ServiceProxy infrastructureServiceProxy) { + infrastructureServiceProxy.setType("infrastructure"); + serviceProxies.add(infrastructureServiceProxy); + } + + //TODO temp solution until references are updated to use getServiceProxyByType + public ServiceProxy getTransportServiceProxy() { + ServiceProxy serviceProxy = null; + for(ServiceProxy sp:serviceProxies){ + if(sp != null){ + if(sp.getType().equals("transport")){ + serviceProxy = sp; + } + } + } + return serviceProxy; + } + + //TODO temp solution until references are updated + public void setTransportServiceProxy(ServiceProxy transportServiceProxy) { + transportServiceProxy.setType("transport"); + serviceProxies.add(transportServiceProxy); + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof VpnBondingLink)) { + return false; + } + VpnBondingLink castOther = (VpnBondingLink) other; + return new EqualsBuilder().append(vpnBondingLinkId, castOther.vpnBondingLinkId).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(vpnBondingLinkId).toHashCode(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/BuildingBlock.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/BuildingBlock.java new file mode 100644 index 0000000000..5746dcd586 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/BuildingBlock.java @@ -0,0 +1,66 @@ +/*- + * ============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.servicedecomposition.entities; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("buildingBlock") +public class BuildingBlock implements Serializable{ + + private static final long serialVersionUID = -1144315411128866052L; + + @JsonProperty("mso-id") + private String msoId; + @JsonProperty("bpmn-flow-name") + private String bpmnFlowName; + @JsonProperty("key") + private String key; + @JsonProperty("is-virtual-link") + private boolean isVirtualLink; + + public String getBpmnFlowName() { + return bpmnFlowName; + } + public void setBpmnFlowName(String bpmnFlowName) { + this.bpmnFlowName = bpmnFlowName; + } + public String getMsoId() { + return msoId; + } + public void setMsoId(String msoId) { + this.msoId = msoId; + } + public String getKey() { + return key; + } + public void setKey(String key) { + this.key = key; + } + public boolean getIsVirtualLink() { + return isVirtualLink; + } + public void setIsVirtualLink(boolean isVirtualLink) { + this.isVirtualLink = isVirtualLink; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ExecuteBuildingBlock.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ExecuteBuildingBlock.java new file mode 100644 index 0000000000..36a24bd1e1 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ExecuteBuildingBlock.java @@ -0,0 +1,103 @@ +/*- + * ============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.servicedecomposition.entities; + +import java.io.Serializable; + +import org.onap.so.serviceinstancebeans.RequestDetails; + +public class ExecuteBuildingBlock implements Serializable{ + /** + * + */ + private static final long serialVersionUID = 1L; + private BuildingBlock buildingBlock; + private String requestId; + private String apiVersion; + private String resourceId; + private String requestAction; + private String vnfType; + private boolean aLaCarte; + private boolean homing; + private WorkflowResourceIds workflowResourceIds; + private RequestDetails requestDetails; + + public BuildingBlock getBuildingBlock() { + return buildingBlock; + } + public void setBuildingBlock(BuildingBlock buildingBlock) { + this.buildingBlock = buildingBlock; + } + public String getRequestId() { + return requestId; + } + public void setRequestId(String requestId) { + this.requestId = requestId; + } + public String getApiVersion() { + return apiVersion; + } + public void setApiVersion(String apiVersion) { + this.apiVersion = apiVersion; + } + public String getResourceId() { + return resourceId; + } + public void setResourceId(String resourceId) { + this.resourceId = resourceId; + } + public String getRequestAction() { + return requestAction; + } + public void setRequestAction(String requestAction) { + this.requestAction = requestAction; + } + public boolean isaLaCarte() { + return aLaCarte; + } + public void setaLaCarte(boolean aLaCarte) { + this.aLaCarte = aLaCarte; + } + public String getVnfType() { + return vnfType; + } + public void setVnfType(String vnfType) { + this.vnfType = vnfType; + } + public boolean isHoming() { + return homing; + } + public void setHoming(boolean homing) { + this.homing = homing; + } + public WorkflowResourceIds getWorkflowResourceIds() { + return workflowResourceIds; + } + public void setWorkflowResourceIds(WorkflowResourceIds workflowResourceIds) { + this.workflowResourceIds = workflowResourceIds; + } + public RequestDetails getRequestDetails() { + return requestDetails; + } + public void setRequestDetails(RequestDetails requestDetails) { + this.requestDetails = requestDetails; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/GeneralBuildingBlock.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/GeneralBuildingBlock.java new file mode 100644 index 0000000000..adea99c4f3 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/GeneralBuildingBlock.java @@ -0,0 +1,93 @@ +/*- + * ============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.servicedecomposition.entities; + +import java.io.Serializable; +import java.util.Map; + +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; + +public class GeneralBuildingBlock implements Serializable { + private static final String INVALID_INPUT_MISSING = "Expected building block input of \"%s\" not found in decomposition"; + private static final String INVALID_INPUT_CLASS_CAST = "Expected building block input of \"%s\" was the wrong object type in the decomposition"; + + private static final long serialVersionUID = -429247436428110843L; + + private RequestContext requestContext; + private OrchestrationContext orchContext; + private Map<String, String> userInput; + private CloudRegion cloudRegion; + + private Customer customer; + private ServiceInstance serviceInstance; + + public CloudRegion getCloudRegion() { + return cloudRegion; + } + + public void setCloudRegion(CloudRegion cloudRegion) { + this.cloudRegion = cloudRegion; + } + + public RequestContext getRequestContext() { + return requestContext; + } + + public void setRequestContext(RequestContext requestContext) { + this.requestContext = requestContext; + } + + public OrchestrationContext getOrchContext() { + return orchContext; + } + + public void setOrchContext(OrchestrationContext orchContext) { + this.orchContext = orchContext; + } + + public Map<String, String> getUserInput() { + return userInput; + } + + public void setUserInput(Map<String, String> userInput) { + this.userInput = userInput; + } + + public Customer getCustomer() { + return customer; + } + + public void setCustomer(Customer customer) { + this.customer = customer; + } + + public ServiceInstance getServiceInstance() { + return serviceInstance; + } + + public void setServiceInstance(ServiceInstance serviceInstance) { + this.serviceInstance = serviceInstance; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ResourceKey.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ResourceKey.java new file mode 100644 index 0000000000..4662db23a1 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ResourceKey.java @@ -0,0 +1,34 @@ +/*- + * ============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.servicedecomposition.entities; + +public enum ResourceKey { + SERVICE_INSTANCE_ID, + GENERIC_VNF_ID, + NETWORK_ID, + VOLUME_GROUP_ID, + VF_MODULE_ID, + ALLOTTED_RESOURCE_ID, + CONFIGURATION_ID, + NETWORK_COLLECTION_ID, + VPN_ID, + VPN_BONDING_LINK_ID; +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/WorkflowResourceIds.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/WorkflowResourceIds.java new file mode 100644 index 0000000000..433315b2ed --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/WorkflowResourceIds.java @@ -0,0 +1,103 @@ +/*- + * ============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.servicedecomposition.entities; + +import java.io.Serializable; +import org.apache.commons.lang3.builder.ToStringBuilder; + +public class WorkflowResourceIds implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 8591599114353940105L; + private String serviceInstanceId; + private String vnfId; + private String networkId; + private String volumeGroupId; + private String vfModuleId; + private String networkCollectionId; + private String configurationId; + + @Override + public String toString() { + return new ToStringBuilder(this).append("serviceInstanceId", serviceInstanceId).append("vnfId", vnfId) + .append("networkId", networkId).append("volumeGroupId", volumeGroupId).append("vfModuleId", vfModuleId) + .append("networkCollectionId", networkCollectionId).append("configurationId", configurationId) + .toString(); + } + + public String getServiceInstanceId() { + return serviceInstanceId; + } + + public void setServiceInstanceId(String serviceInstanceId) { + this.serviceInstanceId = serviceInstanceId; + } + + public String getVnfId() { + return vnfId; + } + + public void setVnfId(String vnfId) { + this.vnfId = vnfId; + } + + public String getNetworkId() { + return networkId; + } + + public void setNetworkId(String networkId) { + this.networkId = networkId; + } + + public String getVolumeGroupId() { + return volumeGroupId; + } + + public void setVolumeGroupId(String volumeGroupId) { + this.volumeGroupId = volumeGroupId; + } + + public String getVfModuleId() { + return vfModuleId; + } + + public void setVfModuleId(String vfModuleId) { + this.vfModuleId = vfModuleId; + } + + public String getNetworkCollectionId() { + return networkCollectionId; + } + + public void setNetworkCollectionId(String networkCollectionId) { + this.networkCollectionId = networkCollectionId; + } + + public String getConfigurationId() { + return configurationId; + } + + public void setConfigurationId(String configurationId) { + this.configurationId = configurationId; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterResponse.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/exceptions/InvalidBuildingBlockInputException.java index 4625bfb74f..21828871db 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterResponse.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/exceptions/InvalidBuildingBlockInputException.java @@ -18,36 +18,30 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.client.sdnc.sync; +package org.onap.so.bpmn.servicedecomposition.entities.exceptions; +public class InvalidBuildingBlockInputException extends Exception { + private static final long serialVersionUID = 221404474263656742L; + + public InvalidBuildingBlockInputException() { + super(); + } -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; + public InvalidBuildingBlockInputException(String message) { + super(message); + } + public InvalidBuildingBlockInputException(String message, Throwable cause) { + super(message, cause); + } -/** - * <p>Java class for anonymous complex type. - * - * <p>The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ -//SDNCAdapter to BPEL Sync Response(ACK) - async response(s) follow -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "") -@XmlRootElement(name = "SDNCAdapterResponse") -public class SDNCAdapterResponse { - + public InvalidBuildingBlockInputException(Throwable cause) { + super(cause); + } + protected InvalidBuildingBlockInputException(String message, Throwable cause, + boolean enableSuppression, + boolean writableStackTrace) { + super(message, cause, enableSuppression, writableStackTrace); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/License.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/License.java new file mode 100644 index 0000000000..e1a12bbad9 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/License.java @@ -0,0 +1,56 @@ +/*- + * ============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.servicedecomposition.generalobjects; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; +import com.fasterxml.jackson.annotation.JsonInclude.Include; + +@JsonRootName("license") +public class License implements Serializable { + + private static final long serialVersionUID = 2345786874755685318L; + + @JsonProperty("entitlement-pool-uuids") + private List<String> entitlementPoolUuids = new ArrayList<String>(); + @JsonProperty("license-key-group-uuids") + private List<String> licenseKeyGroupUuids = new ArrayList<String>(); + + + public List<String> getEntitlementPoolUuids() { + return entitlementPoolUuids; + } + public void setEntitlementPoolUuids(List<String> entitlementPoolUuids) { + this.entitlementPoolUuids = entitlementPoolUuids; + } + public List<String> getLicenseKeyGroupUuids() { + return licenseKeyGroupUuids; + } + public void setLicenseKeyGroupUuids(List<String> licenseKeyGroupUuids) { + this.licenseKeyGroupUuids = licenseKeyGroupUuids; + } + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/OrchestrationContext.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/OrchestrationContext.java new file mode 100644 index 0000000000..d594c73638 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/OrchestrationContext.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.servicedecomposition.generalobjects; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; + +@JsonRootName("orchestration-context") +public class OrchestrationContext implements Serializable { + + private static final long serialVersionUID = 6843015923244810369L; + + @JsonProperty("is-rollback-enabled") + private boolean isRollbackEnabled; + + public boolean getIsRollbackEnabled() { + return this.isRollbackEnabled; + } + + public void setIsRollbackEnabled(boolean isRollbackEnabled) { + this.isRollbackEnabled = isRollbackEnabled; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/RequestContext.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/RequestContext.java new file mode 100644 index 0000000000..7715651b68 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/RequestContext.java @@ -0,0 +1,115 @@ +/*- + * ============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.servicedecomposition.generalobjects; + +import java.io.Serializable; +import java.util.HashMap; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("request-context") +public class RequestContext implements Serializable{ + + private static final long serialVersionUID = -6482733428879732822L; + + @JsonProperty("product-family-id") + private String productFamilyId; + @JsonProperty("source") + private String source; + @JsonProperty("requestor-id") + private String requestorId; + @JsonProperty("subscription-service-type") + private String subscriptionServiceType; + @JsonProperty("user-params") + private HashMap<String, String> userParams; + @JsonProperty("action") + private String action; + @JsonProperty("callback-url") + private String callbackURL; + @JsonProperty("service-uri") + private String serviceURI; + @JsonProperty("mso-request-id") + private String msoRequestId; + @JsonProperty("requestParameters") + private RequestParameters requestParameters; + + public String getServiceURI() { + return serviceURI; + } + public void setServiceURI(String serviceURI) { + this.serviceURI = serviceURI; + } + public String getProductFamilyId() { + return productFamilyId; + } + public void setProductFamilyId(String productFamilyId) { + this.productFamilyId = productFamilyId; + } + public String getSource() { + return source; + } + public void setSource(String source) { + this.source = source; + } + public String getRequestorId() { + return requestorId; + } + public void setRequestorId(String requestorId) { + this.requestorId = requestorId; + } + public String getSubscriptionServiceType() { + return subscriptionServiceType; + } + public void setSubscriptionServiceType(String subscriptionServiceType) { + this.subscriptionServiceType = subscriptionServiceType; + } + public HashMap<String, String> getUserParams() { + return userParams; + } + public void setUserParams(HashMap<String, String> userParams) { + this.userParams = userParams; + } + public String getAction() { + return action; + } + public void setAction(String action) { + this.action = action; + } + public String getCallbackURL() { + return callbackURL; + } + public void setCallbackURL(String callbackURL) { + this.callbackURL = callbackURL; + } + public String getMsoRequestId() { + return msoRequestId; + } + public void setMsoRequestId(String msoRequestId) { + this.msoRequestId = msoRequestId; + } + public RequestParameters getRequestParameters() { + return requestParameters; + } + public void setRequestParameters(RequestParameters requestParameters) { + this.requestParameters = requestParameters; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/RequestParameters.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/RequestParameters.java new file mode 100644 index 0000000000..24c0548641 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/RequestParameters.java @@ -0,0 +1,112 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * 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.servicedecomposition.generalobjects; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.onap.so.logger.MsoLogger; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.ObjectWriter; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName(value = "requestParameters") +@JsonInclude(Include.NON_DEFAULT) +public class RequestParameters implements Serializable { + + private static final MsoLogger log = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, RequestParameters.class); + + private static final long serialVersionUID = -5979049912538894930L; + @JsonProperty("subscriptionServiceType") + private String subscriptionServiceType; + @JsonProperty("userParams") + private List<Map<String, Object>> userParams = new ArrayList<>(); + @JsonProperty("aLaCarte") + private Boolean aLaCarte; + + + public String getSubscriptionServiceType() { + return subscriptionServiceType; + } + + public void setSubscriptionServiceType(String subscriptionServiceType) { + this.subscriptionServiceType = subscriptionServiceType; + } + @JsonProperty("aLaCarte") + public Boolean getALaCarte() { + return aLaCarte; + } + @JsonProperty("aLaCarte") + public void setaLaCarte(Boolean aLaCarte) { + this.aLaCarte = aLaCarte; + } + + public Boolean isaLaCarte() { + return aLaCarte; + } + + public List<Map<String, Object>> getUserParams() { + return userParams; + } + + public void setUserParams(List<Map<String, Object>> userParams) { + this.userParams = userParams; + } + + public Object getUserParamValue(String name) { + if (userParams != null) { + for (Map<String, Object> param : userParams) { + if (param.get(name) != null) { + return param.get(name); + } + } + } + return null; + } + + + @JsonInclude(Include.NON_NULL) + public String toJsonString(){ + String json = ""; + ObjectMapper mapper = new ObjectMapper(); + mapper.setSerializationInclusion(Include.NON_NULL); + ObjectWriter ow = mapper.writer(); + try{ + json = ow.writeValueAsString(this); + }catch (Exception e){ + log.error("Unable to convert Sniro Manager Request to string", e); + } + return json; + } + + @Override + public String toString() { + return "RequestParameters [subscriptionServiceType=" + + subscriptionServiceType + ", userParams=" + userParams + + ", aLaCarte=" + aLaCarte + "]"; + } +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/Candidate.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/Candidate.java new file mode 100644 index 0000000000..01846681db --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/Candidate.java @@ -0,0 +1,71 @@ +/*- + * ============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.servicedecomposition.homingobjects; + +import java.io.Serializable; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + + +public class Candidate implements Serializable { + + + private static final long serialVersionUID = -3959572501582849328L; + + @JsonProperty("candidateType") + private CandidateType candidateType; + @JsonProperty("candidates") + private List<String> candidates; + + /** + * list of candidates + * i.e. actual serviceInstanceId, actual vnfName, actual cloudRegionId, etc. + */ + public List<String> getCandidates() { + return candidates; + } + + /** + * list of candidates + * i.e. actual serviceInstanceId, actual vnfName, actual cloudRegionId, etc. + */ + public void setCandidates(List<String> candidates) { + this.candidates = candidates; + } + + /** + * Way to identify the type of candidate + * i.e. "serviceInstanceId", "vnfName", "cloudRegionId", etc. + */ + public CandidateType getCandidateType(){ + return candidateType; + } + + /** + * Way to identify the type of candidate + * i.e. "serviceInstanceId", "vnfName", "cloudRegionId", etc. + */ + public void setCandidateType(CandidateType candidateType){ + this.candidateType = candidateType; + } + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/beans/SDNCSvcAction.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/CandidateType.java index 91e3a59276..9540b9148e 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/beans/SDNCSvcAction.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/CandidateType.java @@ -2,14 +2,14 @@ * ============LICENSE_START======================================================= * ONAP - SO * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * 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. @@ -18,29 +18,27 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.client.sdnc.beans;
-
-public enum SDNCSvcAction {
- ACTIVATE("activate"),
- DELETE("delete"),
- ASSIGN("assign"),
- ROLLBACK("rollback"),
- UNASSIGN("unassign"),
- DEACTIVATE("deactivate"),
- CHANGE_DELETE("changedelete"),
- CHANGE_ASSIGN("changeassign"),
- CREATE("create"),
- ENABLE("enable"),
- DISABLE("disable");
-
- private final String name;
-
- private SDNCSvcAction(String name) {
- this.name = name;
- }
-
- @Override
- public String toString() {
- return name;
- }
-}
+package org.onap.so.bpmn.servicedecomposition.homingobjects; + +public enum CandidateType { + SERVICE_INSTANCE_ID("serviceInstanceId"), + CLOUD_REGION_ID("cloudRegionId"), + VNF_ID("vnfId"), + VNF_NAME("vnfName"); + + private final String name; + + private CandidateType(String name) { + this.name = name; + } + + @Override + public String toString() { + return name; + } + + //TODO added to get PojoTest to work + public String getName(){ + return name; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/SolutionCandidates.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/SolutionCandidates.java new file mode 100644 index 0000000000..0cbd88b665 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/SolutionCandidates.java @@ -0,0 +1,66 @@ +/*- + * ============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.servicedecomposition.homingobjects; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import org.onap.so.bpmn.servicedecomposition.homingobjects.Candidate; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class SolutionCandidates implements Serializable{ + + private static final long serialVersionUID = 2188754118148819627L; + + @JsonProperty("requiredCandidates") + private List<Candidate> requiredCandidates = new ArrayList<Candidate>(); + @JsonProperty("excludedCandidates") + private List<Candidate> excludedCandidates = new ArrayList<Candidate>(); + //TODO figure out best way to do this + @JsonProperty("existingCandidates") + private List<Candidate> existingCandidates = new ArrayList<Candidate>(); + + + public List<Candidate> getRequiredCandidates() { + return requiredCandidates; + } + public void addRequiredCandidates(Candidate requiredCandidate) { + this.requiredCandidates.add(requiredCandidate); + } + public List<Candidate> getExcludedCandidates() { + return excludedCandidates; + } + public void addExcludedCandidates(Candidate excludedCandidate) { + this.excludedCandidates.add(excludedCandidate); + } + + public List<Candidate> getExistingCandidates(){ + return existingCandidates; + } + + + + + + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/SolutionInfo.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/SolutionInfo.java new file mode 100644 index 0000000000..17e42b4396 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/SolutionInfo.java @@ -0,0 +1,99 @@ +/*- + * ============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.servicedecomposition.homingobjects; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; + +@JsonRootName("solution") +public class SolutionInfo implements Serializable { + + private static final long serialVersionUID = 6903399488466840832L; + + @JsonProperty("solution-id") //identifies which solution + private int solutionId; + @JsonProperty("homed") + private boolean homed; + @JsonProperty("is-rehome") + private boolean isRehome; + @JsonProperty("targeted-cloud") + private CloudRegion targetedCloudRegion; + + + public boolean isHomed() { + return homed; + } + + public void setHomed(boolean homed) { + this.homed = homed; + } + + public boolean isRehome() { + return isRehome; + } + + public void setRehome(boolean isRehome) { + this.isRehome = isRehome; + } + + /** + * Identifies which solution when multiple solutions exist for a + * given resource or resource pair. + * i.e. 1, 2, 3.... + */ + public int getSolutionId() { + return solutionId; + } + + /** + * Identifies which solution when multiple solutions exist for a + * given resource or resource pair. + * i.e. 1, 2, 3.... + */ + public void setSolutionId(int solutionId) { + this.solutionId = solutionId; + } + + /** + * Identifies where the resource should be created for + * homed equals false scenarios. Will return null if resource + * was homed. + */ + public CloudRegion getTargetedCloudRegion() { + return targetedCloudRegion; + } + + /** + * Identifies where the resource should be created for + * homed equals false scenarios. Will return null if resource + * was homed. + */ + public void setTargetedCloudRegion(CloudRegion targetedCloudRegion) { + this.targetedCloudRegion = targetedCloudRegion; + } + + + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoAllottedResource.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoAllottedResource.java new file mode 100644 index 0000000000..b4f2e85e55 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoAllottedResource.java @@ -0,0 +1,146 @@ +/*- + * ============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.servicedecomposition.modelinfo; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ModelInfoAllottedResource extends ModelInfoMetadata implements Serializable{ + + private static final long serialVersionUID = -5240932898637922018L; + + @JsonProperty("max-instances") + private String MaxInstances; + @JsonProperty("min-instances") + private String MinInstances; + @JsonProperty("nf-naming-code") + private String NfNamingCode; + @JsonProperty("nf-role") + private String NfRole; + @JsonProperty("nf-type") + private String NfType; + @JsonProperty("nf-function") + private String NfFunction; + @JsonProperty("target-network-role") + private String TarNetworkRole; + @JsonProperty("providing-service-model-invariant-uuid") + private String ProvidingServiceModelInvariantUUID; + @JsonProperty("providing-service-model-name") + private String ProvidingServiceModelName; + @JsonProperty("providing-service-model-uuid") + private String ProvidingServiceModelUUID; + @JsonProperty("description") + private String Description; + @JsonProperty("created") + private String Created; + @JsonProperty("tosca-node-type") + private String ToscaNodeType; + @JsonProperty("subcategory") + private String Subcategory; +// private ModelInfoMetadata modelInfoMetadata; + + + public String getMaxInstances() { + return MaxInstances; + } + public void setMaxInstances(String maxInstances) { + MaxInstances = maxInstances; + } + public String getMinInstances() { + return MinInstances; + } + public void setMinInstances(String minInstances) { + MinInstances = minInstances; + } + public String getNfNamingCode() { + return NfNamingCode; + } + public void setNfNamingCode(String nfNamingCode) { + NfNamingCode = nfNamingCode; + } + public String getNfRole() { + return NfRole; + } + public void setNfRole(String nfRole) { + NfRole = nfRole; + } + public String getNfType() { + return NfType; + } + public void setNfType(String nfType) { + NfType = nfType; + } + public String getNfFunction() { + return NfFunction; + } + public void setNfFunction(String nfFunction) { + NfFunction = nfFunction; + } + public String getTarNetworkRole() { + return TarNetworkRole; + } + public void setTarNetworkRole(String tarNetworkRole) { + TarNetworkRole = tarNetworkRole; + } + public String getProvidingServiceModelInvariantUUID() { + return ProvidingServiceModelInvariantUUID; + } + public void setProvidingServiceModelInvariantUUID(String providingServiceModelInvariantUUID) { + ProvidingServiceModelInvariantUUID = providingServiceModelInvariantUUID; + } + public String getProvidingServiceModelName() { + return ProvidingServiceModelName; + } + public void setProvidingServiceModelName(String providingServiceModelName) { + ProvidingServiceModelName = providingServiceModelName; + } + public String getProvidingServiceModelUUID() { + return ProvidingServiceModelUUID; + } + public void setProvidingServiceModelUUID(String providingServiceModelUUID) { + ProvidingServiceModelUUID = providingServiceModelUUID; + } + public String getDescription() { + return Description; + } + public void setDescription(String description) { + Description = description; + } + public String getCreated() { + return Created; + } + public void setCreated(String created) { + Created = created; + } + public String getToscaNodeType() { + return ToscaNodeType; + } + public void setToscaNodeType(String toscaNodeType) { + ToscaNodeType = toscaNodeType; + } + public String getSubcategory() { + return Subcategory; + } + public void setSubcategory(String subcategory) { + Subcategory = subcategory; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoCollection.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoCollection.java new file mode 100644 index 0000000000..6ceac935f1 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoCollection.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.servicedecomposition.modelinfo; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ModelInfoCollection implements Serializable { + + private static final long serialVersionUID = 8380534468706675508L; + + @JsonProperty("model-version-id") + private String modelVersionId; + @JsonProperty("model-invariant-uuid") + private String modelInvariantUUID; + @JsonProperty("collection-function") + private String collectionFunction; + @JsonProperty("collection-role") + private String collectionRole; + @JsonProperty("collection-type") + private String collectionType; + @JsonProperty("description") + private String description; + @JsonProperty("quantity") + private int quantity; + + public String getModelVersionId() { + return modelVersionId; + } + public void setModelVersionId(String modelVersionId) { + this.modelVersionId = modelVersionId; + } + public String getModelInvariantUUID() { + return this.modelInvariantUUID; + } + public void setModelInvariantUUID(String modelInvariantUUID) { + this.modelInvariantUUID = modelInvariantUUID; + } + public String getCollectionFunction() { + return collectionFunction; + } + public void setCollectionFunction(String collectionFunction) { + this.collectionFunction = collectionFunction; + } + public String getCollectionRole() { + return collectionRole; + } + public void setCollectionRole(String collectionRole) { + this.collectionRole = collectionRole; + } + public String getCollectionType() { + return collectionType; + } + public void setCollectionType(String collectionType) { + this.collectionType = collectionType; + } + public String getDescription() { + return description; + } + public void setDescription(String description) { + this.description = description; + } + public int getQuantity() { + return quantity; + } + public void setQuantity(int quantity) { + this.quantity = quantity; + } + + + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoConfiguration.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoConfiguration.java new file mode 100644 index 0000000000..9d3aa5934b --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoConfiguration.java @@ -0,0 +1,56 @@ +/*- + * ============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.servicedecomposition.modelinfo; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ModelInfoConfiguration implements Serializable{ + + private static final long serialVersionUID = -387242776138157250L; + + @JsonProperty("model-invariant-id") + private String modelInvariantId; + @JsonProperty("model-version-id") + private String modelVersionId; + @JsonProperty("model-customization-id") + private String modelCustomizationId; + + public String getModelInvariantId() { + return modelInvariantId; + } + public void setModelInvariantId(String modelInvariantId) { + this.modelInvariantId = modelInvariantId; + } + public String getModelVersionId() { + return modelVersionId; + } + public void setModelVersionId(String modelVersionId) { + this.modelVersionId = modelVersionId; + } + public String getModelCustomizationId() { + return modelCustomizationId; + } + public void setModelCustomizationId(String modelCustomizationId) { + this.modelCustomizationId = modelCustomizationId; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoGenericVnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoGenericVnf.java new file mode 100644 index 0000000000..6b53272a75 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoGenericVnf.java @@ -0,0 +1,145 @@ +/*- + * ============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.servicedecomposition.modelinfo; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ModelInfoGenericVnf extends ModelInfoMetadata implements Serializable{ + + private static final long serialVersionUID = -5963022750248280669L; + + @JsonProperty("tosca-node-type") + private String ToscaNodeType; + @JsonProperty("description") + private String Description; + @JsonProperty("orchestration-mode") + private String OrchestrationMode; + @JsonProperty("aic-version-min") + private String AicVersionMin; + @JsonProperty("aic-version-max") + private String AicVersionMax; + @JsonProperty("min-instances") + private String MinInstances; + @JsonProperty("max-instances") + private String MaxInstances; + @JsonProperty("availability-zone-max-count") + private String AvailabilityZoneMaxCount; + @JsonProperty("nf-function") + private String NfFunction; + @JsonProperty("nf-type") + private String NfType; + @JsonProperty("nf-role") + private String NfRole; + @JsonProperty("nf-naming-code") + private String NfNamingCode; + @JsonProperty("multi-stage-design") + private String MultiStageDesign; + @JsonProperty("created") + private String Created; + + + public String getToscaNodeType() { + return ToscaNodeType; + } + public void setToscaNodeType(String toscaNodeType) { + ToscaNodeType = toscaNodeType; + } + public String getDescription() { + return Description; + } + public void setDescription(String description) { + Description = description; + } + public String getOrchestrationMode() { + return OrchestrationMode; + } + public void setOrchestrationMode(String orchestrationMode) { + OrchestrationMode = orchestrationMode; + } + public String getAicVersionMin() { + return AicVersionMin; + } + public void setAicVersionMin(String aicVersionMin) { + AicVersionMin = aicVersionMin; + } + public String getAicVersionMax() { + return AicVersionMax; + } + public void setAicVersionMax(String aicVersionMax) { + AicVersionMax = aicVersionMax; + } + public String getMinInstances() { + return MinInstances; + } + public void setMinInstances(String minInstances) { + MinInstances = minInstances; + } + public String getMaxInstances() { + return MaxInstances; + } + public void setMaxInstances(String maxInstances) { + MaxInstances = maxInstances; + } + public String getAvailabilityZoneMaxCount() { + return AvailabilityZoneMaxCount; + } + public void setAvailabilityZoneMaxCount(String availabilityZoneMaxCount) { + AvailabilityZoneMaxCount = availabilityZoneMaxCount; + } + public String getNfFunction() { + return NfFunction; + } + public void setNfFunction(String nfFunction) { + NfFunction = nfFunction; + } + public String getNfType() { + return NfType; + } + public void setNfType(String nfType) { + NfType = nfType; + } + public String getNfRole() { + return NfRole; + } + public void setNfRole(String nfRole) { + NfRole = nfRole; + } + public String getNfNamingCode() { + return NfNamingCode; + } + public void setNfNamingCode(String nfNamingCode) { + NfNamingCode = nfNamingCode; + } + public String getMultiStageDesign() { + return MultiStageDesign; + } + public void setMultiStageDesign(String multiStageDesign) { + MultiStageDesign = multiStageDesign; + } + public String getCreated() { + return Created; + } + public void setCreated(String created) { + Created = created; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoInstanceGroup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoInstanceGroup.java new file mode 100644 index 0000000000..1f02fea071 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoInstanceGroup.java @@ -0,0 +1,83 @@ +/*- + * ============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.servicedecomposition.modelinfo; + +import java.io.Serializable; +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ModelInfoInstanceGroup implements Serializable { + + private static final long serialVersionUID = -8279040393230356226L; + + public static final String TYPE_L3_NETWORK = "L3-NETWORK"; + public static final String TYPE_NETWORK_INSTANCE_GROUP = "networkInstanceGroup"; + public static final String TYPE_VNFC = "VNFC"; + + @JsonProperty("model-uuid") + private String ModelUUID; + @JsonProperty("model-invariant-uuid") + private String ModelInvariantUUID; + @JsonProperty("type") + private String type; + @JsonProperty("instance-group-role") + private String instanceGroupRole; + @JsonProperty("function") + private String function; + @JsonProperty("description") + private String description; + + public String getModelUUID() { + return ModelUUID; + } + public void setModelUUID(String modelUUID) { + ModelUUID = modelUUID; + } + public String getModelInvariantUUID() { + return ModelInvariantUUID; + } + public void setModelInvariantUUID(String modelInvariantUUID) { + ModelInvariantUUID = modelInvariantUUID; + } + public String getType() { + return type; + } + public void setType(String type) { + this.type = type; + } + public String getInstanceGroupRole() { + return instanceGroupRole; + } + public void setInstanceGroupRole(String instanceGroupRole) { + this.instanceGroupRole = instanceGroupRole; + } + public String getFunction() { + return function; + } + public void setFunction(String function) { + this.function = function; + } + public String getDescription() { + return description; + } + public void setDescription(String description) { + this.description = description; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoMetadata.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoMetadata.java new file mode 100644 index 0000000000..c873912922 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoMetadata.java @@ -0,0 +1,83 @@ +/*- + * ============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.servicedecomposition.modelinfo; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ModelInfoMetadata implements Serializable{ + + private static final long serialVersionUID = -2182850364281359289L; + + @JsonProperty("model-customization-uuid") + private String modelCustomizationUuid; + @JsonProperty("model-invariant-uuid") + private String modelInvariantUuid; + @JsonProperty("model-uuid") + private String modelUuid; + @JsonProperty("model-version") + private String modelVersion; + @JsonProperty("model-instance-name") + private String modelInstanceName; + @JsonProperty("model-name") + private String modelName; + + + public String getModelCustomizationUuid() { + return modelCustomizationUuid; + } + public void setModelCustomizationUuid(String modelCustomizationUuid) { + this.modelCustomizationUuid = modelCustomizationUuid; + } + public String getModelInvariantUuid() { + return modelInvariantUuid; + } + public void setModelInvariantUuid(String modelInvariantUuid) { + this.modelInvariantUuid = modelInvariantUuid; + } + 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 getModelInstanceName() { + return modelInstanceName; + } + public void setModelInstanceName(String modelInstanceName) { + this.modelInstanceName = modelInstanceName; + } + public String getModelName() { + return modelName; + } + public void setModelName(String modelName) { + this.modelName = modelName; + } + + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoNetwork.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoNetwork.java new file mode 100644 index 0000000000..22233e94a5 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoNetwork.java @@ -0,0 +1,169 @@ +/*- + * ============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.servicedecomposition.modelinfo; + +import java.io.Serializable; +import java.sql.Timestamp; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ModelInfoNetwork implements Serializable{ + + private static final long serialVersionUID = -3612850497900637132L; + + @JsonProperty("model-customization-uuid") + private String ModelCustomizationUUID; + @JsonProperty("model-instance-name") + private String ModelInstanceName; + @JsonProperty("network-technology") + private String NetworkTechnology; + @JsonProperty("network-type") + private String NetworkType; + @JsonProperty("network-scope") + private String NetworkScope; + @JsonProperty("network-role") + private String NetworkRole; + @JsonProperty("description") + private String Description; + @JsonProperty("created") + private Timestamp Created; + @JsonProperty("model-version") + private String ModelVersion; + @JsonProperty("model-invariant-uuid") + private String ModelInvariantUUID; + @JsonProperty("model-name") + private String ModelName; + @JsonProperty("model-uuid") + private String ModelUUID; + @JsonProperty("neutron-network-type") + private String NeutronNetworkType; + @JsonProperty("aic-version-min") + private String AicVersionMin; + @JsonProperty("aic-version-max") + private String AicVersionMax; + @JsonProperty("orchestration-mode") + private String OrchestrationMode; + @JsonProperty("tosca-node-type") + private String ToscaNodeType; + + public String getModelCustomizationUUID() { + return ModelCustomizationUUID; + } + public void setModelCustomizationUUID(String modelCustomizationUUID) { + ModelCustomizationUUID = modelCustomizationUUID; + } + public String getModelInstanceName() { + return ModelInstanceName; + } + public void setModelInstanceName(String modelInstanceName) { + ModelInstanceName = modelInstanceName; + } + public String getNetworkTechnology() { + return NetworkTechnology; + } + public void setNetworkTechnology(String networkTechnology) { + NetworkTechnology = networkTechnology; + } + public String getNetworkType() { + return NetworkType; + } + public void setNetworkType(String networkType) { + NetworkType = networkType; + } + public String getNetworkScope() { + return NetworkScope; + } + public void setNetworkScope(String networkScope) { + NetworkScope = networkScope; + } + public String getNetworkRole() { + return NetworkRole; + } + public void setNetworkRole(String networkRole) { + NetworkRole = networkRole; + } + public String getDescription() { + return Description; + } + public void setDescription(String description) { + Description = description; + } + public Timestamp getCreated() { + return Created; + } + public void setCreated(Timestamp created) { + Created = created; + } + public String getModelVersion() { + return ModelVersion; + } + public void setModelVersion(String modelVersion) { + ModelVersion = modelVersion; + } + public String getModelInvariantUUID() { + return ModelInvariantUUID; + } + public void setModelInvariantUUID(String modelInvariantUUID) { + ModelInvariantUUID = modelInvariantUUID; + } + public String getModelName() { + return ModelName; + } + public void setModelName(String modelName) { + ModelName = modelName; + } + public String getModelUUID() { + return ModelUUID; + } + public void setModelUUID(String modelUUID) { + ModelUUID = modelUUID; + } + public String getNeutronNetworkType() { + return NeutronNetworkType; + } + public void setNeutronNetworkType(String neutronNetworkType) { + NeutronNetworkType = neutronNetworkType; + } + public String getAicVersionMin() { + return AicVersionMin; + } + public void setAicVersionMin(String aicVersionMin) { + AicVersionMin = aicVersionMin; + } + public String getAicVersionMax() { + return AicVersionMax; + } + public void setAicVersionMax(String aicVersionMax) { + AicVersionMax = aicVersionMax; + } + public String getOrchestrationMode() { + return OrchestrationMode; + } + public void setOrchestrationMode(String orchestrationMode) { + OrchestrationMode = orchestrationMode; + } + public String getToscaNodeType() { + return ToscaNodeType; + } + public void setToscaNodeType(String toscaNodeType) { + ToscaNodeType = toscaNodeType; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoServiceInstance.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoServiceInstance.java new file mode 100644 index 0000000000..ac206d3dd0 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoServiceInstance.java @@ -0,0 +1,81 @@ +/*- + * ============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.servicedecomposition.modelinfo; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ModelInfoServiceInstance extends ModelInfoMetadata implements Serializable { + + private static final long serialVersionUID = -1812787934683419141L; + + @JsonProperty("description") + private String description; + @JsonProperty("created") + private String created; + @JsonProperty("service-type") + private String serviceType; + @JsonProperty("service-role") + private String serviceRole; + @JsonProperty("environment-context") + private String environmentContext; + @JsonProperty("workload-context") + private String workloadContext; + + + public String getDescription() { + return description; + } + public void setDescription(String description) { + this.description = description; + } + public String getCreated() { + return created; + } + public void setCreated(String created) { + this.created = created; + } + 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 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/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/AdapterRestProperties.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoServiceProxy.java index af429db1f2..b2494384f4 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/AdapterRestProperties.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoServiceProxy.java @@ -18,12 +18,15 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.client.adapter.vnf; +package org.onap.so.bpmn.servicedecomposition.modelinfo; -import org.openecomp.mso.client.RestProperties; -public interface AdapterRestProperties extends RestProperties { +import java.io.Serializable; + + +public class ModelInfoServiceProxy extends ModelInfoMetadata implements Serializable { + + private static final long serialVersionUID = -6256897576261215926L; + - public String getAuth(); - public String getKey(); } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoVfModule.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoVfModule.java new file mode 100644 index 0000000000..593f8c2532 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoVfModule.java @@ -0,0 +1,136 @@ +/*- + * ============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.servicedecomposition.modelinfo; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ModelInfoVfModule implements Serializable { + + private static final long serialVersionUID = 636556989022688657L; + + @JsonProperty("model-customization-uuid") + private String ModelCustomizationUUID; + @JsonProperty("model-name") + private String ModelName; + @JsonProperty("model-uuid") + private String ModelUUID; + @JsonProperty("model-invariant-uuid") + private String ModelInvariantUUID; + @JsonProperty("model-version") + private String ModelVersion; + @JsonProperty("description") + private String Description; + @JsonProperty("is-base-boolean") + private Boolean IsBaseBoolean; + @JsonProperty("min-instances") + private String MinInstances; + @JsonProperty("max-instances") + private String MaxInstances; + @JsonProperty("availability-zone-count") + private String AvailabilityZoneCount; + @JsonProperty("label") + private String Label; + @JsonProperty("initial-count") + private String InitialCount; + @JsonProperty("created") + private String Created; + + public String getModelCustomizationUUID() { + return ModelCustomizationUUID; + } + public void setModelCustomizationUUID(String modelCustomizationUUID) { + ModelCustomizationUUID = modelCustomizationUUID; + } + public String getModelName() { + return ModelName; + } + public void setModelName(String modelName) { + ModelName = modelName; + } + public String getModelUUID() { + return ModelUUID; + } + public void setModelUUID(String modelUUID) { + ModelUUID = modelUUID; + } + public String getModelInvariantUUID() { + return ModelInvariantUUID; + } + public void setModelInvariantUUID(String modelInvariantUUID) { + ModelInvariantUUID = modelInvariantUUID; + } + public String getModelVersion() { + return ModelVersion; + } + public void setModelVersion(String modelVersion) { + ModelVersion = modelVersion; + } + public String getDescription() { + return Description; + } + public void setDescription(String description) { + Description = description; + } + public Boolean getIsBaseBoolean() { + return IsBaseBoolean; + } + public void setIsBaseBoolean(Boolean isBaseBoolean) { + IsBaseBoolean = isBaseBoolean; + } + public String getMinInstances() { + return MinInstances; + } + public void setMinInstances(String minInstances) { + MinInstances = minInstances; + } + public String getMaxInstances() { + return MaxInstances; + } + public void setMaxInstances(String maxInstances) { + MaxInstances = maxInstances; + } + public String getAvailabilityZoneCount() { + return AvailabilityZoneCount; + } + public void setAvailabilityZoneCount(String availabilityZoneCount) { + AvailabilityZoneCount = availabilityZoneCount; + } + public String getLabel() { + return Label; + } + public void setLabel(String label) { + Label = label; + } + public String getInitialCount() { + return InitialCount; + } + public void setInitialCount(String initialCount) { + InitialCount = initialCount; + } + public String getCreated() { + return Created; + } + public void setCreated(String created) { + Created = created; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowAsyncCommonResource.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoVolumeGroup.java index cd98860efe..d3bf99ccb8 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowAsyncCommonResource.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoVolumeGroup.java @@ -18,16 +18,13 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.common.workflow.service; +package org.onap.so.bpmn.servicedecomposition.modelinfo; -import org.camunda.bpm.engine.ProcessEngineServices; -import org.camunda.bpm.engine.ProcessEngines; +import java.io.Serializable; +import com.fasterxml.jackson.annotation.JsonProperty; -public class WorkflowAsyncCommonResource extends WorkflowAsyncResource { +public class ModelInfoVolumeGroup extends ModelInfoVfModule implements Serializable { - @Override - public String getProcessEngineName() { - return "default"; - } + private static final long serialVersionUID = -1157856848495642223L; } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/AssignFlows.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/AssignFlows.java new file mode 100644 index 0000000000..ac96aceec3 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/AssignFlows.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.servicedecomposition.tasks; + +public enum AssignFlows { + + SERVICE_INSTANCE("AssignServiceInstanceBB"), + VNF("AssignVnfBB"), + VF_MODULE("AssignVfModuleBB"), + NETWORK_A_LA_CARTE("AssignNetwork1802BB"), + NETWORK_MACRO("AssignNetworkBB"), + VOLUME_GROUP("AssignVolumeGroupBB"), + NETWORK_COLLECTION("CreateNetworkCollectionBB"), + FABRIC_CONFIGURATION("AssignFabricConfigurationBB"); + + private final String flowName; + + private AssignFlows(String flowName) { + this.flowName = flowName; + } + + @Override + public String toString() { + return this.flowName; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java new file mode 100644 index 0000000000..aa68114011 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java @@ -0,0 +1,1586 @@ +/*- + * ============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.servicedecomposition.tasks; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.UUID; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.JavaDelegate; +import org.javatuples.Pair; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.common.DelegateExecutionImpl; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness; +import org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy; +import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Project; +import org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTableReference; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; +import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds; +import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.client.aai.AAICommonObjectMapperProvider; +import org.onap.so.client.aai.AAIObjectType; +import org.onap.so.client.aai.entities.AAIResultWrapper; +import org.onap.so.client.aai.entities.Relationships; +import org.onap.so.client.aai.entities.uri.AAIResourceUri; +import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization; +import org.onap.so.db.catalog.beans.CollectionResource; +import org.onap.so.db.catalog.beans.CollectionResourceCustomization; +import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization; +import org.onap.so.db.catalog.beans.NetworkResourceCustomization; +import org.onap.so.db.catalog.beans.OrchestrationStatus; +import org.onap.so.db.catalog.beans.Service; +import org.onap.so.db.catalog.beans.VfModuleCustomization; +import org.onap.so.db.catalog.beans.VnfResourceCustomization; +import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization; +import org.onap.so.db.request.beans.InfraActiveRequests; +import org.onap.so.logger.MsoLogger; +import org.onap.so.serviceinstancebeans.CloudConfiguration; +import org.onap.so.serviceinstancebeans.ModelInfo; +import org.onap.so.serviceinstancebeans.ModelType; +import org.onap.so.serviceinstancebeans.Networks; +import org.onap.so.serviceinstancebeans.RelatedInstance; +import org.onap.so.serviceinstancebeans.RelatedInstanceList; +import org.onap.so.serviceinstancebeans.RequestDetails; +import org.onap.so.serviceinstancebeans.RequestParameters; +import org.onap.so.serviceinstancebeans.Resources; +import org.onap.so.serviceinstancebeans.VfModules; +import org.onap.so.serviceinstancebeans.Vnfs; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; + +@Component("BBInputSetup") +public class BBInputSetup implements JavaDelegate { + + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, BBInputSetup.class); + private static final String FLOW_VAR_NAME = "flowToBeCalled"; + private static final String LOOKUP_KEY_MAP_VAR_NAME = "lookupKeyMap"; + private static final String GBB_INPUT_VAR_NAME = "gBBInput"; + private static final String EXECUTE_BB_VAR_NAME = "buildingBlock"; + private static final String CLOUD_OWNER = "att-aic"; + private static final String VOLUME_GROUP = "VolumeGroup"; + private static final String VF_MODULE = "VfModule"; + private static final String NETWORK = "Network"; + private static final String VNF = "Vnf"; + private static final String NETWORK_COLLECTION = "NetworkCollection"; + + @Autowired + private BBInputSetupUtils bbInputSetupUtils; + + @Autowired + private BBInputSetupMapperLayer mapperLayer; + + @Autowired + private ExceptionBuilder exceptionUtil; + + private ObjectMapper mapper = new ObjectMapper(); + + public BBInputSetupUtils getBbInputSetupUtils() { + return bbInputSetupUtils; + } + + public void setBbInputSetupUtils(BBInputSetupUtils bbInputSetupUtils) { + this.bbInputSetupUtils = bbInputSetupUtils; + } + + public BBInputSetupMapperLayer getMapperLayer() { + return mapperLayer; + } + + public void setMapperLayer(BBInputSetupMapperLayer mapperLayer) { + this.mapperLayer = mapperLayer; + } + + @Override + public void execute(DelegateExecution execution) throws Exception { + try { + GeneralBuildingBlock outputBB = null; + ExecuteBuildingBlock executeBB = this.getExecuteBBFromExecution(execution); + String resourceId = executeBB.getResourceId(); + String requestAction = executeBB.getRequestAction(); + String vnfType = executeBB.getVnfType(); + boolean aLaCarte = executeBB.isaLaCarte(); + boolean homing = executeBB.isHoming(); + Map<ResourceKey, String> lookupKeyMap = new HashMap<>(); + outputBB = this.getGBB(executeBB, lookupKeyMap, requestAction, aLaCarte, resourceId, vnfType); + ObjectMapper mapper = new ObjectMapper(); + mapper.enable(SerializationFeature.INDENT_OUTPUT); + msoLogger.debug("GeneralBB: " + mapper.writeValueAsString(outputBB)); + + setHomingFlag(outputBB, homing, lookupKeyMap); + + execution.setVariable(FLOW_VAR_NAME, executeBB.getBuildingBlock().getBpmnFlowName()); + execution.setVariable(GBB_INPUT_VAR_NAME, outputBB); + execution.setVariable(LOOKUP_KEY_MAP_VAR_NAME, lookupKeyMap); + + BuildingBlockExecution gBuildingBlockExecution = new DelegateExecutionImpl(execution); + execution.setVariable("gBuildingBlockExecution", gBuildingBlockExecution); + execution.setVariable("RetryCount", 1); + execution.setVariable("handlingCode", "Success"); + } catch (Exception e) { + msoLogger.error(e); + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, e.getMessage()); + } + } + + protected void setHomingFlag(GeneralBuildingBlock outputBB, boolean homing, Map<ResourceKey, String> lookupKeyMap) { + + if (lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID) != null && homing && outputBB != null) { + for (GenericVnf vnf : outputBB.getCustomer().getServiceSubscription().getServiceInstances().get(0).getVnfs()) { + if (vnf.getVnfId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID))) { + vnf.setCallHoming(homing); + } + } + } + } + + protected ExecuteBuildingBlock getExecuteBBFromExecution(DelegateExecution execution) { + return (ExecuteBuildingBlock) execution.getVariable(EXECUTE_BB_VAR_NAME); + } + + protected GeneralBuildingBlock getGBB(ExecuteBuildingBlock executeBB, Map<ResourceKey, String> lookupKeyMap, + String requestAction, boolean aLaCarte, String resourceId, String vnfType) throws Exception { + String requestId = executeBB.getRequestId(); + this.populateLookupKeyMapWithIds(executeBB.getWorkflowResourceIds(), lookupKeyMap); + RequestDetails requestDetails = executeBB.getRequestDetails(); + if(requestDetails == null) { + requestDetails = bbInputSetupUtils.getRequestDetails(requestId); + } + ModelType modelType = requestDetails.getModelInfo().getModelType(); + if (aLaCarte && modelType.equals(ModelType.service)) { + return this.getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId); + } else if (aLaCarte && !modelType.equals(ModelType.service)) { + return this.getGBBALaCarteNonService(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, + vnfType); + } else { + return this.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); + } + } + + protected void populateLookupKeyMapWithIds(WorkflowResourceIds workflowResourceIds, + Map<ResourceKey, String> lookupKeyMap) { + lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, workflowResourceIds.getServiceInstanceId()); + lookupKeyMap.put(ResourceKey.NETWORK_ID, workflowResourceIds.getNetworkId()); + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, workflowResourceIds.getVnfId()); + lookupKeyMap.put(ResourceKey.VF_MODULE_ID, workflowResourceIds.getVfModuleId()); + lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, workflowResourceIds.getVolumeGroupId()); + lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, workflowResourceIds.getConfigurationId()); + } + + protected GeneralBuildingBlock getGBBALaCarteNonService(ExecuteBuildingBlock executeBB, + RequestDetails requestDetails, Map<ResourceKey, String> lookupKeyMap, String requestAction, + String resourceId, String vnfType) throws Exception { + String bbName = executeBB.getBuildingBlock().getBpmnFlowName(); + String serviceInstanceId = lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID); + org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance = null; + if (serviceInstanceId != null) { + aaiServiceInstance = bbInputSetupUtils.getAAIServiceInstanceById(serviceInstanceId); + } + Service service = null; + if (aaiServiceInstance != null) { + service = bbInputSetupUtils.getCatalogServiceByModelUUID(aaiServiceInstance.getModelVersionId()); + } + if (aaiServiceInstance != null && service != null) { + ServiceInstance serviceInstance = this.getExistingServiceInstance(aaiServiceInstance); + serviceInstance.setModelInfoServiceInstance(this.mapperLayer.mapCatalogServiceIntoServiceInstance(service)); + this.populateObjectsOnAssignAndCreateFlows(requestDetails, service, bbName, serviceInstance, lookupKeyMap, + resourceId, vnfType); + return this.populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, executeBB, requestAction, null); + } else { + msoLogger.debug("Related Service Instance from AAI: " + aaiServiceInstance); + msoLogger.debug("Related Service Instance Model Info from AAI: " + service); + throw new Exception("Could not find relevant information for related Service Instance"); + } + } + + protected void populateObjectsOnAssignAndCreateFlows(RequestDetails requestDetails, Service service, String bbName, + ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap, String resourceId, String vnfType) + throws Exception { + ModelInfo modelInfo = requestDetails.getModelInfo(); + String instanceName = requestDetails.getRequestInfo().getInstanceName(); + ModelType modelType = modelInfo.getModelType(); + RelatedInstanceList[] relatedInstanceList = requestDetails.getRelatedInstanceList(); + + org.onap.so.serviceinstancebeans.Platform platform = requestDetails.getPlatform(); + org.onap.so.serviceinstancebeans.LineOfBusiness lineOfBusiness = requestDetails.getLineOfBusiness(); + + if (modelType.equals(ModelType.network)) { + this.populateL3Network(instanceName, modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, null); + } else if (modelType.equals(ModelType.vnf)) { + this.populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, service, bbName, serviceInstance, + lookupKeyMap, relatedInstanceList, resourceId, vnfType, null); + } else if (modelType.equals(ModelType.volumeGroup)) { + this.populateVolumeGroup(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, + relatedInstanceList, instanceName, vnfType, null); + } else if (modelType.equals(ModelType.vfModule)) { + this.populateVfModule(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, + relatedInstanceList, instanceName, null, requestDetails.getCloudConfiguration()); + } else { + return; + } + } + + protected void populateConfiguration(ModelInfo modelInfo, Service service, String bbName, + ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap, String resourceId, String instanceName) { + boolean foundByName = false; + boolean foundById = false; + for (Configuration configuration : serviceInstance.getConfigurations()) { + if (lookupKeyMap.get(ResourceKey.CONFIGURATION_ID) != null + && configuration.getConfigurationId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.CONFIGURATION_ID))) { + foundById = true; + org.onap.aai.domain.yang.Configuration aaiConfiguration = bbInputSetupUtils.getAAIConfiguration(configuration.getConfigurationId()); + if(aaiConfiguration!=null){ + modelInfo.setModelCustomizationUuid(aaiConfiguration.getModelCustomizationId()); + } + this.mapCatalogConfiguration(configuration, modelInfo, service); + } else if (instanceName != null && configuration.getConfigurationName().equalsIgnoreCase(instanceName)) { + foundByName = true; + lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, configuration.getConfigurationId()); + org.onap.aai.domain.yang.Configuration aaiConfiguration = bbInputSetupUtils.getAAIConfiguration(configuration.getConfigurationId()); + if(aaiConfiguration!=null){ + modelInfo.setModelCustomizationUuid(aaiConfiguration.getModelCustomizationId()); + } + this.mapCatalogConfiguration(configuration, modelInfo, service); + } + } + if (!foundByName && !foundById && bbName.equalsIgnoreCase(AssignFlows.FABRIC_CONFIGURATION.toString())) { + Configuration configuration = this.createConfiguration(lookupKeyMap, instanceName, resourceId); + serviceInstance.getConfigurations().add(configuration); + this.mapCatalogConfiguration(configuration, modelInfo, service); + } + } + + protected Configuration createConfiguration(Map<ResourceKey, String> lookupKeyMap, + String instanceName, String resourceId) { + lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, resourceId); + Configuration configuration = new Configuration(); + configuration.setConfigurationId(resourceId); + configuration.setConfigurationName(instanceName); + configuration.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + return configuration; + } + + protected void mapCatalogConfiguration(Configuration configuration, ModelInfo modelInfo, Service service) { + ConfigurationResourceCustomization configurationResourceCustomization = findConfigurationResourceCustomization(modelInfo, service); + if (configurationResourceCustomization != null) { + configuration.setModelInfoConfiguration(this.mapperLayer.mapCatalogConfigurationToConfiguration(configurationResourceCustomization)); + } + } + + protected ConfigurationResourceCustomization findConfigurationResourceCustomization(ModelInfo modelInfo, Service service) { + for (ConfigurationResourceCustomization resourceCust : service.getConfigurationCustomizations()) { + if (resourceCust.getModelCustomizationUUID().equalsIgnoreCase(modelInfo.getModelCustomizationUuid())) { + return resourceCust; + } + } + return null; + } + + protected void populateVfModule(ModelInfo modelInfo, Service service, String bbName, + ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap, String resourceId, + RelatedInstanceList[] relatedInstanceList, String instanceName, List<Map<String, String>> instanceParams, CloudConfiguration cloudConfiguration) throws Exception { + boolean foundByName = false; + boolean foundById = false; + String vnfModelCustomizationUUID = null; + if (relatedInstanceList != null) { + for (RelatedInstanceList relatedInstList : relatedInstanceList) { + RelatedInstance relatedInstance = relatedInstList.getRelatedInstance(); + if (relatedInstance.getModelInfo().getModelType().equals(ModelType.vnf)) { + vnfModelCustomizationUUID = relatedInstance.getModelInfo().getModelCustomizationId(); + } + if (relatedInstance.getModelInfo().getModelType().equals(ModelType.volumeGroup)) { + lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, relatedInstance.getInstanceId()); + } + } + } + GenericVnf vnf = null; + for (GenericVnf tempVnf : serviceInstance.getVnfs()) { + if (tempVnf.getVnfId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID))) { + vnf = tempVnf; + vnfModelCustomizationUUID = this.bbInputSetupUtils.getAAIGenericVnf(vnf.getVnfId()) + .getModelCustomizationId(); + ModelInfo vnfModelInfo = new ModelInfo(); + vnfModelInfo.setModelCustomizationUuid(vnfModelCustomizationUUID); + this.mapCatalogVnf(tempVnf, vnfModelInfo, service); + for(VolumeGroup volumeGroup : tempVnf.getVolumeGroups()) { + String volumeGroupCustId = + this.bbInputSetupUtils.getAAIVolumeGroup(CLOUD_OWNER, + cloudConfiguration.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId()).getModelCustomizationId(); + if(modelInfo.getModelCustomizationId().equalsIgnoreCase(volumeGroupCustId)) { + lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, volumeGroup.getVolumeGroupId()); + } + } + break; + } + } + if (vnf != null) { + for (VfModule vfModule : vnf.getVfModules()) { + if (lookupKeyMap.get(ResourceKey.VF_MODULE_ID) != null + && vfModule.getVfModuleId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.VF_MODULE_ID))) { + foundById = true; + this.mapCatalogVfModule(vfModule, modelInfo, service, vnfModelCustomizationUUID); + } else if (instanceName != null && vfModule.getVfModuleName().equalsIgnoreCase(instanceName)) { + foundByName = true; + lookupKeyMap.put(ResourceKey.VF_MODULE_ID, vfModule.getVfModuleId()); + this.mapCatalogVfModule(vfModule, modelInfo, service, vnfModelCustomizationUUID); + } + } + if (!foundByName && !foundById && bbName.equalsIgnoreCase(AssignFlows.VF_MODULE.toString())) { + VfModule vfModule = this.createVfModule(lookupKeyMap, + resourceId, instanceName, instanceParams); + this.mapCatalogVfModule(vfModule, modelInfo, service, vnfModelCustomizationUUID); + vnf.getVfModules().add(vfModule); + } + } else { + msoLogger.debug("Related VNF instance Id not found: " + lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID)); + throw new Exception("Could not find relevant information for related VNF"); + } + } + + protected void mapCatalogVfModule(VfModule vfModule, ModelInfo modelInfo, Service service, + String vnfModelCustomizationUUID) { + if(modelInfo.getModelCustomizationUuid() != null) { + modelInfo.setModelCustomizationId(modelInfo.getModelCustomizationUuid()); + } + VnfResourceCustomization vnfResourceCustomization = null; + for (VnfResourceCustomization resourceCust : service.getVnfCustomizations()) { + if (resourceCust.getModelCustomizationUUID().equalsIgnoreCase(vnfModelCustomizationUUID)) { + vnfResourceCustomization = resourceCust; + break; + } + } + if (vnfResourceCustomization != null) { + VfModuleCustomization vfResourceCustomization = vnfResourceCustomization.getVfModuleCustomizations() + .stream() // Convert to steam + .filter(x -> modelInfo.getModelCustomizationId().equalsIgnoreCase(x.getModelCustomizationUUID()))// find + // what + // we + // want + .findAny() // If 'findAny' then return found + .orElse(null); + if (vfResourceCustomization != null) { + vfModule.setModelInfoVfModule(this.mapperLayer.mapCatalogVfModuleToVfModule(vfResourceCustomization)); + } + } + } + + protected VfModule createVfModule(Map<ResourceKey, String> lookupKeyMap, String vfModuleId, String instanceName, List<Map<String, String>> instanceParams) { + lookupKeyMap.put(ResourceKey.VF_MODULE_ID, vfModuleId); + VfModule vfModule = new VfModule(); + vfModule.setVfModuleId(vfModuleId); + vfModule.setVfModuleName(instanceName); + vfModule.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + if(instanceParams != null) { + for(Map<String, String> params : instanceParams) { + vfModule.getCloudParams().putAll(params); + } + } + return vfModule; + } + + protected void populateVolumeGroup(ModelInfo modelInfo, Service service, String bbName, + ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap, String resourceId, + RelatedInstanceList[] relatedInstanceList, String instanceName, String vnfType, List<Map<String, String>> instanceParams) throws Exception { + boolean foundByName = false; + boolean foundById = false; + String vnfModelCustomizationUUID = null; + if (relatedInstanceList != null) { + for (RelatedInstanceList relatedInstList : relatedInstanceList) { + RelatedInstance relatedInstance = relatedInstList.getRelatedInstance(); + if (relatedInstance.getModelInfo().getModelType().equals(ModelType.vnf)) { + vnfModelCustomizationUUID = relatedInstance.getModelInfo().getModelCustomizationUuid(); + } + } + } + GenericVnf vnf = null; + for (GenericVnf tempVnf : serviceInstance.getVnfs()) { + if (tempVnf.getVnfId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID))) { + vnf = tempVnf; + vnfModelCustomizationUUID = this.bbInputSetupUtils.getAAIGenericVnf(vnf.getVnfId()) + .getModelCustomizationId(); + ModelInfo vnfModelInfo = new ModelInfo(); + vnfModelInfo.setModelCustomizationUuid(vnfModelCustomizationUUID); + this.mapCatalogVnf(tempVnf, vnfModelInfo, service); + break; + } + } + if (vnf != null && vnfModelCustomizationUUID != null) { + for (VolumeGroup volumeGroup : vnf.getVolumeGroups()) { + if (lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID) != null && volumeGroup.getVolumeGroupId() + .equalsIgnoreCase(lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID))) { + foundById = true; + this.mapCatalogVolumeGroup(volumeGroup, modelInfo, service, vnfModelCustomizationUUID); + } else if (instanceName != null && volumeGroup.getVolumeGroupName().equalsIgnoreCase(instanceName)) { + foundByName = true; + lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, volumeGroup.getVolumeGroupId()); + this.mapCatalogVolumeGroup(volumeGroup, modelInfo, service, vnfModelCustomizationUUID); + } + } + if (!foundByName && !foundById && bbName.equalsIgnoreCase(AssignFlows.VOLUME_GROUP.toString())) { + if (vnfType == null || vnfType.isEmpty()) { + vnfType = service.getModelName() + "/" + modelInfo.getModelCustomizationName(); + } + VolumeGroup volumeGroup = this.createVolumeGroup(lookupKeyMap, resourceId, instanceName, vnfType, instanceParams); + vnf.getVolumeGroups().add(volumeGroup); + this.mapCatalogVolumeGroup(volumeGroup, modelInfo, service, vnfModelCustomizationUUID); + } + } else { + msoLogger.debug("Related VNF instance Id not found: " + lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID)); + throw new Exception("Could not find relevant information for related VNF"); + } + } + + protected VolumeGroup createVolumeGroup(Map<ResourceKey, String> lookupKeyMap, String volumeGroupId, String instanceName, String vnfType, List<Map<String, String>> instanceParams) { + lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, volumeGroupId); + VolumeGroup volumeGroup = new VolumeGroup(); + volumeGroup.setVolumeGroupId(volumeGroupId); + volumeGroup.setVolumeGroupName(instanceName); + volumeGroup.setVnfType(vnfType); + volumeGroup.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + if(instanceParams != null) { + for(Map<String, String> params : instanceParams) { + volumeGroup.getCloudParams().putAll(params); + } + } + return volumeGroup; + } + + protected void mapCatalogVolumeGroup(VolumeGroup volumeGroup, ModelInfo modelInfo, Service service, + String vnfModelCustomizationUUID) { + VfModuleCustomization vfResourceCustomization = getVfResourceCustomization(modelInfo, service, + vnfModelCustomizationUUID); + if (vfResourceCustomization != null) { + volumeGroup.setModelInfoVfModule(this.mapperLayer.mapCatalogVfModuleToVfModule(vfResourceCustomization)); + } + } + + protected VfModuleCustomization getVfResourceCustomization(ModelInfo modelInfo, Service service, + String vnfModelCustomizationUUID) { + VnfResourceCustomization vnfResourceCustomization = null; + for (VnfResourceCustomization resourceCust : service.getVnfCustomizations()) { + if (resourceCust.getModelCustomizationUUID().equalsIgnoreCase(vnfModelCustomizationUUID)) { + vnfResourceCustomization = resourceCust; + break; + } + } + if (vnfResourceCustomization != null) { + for (VfModuleCustomization vfResourceCust : vnfResourceCustomization.getVfModuleCustomizations()) { + if (vfResourceCust.getModelCustomizationUUID() + .equalsIgnoreCase(modelInfo.getModelCustomizationUuid())) { + return vfResourceCust; + } + } + + } + return null; + } + + protected void populateGenericVnf(ModelInfo modelInfo, String instanceName, + org.onap.so.serviceinstancebeans.Platform platform, + org.onap.so.serviceinstancebeans.LineOfBusiness lineOfBusiness, Service service, String bbName, + ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap, + RelatedInstanceList[] relatedInstanceList, String resourceId, String vnfType, List<Map<String, String>> instanceParams) { + boolean foundByName = false; + boolean foundById = false; + ModelInfo instanceGroupModelInfo = null; + String instanceGroupId = null; + if (relatedInstanceList != null) { + for (RelatedInstanceList relatedInstList : relatedInstanceList) { + RelatedInstance relatedInstance = relatedInstList.getRelatedInstance(); + if (relatedInstance.getModelInfo().getModelType().equals(ModelType.networkCollection)) { + instanceGroupModelInfo = relatedInstance.getModelInfo(); + instanceGroupId = relatedInstance.getInstanceId(); + } + } + } + for (GenericVnf genericVnf : serviceInstance.getVnfs()) { + if (lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID) != null + && genericVnf.getVnfId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID))) { + foundById = true; + org.onap.aai.domain.yang.GenericVnf vnf = bbInputSetupUtils.getAAIGenericVnf(genericVnf.getVnfId()); + if(vnf!=null){ + modelInfo.setModelCustomizationUuid(vnf.getModelCustomizationId()); + } + this.mapCatalogVnf(genericVnf, modelInfo, service); + } else if (instanceName != null && genericVnf.getVnfName().equalsIgnoreCase(instanceName)) { + foundByName = true; + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, genericVnf.getVnfId()); + org.onap.aai.domain.yang.GenericVnf vnf = bbInputSetupUtils.getAAIGenericVnf(genericVnf.getVnfId()); + if(vnf!=null){ + modelInfo.setModelCustomizationUuid(vnf.getModelCustomizationId()); + } + this.mapCatalogVnf(genericVnf, modelInfo, service); + } + } + if (!foundByName && !foundById && bbName.equalsIgnoreCase(AssignFlows.VNF.toString())) { + if(vnfType == null || vnfType.isEmpty()) { + vnfType = service.getModelName() + "/" + modelInfo.getModelCustomizationName(); + } + GenericVnf genericVnf = this.createGenericVnf(lookupKeyMap, instanceName, platform, lineOfBusiness, + resourceId, vnfType, instanceParams); + serviceInstance.getVnfs().add(genericVnf); + this.mapCatalogVnf(genericVnf, modelInfo, service); + this.mapVnfcCollectionInstanceGroup(genericVnf, modelInfo, service); + if (instanceGroupId != null && instanceGroupModelInfo != null) + this.mapNetworkCollectionInstanceGroup(genericVnf, instanceGroupId); + } + } + + protected void mapVnfcCollectionInstanceGroup(GenericVnf genericVnf, ModelInfo modelInfo, Service service) { + VnfResourceCustomization vnfResourceCustomization = getVnfResourceCustomizationFromService(modelInfo, service); + if(vnfResourceCustomization != null) { + List<VnfcInstanceGroupCustomization> vnfcInstanceGroups = vnfResourceCustomization + .getVnfcInstanceGroupCustomizations(); + for (VnfcInstanceGroupCustomization vnfcInstanceGroupCust : vnfcInstanceGroups) { + InstanceGroup instanceGroup = this.createInstanceGroup(); + instanceGroup.setModelInfoInstanceGroup(this.mapperLayer + .mapCatalogInstanceGroupToInstanceGroup(null, vnfcInstanceGroupCust.getInstanceGroup())); + instanceGroup.getModelInfoInstanceGroup().setFunction(vnfcInstanceGroupCust.getFunction()); + instanceGroup.setDescription(vnfcInstanceGroupCust.getDescription()); + genericVnf.getInstanceGroups().add(instanceGroup); + } + } + } + + protected void mapNetworkCollectionInstanceGroup(GenericVnf genericVnf, String instanceGroupId) { + org.onap.aai.domain.yang.InstanceGroup aaiInstanceGroup = this.bbInputSetupUtils + .getAAIInstanceGroup(instanceGroupId); + InstanceGroup instanceGroup = this.mapperLayer.mapAAIInstanceGroupIntoInstanceGroup(aaiInstanceGroup); + instanceGroup.setModelInfoInstanceGroup(this.mapperLayer.mapCatalogInstanceGroupToInstanceGroup( + null, this.bbInputSetupUtils.getCatalogInstanceGroup(aaiInstanceGroup.getModelVersionId()))); + genericVnf.getInstanceGroups().add(instanceGroup); + } + + protected GenericVnf createGenericVnf(Map<ResourceKey, String> lookupKeyMap, String instanceName, + org.onap.so.serviceinstancebeans.Platform platform, + org.onap.so.serviceinstancebeans.LineOfBusiness lineOfBusiness, String vnfId, String vnfType, List<Map<String, String>> instanceParams) { + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, vnfId); + GenericVnf genericVnf = new GenericVnf(); + genericVnf.setVnfId(vnfId); + genericVnf.setVnfName(instanceName); + genericVnf.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + genericVnf.setVnfType(vnfType); + if (platform != null) { + genericVnf.setPlatform(this.mapperLayer.mapRequestPlatform(platform)); + } + if (lineOfBusiness != null) { + genericVnf.setLineOfBusiness(this.mapperLayer.mapRequestLineOfBusiness(lineOfBusiness)); + } + if(instanceParams != null) { + for(Map<String, String> params : instanceParams) { + genericVnf.getCloudParams().putAll(params); + } + } + return genericVnf; + } + + protected void mapCatalogVnf(GenericVnf genericVnf, ModelInfo modelInfo, Service service) { + VnfResourceCustomization vnfResourceCustomization = getVnfResourceCustomizationFromService(modelInfo, service); + if (vnfResourceCustomization != null) { + genericVnf.setModelInfoGenericVnf(this.mapperLayer.mapCatalogVnfToVnf(vnfResourceCustomization)); + } + } + + protected VnfResourceCustomization getVnfResourceCustomizationFromService(ModelInfo modelInfo, Service service) { + VnfResourceCustomization vnfResourceCustomization = null; + for (VnfResourceCustomization resourceCust : service.getVnfCustomizations()) { + if (resourceCust.getModelCustomizationUUID().equalsIgnoreCase(modelInfo.getModelCustomizationUuid())) { + vnfResourceCustomization = resourceCust; + break; + } + } + return vnfResourceCustomization; + } + + protected void populateL3Network(String instanceName, ModelInfo modelInfo, Service service, String bbName, + ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap, String resourceId, List<Map<String, String>> instanceParams) { + boolean foundByName = false; + boolean foundById = false; + for (L3Network network : serviceInstance.getNetworks()) { + if (lookupKeyMap.get(ResourceKey.NETWORK_ID) != null + && network.getNetworkId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.NETWORK_ID))) { + foundById = true; + this.mapCatalogNetwork(network, modelInfo, service); + } else if (instanceName != null && network.getNetworkName().equalsIgnoreCase(instanceName)) { + foundByName = true; + lookupKeyMap.put(ResourceKey.NETWORK_ID, network.getNetworkId()); + this.mapCatalogNetwork(network, modelInfo, service); + } + } + if (!foundByName && !foundById + && (bbName.equalsIgnoreCase(AssignFlows.NETWORK_A_LA_CARTE.toString()) + || bbName.equalsIgnoreCase(AssignFlows.NETWORK_MACRO.toString()))) { + L3Network l3Network = this.createNetwork(lookupKeyMap, instanceName, resourceId, instanceParams); + serviceInstance.getNetworks().add(l3Network); + this.mapCatalogNetwork(l3Network, modelInfo, service); + } + } + + protected L3Network createNetwork(Map<ResourceKey, String> lookupKeyMap, String instanceName, + String networkId, List<Map<String, String>> instanceParams) { + lookupKeyMap.put(ResourceKey.NETWORK_ID, networkId); + L3Network network = new L3Network(); + network.setNetworkId(networkId); + network.setNetworkName(instanceName); + network.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + if(instanceParams != null) { + for(Map<String, String> params : instanceParams) { + network.getCloudParams().putAll(params); + } + } + return network; + } + + protected void mapCatalogNetwork(L3Network network, ModelInfo modelInfo, Service service) { + NetworkResourceCustomization networkResourceCustomization = null; + for (NetworkResourceCustomization resourceCust : service.getNetworkCustomizations()) { + if (resourceCust.getModelCustomizationUUID().equalsIgnoreCase(modelInfo.getModelCustomizationUuid())) { + networkResourceCustomization = resourceCust; + break; + } + } + if (networkResourceCustomization != null) { + network.setModelInfoNetwork(this.mapperLayer.mapCatalogNetworkToNetwork(networkResourceCustomization)); + } + } + + protected GeneralBuildingBlock getGBBALaCarteService(ExecuteBuildingBlock executeBB, RequestDetails requestDetails, + Map<ResourceKey, String> lookupKeyMap, String requestAction, String resourceId) throws Exception { + Customer customer = getCustomerAndServiceSubscription(requestDetails, resourceId); + if (customer != null) { + Project project = null; + OwningEntity owningEntity = null; + + if (requestDetails.getProject() != null) + project = mapperLayer.mapRequestProject(requestDetails.getProject()); + if (requestDetails.getOwningEntity() != null) + owningEntity = mapperLayer.mapRequestOwningEntity(requestDetails.getOwningEntity()); + + + Service service = bbInputSetupUtils + .getCatalogServiceByModelUUID(requestDetails.getModelInfo().getModelVersionId()); + if (service == null) { + service = bbInputSetupUtils.getCatalogServiceByModelVersionAndModelInvariantUUID( + requestDetails.getModelInfo().getModelVersion(), + requestDetails.getModelInfo().getModelInvariantId()); + if(service == null) { + throw new Exception("Could not find service for model version Id: " + + requestDetails.getModelInfo().getModelVersionId() + " and for model invariant Id: " + + requestDetails.getModelInfo().getModelInvariantId()); + } + } + ServiceInstance serviceInstance = this.getALaCarteServiceInstance(service, requestDetails, customer, + project, owningEntity, lookupKeyMap, resourceId, executeBB.isaLaCarte(), + executeBB.getBuildingBlock().getBpmnFlowName()); + return this.populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, executeBB, requestAction, customer); + } else { + throw new Exception("Could not find customer"); + } + } + + protected Customer getCustomerAndServiceSubscription(RequestDetails requestDetails, String resourceId) { + Customer customer; + if (requestDetails.getSubscriberInfo() != null) { + customer = this.getCustomerFromRequest(requestDetails); + } else { + customer = this.getCustomerFromURI(resourceId); + } + if (customer != null) { + ServiceSubscription serviceSubscription = null; + serviceSubscription = getServiceSubscription(requestDetails, customer); + if (serviceSubscription == null) { + serviceSubscription = getServiceSubscriptionFromURI(resourceId, customer); + } + customer.setServiceSubscription(serviceSubscription); + return customer; + } else { + return null; + } + } + + protected ServiceSubscription getServiceSubscriptionFromURI(String resourceId, Customer customer) { + Map<String, String> uriKeys = bbInputSetupUtils.getURIKeysFromServiceInstance(resourceId); + String subscriptionServiceType = uriKeys.get("service-type"); + org.onap.aai.domain.yang.ServiceSubscription serviceSubscriptionAAI = bbInputSetupUtils + .getAAIServiceSubscription(customer.getGlobalCustomerId(), subscriptionServiceType); + if (serviceSubscriptionAAI != null) { + return mapperLayer.mapAAIServiceSubscription(serviceSubscriptionAAI); + } else { + return null; + } + } + + protected Customer getCustomerFromURI(String resourceId) { + Map<String, String> uriKeys = bbInputSetupUtils.getURIKeysFromServiceInstance(resourceId); + String globalCustomerId = uriKeys.get("global-customer-id"); + org.onap.aai.domain.yang.Customer customerAAI = this.bbInputSetupUtils.getAAICustomer(globalCustomerId); + if (customerAAI != null) { + return mapperLayer.mapAAICustomer(customerAAI); + } else { + return null; + } + } + + protected GeneralBuildingBlock populateGBBWithSIAndAdditionalInfo(RequestDetails requestDetails, + ServiceInstance serviceInstance, ExecuteBuildingBlock executeBB, String requestAction, Customer customer) { + GeneralBuildingBlock outputBB = new GeneralBuildingBlock(); + OrchestrationContext orchContext = mapperLayer.mapOrchestrationContext(requestDetails); + RequestContext requestContext = mapperLayer.mapRequestContext(requestDetails); + requestContext.setAction(requestAction); + requestContext.setMsoRequestId(executeBB.getRequestId()); + org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = bbInputSetupUtils + .getCloudRegion(requestDetails.getCloudConfiguration(), CLOUD_OWNER); + CloudRegion cloudRegion = mapperLayer.mapCloudRegion(requestDetails.getCloudConfiguration(), aaiCloudRegion, + CLOUD_OWNER); + outputBB.setOrchContext(orchContext); + outputBB.setRequestContext(requestContext); + outputBB.setCloudRegion(cloudRegion); + if(customer == null){ + Map<String, String> uriKeys = bbInputSetupUtils.getURIKeysFromServiceInstance(serviceInstance.getServiceInstanceId()); + String globalCustomerId = uriKeys.get("global-customer-id"); + String subscriptionServiceType = uriKeys.get("service-type"); + customer = mapCustomer(globalCustomerId, subscriptionServiceType); + } + outputBB.setServiceInstance(serviceInstance); + customer.getServiceSubscription().getServiceInstances().add(serviceInstance); + outputBB.setCustomer(customer); + return outputBB; + } + + protected ServiceSubscription getServiceSubscription(RequestDetails requestDetails, Customer customer) { + org.onap.aai.domain.yang.ServiceSubscription aaiServiceSubscription = bbInputSetupUtils + .getAAIServiceSubscription(customer.getGlobalCustomerId(), + requestDetails.getRequestParameters().getSubscriptionServiceType()); + if (aaiServiceSubscription != null) { + return mapperLayer.mapAAIServiceSubscription(aaiServiceSubscription); + } else { + return null; + } + } + + protected Customer getCustomerFromRequest(RequestDetails requestDetails) { + org.onap.aai.domain.yang.Customer aaiCustomer = bbInputSetupUtils + .getAAICustomer(requestDetails.getSubscriberInfo().getGlobalSubscriberId()); + if (aaiCustomer != null) { + return mapperLayer.mapAAICustomer(aaiCustomer); + } else { + return null; + } + } + + protected ServiceInstance getALaCarteServiceInstance(Service service, RequestDetails requestDetails, + Customer customer, Project project, OwningEntity owningEntity, Map<ResourceKey, String> lookupKeyMap, + String serviceInstanceId, boolean aLaCarte, String bbName) throws Exception { + ServiceInstance serviceInstance = this.getServiceInstanceHelper(requestDetails, customer, project, owningEntity, + lookupKeyMap, serviceInstanceId, aLaCarte, service, bbName); + org.onap.aai.domain.yang.ServiceInstance serviceInstanceAAI = this.bbInputSetupUtils + .getAAIServiceInstanceById(serviceInstanceId); + if (serviceInstanceAAI != null + && !serviceInstanceAAI.getModelVersionId().equalsIgnoreCase(service.getModelUUID())) { + Service tempService = this.bbInputSetupUtils + .getCatalogServiceByModelUUID(serviceInstanceAAI.getModelVersionId()); + if (tempService != null) { + serviceInstance + .setModelInfoServiceInstance(mapperLayer.mapCatalogServiceIntoServiceInstance(tempService)); + return serviceInstance; + } else { + throw new Exception( + "Could not find model of existing SI. Service Instance in AAI already exists with different model version id: " + + serviceInstanceAAI.getModelVersionId()); + } + } + serviceInstance.setModelInfoServiceInstance(mapperLayer.mapCatalogServiceIntoServiceInstance(service)); + return serviceInstance; + } + + protected GeneralBuildingBlock getGBBMacro(ExecuteBuildingBlock executeBB, RequestDetails requestDetails, + Map<ResourceKey, String> lookupKeyMap, String requestAction, String resourceId, String vnfType) + throws Exception { + String bbName = executeBB.getBuildingBlock().getBpmnFlowName(); + String key = executeBB.getBuildingBlock().getKey(); + GeneralBuildingBlock gBB = this.getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, requestAction, + resourceId); + RequestParameters requestParams = requestDetails.getRequestParameters(); + Service service = null; + if (gBB != null && gBB.getServiceInstance() != null + && gBB.getServiceInstance().getModelInfoServiceInstance() != null + && gBB.getServiceInstance().getModelInfoServiceInstance().getModelUuid() != null) { + service = bbInputSetupUtils.getCatalogServiceByModelUUID( + gBB.getServiceInstance().getModelInfoServiceInstance().getModelUuid()); + } else { + throw new Exception("Could not get service instance for macro request"); + } + if (requestParams != null && requestParams.getUserParams() != null) { + for(Map<String, Object> userParams : requestParams.getUserParams()) { + if(userParams.containsKey("service")) { + String input = mapper.writeValueAsString(userParams.get("service")); + return getGBBMacroUserParams(executeBB, requestDetails, lookupKeyMap, vnfType, bbName, key, gBB, + requestParams, service, input); + } + } + } + if (requestAction.equalsIgnoreCase("deactivateInstance")) { + return gBB; + } else if (requestAction.equalsIgnoreCase("createInstance")) { + return getGBBMacroNoUserParamsCreate(executeBB, lookupKeyMap, bbName, key, gBB, service); + } else if (requestAction.equalsIgnoreCase("deleteInstance") + || requestAction.equalsIgnoreCase("unassignInstance") + || requestAction.equalsIgnoreCase("activateInstance") + || requestAction.equalsIgnoreCase("activateFabricConfiguration")) { + return getGBBMacroExistingService(executeBB, lookupKeyMap, bbName, gBB, service, requestAction, + requestDetails.getCloudConfiguration()); + } else { + throw new IllegalArgumentException( + "No user params on requestAction: assignInstance. Please specify user params."); + } + } + + protected GeneralBuildingBlock getGBBMacroNoUserParamsCreate(ExecuteBuildingBlock executeBB, + Map<ResourceKey, String> lookupKeyMap, String bbName, String key, GeneralBuildingBlock gBB, Service service) + throws Exception { + ServiceInstance serviceInstance = gBB.getServiceInstance(); + if (bbName.contains(NETWORK) && !bbName.contains(NETWORK_COLLECTION)) { + String networkId = lookupKeyMap.get(ResourceKey.NETWORK_ID); + ModelInfo networkModelInfo = new ModelInfo(); + if(!executeBB.getBuildingBlock().getIsVirtualLink()) { + NetworkResourceCustomization networkCust = getNetworkCustomizationByKey(key, service); + if (networkCust != null) { + networkModelInfo.setModelCustomizationUuid(networkCust.getModelCustomizationUUID()); + this.populateL3Network(null, networkModelInfo, service, bbName, serviceInstance, lookupKeyMap, + networkId, null); + } else { + msoLogger.debug("Could not find a network customization with key: " + key); + } + } else { + msoLogger.debug("Orchestrating on Collection Network Resource Customization"); + serviceInstance.getNetworks().add(getVirtualLinkL3Network(lookupKeyMap, bbName, key, networkId)); + } + } else if(bbName.contains("Configuration")) { + String configurationId = lookupKeyMap.get(ResourceKey.CONFIGURATION_ID); + ModelInfo configurationModelInfo = new ModelInfo(); + configurationModelInfo.setModelCustomizationUuid(key); + ConfigurationResourceCustomization configurationCust = findConfigurationResourceCustomization(configurationModelInfo, service); + if(configurationCust != null) { + this.populateConfiguration(configurationModelInfo, service, bbName, serviceInstance, lookupKeyMap, configurationId, null); + } else { + msoLogger.debug("Could not find a configuration customization with key: " + key); + } + } + if (executeBB.getWorkflowResourceIds() != null) { + this.populateNetworkCollectionAndInstanceGroupAssign(service, bbName, serviceInstance, + executeBB.getWorkflowResourceIds().getNetworkCollectionId(), key); + } + return gBB; + } + + protected L3Network getVirtualLinkL3Network(Map<ResourceKey, String> lookupKeyMap, String bbName, String key, + String networkId) { + CollectionNetworkResourceCustomization collectionNetworkResourceCust = bbInputSetupUtils.getCatalogCollectionNetworkResourceCustByID(key); + if(collectionNetworkResourceCust != null && (bbName.equalsIgnoreCase(AssignFlows.NETWORK_A_LA_CARTE.toString()) + || bbName.equalsIgnoreCase(AssignFlows.NETWORK_MACRO.toString()))) { + NetworkResourceCustomization networkResourceCustomization = + mapperLayer.mapCollectionNetworkResourceCustToNetworkResourceCust(collectionNetworkResourceCust); + L3Network l3Network = createNetwork(lookupKeyMap, null, networkId, null); + l3Network.setModelInfoNetwork(mapperLayer.mapCatalogNetworkToNetwork(networkResourceCustomization)); + return l3Network; + } + return null; + } + + protected NetworkResourceCustomization getNetworkCustomizationByKey(String key, Service service) { + for (NetworkResourceCustomization networkCust : service.getNetworkCustomizations()) { + if (networkCust.getModelCustomizationUUID().equalsIgnoreCase(key)) { + return networkCust; + } + } + return null; + } + + protected GeneralBuildingBlock getGBBMacroExistingService(ExecuteBuildingBlock executeBB, + Map<ResourceKey, String> lookupKeyMap, String bbName, GeneralBuildingBlock gBB, Service service, + String requestAction, CloudConfiguration cloudConfiguration) throws Exception { + ServiceInstance serviceInstance = gBB.getServiceInstance(); + if (cloudConfiguration != null && requestAction.equalsIgnoreCase("deleteInstance")) { + org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = bbInputSetupUtils.getCloudRegion(cloudConfiguration, + CLOUD_OWNER); + CloudRegion cloudRegion = mapperLayer.mapCloudRegion(cloudConfiguration, aaiCloudRegion, CLOUD_OWNER); + gBB.setCloudRegion(cloudRegion); + } + if (bbName.contains(VNF)) { + for (GenericVnf genericVnf : serviceInstance.getVnfs()) { + if (lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID) != null + && genericVnf.getVnfId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID))) { + org.onap.aai.domain.yang.GenericVnf vnf = bbInputSetupUtils.getAAIGenericVnf(genericVnf.getVnfId()); + ModelInfo modelInfo = new ModelInfo(); + if (vnf != null) { + modelInfo.setModelCustomizationUuid(vnf.getModelCustomizationId()); + } + this.mapCatalogVnf(genericVnf, modelInfo, service); + } + } + } else if (bbName.contains(VF_MODULE)) { + for (GenericVnf vnf : serviceInstance.getVnfs()) { + for (VfModule vfModule : vnf.getVfModules()) { + if (lookupKeyMap.get(ResourceKey.VF_MODULE_ID) != null + && vfModule.getVfModuleId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.VF_MODULE_ID))) { + String vnfModelCustomizationUUID = this.bbInputSetupUtils.getAAIGenericVnf(vnf.getVnfId()) + .getModelCustomizationId(); + ModelInfo vnfModelInfo = new ModelInfo(); + vnfModelInfo.setModelCustomizationUuid(vnfModelCustomizationUUID); + this.mapCatalogVnf(vnf, vnfModelInfo, service); + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, vnf.getVnfId()); + String vfModuleCustomizationUUID = this.bbInputSetupUtils + .getAAIVfModule(vnf.getVnfId(), vfModule.getVfModuleId()).getModelCustomizationId(); + ModelInfo vfModuleModelInfo = new ModelInfo(); + vfModuleModelInfo.setModelCustomizationId(vfModuleCustomizationUUID); + this.mapCatalogVfModule(vfModule, vfModuleModelInfo, service, vnfModelCustomizationUUID); + break; + } + } + } + } else if (bbName.contains(VOLUME_GROUP)) { + for (GenericVnf vnf : serviceInstance.getVnfs()) { + for (VolumeGroup volumeGroup : vnf.getVolumeGroups()) { + if (lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID) != null && volumeGroup.getVolumeGroupId() + .equalsIgnoreCase(lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID))) { + String vnfModelCustomizationUUID = this.bbInputSetupUtils.getAAIGenericVnf(vnf.getVnfId()) + .getModelCustomizationId(); + ModelInfo vnfModelInfo = new ModelInfo(); + vnfModelInfo.setModelCustomizationUuid(vnfModelCustomizationUUID); + this.mapCatalogVnf(vnf, vnfModelInfo, service); + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, vnf.getVnfId()); + if (cloudConfiguration != null) { + String volumeGroupCustomizationUUID = this.bbInputSetupUtils.getAAIVolumeGroup(CLOUD_OWNER, + cloudConfiguration.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId()) + .getModelCustomizationId(); + ModelInfo volumeGroupModelInfo = new ModelInfo(); + volumeGroupModelInfo.setModelCustomizationId(volumeGroupCustomizationUUID); + this.mapCatalogVolumeGroup(volumeGroup, volumeGroupModelInfo, service, + vnfModelCustomizationUUID); + } + break; + } + } + } + } else if (bbName.contains(NETWORK)) { + for (L3Network network : serviceInstance.getNetworks()) { + if (lookupKeyMap.get(ResourceKey.NETWORK_ID) != null + && network.getNetworkId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.NETWORK_ID))) { + String networkCustomizationUUID = this.bbInputSetupUtils.getAAIL3Network(network.getNetworkId()) + .getModelCustomizationId(); + ModelInfo modelInfo = new ModelInfo(); + modelInfo.setModelCustomizationUuid(networkCustomizationUUID); + this.mapCatalogNetwork(network, modelInfo, service); + break; + } + } + } else if (bbName.contains("Fabric")) { + for(Configuration configuration : serviceInstance.getConfigurations()) { + if(lookupKeyMap.get(ResourceKey.CONFIGURATION_ID) != null + && configuration.getConfigurationId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.CONFIGURATION_ID))) { + String configurationCustUUID = this.bbInputSetupUtils.getAAIConfiguration(configuration.getConfigurationId()) + .getModelCustomizationId(); + ModelInfo modelInfo = new ModelInfo(); + modelInfo.setModelCustomizationUuid(configurationCustUUID); + this.mapCatalogConfiguration(configuration, modelInfo, service); + break; + } + } + } + if (executeBB.getWorkflowResourceIds() != null) { + this.populateNetworkCollectionAndInstanceGroupAssign(service, bbName, serviceInstance, + executeBB.getWorkflowResourceIds().getNetworkCollectionId(), executeBB.getBuildingBlock().getKey()); + } + return gBB; + } + + protected GeneralBuildingBlock getGBBMacroUserParams(ExecuteBuildingBlock executeBB, RequestDetails requestDetails, + Map<ResourceKey, String> lookupKeyMap, String vnfType, String bbName, String key, GeneralBuildingBlock gBB, + RequestParameters requestParams, Service service, String input) throws Exception { + ServiceInstance serviceInstance = gBB.getServiceInstance(); + org.onap.so.serviceinstancebeans.Service serviceMacro = mapper.readValue(input, + org.onap.so.serviceinstancebeans.Service.class); + + Resources resources = serviceMacro.getResources(); + Vnfs vnfs = null; + VfModules vfModules = null; + Networks networks = null; + CloudConfiguration cloudConfiguration = requestDetails.getCloudConfiguration(); + CloudRegion cloudRegion = getCloudRegionFromMacroRequest(cloudConfiguration, resources); + gBB.setCloudRegion(cloudRegion); + if (bbName.contains(VNF)) { + vnfs = findVnfsByKey(key, resources, vnfs); + String vnfId = lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID); + // This stores the vnf id in request db to be retrieved later when + // working on a vf module or volume group + InfraActiveRequests request = this.bbInputSetupUtils.getInfraActiveRequest(executeBB.getRequestId()); + if (request != null) { + this.bbInputSetupUtils.updateInfraActiveRequestVnfId(request, vnfId); + } + this.populateGenericVnf(vnfs.getModelInfo(), vnfs.getInstanceName(), vnfs.getPlatform(), + vnfs.getLineOfBusiness(), service, bbName, serviceInstance, lookupKeyMap, null, vnfId, vnfType, vnfs.getInstanceParams()); + } else if (bbName.contains(VF_MODULE) || bbName.contains(VOLUME_GROUP)) { + Pair<Vnfs, VfModules> vnfsAndVfModules = getVfModulesAndItsVnfsByKey(key, resources); + vfModules = vnfsAndVfModules.getValue1(); + vnfs = vnfsAndVfModules.getValue0(); + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, getVnfId(executeBB, lookupKeyMap)); + if (vnfs == null) { + throw new Exception("Could not find Vnf to orchestrate VfModule"); + } + ModelInfo modelInfo = vfModules.getModelInfo(); + if (bbName.contains(VOLUME_GROUP)) { + String volumeGroupId = lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID); + this.populateVolumeGroup(modelInfo, service, bbName, serviceInstance, lookupKeyMap, volumeGroupId, null, + vfModules.getVolumeGroupInstanceName(), vnfType, vfModules.getInstanceParams()); + } else { + String vfModuleId = lookupKeyMap.get(ResourceKey.VF_MODULE_ID); + CloudConfiguration cloudConfig = new CloudConfiguration(); + cloudConfig.setLcpCloudRegionId(cloudRegion.getLcpCloudRegionId()); + this.populateVfModule(modelInfo, service, bbName, serviceInstance, lookupKeyMap, vfModuleId, null, + vfModules.getInstanceName(), vfModules.getInstanceParams(), cloudConfig); + } + } else if (bbName.contains(NETWORK)) { + networks = findNetworksByKey(key, resources); + String networkId = lookupKeyMap.get(ResourceKey.NETWORK_ID); + this.populateL3Network(networks.getInstanceName(), networks.getModelInfo(), service, bbName, + serviceInstance, lookupKeyMap, networkId, networks.getInstanceParams()); + } else if (bbName.contains("Configuration")) { + String configurationId = lookupKeyMap.get(ResourceKey.CONFIGURATION_ID); + ModelInfo configurationModelInfo = new ModelInfo(); + configurationModelInfo.setModelCustomizationUuid(key); + ConfigurationResourceCustomization configurationCust = findConfigurationResourceCustomization(configurationModelInfo, service); + if(configurationCust != null) { + this.populateConfiguration(configurationModelInfo, service, bbName, serviceInstance, lookupKeyMap, configurationId, null); + } else { + msoLogger.debug("Could not find a configuration customization with key: " + key); + } + } + return gBB; + } + + protected Networks findNetworksByKey(String key, Resources resources) { + for (Networks networks : resources.getNetworks()) { + if (networks.getModelInfo().getModelCustomizationId().equalsIgnoreCase(key)) { + return networks; + } + } + return null; + } + + protected Pair<Vnfs, VfModules> getVfModulesAndItsVnfsByKey(String key, Resources resources) { + for (Vnfs vnfs : resources.getVnfs()) { + for (VfModules vfModules : vnfs.getVfModules()) { + if (vfModules.getModelInfo().getModelCustomizationId().equalsIgnoreCase(key)) { + return new Pair<Vnfs, VfModules>(vnfs, vfModules); + } + } + } + return null; + } + + protected Vnfs findVnfsByKey(String key, Resources resources, Vnfs vnfs) { + for (Vnfs tempVnfs : resources.getVnfs()) { + if (tempVnfs.getModelInfo().getModelCustomizationId().equalsIgnoreCase(key)) { + vnfs = tempVnfs; + break; + } + } + return vnfs; + } + + protected CloudRegion getCloudRegionFromMacroRequest(CloudConfiguration cloudConfiguration, Resources resources) { + if(cloudConfiguration == null) { + for(Vnfs vnfs : resources.getVnfs()) { + if(cloudConfiguration == null) { + cloudConfiguration = vnfs.getCloudConfiguration(); + } else { + break; + } + for(VfModules vfModules : vnfs.getVfModules()) { + if(cloudConfiguration == null) { + cloudConfiguration = vfModules.getCloudConfiguration(); + } else { + break; + } + } + } + for(Networks networks : resources.getNetworks()) { + if(cloudConfiguration == null) { + cloudConfiguration = networks.getCloudConfiguration(); + } else { + break; + } + } + } + if(cloudConfiguration != null) { + org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = bbInputSetupUtils.getCloudRegion(cloudConfiguration, + CLOUD_OWNER); + return mapperLayer.mapCloudRegion(cloudConfiguration, aaiCloudRegion, CLOUD_OWNER); + } else { + msoLogger.debug("Could not find any cloud configuration for this request."); + return null; + } + } + + protected String getVnfId(ExecuteBuildingBlock executeBB, Map<ResourceKey, String> lookupKeyMap) { + String vnfId = lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID); + if (vnfId == null) { + InfraActiveRequests request = this.bbInputSetupUtils.getInfraActiveRequest(executeBB.getRequestId()); + vnfId = request.getVnfId(); + } + + return vnfId; + } + + protected String generateRandomUUID() { + return UUID.randomUUID().toString(); + } + + protected ServiceInstance getServiceInstanceHelper(RequestDetails requestDetails, Customer customer, + Project project, OwningEntity owningEntity, Map<ResourceKey, String> lookupKeyMap, String serviceInstanceId, + boolean aLaCarte, Service service, String bbName) throws Exception { + if (requestDetails.getRequestInfo().getInstanceName() == null && aLaCarte + && bbName.equalsIgnoreCase(AssignFlows.SERVICE_INSTANCE.toString())) { + throw new Exception("Request invalid missing: RequestInfo:InstanceName"); + } else { + org.onap.aai.domain.yang.ServiceInstance serviceInstanceAAI = null; + if (aLaCarte && bbName.equalsIgnoreCase(AssignFlows.SERVICE_INSTANCE.toString())) { + serviceInstanceAAI = bbInputSetupUtils + .getAAIServiceInstanceByName(requestDetails.getRequestInfo().getInstanceName(), customer); + } + if (serviceInstanceId != null && serviceInstanceAAI == null) { + serviceInstanceAAI = bbInputSetupUtils.getAAIServiceInstanceById(serviceInstanceId); + } + if (serviceInstanceAAI != null) { + lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, serviceInstanceId); + return this.getExistingServiceInstance(serviceInstanceAAI); + } else { + return createServiceInstance(requestDetails, project, owningEntity, lookupKeyMap, + serviceInstanceId); + } + } + } + + protected ServiceInstance createServiceInstance(RequestDetails requestDetails, Project project, + OwningEntity owningEntity, Map<ResourceKey, String> lookupKeyMap, String serviceInstanceId) { + ServiceInstance serviceInstance = new ServiceInstance(); + lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, serviceInstanceId); + serviceInstance.setServiceInstanceId(serviceInstanceId); + if(requestDetails.getRequestInfo() != null) { + serviceInstance.setServiceInstanceName(requestDetails.getRequestInfo().getInstanceName()); + } + serviceInstance.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + serviceInstance.setProject(project); + serviceInstance.setOwningEntity(owningEntity); + return serviceInstance; + } + + public ServiceInstance getExistingServiceInstance(org.onap.aai.domain.yang.ServiceInstance serviceInstanceAAI) + throws Exception { + ServiceInstance serviceInstance = mapperLayer.mapAAIServiceInstanceIntoServiceInstance(serviceInstanceAAI); + if (serviceInstanceAAI.getRelationshipList() != null + && serviceInstanceAAI.getRelationshipList().getRelationship() != null + && !serviceInstanceAAI.getRelationshipList().getRelationship().isEmpty()) { + addRelationshipsToSI(serviceInstanceAAI, serviceInstance); + } + return serviceInstance; + } + + protected void populateNetworkCollectionAndInstanceGroupAssign(Service service, String bbName, + ServiceInstance serviceInstance, String resourceId, String key) throws Exception { + if (serviceInstance.getCollection() == null + && bbName.equalsIgnoreCase(AssignFlows.NETWORK_COLLECTION.toString())) { + Collection collection = this.createCollection(resourceId); + serviceInstance.setCollection(collection); + this.mapCatalogCollection(service, serviceInstance.getCollection(), key); + if(isVlanTagging(service, key)) { + InstanceGroup instanceGroup = this.createInstanceGroup(); + serviceInstance.getCollection().setInstanceGroup(instanceGroup); + this.mapCatalogNetworkCollectionInstanceGroup(service, + serviceInstance.getCollection().getInstanceGroup(), key); + } + } + } + + protected CollectionResourceCustomization findCatalogNetworkCollection(Service service, String key) { + for(CollectionResourceCustomization collectionCust : service.getCollectionResourceCustomizations()){ + if(collectionCust.getModelCustomizationUUID().equalsIgnoreCase(key)) { + return collectionCust; + } + } + return null; + } + + protected boolean isVlanTagging(Service service, String key) { + CollectionResourceCustomization collectionCust = findCatalogNetworkCollection(service, key); + if (collectionCust != null) { + CollectionResource collectionResource = collectionCust.getCollectionResource(); + if (collectionResource != null + && collectionResource.getInstanceGroup() != null + && collectionResource.getInstanceGroup().getToscaNodeType() != null + && collectionResource.getInstanceGroup().getToscaNodeType().contains("NetworkCollection")) { + return true; + } + } + return false; + } + + protected void mapCatalogNetworkCollectionInstanceGroup(Service service, InstanceGroup instanceGroup, String key) { + CollectionResourceCustomization collectionCust = this.findCatalogNetworkCollection(service, key); + org.onap.so.db.catalog.beans.InstanceGroup catalogInstanceGroup = collectionCust.getCollectionResource().getInstanceGroup(); + instanceGroup.setModelInfoInstanceGroup( + mapperLayer.mapCatalogInstanceGroupToInstanceGroup(collectionCust, catalogInstanceGroup)); + } + + protected void mapCatalogCollection(Service service, Collection collection, String key) { + CollectionResourceCustomization collectionCust = findCatalogNetworkCollection(service, key); + if (collectionCust != null) { + CollectionResource collectionResource = collectionCust.getCollectionResource(); + if (collectionResource != null) { + collection.setModelInfoCollection( + mapperLayer.mapCatalogCollectionToCollection(collectionCust, collectionResource)); + } + } + } + + protected Collection createCollection(String collectionId) { + Collection collection = new Collection(); + collection.setId(collectionId); + collection.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + return collection; + } + + protected InstanceGroup createInstanceGroup() { + InstanceGroup instanceGroup = new InstanceGroup(); + String instanceGroupId = this.generateRandomUUID(); + instanceGroup.setId(instanceGroupId); + return instanceGroup; + } + + protected void addRelationshipsToSI(org.onap.aai.domain.yang.ServiceInstance serviceInstanceAAI, + ServiceInstance serviceInstance) throws Exception { + AAIResultWrapper serviceInstanceWrapper = new AAIResultWrapper( + new AAICommonObjectMapperProvider().getMapper().writeValueAsString(serviceInstanceAAI)); + Optional<Relationships> relationshipsOp = serviceInstanceWrapper.getRelationships(); + Relationships relationships = null; + if (relationshipsOp.isPresent()) { + relationships = relationshipsOp.get(); + } else { + return; + } + + this.mapProject(relationships.getByType(AAIObjectType.PROJECT), serviceInstance); + this.mapOwningEntity(relationships.getByType(AAIObjectType.OWNING_ENTITY), serviceInstance); + this.mapL3Networks(relationships.getRelatedAAIUris(AAIObjectType.L3_NETWORK), serviceInstance.getNetworks()); + this.mapGenericVnfs(relationships.getRelatedAAIUris(AAIObjectType.GENERIC_VNF), serviceInstance.getVnfs()); + this.mapCollection(relationships.getByType(AAIObjectType.COLLECTION), serviceInstance); + this.mapConfigurations(relationships.getRelatedAAIUris(AAIObjectType.CONFIGURATION), serviceInstance.getConfigurations()); + } + + protected void mapConfigurations(List<AAIResourceUri> relatedAAIUris, List<Configuration> configurations) { + for (AAIResourceUri aaiResourceUri : relatedAAIUris) { + configurations.add(mapConfiguration(aaiResourceUri)); + } + } + + protected Configuration mapConfiguration(AAIResourceUri aaiResourceUri) { + AAIResultWrapper aaiConfigurationWrapper = this.bbInputSetupUtils.getAAIResourceDepthOne(aaiResourceUri); + Optional<org.onap.aai.domain.yang.Configuration> aaiConfigurationOp = aaiConfigurationWrapper + .asBean(org.onap.aai.domain.yang.Configuration.class); + if (!aaiConfigurationOp.isPresent()) { + return null; + } + + return this.mapperLayer.mapAAIConfiguration(aaiConfigurationOp.get()); + } + + protected void mapGenericVnfs(List<AAIResourceUri> list, List<GenericVnf> genericVnfs) { + for (AAIResourceUri aaiResourceUri : list) { + genericVnfs.add(this.mapGenericVnf(aaiResourceUri)); + } + } + + protected GenericVnf mapGenericVnf(AAIResourceUri aaiResourceUri) { + AAIResultWrapper aaiGenericVnfWrapper = this.bbInputSetupUtils.getAAIResourceDepthOne(aaiResourceUri); + Optional<org.onap.aai.domain.yang.GenericVnf> aaiGenericVnfOp = aaiGenericVnfWrapper + .asBean(org.onap.aai.domain.yang.GenericVnf.class); + if (!aaiGenericVnfOp.isPresent()) { + return null; + } + + GenericVnf genericVnf = this.mapperLayer.mapAAIGenericVnfIntoGenericVnf(aaiGenericVnfOp.get()); + + Optional<Relationships> relationshipsOp = aaiGenericVnfWrapper.getRelationships(); + if (relationshipsOp.isPresent()) { + Relationships relationships = relationshipsOp.get(); + this.mapPlatform(relationships.getByType(AAIObjectType.PLATFORM), genericVnf); + this.mapLineOfBusiness(relationships.getByType(AAIObjectType.LINE_OF_BUSINESS), genericVnf); + genericVnf.getVolumeGroups().addAll(mapVolumeGroups(relationships.getByType(AAIObjectType.VOLUME_GROUP))); + genericVnf.getInstanceGroups().addAll(mapInstanceGroups(relationships.getByType(AAIObjectType.INSTANCE_GROUP))); + } + + return genericVnf; + } + + protected List<InstanceGroup> mapInstanceGroups(List<AAIResultWrapper> instanceGroups) { + List<InstanceGroup> instanceGroupsList = new ArrayList<>(); + for (AAIResultWrapper volumeGroupWrapper : instanceGroups) { + instanceGroupsList.add(this.mapInstanceGroup(volumeGroupWrapper)); + } + return instanceGroupsList; + } + + protected InstanceGroup mapInstanceGroup(AAIResultWrapper instanceGroupWrapper) { + Optional<org.onap.aai.domain.yang.InstanceGroup> aaiInstanceGroupOp = instanceGroupWrapper + .asBean(org.onap.aai.domain.yang.InstanceGroup.class); + org.onap.aai.domain.yang.InstanceGroup aaiInstanceGroup = null; + + if (!aaiInstanceGroupOp.isPresent()) { + return null; + } + + aaiInstanceGroup = aaiInstanceGroupOp.get(); + InstanceGroup instanceGroup = this.mapperLayer.mapAAIInstanceGroupIntoInstanceGroup(aaiInstanceGroup); + instanceGroup.setModelInfoInstanceGroup(this.mapperLayer.mapCatalogInstanceGroupToInstanceGroup(null, + this.bbInputSetupUtils.getCatalogInstanceGroup(aaiInstanceGroup.getModelVersionId()))); + return instanceGroup; + } + + protected List<VolumeGroup> mapVolumeGroups(List<AAIResultWrapper> volumeGroups) { + List<VolumeGroup> volumeGroupsList = new ArrayList<>(); + for (AAIResultWrapper volumeGroupWrapper : volumeGroups) { + volumeGroupsList.add(this.mapVolumeGroup(volumeGroupWrapper)); + } + return volumeGroupsList; + } + + protected VolumeGroup mapVolumeGroup(AAIResultWrapper volumeGroupWrapper) { + Optional<org.onap.aai.domain.yang.VolumeGroup> aaiVolumeGroupOp = volumeGroupWrapper + .asBean(org.onap.aai.domain.yang.VolumeGroup.class); + org.onap.aai.domain.yang.VolumeGroup aaiVolumeGroup = null; + + if (!aaiVolumeGroupOp.isPresent()) { + return null; + } + + aaiVolumeGroup = aaiVolumeGroupOp.get(); + return this.mapperLayer.mapAAIVolumeGroup(aaiVolumeGroup); + } + + protected void mapLineOfBusiness(List<AAIResultWrapper> lineOfBusinesses, GenericVnf genericVnf) { + if (!lineOfBusinesses.isEmpty()) { + AAIResultWrapper lineOfBusinessWrapper = lineOfBusinesses.get(0); + Optional<org.onap.aai.domain.yang.LineOfBusiness> aaiLineOfBusinessOp = lineOfBusinessWrapper + .asBean(org.onap.aai.domain.yang.LineOfBusiness.class); + org.onap.aai.domain.yang.LineOfBusiness aaiLineOfBusiness = null; + if (!aaiLineOfBusinessOp.isPresent()) { + return; + } + aaiLineOfBusiness = aaiLineOfBusinessOp.get(); + + LineOfBusiness lineOfBusiness = this.mapperLayer.mapAAILineOfBusiness(aaiLineOfBusiness); + genericVnf.setLineOfBusiness(lineOfBusiness); + } + } + + protected void mapPlatform(List<AAIResultWrapper> platforms, GenericVnf genericVnf) { + if (!platforms.isEmpty()) { + AAIResultWrapper platformWrapper = platforms.get(0); + Optional<org.onap.aai.domain.yang.Platform> aaiPlatformOp = platformWrapper + .asBean(org.onap.aai.domain.yang.Platform.class); + org.onap.aai.domain.yang.Platform aaiPlatform = null; + if (!aaiPlatformOp.isPresent()) { + return; + } + aaiPlatform = aaiPlatformOp.get(); + + Platform platform = this.mapperLayer.mapAAIPlatform(aaiPlatform); + genericVnf.setPlatform(platform); + } + } + + protected void mapCollection(List<AAIResultWrapper> collections, ServiceInstance serviceInstance) { + if (!collections.isEmpty()) { + AAIResultWrapper collectionWrapper = collections.get(0); + Optional<org.onap.aai.domain.yang.Collection> aaiCollectionOp = collectionWrapper + .asBean(org.onap.aai.domain.yang.Collection.class); + org.onap.aai.domain.yang.Collection aaiCollection = null; + if (!aaiCollectionOp.isPresent()) { + return; + } + aaiCollection = aaiCollectionOp.get(); + + Collection collection = this.mapperLayer.mapAAICollectionIntoCollection(aaiCollection); + + Optional<Relationships> relationshipsOp = collectionWrapper.getRelationships(); + Relationships relationships = null; + if (relationshipsOp.isPresent()) { + relationships = relationshipsOp.get(); + } else { + serviceInstance.setCollection(collection); + return; + } + List<InstanceGroup> instanceGroupsList = mapInstanceGroups(relationships.getByType(AAIObjectType.INSTANCE_GROUP)); + if(!instanceGroupsList.isEmpty()) { + collection.setInstanceGroup(instanceGroupsList.get(0)); + } + serviceInstance.setCollection(collection); + } + } + + protected void mapL3Networks(List<AAIResourceUri> list, List<L3Network> l3Networks) { + for (AAIResourceUri aaiResourceUri : list) { + l3Networks.add(this.mapL3Network(aaiResourceUri)); + } + } + + protected L3Network mapL3Network(AAIResourceUri aaiResourceUri) { + AAIResultWrapper aaiNetworkWrapper = this.bbInputSetupUtils.getAAIResourceDepthTwo(aaiResourceUri); + Optional<org.onap.aai.domain.yang.L3Network> aaiL3NetworkOp = aaiNetworkWrapper + .asBean(org.onap.aai.domain.yang.L3Network.class); + org.onap.aai.domain.yang.L3Network aaiL3Network = null; + + if (!aaiL3NetworkOp.isPresent()) { + return null; + } + + aaiL3Network = aaiL3NetworkOp.get(); + L3Network network = this.mapperLayer.mapAAIL3Network(aaiL3Network); + + Optional<Relationships> relationshipsOp = aaiNetworkWrapper.getRelationships(); + if (relationshipsOp.isPresent()) { + Relationships relationships = relationshipsOp.get(); + this.mapNetworkPolicies(relationships.getByType(AAIObjectType.NETWORK_POLICY), + network.getNetworkPolicies()); + this.mapRouteTableReferences(relationships.getByType(AAIObjectType.ROUTE_TABLE_REFERENCE), + network.getContrailNetworkRouteTableReferences()); + } + + return network; + } + + protected void mapNetworkPolicies(List<AAIResultWrapper> aaiNetworkPolicies, List<NetworkPolicy> networkPolicies) { + for (AAIResultWrapper networkPolicyWrapper : aaiNetworkPolicies) { + networkPolicies.add(this.mapNetworkPolicy(networkPolicyWrapper)); + } + } + + protected NetworkPolicy mapNetworkPolicy(AAIResultWrapper networkPolicyWrapper) { + Optional<org.onap.aai.domain.yang.NetworkPolicy> aaiNetworkPolicyOp = networkPolicyWrapper + .asBean(org.onap.aai.domain.yang.NetworkPolicy.class); + org.onap.aai.domain.yang.NetworkPolicy aaiNetworkPolicy = null; + + if (!aaiNetworkPolicyOp.isPresent()) { + return null; + } + + aaiNetworkPolicy = aaiNetworkPolicyOp.get(); + return this.mapperLayer.mapAAINetworkPolicy(aaiNetworkPolicy); + } + + protected void mapRouteTableReferences(List<AAIResultWrapper> routeTableReferences, + List<RouteTableReference> contrailNetworkRouteTableReferences) { + for (AAIResultWrapper routeTableReferenceWrapper : routeTableReferences) { + contrailNetworkRouteTableReferences.add(this.mapRouteTableReference(routeTableReferenceWrapper)); + } + } + + protected RouteTableReference mapRouteTableReference(AAIResultWrapper routeTableReferenceWrapper) { + Optional<org.onap.aai.domain.yang.RouteTableReference> aaiRouteTableReferenceOp = routeTableReferenceWrapper + .asBean(org.onap.aai.domain.yang.RouteTableReference.class); + org.onap.aai.domain.yang.RouteTableReference aaiRouteTableReference = null; + + if (!aaiRouteTableReferenceOp.isPresent()) { + return null; + } + + aaiRouteTableReference = aaiRouteTableReferenceOp.get(); + return this.mapperLayer.mapAAIRouteTableReferenceIntoRouteTableReference(aaiRouteTableReference); + } + + protected void mapOwningEntity(List<AAIResultWrapper> owningEntities, ServiceInstance serviceInstance) { + if (!owningEntities.isEmpty()) { + AAIResultWrapper owningEntityWrapper = owningEntities.get(0); + Optional<org.onap.aai.domain.yang.OwningEntity> aaiOwningEntityOp = owningEntityWrapper + .asBean(org.onap.aai.domain.yang.OwningEntity.class); + org.onap.aai.domain.yang.OwningEntity aaiOwningEntity = null; + if (!aaiOwningEntityOp.isPresent()) { + return; + } + aaiOwningEntity = aaiOwningEntityOp.get(); + + OwningEntity owningEntity = this.mapperLayer.mapAAIOwningEntity(aaiOwningEntity); + serviceInstance.setOwningEntity(owningEntity); + } + } + + protected void mapProject(List<AAIResultWrapper> projects, ServiceInstance serviceInstance) { + if (!projects.isEmpty()) { + AAIResultWrapper projectWrapper = projects.get(0); + Optional<org.onap.aai.domain.yang.Project> aaiProjectOp = projectWrapper + .asBean(org.onap.aai.domain.yang.Project.class); + org.onap.aai.domain.yang.Project aaiProject = null; + if (!aaiProjectOp.isPresent()) { + return; + } + aaiProject = aaiProjectOp.get(); + + Project project = this.mapperLayer.mapAAIProject(aaiProject); + serviceInstance.setProject(project); + } + } + protected Customer mapCustomer(String globalCustomerId, String subscriptionServiceType) { + org.onap.aai.domain.yang.Customer aaiCustomer = this.bbInputSetupUtils.getAAICustomer(globalCustomerId); + org.onap.aai.domain.yang.ServiceSubscription aaiServiceSubscription = this.bbInputSetupUtils + .getAAIServiceSubscription(globalCustomerId, subscriptionServiceType); + Customer customer = this.mapperLayer.mapAAICustomer(aaiCustomer); + ServiceSubscription serviceSubscription = this.mapperLayer.mapAAIServiceSubscription(aaiServiceSubscription); + if(serviceSubscription != null){ + customer.setServiceSubscription(serviceSubscription); + } + return customer; + } + + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java new file mode 100644 index 0000000000..04f9cdcb86 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java @@ -0,0 +1,464 @@ +/*- + * ============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.servicedecomposition.tasks; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +import org.modelmapper.ModelMapper; +import org.modelmapper.convention.MatchingStrategies; +import org.onap.so.bpmn.servicedecomposition.bbobjects.AllottedResource; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CtagAssignment; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Entitlement; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Evc; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ForwarderEvc; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.LagInterface; +import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness; +import org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy; +import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Project; +import org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTableReference; +import org.onap.so.bpmn.servicedecomposition.bbobjects.SegmentationAssignment; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.bpmn.servicedecomposition.generalobjects.License; +import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoCollection; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoConfiguration; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule; +import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization; +import org.onap.so.db.catalog.beans.CollectionResource; +import org.onap.so.db.catalog.beans.CollectionResourceCustomization; +import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization; +import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization; +import org.onap.so.db.catalog.beans.InstanceGroup; +import org.onap.so.db.catalog.beans.InstanceGroupType; +import org.onap.so.db.catalog.beans.NetworkResourceCustomization; +import org.onap.so.db.catalog.beans.OrchestrationStatus; +import org.onap.so.db.catalog.beans.Service; +import org.onap.so.db.catalog.beans.VfModuleCustomization; +import org.onap.so.db.catalog.beans.VnfResourceCustomization; +import org.onap.so.logger.MsoLogger; +import org.onap.so.serviceinstancebeans.CloudConfiguration; +import org.onap.so.serviceinstancebeans.RequestDetails; +import org.springframework.stereotype.Component; + +@Component("BBInputSetupMapperLayer") +public class BBInputSetupMapperLayer { + + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, + BBInputSetupMapperLayer.class); + + private ModelMapper modelMapper = new ModelMapper(); + + public Customer mapAAICustomer(org.onap.aai.domain.yang.Customer customerAAI) { + return modelMapper.map(customerAAI, Customer.class); + } + + public ServiceSubscription mapAAIServiceSubscription( + org.onap.aai.domain.yang.ServiceSubscription serviceSubscriptionAAI) { + return modelMapper.map(serviceSubscriptionAAI, ServiceSubscription.class); + } + + protected Project mapAAIProject(org.onap.aai.domain.yang.Project aaiProject) { + return modelMapper.map(aaiProject, Project.class); + } + + protected OwningEntity mapAAIOwningEntity(org.onap.aai.domain.yang.OwningEntity aaiOwningEntity) { + return modelMapper.map(aaiOwningEntity, OwningEntity.class); + } + + protected Platform mapAAIPlatform(org.onap.aai.domain.yang.Platform aaiPlatform) { + return modelMapper.map(aaiPlatform, Platform.class); + } + + protected LineOfBusiness mapAAILineOfBusiness(org.onap.aai.domain.yang.LineOfBusiness aaiLineOfBusiness) { + return modelMapper.map(aaiLineOfBusiness, LineOfBusiness.class); + } + + protected SegmentationAssignment mapAAISegmentationAssignment( + org.onap.aai.domain.yang.SegmentationAssignment aaiSegmentationAssignment) { + return modelMapper.map(aaiSegmentationAssignment, SegmentationAssignment.class); + } + + protected CtagAssignment mapAAICtagAssignment(org.onap.aai.domain.yang.CtagAssignment aaiCtagAssignment) { + return modelMapper.map(aaiCtagAssignment, CtagAssignment.class); + } + + protected Subnet mapAAISubnet(org.onap.aai.domain.yang.Subnet aaiSubnet) { + return modelMapper.map(aaiSubnet, Subnet.class); + } + + protected License mapAAILicense(org.onap.aai.domain.yang.License aaiLicense) { + return modelMapper.map(aaiLicense, License.class); + } + + protected Entitlement mapAAIEntitlement(org.onap.aai.domain.yang.Entitlement aaiEntitlement) { + return modelMapper.map(aaiEntitlement, Entitlement.class); + } + + protected LagInterface mapAAILagInterface(org.onap.aai.domain.yang.LagInterface aaiLagInterface) { + return modelMapper.map(aaiLagInterface, LagInterface.class); + } + + protected VfModule mapAAIVfModule(org.onap.aai.domain.yang.VfModule aaiVfModule) { + VfModule vfModule = modelMapper.map(aaiVfModule, VfModule.class); + vfModule.setOrchestrationStatus(this.mapOrchestrationStatusFromAAI(aaiVfModule.getOrchestrationStatus())); + return vfModule; + } + + public NetworkPolicy mapAAINetworkPolicy(org.onap.aai.domain.yang.NetworkPolicy aaiNetworkPolicy) { + return modelMapper.map(aaiNetworkPolicy, NetworkPolicy.class); + } + + protected VolumeGroup mapAAIVolumeGroup(org.onap.aai.domain.yang.VolumeGroup aaiVolumeGroup) { + VolumeGroup volumeGroup = modelMapper.map(aaiVolumeGroup, VolumeGroup.class); + volumeGroup.setOrchestrationStatus(this.mapOrchestrationStatusFromAAI(aaiVolumeGroup.getOrchestrationStatus())); + return volumeGroup; + } + + protected void setPlatformAndLOBIntoServiceInstance(Platform platformMSO, LineOfBusiness lineOfBusinessMSO, + ServiceInstance serviceInstance, Map<ResourceKey, String> resourcesToBeOrchestrated) { + String vnfId = resourcesToBeOrchestrated.get(ResourceKey.GENERIC_VNF_ID); + if (vnfId != null && !serviceInstance.getVnfs().isEmpty()) { + for (GenericVnf vnf : serviceInstance.getVnfs()) { + if (vnf.getVnfId().equalsIgnoreCase(vnfId)) { + vnf.setPlatform(platformMSO); + vnf.setLineOfBusiness(lineOfBusinessMSO); + break; + } + } + } + } + + public ModelInfoServiceInstance mapCatalogServiceIntoServiceInstance(Service service) { + return modelMapper.map(service, ModelInfoServiceInstance.class); + } + + protected ModelInfoInstanceGroup mapCatalogInstanceGroupToInstanceGroup(CollectionResourceCustomization collectionCust, InstanceGroup instanceGroup) { + ModelInfoInstanceGroup modelInfoInstanceGroup = modelMapper.map(instanceGroup, ModelInfoInstanceGroup.class); + if(instanceGroup.getType().equals(InstanceGroupType.L3_NETWORK)) + modelInfoInstanceGroup.setType(ModelInfoInstanceGroup.TYPE_L3_NETWORK); + else + modelInfoInstanceGroup.setType(ModelInfoInstanceGroup.TYPE_VNFC); + if(collectionCust != null) { + List<CollectionResourceInstanceGroupCustomization> instanceGroupCustList = instanceGroup.getCollectionInstanceGroupCustomizations(); + for(CollectionResourceInstanceGroupCustomization collectionInsatnceGroupCust : instanceGroupCustList) { + if(collectionInsatnceGroupCust.getModelCustomizationUUID().equalsIgnoreCase(collectionCust.getModelCustomizationUUID())) { + modelInfoInstanceGroup.setFunction(collectionInsatnceGroupCust.getFunction()); + modelInfoInstanceGroup.setDescription(collectionInsatnceGroupCust.getDescription()); + break; + } + } + } + return modelInfoInstanceGroup; + } + + protected ModelInfoCollection mapCatalogCollectionToCollection(CollectionResourceCustomization collectionCust, + CollectionResource collectionResource) { + ModelInfoCollection modelInfoCollection = new ModelInfoCollection(); + modelInfoCollection.setCollectionFunction(collectionCust.getFunction()); + modelInfoCollection.setCollectionRole(collectionCust.getRole()); + modelInfoCollection.setCollectionType(collectionCust.getType()); + modelInfoCollection.setDescription(collectionResource.getDescription()); + modelInfoCollection.setModelInvariantUUID(collectionResource.getModelInvariantUUID()); + modelInfoCollection.setModelVersionId(collectionResource.getModelUUID()); + return modelInfoCollection; + } + + public ServiceInstance mapAAIServiceInstanceIntoServiceInstance( + org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance) { + ServiceInstance serviceInstance = modelMapper.map(aaiServiceInstance, ServiceInstance.class); + if (aaiServiceInstance.getAllottedResources() != null) { + for (org.onap.aai.domain.yang.AllottedResource allottedResource : aaiServiceInstance.getAllottedResources() + .getAllottedResource()) { + serviceInstance.getAllottedResources().add(mapAAIAllottedResource(allottedResource)); + } + } + serviceInstance.setOrchestrationStatus( + this.mapOrchestrationStatusFromAAI(aaiServiceInstance.getOrchestrationStatus())); + return serviceInstance; + } + + protected AllottedResource mapAAIAllottedResource(org.onap.aai.domain.yang.AllottedResource aaiAllottedResource) { + AllottedResource allottedResource = modelMapper.map(aaiAllottedResource, AllottedResource.class); + return allottedResource; + } + + protected L3Network mapAAIL3Network(org.onap.aai.domain.yang.L3Network aaiL3Network) { + L3Network network = modelMapper.map(aaiL3Network, L3Network.class); + mapAllSubnetsIntoL3Network(aaiL3Network, network); + mapAllCtagAssignmentsIntoL3Network(aaiL3Network, network); + mapAllSegmentationAssignmentsIntoL3Network(aaiL3Network, network); + network.setOrchestrationStatus(this.mapOrchestrationStatusFromAAI(aaiL3Network.getOrchestrationStatus())); + return network; + } + + protected void mapAllSegmentationAssignmentsIntoL3Network(org.onap.aai.domain.yang.L3Network aaiL3Network, + L3Network network) { + if (aaiL3Network.getSegmentationAssignments() != null) { + for (org.onap.aai.domain.yang.SegmentationAssignment aaiSegmentationAssignment : aaiL3Network + .getSegmentationAssignments().getSegmentationAssignment()) { + network.getSegmentationAssignments().add(mapAAISegmentationAssignment(aaiSegmentationAssignment)); + } + } + } + + protected void mapAllCtagAssignmentsIntoL3Network(org.onap.aai.domain.yang.L3Network aaiL3Network, + L3Network network) { + if (aaiL3Network.getCtagAssignments() != null) { + for (org.onap.aai.domain.yang.CtagAssignment aaiCtagAssignment : aaiL3Network.getCtagAssignments() + .getCtagAssignment()) { + network.getCtagAssignments().add(mapAAICtagAssignment(aaiCtagAssignment)); + } + } + } + + protected void mapAllSubnetsIntoL3Network(org.onap.aai.domain.yang.L3Network aaiL3Network, L3Network network) { + if (aaiL3Network.getSubnets() != null) { + for (org.onap.aai.domain.yang.Subnet aaiSubnet : aaiL3Network.getSubnets().getSubnet()) { + network.getSubnets().add(mapAAISubnet(aaiSubnet)); + } + } + } + + protected GenericVnf mapAAIGenericVnfIntoGenericVnf(org.onap.aai.domain.yang.GenericVnf aaiGenericVnf) { + GenericVnf genericVnf = modelMapper.map(aaiGenericVnf, GenericVnf.class); + mapAllVfModulesIntoGenericVnf(aaiGenericVnf, genericVnf); + mapAllLagInterfacesIntoGenericVnf(aaiGenericVnf, genericVnf); + mapAllEntitlementsIntoGenericVnf(aaiGenericVnf, genericVnf); + mapAllLicensesIntoGenericVnf(aaiGenericVnf, genericVnf); + genericVnf.setOrchestrationStatus(this.mapOrchestrationStatusFromAAI(aaiGenericVnf.getOrchestrationStatus())); + return genericVnf; + } + + protected void mapAllLicensesIntoGenericVnf(org.onap.aai.domain.yang.GenericVnf aaiGenericVnf, + GenericVnf genericVnf) { + if (aaiGenericVnf.getLicenses() != null) { + for (org.onap.aai.domain.yang.License aaiLicense : aaiGenericVnf.getLicenses().getLicense()) { + genericVnf.setLicense(mapAAILicense(aaiLicense)); + } + } + } + + protected void mapAllEntitlementsIntoGenericVnf(org.onap.aai.domain.yang.GenericVnf aaiGenericVnf, + GenericVnf genericVnf) { + if (aaiGenericVnf.getEntitlements() != null) { + for (org.onap.aai.domain.yang.Entitlement aaiEntitlement : aaiGenericVnf.getEntitlements() + .getEntitlement()) { + genericVnf.getEntitlements().add(mapAAIEntitlement(aaiEntitlement)); + } + } + } + + protected void mapAllLagInterfacesIntoGenericVnf(org.onap.aai.domain.yang.GenericVnf aaiGenericVnf, + GenericVnf genericVnf) { + if (aaiGenericVnf.getLagInterfaces() != null) { + for (org.onap.aai.domain.yang.LagInterface aaiLagInterface : aaiGenericVnf.getLagInterfaces() + .getLagInterface()) { + genericVnf.getLagInterfaces().add(mapAAILagInterface(aaiLagInterface)); + } + } + } + + protected void mapAllVfModulesIntoGenericVnf(org.onap.aai.domain.yang.GenericVnf aaiGenericVnf, + GenericVnf genericVnf) { + if (aaiGenericVnf.getVfModules() != null) { + for (org.onap.aai.domain.yang.VfModule aaiVfModule : aaiGenericVnf.getVfModules().getVfModule()) { + VfModule vfModule = mapAAIVfModule(aaiVfModule); + genericVnf.getVfModules().add(vfModule); + } + } + } + + public OrchestrationStatus mapOrchestrationStatusFromAAI(String orchestrationStatus) { + + Optional<OrchestrationStatus> result = Arrays.asList(OrchestrationStatus.values()).stream() + .filter(item -> item.fuzzyMap(orchestrationStatus)) + .findFirst(); + + return result.orElse(null); + + } + + public RequestContext mapRequestContext(RequestDetails requestDetails) { + RequestContext context = new RequestContext(); + modelMapper.map(requestDetails.getRequestInfo(), context); + org.onap.so.serviceinstancebeans.RequestParameters requestParameters = requestDetails.getRequestParameters(); + if (null != requestParameters) { + context.setSubscriptionServiceType(requestParameters.getSubscriptionServiceType()); + context.setRequestParameters(this.mapRequestParameters(requestDetails.getRequestParameters())); + } + return context; + } + + protected RequestParameters mapRequestParameters(org.onap.so.serviceinstancebeans.RequestParameters requestParameters) { + RequestParameters requestParams = new RequestParameters(); + requestParams.setaLaCarte(requestParameters.getALaCarte()); + requestParams.setSubscriptionServiceType(requestParameters.getSubscriptionServiceType()); + requestParams.setUserParams(requestParameters.getUserParams()); + return requestParams; + } + + protected OrchestrationContext mapOrchestrationContext(RequestDetails requestDetails) { + OrchestrationContext context = new OrchestrationContext(); + context.setIsRollbackEnabled((requestDetails.getRequestInfo().getSuppressRollback())); + return context; + } + + protected CloudRegion mapCloudRegion(CloudConfiguration cloudConfiguration, org.onap.aai.domain.yang.CloudRegion aaiCloudRegion, String cloudOwner) { + CloudRegion cloudRegion = new CloudRegion(); + if(cloudConfiguration != null) + cloudRegion = modelMapper.map(cloudConfiguration, CloudRegion.class); + if(aaiCloudRegion != null) + modelMapper.map(aaiCloudRegion, cloudRegion); + if(cloudOwner != null) + cloudRegion.setCloudOwner(cloudOwner); + return cloudRegion; + } + + protected Collection mapAAICollectionIntoCollection(org.onap.aai.domain.yang.Collection aaiCollection) { + Collection collection = new Collection(); + collection.setId(aaiCollection.getCollectionId()); + collection.setOrchestrationStatus(this.mapOrchestrationStatusFromAAI(aaiCollection.getOrchestrationStatus())); + return collection; + } + + protected org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup mapAAIInstanceGroupIntoInstanceGroup( + org.onap.aai.domain.yang.InstanceGroup aaiInstanceGroup) { + return modelMapper.map(aaiInstanceGroup, + org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup.class); + } + + public RouteTableReference mapAAIRouteTableReferenceIntoRouteTableReference( + org.onap.aai.domain.yang.RouteTableReference aaiRouteTableReference) { + return modelMapper.map(aaiRouteTableReference, RouteTableReference.class); + } + + protected ModelInfoNetwork mapCatalogNetworkToNetwork(NetworkResourceCustomization networkResourceCustomization) { + modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT); + ModelInfoNetwork modelInfoNetwork = modelMapper.map(networkResourceCustomization, ModelInfoNetwork.class); + modelMapper.map(networkResourceCustomization.getNetworkResource(), modelInfoNetwork); + modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STANDARD); + return modelInfoNetwork; + } + + protected ModelInfoGenericVnf mapCatalogVnfToVnf(VnfResourceCustomization vnfResourceCustomization) { + ModelInfoGenericVnf modelInfoVnf = modelMapper.map(vnfResourceCustomization, ModelInfoGenericVnf.class); + modelMapper.map(vnfResourceCustomization.getVnfResources(), modelInfoVnf); + return modelInfoVnf; + } + + protected ModelInfoVfModule mapCatalogVfModuleToVfModule(VfModuleCustomization vfResourceCustomization) { + ModelInfoVfModule modelInfoVfModule = modelMapper.map(vfResourceCustomization, ModelInfoVfModule.class); + modelMapper.map(vfResourceCustomization.getVfModule(), modelInfoVfModule); + return modelInfoVfModule; + } + + protected Platform mapRequestPlatform(org.onap.so.serviceinstancebeans.Platform platform) { + return modelMapper.map(platform, Platform.class); + } + + protected LineOfBusiness mapRequestLineOfBusiness( + org.onap.so.serviceinstancebeans.LineOfBusiness lineOfBusiness) { + return modelMapper.map(lineOfBusiness, LineOfBusiness.class); + } + + public Configuration mapAAIConfiguration(org.onap.aai.domain.yang.Configuration configurationAAI) { + modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT); + Configuration configuration = modelMapper.map(configurationAAI, Configuration.class); + modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STANDARD); + configuration.getForwarderEvcs().addAll(mapAllForwarderEvcs(configurationAAI)); + configuration.getEvcs().addAll(mapAllEvcs(configurationAAI)); + configuration.setOrchestrationStatus(this.mapOrchestrationStatusFromAAI(configurationAAI.getOrchestrationStatus())); + return configuration; + } + + protected List<Evc> mapAllEvcs(org.onap.aai.domain.yang.Configuration configurationAAI) { + List<Evc> listOfEvcs = new ArrayList<>(); + if (configurationAAI.getEvcs() != null) { + for (org.onap.aai.domain.yang.Evc aaiEvc : configurationAAI.getEvcs().getEvc()) { + listOfEvcs.add(mapEvc(aaiEvc)); + } + } + return listOfEvcs; + } + + protected Evc mapEvc(org.onap.aai.domain.yang.Evc aaiEvc) { + return modelMapper.map(aaiEvc, Evc.class); + } + + protected List<ForwarderEvc> mapAllForwarderEvcs(org.onap.aai.domain.yang.Configuration configurationAAI) { + List<ForwarderEvc> listOfForwarderEvcs = new ArrayList<>(); + if (configurationAAI.getForwarderEvcs() != null) { + for (org.onap.aai.domain.yang.ForwarderEvc aaiForwarderEvc : configurationAAI.getForwarderEvcs().getForwarderEvc()) { + listOfForwarderEvcs.add(mapForwarderEvc(aaiForwarderEvc)); + } + } + return listOfForwarderEvcs; + } + + protected ForwarderEvc mapForwarderEvc(org.onap.aai.domain.yang.ForwarderEvc aaiForwarderEvc) { + return modelMapper.map(aaiForwarderEvc, ForwarderEvc.class); + } + + protected OwningEntity mapRequestOwningEntity(org.onap.so.serviceinstancebeans.OwningEntity owningEntity) { + return modelMapper.map(owningEntity, OwningEntity.class); + } + + protected Project mapRequestProject(org.onap.so.serviceinstancebeans.Project project) { + return modelMapper.map(project, Project.class); + } + + protected ModelInfoConfiguration mapCatalogConfigurationToConfiguration( + ConfigurationResourceCustomization configurationResourceCustomization) { + ModelInfoConfiguration modelInfoConfiguration = new ModelInfoConfiguration(); + modelInfoConfiguration.setModelVersionId(configurationResourceCustomization.getConfigurationResource().getModelUUID()); + modelInfoConfiguration.setModelCustomizationId(configurationResourceCustomization.getModelCustomizationUUID()); + modelInfoConfiguration.setModelInvariantId(configurationResourceCustomization.getConfigurationResource().getModelInvariantUUID()); + return modelInfoConfiguration; + } + + public NetworkResourceCustomization mapCollectionNetworkResourceCustToNetworkResourceCust( + CollectionNetworkResourceCustomization collectionNetworkResourceCust) { + return modelMapper.map(collectionNetworkResourceCust, NetworkResourceCustomization.class); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java new file mode 100644 index 0000000000..14c162935a --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java @@ -0,0 +1,409 @@ +/*- + * ============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.servicedecomposition.tasks; + +import java.io.IOException; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +import org.onap.aai.domain.yang.CloudRegion; +import org.onap.aai.domain.yang.Configuration; +import org.onap.aai.domain.yang.GenericVnf; +import org.onap.aai.domain.yang.GenericVnfs; +import org.onap.aai.domain.yang.InstanceGroup; +import org.onap.aai.domain.yang.L3Network; +import org.onap.aai.domain.yang.L3Networks; +import org.onap.aai.domain.yang.ServiceInstance; +import org.onap.aai.domain.yang.ServiceInstances; +import org.onap.aai.domain.yang.ServiceSubscription; +import org.onap.aai.domain.yang.VfModule; +import org.onap.aai.domain.yang.VolumeGroup; +import org.onap.aai.domain.yang.VolumeGroups; +import org.onap.so.bpmn.common.InjectionHelper; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.client.aai.AAIObjectPlurals; +import org.onap.so.client.aai.AAIObjectType; +import org.onap.so.client.aai.entities.AAIResultWrapper; +import org.onap.so.client.aai.entities.uri.AAIResourceUri; +import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.so.client.db.request.RequestsDbClient; +import org.onap.so.client.graphinventory.entities.uri.Depth; +import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization; +import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization; +import org.onap.so.db.catalog.beans.Service; +import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization; +import org.onap.so.db.catalog.client.CatalogDbClient; +import org.onap.so.db.request.beans.InfraActiveRequests; +import org.onap.so.logger.MsoLogger; +import org.onap.so.serviceinstancebeans.CloudConfiguration; +import org.onap.so.serviceinstancebeans.RequestDetails; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; + +@Component("BBInputSetupUtils") +public class BBInputSetupUtils { + + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, BBInputSetupUtils.class); + private ObjectMapper objectMapper = new ObjectMapper(); + private static final String REQUEST_ERROR = "Could not find request."; + + @Autowired + protected CatalogDbClient catalogDbClient; + + @Autowired + protected RequestsDbClient requestsDbClient; + + @Autowired + protected InjectionHelper injectionHelper; + + public void updateInfraActiveRequestVnfId(InfraActiveRequests request, String vnfId) { + if(request != null) { + request.setVnfId(vnfId); + this.requestsDbClient.updateInfraActiveRequests(request); + } else { + msoLogger.debug(REQUEST_ERROR); + } + } + + public void updateInfraActiveRequestVfModuleId(InfraActiveRequests request, String vfModuleId) { + if(request != null) { + request.setVfModuleId(vfModuleId); + this.requestsDbClient.updateInfraActiveRequests(request); + } else { + msoLogger.debug(REQUEST_ERROR); + } + } + + public void updateInfraActiveRequestVolumeGroupId(InfraActiveRequests request, String volumeGroupId) { + if(request != null) { + request.setVolumeGroupId(volumeGroupId); + this.requestsDbClient.updateInfraActiveRequests(request); + } else { + msoLogger.debug(REQUEST_ERROR); + } + } + + public void updateInfraActiveRequestNetworkId(InfraActiveRequests request, String networkId) { + if(request != null) { + request.setNetworkId(networkId); + this.requestsDbClient.updateInfraActiveRequests(request); + } else { + msoLogger.debug(REQUEST_ERROR); + } + } + + public Service getCatalogServiceByModelUUID(String modelUUID) { + return catalogDbClient.getServiceByID(modelUUID); + } + + public Service getCatalogServiceByModelVersionAndModelInvariantUUID(String modelVersion, String modelInvariantUUID) { + return catalogDbClient.getServiceByModelVersionAndModelInvariantUUID(modelVersion, modelInvariantUUID); + } + + public CollectionNetworkResourceCustomization getCatalogCollectionNetworkResourceCustByID(String key) { + return catalogDbClient.getCollectionNetworkResourceCustomizationByID(key); + } + + public List<VnfcInstanceGroupCustomization> getVnfcInstanceGroups(String modelCustomizationUUID) { + return catalogDbClient.getVnfcInstanceGroupsByVnfResourceCust(modelCustomizationUUID); + } + + public Map<String, String> getURIKeysFromServiceInstance(String serviceInstanceId) { + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId); + return uri.getURIKeys(); + } + + protected RequestDetails getRequestDetails(String requestId) throws IOException { + if (requestId != null && !requestId.isEmpty()) { + InfraActiveRequests activeRequest = this.getInfraActiveRequest(requestId); + String requestBody = activeRequest.getRequestBody().replaceAll("\\\\", ""); + objectMapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true); + objectMapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true); + return objectMapper.readValue(requestBody, RequestDetails.class); + } else { + return null; + } + } + + protected InfraActiveRequests getInfraActiveRequest(String requestId) { + if (requestId != null && !requestId.isEmpty()) { + return requestsDbClient.getInfraActiveRequestbyRequestId(requestId); + } else { + return null; + } + } + + protected CloudRegion getCloudRegion(CloudConfiguration cloudConfiguration, String cloudOwner) { + if (cloudConfiguration != null) { + String cloudRegionId = cloudConfiguration.getLcpCloudRegionId(); + if (cloudRegionId != null && !cloudRegionId.isEmpty()) { + return injectionHelper.getAaiClient().get(CloudRegion.class, + AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, cloudOwner, + cloudConfiguration.getLcpCloudRegionId())).orElse(null); + + } else { + return null; + } + } else { + return null; + } + } + + protected InstanceGroup getAAIInstanceGroup(String instanceGroupId) { + return injectionHelper.getAaiClient().get(InstanceGroup.class, + AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroupId)) + .orElse(null); + } + + public org.onap.aai.domain.yang.Customer getAAICustomer(String globalSubscriberId) { + return injectionHelper.getAaiClient().get(org.onap.aai.domain.yang.Customer.class, + AAIUriFactory.createResourceUri(AAIObjectType.CUSTOMER, globalSubscriberId)) + .orElse(null); + } + + public ServiceSubscription getAAIServiceSubscription(String globalSubscriberId, String subscriptionServiceType) { + + if(globalSubscriberId == null || globalSubscriberId.equals("") || subscriptionServiceType == null || subscriptionServiceType.equals("")) { + return null; + } else { + return injectionHelper.getAaiClient().get(ServiceSubscription.class, AAIUriFactory.createResourceUri( + AAIObjectType.SERVICE_SUBSCRIPTION, globalSubscriberId, subscriptionServiceType)) + .orElse(null); + } + + } + + public ServiceInstance getAAIServiceInstanceById(String serviceInstanceId) { + return injectionHelper.getAaiClient().get(ServiceInstance.class, + AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId).depth(Depth.TWO)) + .orElse(null); + } + + protected ServiceInstance getAAIServiceInstanceByIdAndCustomer(String globalCustomerId, String serviceType, + String serviceInstanceId) { + return injectionHelper.getAaiClient().get(ServiceInstance.class, AAIUriFactory.createResourceUri( + AAIObjectType.SERVICE_INSTANCE, globalCustomerId, serviceType, serviceInstanceId).depth(Depth.TWO)) + .orElse(null); + } + + protected org.onap.aai.domain.yang.ServiceInstances getAAIServiceInstancesByName(String serviceInstanceName, + Customer customer) { + + return injectionHelper.getAaiClient().get(org.onap.aai.domain.yang.ServiceInstances.class, + AAIUriFactory + .createResourceUri(AAIObjectPlurals.SERVICE_INSTANCE, customer.getGlobalCustomerId(), + customer.getServiceSubscription().getServiceType()) + .queryParam("service-instance-name", serviceInstanceName).depth(Depth.TWO)) + .orElseGet(() -> { + msoLogger.debug("No Service Instance matched by name"); + return null; + }); + } + + public org.onap.aai.domain.yang.ServiceInstance getAAIServiceInstanceByName(String serviceInstanceName, + Customer customer) throws Exception { + org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance = null; + org.onap.aai.domain.yang.ServiceInstances aaiServiceInstances = null; + aaiServiceInstances = getAAIServiceInstancesByName(serviceInstanceName, customer); + + if (aaiServiceInstances == null) { + return null; + } else if (aaiServiceInstances.getServiceInstance().size() > 1) { + throw new Exception("Multiple Service Instances Returned"); + } else { + aaiServiceInstance = aaiServiceInstances.getServiceInstance().get(0); + } + return aaiServiceInstance; + } + + protected ServiceInstances getAAIServiceInstancesByName(String globalCustomerId, String serviceType, + String serviceInstanceName) { + + return injectionHelper.getAaiClient().get(ServiceInstances.class, + AAIUriFactory.createResourceUri(AAIObjectPlurals.SERVICE_INSTANCE, globalCustomerId, serviceType) + .queryParam("service-instance-name", serviceInstanceName).depth(Depth.TWO)) + .orElseGet(() -> { + msoLogger.debug("No Service Instance matched by name"); + return null; + }); + } + + public Optional<ServiceInstance> getAAIServiceInstanceByName(String globalCustomerId, String serviceType, + String serviceInstanceName) throws Exception { + ServiceInstance aaiServiceInstance = null; + ServiceInstances aaiServiceInstances = null; + aaiServiceInstances = getAAIServiceInstancesByName(globalCustomerId, serviceType, serviceInstanceName); + + if (aaiServiceInstances == null) { + return Optional.empty(); + } else if (aaiServiceInstances.getServiceInstance().size() > 1) { + throw new Exception("Multiple Service Instances Returned"); + } else { + aaiServiceInstance = aaiServiceInstances.getServiceInstance().get(0); + } + return Optional.of(aaiServiceInstance); + } + + public org.onap.so.db.catalog.beans.InstanceGroup getCatalogInstanceGroup(String modelUUID) { + return this.catalogDbClient.getInstanceGroupByModelUUID(modelUUID); + } + + public List<CollectionResourceInstanceGroupCustomization> getCollectionResourceInstanceGroupCustomization( + String modelCustomizationUUID) { + return this.catalogDbClient + .getCollectionResourceInstanceGroupCustomizationByModelCustUUID(modelCustomizationUUID); + } + + public AAIResultWrapper getAAIResourceDepthOne(AAIResourceUri aaiResourceUri) { + AAIResourceUri clonedUri = aaiResourceUri.clone(); + return this.injectionHelper.getAaiClient().get(clonedUri.depth(Depth.ONE)); + } + + public AAIResultWrapper getAAIResourceDepthTwo(AAIResourceUri aaiResourceUri) { + AAIResourceUri clonedUri = aaiResourceUri.clone(); + return this.injectionHelper.getAaiClient().get(clonedUri.depth(Depth.TWO)); + } + + public Configuration getAAIConfiguration(String configurationId) { + return this.injectionHelper.getAaiClient().get(Configuration.class, + AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId).depth(Depth.ONE)) + .orElseGet(() -> { + msoLogger.debug("No Configuration matched by id"); + return null; + }); + } + + public GenericVnf getAAIGenericVnf(String vnfId) { + + return this.injectionHelper.getAaiClient().get(GenericVnf.class, + AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId).depth(Depth.ONE)) + .orElseGet(() -> { + msoLogger.debug("No Generic Vnf matched by id"); + return null; + }); + } + + public VolumeGroup getAAIVolumeGroup(String cloudOwnerId, String cloudRegionId, String volumeGroupId) { + return this.injectionHelper.getAaiClient().get(VolumeGroup.class, + AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, cloudOwnerId, cloudRegionId, volumeGroupId).depth(Depth.ONE)) + .orElseGet(() -> { + msoLogger.debug("No Generic Vnf matched by id"); + return null; + }); + } + + public VfModule getAAIVfModule(String vnfId, String vfModuleId) { + return this.injectionHelper.getAaiClient().get(VfModule.class, + AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId).depth(Depth.ONE)) + .orElseGet(() -> { + msoLogger.debug("No Generic Vnf matched by id"); + return null; + }); + } + + public L3Network getAAIL3Network(String networkId) { + + return this.injectionHelper.getAaiClient().get(L3Network.class, + AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, networkId).depth(Depth.ONE)) + .orElseGet(() -> { + msoLogger.debug("No Generic Vnf matched by id"); + return null; + }); + + } + + public Optional<L3Network> getRelatedNetworkByNameFromServiceInstance(String serviceInstanceId, String networkName) throws Exception{ + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId); + uri.relatedTo(AAIObjectPlurals.L3_NETWORK).queryParam("network-name", networkName); + Optional<L3Networks> networks = injectionHelper.getAaiClient().get(L3Networks.class, uri); + L3Network network = null; + if (!networks.isPresent()) { + msoLogger.debug("No Networks matched by name"); + return Optional.empty(); + } else { + if (networks.get().getL3Network().size() > 1) { + throw new Exception("Multiple Networks Returned"); + } else { + network = networks.get().getL3Network().get(0); + } + return Optional.of(network); + } + } + + public Optional<GenericVnf> getRelatedVnfByNameFromServiceInstance(String serviceInstanceId, String vnfName) throws Exception { + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId); + uri.relatedTo(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName); + Optional<GenericVnfs> vnfs = injectionHelper.getAaiClient().get(GenericVnfs.class, uri); + GenericVnf vnf = null; + if (!vnfs.isPresent()) { + msoLogger.debug("No Vnfs matched by name"); + return Optional.empty(); + } else { + if (vnfs.get().getGenericVnf().size() > 1) { + throw new Exception("Multiple Vnfs Returned"); + } else { + vnf = vnfs.get().getGenericVnf().get(0); + } + return Optional.of(vnf); + } + } + + public Optional<VolumeGroup> getRelatedVolumeGroupByNameFromVnf(String vnfId, String volumeGroupName) throws Exception{ + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId); + uri.relatedTo(AAIObjectPlurals.VOLUME_GROUP).queryParam("volume-group-name", volumeGroupName); + Optional<VolumeGroups> volumeGroups = injectionHelper.getAaiClient().get(VolumeGroups.class, uri); + VolumeGroup volumeGroup = null; + if (!volumeGroups.isPresent()) { + msoLogger.debug("No VolumeGroups matched by name"); + return Optional.empty(); + } else { + if (volumeGroups.get().getVolumeGroup().size() > 1) { + throw new Exception("Multiple VolumeGroups Returned"); + } else { + volumeGroup = volumeGroups.get().getVolumeGroup().get(0); + } + return Optional.of(volumeGroup); + } + } + + public Optional<VolumeGroup> getRelatedVolumeGroupByNameFromVfModule(String vfModuleId, String volumeGroupName) throws Exception { + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vfModuleId); + uri.relatedTo(AAIObjectPlurals.VOLUME_GROUP).queryParam("volume-group-name", volumeGroupName); + Optional<VolumeGroups> volumeGroups = injectionHelper.getAaiClient().get(VolumeGroups.class, uri); + VolumeGroup volumeGroup = null; + if (!volumeGroups.isPresent()) { + msoLogger.debug("No VolumeGroups matched by name"); + return Optional.empty(); + } else { + if (volumeGroups.get().getVolumeGroup().size() > 1) { + throw new Exception("Multiple VolumeGroups Returned"); + } else { + volumeGroup = volumeGroups.get().getVolumeGroup().get(0); + } + return Optional.of(volumeGroup); + } + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java new file mode 100644 index 0000000000..7a56ab88ab --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java @@ -0,0 +1,116 @@ +/*- + * ============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.servicedecomposition.tasks; + +import java.util.Map; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.onap.so.bpmn.core.WorkflowException; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.db.catalog.beans.macro.RainyDayHandlerStatus; +import org.onap.so.db.catalog.client.CatalogDbClient; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class ExecuteBuildingBlockRainyDay { + + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ExecuteBuildingBlockRainyDay.class); + + @Autowired + private CatalogDbClient catalogDbClient; + private static final String ASTERISK = "ASTERISK"; + + public void setRetryTimer(DelegateExecution execution) { + try { + int retryCount = (int) execution.getVariable("retryCount"); + int retryTimeToWait = (int) Math.pow(5, retryCount); + String RetryDuration = "PT" + retryTimeToWait + "M"; + execution.setVariable("RetryDuration", RetryDuration); + } catch (Exception e) { + msoLogger.error(e); + throw new BpmnError("Unknown error incrementing retry counter"); + } + } + + public void queryRainyDayTable(DelegateExecution execution) { + try { + ExecuteBuildingBlock ebb = (ExecuteBuildingBlock) execution.getVariable("buildingBlock"); + String bbName = ebb.getBuildingBlock().getBpmnFlowName(); + GeneralBuildingBlock gBBInput = (GeneralBuildingBlock) execution.getVariable("gBBInput"); + Map<ResourceKey, String> lookupKeyMap = (Map<ResourceKey, String>) execution.getVariable("lookupKeyMap"); + String serviceType = ASTERISK; + try { + serviceType = gBBInput.getCustomer().getServiceSubscription().getServiceInstances().get(0).getModelInfoServiceInstance().getServiceType(); + } catch (Exception ex) { + // keep default serviceType value + } + String vnfType = ASTERISK; + try { + for(GenericVnf vnf : gBBInput.getCustomer().getServiceSubscription().getServiceInstances().get(0).getVnfs()) { + if(vnf.getVnfId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID))) { + vnfType = vnf.getVnfType(); + } + } + } catch (Exception ex) { + // keep default vnfType value + } + WorkflowException workflowException = (WorkflowException) execution.getVariable("WorkflowException"); + String errorCode = ASTERISK; + try { + errorCode = "" + workflowException.getErrorCode(); + } catch (Exception ex) { + // keep default errorCode value + } + String workStep = ASTERISK; + try { + workStep = workflowException.getWorkStep(); + } catch (Exception ex) { + // keep default workStep value + } + //Extract error data to be returned to WorkflowAction + execution.setVariable("WorkflowExceptionErrorMessage", workflowException.getErrorMessage()); + RainyDayHandlerStatus rainyDayHandlerStatus; + String handlingCode = ""; + rainyDayHandlerStatus = catalogDbClient.getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(bbName,serviceType,vnfType,errorCode,workStep); + if(rainyDayHandlerStatus==null){ + rainyDayHandlerStatus = catalogDbClient.getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(bbName,ASTERISK,ASTERISK,ASTERISK,ASTERISK); + if(rainyDayHandlerStatus==null){ + handlingCode = "Abort"; + }else{ + handlingCode = rainyDayHandlerStatus.getPolicy(); + } + }else{ + handlingCode = rainyDayHandlerStatus.getPolicy(); + } + msoLogger.debug("RainyDayHandler Status Code is: " + handlingCode); + execution.setVariable("handlingCode", handlingCode); + } catch (Exception e) { + msoLogger.debug("RainyDayHandler Status Code is: Abort"); + execution.setVariable("handlingCode", "Abort"); + } + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java new file mode 100644 index 0000000000..a212668fec --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java @@ -0,0 +1,137 @@ +/*- + * ============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.servicedecomposition.tasks; + +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.util.List; +import java.util.Optional; + +import javax.persistence.Id; + +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.client.exception.BBObjectNotFoundException; +import org.onap.so.logger.MsoLogger; +import org.springframework.stereotype.Component; + +import com.google.common.base.CaseFormat; + +@Component +public class ExtractPojosForBB { + + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ExtractPojosForBB.class); + + public <T> T extractByKey(BuildingBlockExecution execution, ResourceKey key, String value) + throws BBObjectNotFoundException { + + Optional<T> result = Optional.empty(); + GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); + try { + ServiceInstance serviceInstance; + GenericVnf vnf; + switch (key) { + case SERVICE_INSTANCE_ID: + result = lookupObjectInList(gBBInput.getCustomer().getServiceSubscription().getServiceInstances(), value); + break; + case GENERIC_VNF_ID: + serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + result = lookupObjectInList(serviceInstance.getVnfs(), value); + break; + case NETWORK_ID: + serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + result = lookupObjectInList(serviceInstance.getNetworks(), value); + break; + case VOLUME_GROUP_ID: + vnf = extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + result = lookupObjectInList(vnf.getVolumeGroups(), value); + break; + case VF_MODULE_ID: + vnf = extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + result = lookupObjectInList(vnf.getVfModules(), value); + break; + case ALLOTTED_RESOURCE_ID: + serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + result = lookupObjectInList(serviceInstance.getAllottedResources(), value); + break; + case CONFIGURATION_ID: + serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + result = lookupObjectInList(serviceInstance.getConfigurations(), value); + break; + case VPN_ID: + serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + result = lookupObjectInList(gBBInput.getCustomer().getVpnBindings(), value); + break; + case VPN_BONDING_LINK_ID: + serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + result = lookupObjectInList(serviceInstance.getVpnBondingLinks(),value); + break; + default: + throw new BBObjectNotFoundException(key, value); + } + } catch (BBObjectNotFoundException e) { // re-throw parent object not found + throw e; + } catch (Exception e) { // convert all other exceptions to object not found + msoLogger.warnSimple("BBObjectNotFoundException in ExtractPojosForBB", "BBObject " + key + " was not found in gBBInput using reference value: " + value); + throw new BBObjectNotFoundException(key, value); + } + + if (result.isPresent()) { + return result.get(); + } else { + throw new BBObjectNotFoundException(key, value); + } + } + + protected <T> Optional<T> lookupObject(Object obj, String value) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException { + return findValue(obj, value); + } + + protected <T> Optional<T> lookupObjectInList(List<?> list, String value) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException { + Optional<T> result = Optional.empty(); + for (Object obj : list) { + result = findValue(obj, value); + if (result.isPresent()) { + break; + } + } + return result; + + } + + protected <T> Optional<T> findValue(Object obj, String value) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException { + for (Field field : obj.getClass().getDeclaredFields()) { + if (field.isAnnotationPresent(Id.class)) { + String fieldName = field.getName(); + fieldName = CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, fieldName); + String fieldValue = (String) obj.getClass().getMethod("get" + fieldName).invoke(obj); + if (fieldValue.equals(value)) { + return Optional.of((T)obj); + } + } + } + + return Optional.empty(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerAction.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerAction.java index 3c00627bff..9feee14640 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerAction.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerAction.java @@ -18,25 +18,22 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.client.appc; +package org.onap.so.client.appc; import java.util.HashMap; import java.util.List; - -import org.openecomp.mso.client.appc.ApplicationControllerSupport.StatusCategory; -import org.openecomp.mso.bpmn.appc.payload.PayloadClient; -import org.openecomp.mso.bpmn.core.json.JsonUtils; -import org.openecomp.mso.client.appc.ApplicationControllerOrchestrator; import java.util.Optional; + import org.onap.appc.client.lcm.model.Action; import org.onap.appc.client.lcm.model.Status; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; -import com.att.eelf.configuration.EELFLogger.Level; -import java.lang.NoSuchMethodError; +import org.onap.so.bpmn.appc.payload.PayloadClient; +import org.onap.so.bpmn.core.json.JsonUtils; +import org.onap.so.client.appc.ApplicationControllerSupport.StatusCategory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; @@ -44,14 +41,16 @@ public class ApplicationControllerAction { protected ApplicationControllerOrchestrator client = new ApplicationControllerOrchestrator(); private String errorCode = "1002"; private String errorMessage = "Unable to reach App C Servers"; - protected final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger(); + private static Logger logger = LoggerFactory.getLogger(ApplicationControllerAction.class); - public void runAppCCommand(Action action, String msoRequestId, String vnfId, Optional<String> payload, HashMap<String, String> payloadInfo, String controllerType){ Status appCStatus = null; + public void runAppCCommand(Action action, String msoRequestId, String vnfId, Optional<String> payload, HashMap<String, String> payloadInfo, String controllerType){ + Status appCStatus = null; try{ String vnfName = payloadInfo.getOrDefault("vnfName", ""); String aicIdentity = payloadInfo.getOrDefault("vnfName",""); String vnfHostIpAddress = payloadInfo.getOrDefault("vnfHostIpAddress",""); String vmIdList = payloadInfo.getOrDefault("vmIdList", ""); + String vserverIdList = payloadInfo.getOrDefault("vserverIdList", ""); String identityUrl = payloadInfo.getOrDefault("identityUrl", ""); switch(action){ case ResumeTraffic: @@ -63,7 +62,7 @@ public class ApplicationControllerAction { break; case Unlock: case Lock: - appCStatus = client.vnfCommand(action, msoRequestId, vnfId, Optional.empty(), controllerType); + appCStatus = client.vnfCommand(action, msoRequestId, vnfId, Optional.empty(), Optional.empty(), controllerType); break; case QuiesceTraffic: appCStatus = quiesceTrafficAction(msoRequestId, vnfId, payload, vnfName, controllerType); @@ -73,13 +72,18 @@ public class ApplicationControllerAction { break; case Snapshot: String vmIds = JsonUtils.getJsonValue(vmIdList, "vmIds"); + String vserverIds = JsonUtils.getJsonValue(vserverIdList, "vserverIds"); String vmId = ""; + String vserverId = ""; ObjectMapper mapper = new ObjectMapper(); List<String> vmIdJsonList = mapper.readValue(vmIds, new TypeReference<List<String>>(){}); + List<String> vserverIdJsonList = mapper.readValue(vserverIds, new TypeReference<List<String>>(){}); int i = 0; while(i < vmIdJsonList.size()){ vmId = vmIdJsonList.get(i); - appCStatus = snapshotAction(msoRequestId, vnfId, vmId, identityUrl, controllerType); + vserverId = vserverIdJsonList.get(i); + Optional<String> vserverIdString = Optional.of(vserverId); + appCStatus = snapshotAction(msoRequestId, vnfId, vmId, vserverIdString, identityUrl, controllerType); i++; } break; @@ -107,20 +111,20 @@ public class ApplicationControllerAction { } } catch(JsonProcessingException e){ - auditLogger.log(Level.ERROR, "Incorrect Payload format for action request" + action.toString(),e, e.getMessage()); + logger.error("Incorrect Payload format for action request: {}", action.toString(),e); errorMessage = e.getMessage(); } catch(ApplicationControllerOrchestratorException e){ - auditLogger.log(Level.ERROR, "Error building Appc request: ", e, e.getMessage()); + logger.error("Error building Appc request: {}",e.getMessage(), e); errorCode = "1002"; errorMessage = e.getMessage(); } catch (NoSuchMethodError e) { - auditLogger.log(Level.ERROR, "Error building Appc request: ", e, e.getMessage()); + logger.error( "Error building Appc request: {}", e.getMessage(), e); errorMessage = e.getMessage(); } catch(Exception e){ - auditLogger.log(Level.ERROR, "Error building Appc request: ", e, e.getMessage()); + logger.error("Error building Appc request: {}", e.getMessage(), e); errorMessage = e.getMessage(); } } @@ -129,7 +133,7 @@ public class ApplicationControllerAction { if(!(payload.isPresent())){ throw new IllegalArgumentException("Payload is not present for " + action.toString()); } - return client.vnfCommand(action, msoRequestId, vnfId, payload, controllerType); + return client.vnfCommand(action, msoRequestId, vnfId, Optional.empty(), payload, controllerType); } private Status quiesceTrafficAction(String msoRequestId, String vnfId, Optional<String> payload, String vnfName, String controllerType) throws JsonProcessingException, IllegalArgumentException,ApplicationControllerOrchestratorException{ @@ -137,7 +141,7 @@ public class ApplicationControllerAction { throw new IllegalArgumentException("Payload is not present for " + Action.QuiesceTraffic.toString()); } payload = PayloadClient.quiesceTrafficFormat(payload, vnfName); - return client.vnfCommand(Action.QuiesceTraffic, msoRequestId, vnfId, payload, controllerType); + return client.vnfCommand(Action.QuiesceTraffic, msoRequestId, vnfId, Optional.empty(), payload, controllerType); } private Status upgradeAction(Action action, String msoRequestId, String vnfId, Optional<String> payload, String vnfName, String controllerType) throws JsonProcessingException, IllegalArgumentException,ApplicationControllerOrchestratorException{ @@ -145,27 +149,27 @@ public class ApplicationControllerAction { throw new IllegalArgumentException("Payload is not present for " + action.toString()); } payload = PayloadClient.upgradeFormat(payload, vnfName); - return client.vnfCommand(action, msoRequestId, vnfId, payload, controllerType); + return client.vnfCommand(action, msoRequestId, vnfId, Optional.empty(), payload, controllerType); } private Status resumeTrafficAction(String msoRequestId, String vnfId, String vnfName, String controllerType)throws JsonProcessingException, ApplicationControllerOrchestratorException{ Optional<String> payload = PayloadClient.resumeTrafficFormat(vnfName); - return client.vnfCommand(Action.ResumeTraffic, msoRequestId, vnfId, payload, controllerType); + return client.vnfCommand(Action.ResumeTraffic, msoRequestId, vnfId, Optional.empty(), payload, controllerType); } private Status startStopAction(Action action, String msoRequestId, String vnfId, String aicIdentity, String controllerType)throws JsonProcessingException, ApplicationControllerOrchestratorException{ Optional<String> payload = PayloadClient.startStopFormat(aicIdentity); - return client.vnfCommand(action, msoRequestId, vnfId, payload, controllerType); + return client.vnfCommand(action, msoRequestId, vnfId, Optional.empty(), payload, controllerType); } private Status healthCheckAction(String msoRequestId, String vnfId, String vnfName, String vnfHostIpAddress, String controllerType)throws JsonProcessingException, ApplicationControllerOrchestratorException{ Optional<String> payload = PayloadClient.healthCheckFormat(vnfName, vnfHostIpAddress); - return client.vnfCommand(Action.HealthCheck, msoRequestId, vnfId, payload, controllerType); + return client.vnfCommand(Action.HealthCheck, msoRequestId, vnfId, Optional.empty(), payload, controllerType); } - private Status snapshotAction(String msoRequestId, String vnfId, String vmId, String identityUrl, String controllerType) throws JsonProcessingException, ApplicationControllerOrchestratorException{ + private Status snapshotAction(String msoRequestId, String vnfId, String vmId, Optional<String> vserverId, String identityUrl, String controllerType) throws JsonProcessingException, ApplicationControllerOrchestratorException{ Optional<String> payload = PayloadClient.snapshotFormat(vmId, identityUrl); - return client.vnfCommand(Action.Snapshot, msoRequestId, vnfId, payload, controllerType); + return client.vnfCommand(Action.Snapshot, msoRequestId, vnfId, vserverId, payload, controllerType); } public String getErrorMessage(){ diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerCallback.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerCallback.java index 1bb4dc7eed..cb3f144cd1 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerCallback.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerCallback.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.client.appc; +package org.onap.so.client.appc; import org.onap.appc.client.lcm.api.ResponseHandler; import org.onap.appc.client.lcm.exceptions.AppcClientException; @@ -27,13 +27,13 @@ public class ApplicationControllerCallback<T> implements ResponseHandler<T> { @Override public void onResponse(T response) { - System.out.println("ON RESPONSE"); + } @Override public void onException(AppcClientException exception) { - System.out.println("ON EXCEPTION"); + } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerClient.java index c9e2e880e7..f87ec91440 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerClient.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerClient.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,16 +18,18 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.client.appc; +package org.onap.so.client.appc; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.time.Instant; -import java.util.Map; import java.util.Properties; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; +import org.onap.so.bpmn.core.UrnPropertiesReader; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.onap.appc.client.lcm.api.AppcClientServiceFactoryProvider; import org.onap.appc.client.lcm.api.AppcLifeCycleManagerServiceFactory; import org.onap.appc.client.lcm.api.ApplicationContext; @@ -42,26 +44,19 @@ import org.onap.appc.client.lcm.model.Flags.Mode; import org.onap.appc.client.lcm.model.Payload; import org.onap.appc.client.lcm.model.Status; import org.onap.appc.client.lcm.model.ZULU; -import org.openecomp.mso.bpmn.core.PropertyConfiguration; -import org.springframework.beans.factory.annotation.Autowired; - -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFLogger.Level; -import com.att.eelf.configuration.EELFManager; public class ApplicationControllerClient { - - public static final String DEFAULT_CONTROLLER_TYPE = "SDNC"; + + public static final String DEFAULT_CONTROLLER_TYPE = "APPC"; private static final String CLIENT_NAME = "MSO"; private static final String API_VER = "2.00"; private static final String ORIGINATOR_ID = "MSO"; private static final int FLAGS_TTL = 65000; - protected final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger(); + private static Logger logger = LoggerFactory.getLogger(ApplicationControllerClient.class); - @Autowired - public ApplicationControllerSupport appCSupport; + private ApplicationControllerSupport appCSupport; // APPC gave us an API where the controllerType is configured in the // client object, which is not what we asked for. We asked for an API @@ -92,7 +87,7 @@ public class ApplicationControllerClient { this.controllerType = controllerType.toUpperCase(); appCSupport = new ApplicationControllerSupport(); } - + /** * Gets the controller type. * @return the controllertype @@ -119,7 +114,7 @@ public class ApplicationControllerClient { return AppcClientServiceFactoryProvider.getFactory(AppcLifeCycleManagerServiceFactory.class) .createLifeCycleManagerStateful(new ApplicationContext(), getLCMProperties(controllerType)); } catch (AppcClientException e) { - auditLogger.log(Level.ERROR, "Error in getting LifeCycleManagerStateful: ", e, e.getMessage()); + logger.error("Error in getting LifeCycleManagerStateful: {}",e.getMessage(), e); // This null value will cause NullPointerException when used later. // Error handling could certainly be improved here. return null; @@ -129,7 +124,8 @@ public class ApplicationControllerClient { public Status runCommand(Action action, org.onap.appc.client.lcm.model.ActionIdentifiers actionIdentifiers, org.onap.appc.client.lcm.model.Payload payload, String requestID) throws ApplicationControllerOrchestratorException { - Object requestObject = createRequest(action, actionIdentifiers, payload, requestID); + Object requestObject; + requestObject = createRequest(action, actionIdentifiers, payload, requestID); appCSupport.logLCMMessage(requestObject); LifeCycleManagerStateful client = getAppCClient(); Method lcmMethod = appCSupport.getAPIMethod(action.name(), client, false); @@ -147,21 +143,19 @@ public class ApplicationControllerClient { protected Properties getLCMProperties(String controllerType) { Properties properties = new Properties(); - Map<String, String> globalProperties = PropertyConfiguration.getInstance() - .getProperties("mso.bpmn.urn.properties"); - - properties.put("topic.read", globalProperties.get("appc.client.topic.read")); - properties.put("topic.write", globalProperties.get("appc.client.topic.write")); - properties.put("SDNC-topic.read", globalProperties.get("appc.client.topic.sdnc.read")); - properties.put("SDNC-topic.write", globalProperties.get("appc.client.topic.sdnc.write")); - properties.put("topic.read.timeout", globalProperties.get("appc.client.topic.read.timeout")); - properties.put("client.response.timeout", globalProperties.get("appc.client.response.timeout")); - properties.put("poolMembers", globalProperties.get("appc.client.poolMembers")); + + properties.put("topic.read", UrnPropertiesReader.getVariable("appc.client.topic.read.name")); + properties.put("topic.write", UrnPropertiesReader.getVariable("appc.client.topic.write")); + properties.put("SDNC-topic.read", UrnPropertiesReader.getVariable("appc.client.topic.sdnc.read")); + properties.put("SDNC-topic.write", UrnPropertiesReader.getVariable("appc.client.topic.sdnc.write")); + properties.put("topic.read.timeout", UrnPropertiesReader.getVariable("appc.client.topic.read.timeout")); + properties.put("client.response.timeout", UrnPropertiesReader.getVariable("appc.client.response.timeout")); + properties.put("poolMembers", UrnPropertiesReader.getVariable("appc.client.poolMembers")); properties.put("controllerType", controllerType); - properties.put("client.key", globalProperties.get("appc.client.key")); - properties.put("client.secret", globalProperties.get("appc.client.secret")); + properties.put("client.key", UrnPropertiesReader.getVariable("appc.client.key")); + properties.put("client.secret", UrnPropertiesReader.getVariable("appc.client.secret")); properties.put("client.name", CLIENT_NAME); - properties.put("service", globalProperties.get("appc.client.service")); + properties.put("service", UrnPropertiesReader.getVariable("appc.client.service")); return properties; } @@ -178,7 +172,7 @@ public class ApplicationControllerClient { requestObject.getClass().getDeclaredMethod("setPayload", Payload.class).invoke(requestObject, payload); } } catch (IllegalAccessException | NoSuchMethodException | InvocationTargetException e) { - auditLogger.log(Level.ERROR, "Error building Appc request: ", e, e.getMessage()); + logger.error("Error building Appc request", e); } return requestObject; } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerClientV2.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerClientV2.java new file mode 100644 index 0000000000..d4599a5248 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerClientV2.java @@ -0,0 +1,154 @@ +/*- + * ============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.client.appc; + +import org.onap.appc.client.lcm.api.AppcClientServiceFactoryProvider; +import org.onap.appc.client.lcm.api.AppcLifeCycleManagerServiceFactory; +import org.onap.appc.client.lcm.api.ApplicationContext; +import org.onap.appc.client.lcm.api.LifeCycleManagerStateful; +import org.onap.appc.client.lcm.exceptions.AppcClientException; +import org.onap.appc.client.lcm.model.*; +import org.onap.appc.client.lcm.model.Flags.Force; +import org.onap.appc.client.lcm.model.Flags.Mode; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import javax.annotation.PostConstruct; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.time.Instant; +import java.util.Properties; +import java.util.UUID; + +@Component +@Deprecated +public class ApplicationControllerClientV2 { + + private static final String CLIENT_NAME = "MSO"; + private static final String API_VER = "2.00"; + private static final String ORIGINATOR_ID = "MSO"; + private static final int FLAGS_TTL = 65000; + private static Logger logger = LoggerFactory.getLogger(ApplicationControllerClientV2.class); + + //@Autowired + ApplicationControllerConfiguration applicationControllerConfiguration; + + //@Autowired + private ApplicationControllerSupport appCSupport; + + private static LifeCycleManagerStateful client; + + //@PostConstruct + public void buildClient() { + client = this.getAppCClient(""); + } + + //@PostConstruct + public void buildClient(String controllerType) { + client = this.getAppCClient(controllerType); + } + + public Status runCommand(Action action, ActionIdentifiers actionIdentifiers, Payload payload, String requestID) + throws ApplicationControllerOrchestratorException { + Object requestObject; + requestObject = createRequest(action, actionIdentifiers, payload, requestID); + appCSupport.logLCMMessage(requestObject); + Method lcmMethod = appCSupport.getAPIMethod(action.name(), client, false); + try { + Object response = lcmMethod.invoke(client, requestObject); + return appCSupport.getStatusFromGenericResponse(response); + } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + throw new RuntimeException(String.format("%s : %s", "Unable to invoke action", action.toString()), e); + } + } + + public LifeCycleManagerStateful getAppCClient(String controllerType) { + if (client == null) + try { + client = AppcClientServiceFactoryProvider.getFactory(AppcLifeCycleManagerServiceFactory.class) + .createLifeCycleManagerStateful(new ApplicationContext(), getLCMProperties(controllerType)); + } catch (AppcClientException e) { + logger.error("Error in getting LifeCycleManagerStateful Client", e); + } + return client; + } + + protected Properties getLCMProperties(String controllerType) { + Properties properties = new Properties(); + properties.put("topic.read", applicationControllerConfiguration.getReadTopic()); + properties.put("topic.read.timeout", applicationControllerConfiguration.getReadTimeout()); + properties.put("client.response.timeout", applicationControllerConfiguration.getResponseTimeout()); + properties.put("topic.write", applicationControllerConfiguration.getWrite()); + properties.put("poolMembers", applicationControllerConfiguration.getPoolMembers()); + properties.put("client.key", applicationControllerConfiguration.getClientKey()); + properties.put("client.secret", applicationControllerConfiguration.getClientSecret()); + properties.put("client.name", CLIENT_NAME); + properties.put("service", applicationControllerConfiguration.getService()); + return properties; + } + + public Object createRequest(Action action, ActionIdentifiers identifier, Payload payload, String requestId) { + Object requestObject = appCSupport.getInput(action.name()); + try { + CommonHeader commonHeader = buildCommonHeader(requestId); + requestObject.getClass().getDeclaredMethod("setCommonHeader", CommonHeader.class).invoke(requestObject, + commonHeader); + requestObject.getClass().getDeclaredMethod("setAction", Action.class).invoke(requestObject, action); + requestObject.getClass().getDeclaredMethod("setActionIdentifiers", ActionIdentifiers.class) + .invoke(requestObject, identifier); + if (payload != null) { + requestObject.getClass().getDeclaredMethod("setPayload", Payload.class).invoke(requestObject, payload); + } + } catch (IllegalAccessException | NoSuchMethodException | InvocationTargetException e) { + logger.error("Error building Appc request", e); + } + return requestObject; + } + + private CommonHeader buildCommonHeader(String requestId) { + CommonHeader commonHeader = new CommonHeader(); + commonHeader.setApiVer(API_VER); + commonHeader.setOriginatorId(ORIGINATOR_ID); + commonHeader.setRequestId(requestId == null ? UUID.randomUUID().toString() : requestId); + commonHeader.setSubRequestId(requestId); + Flags flags = new Flags(); + String flagsMode = "NORMAL"; + Mode mode = Mode.valueOf(flagsMode); + flags.setMode(mode); + String flagsForce = "FALSE"; + Force force = Force.valueOf(flagsForce); + flags.setForce(force); + flags.setTtl(FLAGS_TTL); + commonHeader.setFlags(flags); + Instant timestamp = Instant.now(); + ZULU zulu = new ZULU(timestamp.toString()); + commonHeader.setTimestamp(zulu); + return commonHeader; + } + + public Flags createRequestFlags() { + Flags flags = new Flags(); + flags.setTtl(6000); + return flags; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerConfiguration.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerConfiguration.java new file mode 100644 index 0000000000..430767f24a --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerConfiguration.java @@ -0,0 +1,85 @@ +/*- + * ============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.client.appc; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Configuration; +import org.springframework.stereotype.Service; + +@Configuration +public class ApplicationControllerConfiguration { + @Value("${appc.client.topic.read.name}") + private String readTopic; + + @Value("${appc.client.topic.read.timeout}") + private String readTimeout; + + @Value("${appc.client.response.timeout}") + private String responseTimeout; + + @Value("${appc.client.topic.write}") + private String write; + + @Value("${appc.client.poolMembers}") + private String poolMembers; + + @Value("${appc.client.key}") + private String clientKey; + + @Value("${appc.client.secret}") + private String clientSecret; + + @Value("${appc.client.service}") + private String service; + + public String getClientKey() { + return clientKey; + } + + public String getClientSecret() { + return clientSecret; + } + + public String getPoolMembers() { + return poolMembers; + } + + public String getReadTimeout() { + return readTimeout; + } + + public String getResponseTimeout() { + return responseTimeout; + } + + public String getReadTopic() { + return readTopic; + } + + public String getService() { + return service; + } + + public String getWrite() { + return write; + } +} + diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerOrchestrator.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerOrchestrator.java index 744be5f28f..84e0f93294 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerOrchestrator.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerOrchestrator.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,11 +18,11 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.client.appc; +package org.onap.so.client.appc; import java.util.Optional; -import org.openecomp.mso.client.appc.ApplicationControllerSupport.StatusCategory; +import org.onap.so.client.appc.ApplicationControllerSupport.StatusCategory; import org.onap.appc.client.lcm.model.Action; import org.onap.appc.client.lcm.model.ActionIdentifiers; @@ -31,11 +31,14 @@ import org.onap.appc.client.lcm.model.Status; public class ApplicationControllerOrchestrator { - public Status vnfCommand(Action action, String requestId, String vnfId, Optional<String> request, String controllerType) throws ApplicationControllerOrchestratorException { + public Status vnfCommand(Action action, String requestId, String vnfId, Optional<String> vserverId, Optional<String> request, String controllerType) throws ApplicationControllerOrchestratorException { ApplicationControllerClient client = new ApplicationControllerClient(controllerType); Status status; ActionIdentifiers actionIdentifiers = new ActionIdentifiers(); actionIdentifiers.setVnfId(vnfId); + if (vserverId.isPresent()) { + actionIdentifiers.setVserverId(vserverId.get()); + } Payload payload = null; if (request.isPresent()) { payload = new Payload(request.get()); diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerOrchestratorException.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerOrchestratorException.java index 4692f1dcc2..2532e485ed 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerOrchestratorException.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerOrchestratorException.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,19 +18,19 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.client.appc;
-
-public class ApplicationControllerOrchestratorException extends Exception {
-
- private final int appcCode;
-
- public ApplicationControllerOrchestratorException(String message, int code) {
- super(message);
- appcCode = code;
- }
-
- public int getAppcCode()
- {
- return appcCode;
- }
-}
+package org.onap.so.client.appc; + +public class ApplicationControllerOrchestratorException extends Exception { + + private final int appcCode; + + public ApplicationControllerOrchestratorException(String message, int code) { + super(message); + appcCode = code; + } + + public int getAppcCode() + { + return appcCode; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerSupport.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerSupport.java index e3ed432dfc..ef8749ece9 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerSupport.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerSupport.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.client.appc; +package org.onap.so.client.appc; import java.beans.BeanInfo; import java.beans.IntrospectionException; @@ -32,15 +32,15 @@ import org.springframework.stereotype.Component; import org.onap.appc.client.lcm.api.LifeCycleManagerStateful; import org.onap.appc.client.lcm.api.ResponseHandler; import org.onap.appc.client.lcm.model.Status; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; -import com.att.eelf.configuration.EELFLogger.Level; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectWriter; +import org.springframework.stereotype.Service; -@Component public class ApplicationControllerSupport { private static final int ACCEPT_SERIES = 100; @@ -52,7 +52,7 @@ public class ApplicationControllerSupport { private static final int PARTIAL_SUCCESS_STATUS = PARTIAL_SERIES; private static final int PARTIAL_FAILURE_STATUS = PARTIAL_SERIES + 1; - protected final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger(); + private static Logger logger = LoggerFactory.getLogger(ApplicationControllerSupport.class); private String lcmModelPackage = "org.onap.appc.client.lcm.model"; /** @@ -105,7 +105,7 @@ public class ApplicationControllerSupport { try { return (Status) statusReader.invoke(response); } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - auditLogger.log(Level.ERROR, "Unable to obtain status from LCM Kit response", e, e.getMessage()); + logger.error("Unable to obtain status from LCM Kit response", e); } } return new Status(); @@ -207,9 +207,9 @@ public class ApplicationControllerSupport { String inputAsJSON; try { inputAsJSON = writer.writeValueAsString(message); - auditLogger.log(Level.INFO, "\nLCM Kit input message follows: \n" + inputAsJSON, null); + logger.info("LCM Kit input message follows: {}" , inputAsJSON); } catch (JsonProcessingException e) { - auditLogger.log(Level.ERROR, "Error in logging LCM Message: ", e, e.getMessage()); + logger.error("Error in logging LCM Message", e); } } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/avpn/dmaap/beans/AVPNDmaapBean.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/avpn/dmaap/beans/AVPNDmaapBean.java new file mode 100644 index 0000000000..fff818f09b --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/avpn/dmaap/beans/AVPNDmaapBean.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.client.avpn.dmaap.beans; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +@JsonInclude(JsonInclude.Include.NON_NULL) +public class AVPNDmaapBean { + + @JsonProperty("asyncRequestStatus") + private AsyncRequestStatus asyncRequestStatus; + + public AsyncRequestStatus getAsyncRequestStatus() { + return asyncRequestStatus; + } + + public void setAsyncRequestStatus(AsyncRequestStatus asyncRequestStatus) { + this.asyncRequestStatus = asyncRequestStatus; + } + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/avpn/dmaap/beans/AsyncRequestStatus.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/avpn/dmaap/beans/AsyncRequestStatus.java new file mode 100644 index 0000000000..13206e8c92 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/avpn/dmaap/beans/AsyncRequestStatus.java @@ -0,0 +1,119 @@ +/*- + * ============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.client.avpn.dmaap.beans; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName(value = "asyncRequestStatus") +public class AsyncRequestStatus { + + @JsonProperty("requestId") + private String requestId; + @JsonProperty("clientSource") + private String clientSource; + @JsonProperty("correlator") + private String correlator; + @JsonProperty("instanceReferences") + private InstanceReferences instanceReferences; + @JsonProperty("startTime") + private String startTime; + @JsonProperty("finishTime") + private String finishTime; + @JsonProperty("requestScope") + private String requestScope; + @JsonProperty("requestType") + private String requestType; + @JsonProperty("requestStatus") + private RequestStatus requestStatus; + + public String getRequestId() { + return requestId; + } + + public void setRequestId(String requestId) { + this.requestId = requestId; + } + + public String getClientSource() { + return clientSource; + } + + public void setClientSource(String clientSource) { + this.clientSource = clientSource; + } + + public String getCorrelator() { + return correlator; + } + + public void setCorrelator(String correlator) { + this.correlator = correlator; + } + + public InstanceReferences getInstanceReferences() { + return instanceReferences; + } + + public void setInstanceReferences(InstanceReferences instanceReferences) { + this.instanceReferences = instanceReferences; + } + + public String getStartTime() { + return startTime; + } + + public void setStartTime(String startTime) { + this.startTime = startTime; + } + + public String getFinishTime() { + return finishTime; + } + + public void setFinishTime(String finishTime) { + this.finishTime = finishTime; + } + + public String getRequestScope() { + return requestScope; + } + + public void setRequestScope(String requestScope) { + this.requestScope = requestScope; + } + + public String getRequestType() { + return requestType; + } + + public void setRequestType(String requestType) { + this.requestType = requestType; + } + + public RequestStatus getRequestStatus() { + return requestStatus; + } + + public void setRequestStatus(RequestStatus requestStatus) { + this.requestStatus = requestStatus; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/avpn/dmaap/beans/InstanceReferences.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/avpn/dmaap/beans/InstanceReferences.java new file mode 100644 index 0000000000..322f41bf75 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/avpn/dmaap/beans/InstanceReferences.java @@ -0,0 +1,39 @@ +/*- + * ============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.client.avpn.dmaap.beans; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName(value = "instanceReferences") +public class InstanceReferences { + + @JsonProperty("serviceInstanceId") + private String serviceInstanceId; + + public String getServiceInstanceId() { + return serviceInstanceId; + } + + public void setServiceInstanceId(String serviceInstanceId) { + this.serviceInstanceId = serviceInstanceId; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/avpn/dmaap/beans/RequestStatus.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/avpn/dmaap/beans/RequestStatus.java new file mode 100644 index 0000000000..edc8be7bfe --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/avpn/dmaap/beans/RequestStatus.java @@ -0,0 +1,79 @@ +/*- + * ============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.client.avpn.dmaap.beans; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName(value = "requestStatus") +public class RequestStatus { + + @JsonProperty("timestamp") + private String timestamp; + @JsonProperty("requestState") + private String requestState; + @JsonProperty("statusMessage") + private String statusMessage; + @JsonProperty("percentProgress") + private String percentProgress; + @JsonProperty("wasRolledBack") + private Boolean wasRolledBack; + + public String getTimestamp() { + return timestamp; + } + + public void setTimestamp(String timestamp) { + this.timestamp = timestamp; + } + + public String getRequestState() { + return requestState; + } + + public void setRequestState(String requestState) { + this.requestState = requestState; + } + + public String getStatusMessage() { + return statusMessage; + } + + public void setStatusMessage(String statusMessage) { + this.statusMessage = statusMessage; + } + + public String getPercentProgress() { + return percentProgress; + } + + public void setPercentProgress(String percentProgress) { + this.percentProgress = percentProgress; + } + + public Boolean isWasRolledBack() { + return wasRolledBack; + } + + public void setWasRolledBack(Boolean wasRolledBack) { + this.wasRolledBack = wasRolledBack; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/db/request/RequestsDbClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/db/request/RequestsDbClient.java new file mode 100644 index 0000000000..61869ca322 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/db/request/RequestsDbClient.java @@ -0,0 +1,86 @@ +/*- + * ============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.client.db.request; + +import java.io.IOException; +import java.net.URI; + +import org.onap.so.db.request.beans.InfraActiveRequests; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.HttpRequest; +import org.springframework.http.client.ClientHttpRequestExecution; +import org.springframework.http.client.ClientHttpRequestInterceptor; +import org.springframework.http.client.ClientHttpResponse; +import org.springframework.stereotype.Component; +import org.springframework.web.client.RestTemplate; + +import uk.co.blackpepper.bowman.Client; +import uk.co.blackpepper.bowman.ClientFactory; +import uk.co.blackpepper.bowman.Configuration; +import uk.co.blackpepper.bowman.RestTemplateConfigurer; + +@Component("RequestDbClient") +public class RequestsDbClient { + + private Client<InfraActiveRequests> infraActiveRequestClient; + + @Value("${mso.adapters.db.spring.endpoint}") + private String endpoint; + + @Value("${mso.db.auth}") + private String msoAdaptersAuth; + + public RequestsDbClient() { + ClientFactory clientFactory = Configuration.builder().setRestTemplateConfigurer(new RestTemplateConfigurer() { + + public void configure(RestTemplate restTemplate) { + + restTemplate.getInterceptors().add(new ClientHttpRequestInterceptor() { + + public ClientHttpResponse intercept(HttpRequest request, byte[] body, + ClientHttpRequestExecution execution) throws IOException { + + request.getHeaders().add("Authorization", msoAdaptersAuth); + return execution.execute(request, body); + } + }); + } + }).build().buildClientFactory(); + infraActiveRequestClient = clientFactory.create(InfraActiveRequests.class); + + } + + public InfraActiveRequests getInfraActiveRequestbyRequestId(String requestId) { + return this.getSingleInfraActiveRequests(this.getUri(endpoint + "/infraActiveRequests/" + requestId)); + } + + protected InfraActiveRequests getSingleInfraActiveRequests(URI uri) { + return infraActiveRequestClient.get(uri); + } + + public void updateInfraActiveRequests(InfraActiveRequests request) { + infraActiveRequestClient.put(request); + } + + protected URI getUri(String uri) { + return URI.create(uri); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaaproperties/DefaultDmaapPropertiesImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/DefaultDmaapPropertiesImpl.java index c3bf53cfde..c5f08d4809 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaaproperties/DefaultDmaapPropertiesImpl.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/DefaultDmaapPropertiesImpl.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,22 +18,23 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.client.dmaaproperties; +package org.onap.so.client.dmaapproperties; -import java.util.Map; +import org.onap.so.client.dmaap.DmaapProperties; -import org.openecomp.mso.bpmn.core.PropertyConfiguration; -import org.openecomp.mso.client.dmaap.DmaapProperties; +import java.util.Map; public class DefaultDmaapPropertiesImpl implements DmaapProperties { private final Map<String, String> properties; + public DefaultDmaapPropertiesImpl() { - this.properties = PropertyConfiguration.getInstance().getProperties("mso.bpmn.urn.properties"); + this.properties = new DmaapPropertiesMap(); } + @Override public Map<String, String> getProperties() { - return this.properties; + return properties; } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/DmaapPropertiesClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/DmaapPropertiesClient.java new file mode 100644 index 0000000000..af7c608fee --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/DmaapPropertiesClient.java @@ -0,0 +1,115 @@ +/*- + * ============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.client.dmaapproperties; + +import javax.inject.Provider; + +import org.onap.so.client.avpn.dmaap.beans.AVPNDmaapBean; +import org.onap.so.client.avpn.dmaap.beans.AsyncRequestStatus; +import org.onap.so.client.avpn.dmaap.beans.InstanceReferences; +import org.onap.so.client.avpn.dmaap.beans.RequestStatus; +import org.onap.so.client.exception.MapperException; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +@Component +public class DmaapPropertiesClient { + + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DmaapPropertiesClient.class); + + @Autowired + private Provider<GlobalDmaapPublisher> dmaapPublisher; + + protected AVPNDmaapBean buildRequestJson(String requestId, String clientSource, String correlator, String serviceInstanceId, String startTime, String finishTime, + String requestScope, String requestType, String timestamp, String requestState, String statusMessage, String percentProgress, Boolean wasRolledBack) { + + RequestStatus requestStatus = buildRequestStatus(timestamp, requestState, statusMessage, percentProgress, wasRolledBack); + + InstanceReferences instanceReferences = buildInstanceReferences(serviceInstanceId); + + AsyncRequestStatus asyncRequestStatus = buildAsyncRequestStatus(requestId, clientSource, correlator, startTime, finishTime, + requestScope, requestType, requestStatus, instanceReferences); + + AVPNDmaapBean dmaapBean = new AVPNDmaapBean(); + dmaapBean.setAsyncRequestStatus(asyncRequestStatus); + + return dmaapBean; + } + + private String jsonToString(AVPNDmaapBean dmaapBean) throws JsonProcessingException, MapperException { + try { + return new ObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(dmaapBean); + } catch (JsonProcessingException e) { + msoLogger.error(e); + throw new MapperException(e.getMessage()); + } + } + + private AsyncRequestStatus buildAsyncRequestStatus(String requestId, String clientSource, String correlator, String startTime, + String finishTime, String requestScope, String requestType, + RequestStatus requestStatus, InstanceReferences instanceReferences) { + + AsyncRequestStatus asyncRequestStatus = new AsyncRequestStatus(); + asyncRequestStatus.setRequestId(requestId); + asyncRequestStatus.setClientSource(clientSource); + asyncRequestStatus.setCorrelator(correlator); + asyncRequestStatus.setStartTime(startTime); + asyncRequestStatus.setFinishTime(finishTime); + asyncRequestStatus.setRequestScope(requestScope); + asyncRequestStatus.setRequestType(requestType); + asyncRequestStatus.setInstanceReferences(instanceReferences); + asyncRequestStatus.setRequestStatus(requestStatus); + + return asyncRequestStatus; + } + + private InstanceReferences buildInstanceReferences(String serviceInstanceId) { + InstanceReferences instanceReferences = new InstanceReferences(); + instanceReferences.setServiceInstanceId(serviceInstanceId); + return instanceReferences; + } + + private RequestStatus buildRequestStatus(String timestamp, String requestState, String statusMessage, + String percentProgress, Boolean wasRolledBack) { + RequestStatus requestStatus = new RequestStatus(); + requestStatus.setTimestamp(timestamp); + requestStatus.setRequestState(requestState); + requestStatus.setStatusMessage(statusMessage); + requestStatus.setPercentProgress(percentProgress); + requestStatus.setWasRolledBack(wasRolledBack); + return requestStatus; + } + + public void dmaapPublishRequest(String requestId, String clientSource, String correlator, String serviceInstanceId, String startTime, + String finishTime, String requestScope, String requestType, String timestamp, String requestState, + String statusMessage, String percentProgress, Boolean wasRolledBack) throws MapperException, JsonProcessingException { + + AVPNDmaapBean bean = this.buildRequestJson(requestId, clientSource, correlator, serviceInstanceId, startTime, finishTime, + requestScope, requestType, timestamp, requestState, statusMessage, percentProgress, wasRolledBack); + + String request = jsonToString(bean); + dmaapPublisher.get().send(request); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/DmaapPropertiesMap.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/DmaapPropertiesMap.java new file mode 100644 index 0000000000..796ccf18b7 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/DmaapPropertiesMap.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.client.dmaapproperties; + +import org.onap.so.bpmn.core.UrnPropertiesReader; + +import java.util.HashMap; + +/** + * This class is used when Dmaap Properties are to be accessed from + * application.yaml and it delegates get calls to UrnPropertyReader class + * for reading the value from active configuration + * @param <K> Key for Map Entry + * @param <V> Value for Map Entry + */ +public class DmaapPropertiesMap<K,V> extends HashMap<K,V> { + + @Override + public V get(Object key) { + return (V)UrnPropertiesReader.getVariable((String)key); + } + + @Override + public V getOrDefault(Object key, V defaultValue) { + String str = UrnPropertiesReader.getVariable((String)key); + return str ==null ? defaultValue : (V)str; + } + + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/network/NetworkAdapterRestProperties.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/GlobalDmaapPublisher.java index 62d78d423c..382852886e 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/network/NetworkAdapterRestProperties.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/GlobalDmaapPublisher.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,40 +17,48 @@ * limitations under the License. * ============LICENSE_END========================================================= */ +package org.onap.so.client.dmaapproperties; -package org.openecomp.mso.client.adapter.network; +import java.io.IOException; +import java.util.Optional; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.Map; +import org.onap.so.bpmn.core.UrnPropertiesReader; +import org.onap.so.client.dmaap.DmaapPublisher; -import org.openecomp.mso.bpmn.core.PropertyConfiguration; -import org.openecomp.mso.client.adapter.vnf.AdapterRestProperties; +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Component; -public class NetworkAdapterRestProperties implements AdapterRestProperties { +@Component +@Scope("prototype") +public class GlobalDmaapPublisher extends DmaapPublisher { - private final Map<String, String> props; - public NetworkAdapterRestProperties() { - this.props = PropertyConfiguration.getInstance().getProperties("mso.bpmn.urn.properties"); + public GlobalDmaapPublisher() throws IOException { + super(); } @Override - public String getAuth() { - return props.get("mso.adapters.po.auth"); + public String getUserName() { + + return UrnPropertiesReader.getVariable("mso.global.dmaap.username"); } + + + @Override - public String getKey() { - return props.get("mso.msoKey"); + public String getPassword() { + + return UrnPropertiesReader.getVariable("mso.global.dmaap.password"); } + @Override - public URL getEndpoint() throws MalformedURLException { - return new URL(props.get("mso.adapters.network.rest.endpoint")); + public String getTopic() { + + return UrnPropertiesReader.getVariable("mso.global.dmaap.publisher.topic"); } @Override - public String getSystemName() { - return "MSO"; + public Optional<String> getHost() { + return Optional.ofNullable(UrnPropertiesReader.getVariable("mso.global.dmaap.host")); } - } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/BBObjectNotFoundException.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/BBObjectNotFoundException.java new file mode 100644 index 0000000000..26c8d80075 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/BBObjectNotFoundException.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.client.exception; + +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; + +public class BBObjectNotFoundException extends Exception{ + private ResourceKey resourceKey; + private String resourceValue; + + public BBObjectNotFoundException() {} + + public BBObjectNotFoundException(ResourceKey resourceKey, String resourceValue) + { + super("BBObject" + resourceKey + " was not found in gBBInput using reference value: " + resourceValue); + this.resourceKey = resourceKey; + this.resourceValue = resourceValue; + } + + public ResourceKey getResourceKey() { + return resourceKey; + } + + public String getResourceValue() { + return resourceValue; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/ResponseStatus.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/BadResponseException.java index cc00fd1ff2..ac8ff9efe4 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/ResponseStatus.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/BadResponseException.java @@ -18,16 +18,15 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.client.adapter.requests.db.entities; +package org.onap.so.client.exception; +public class BadResponseException extends Exception{ + public BadResponseException() {} + + public BadResponseException(String message) + { + super(message); + } -/* - * Enum for Status values returned by API Handler to Tail-F -*/ -public enum ResponseStatus { - SENDING_FINAL_NOTIFY, - SUCCESS, - FAILED, - TIMEOUT } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java new file mode 100644 index 0000000000..c74e81506c --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.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.client.exception; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.common.DelegateExecutionImpl; +import org.onap.so.bpmn.core.WorkflowException; +import org.onap.so.logger.MessageEnum; +import org.onap.so.logger.MsoLogger; +import org.springframework.stereotype.Component; + +@Component +public class ExceptionBuilder { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ExceptionBuilder.class); + + public void buildAndThrowWorkflowException(BuildingBlockExecution execution, int errorCode, Exception exception) { + String msg = "Exception in %s.%s "; + try{ + msoLogger.error(exception); + + String errorVariable = "Error%s%s"; + + StackTraceElement[] trace = Thread.currentThread().getStackTrace(); + for (StackTraceElement traceElement : trace) { + if (!traceElement.getClassName().equals(this.getClass().getName()) && !traceElement.getClassName().equals(Thread.class.getName())) { + msg = String.format(msg, traceElement.getClassName(), traceElement.getMethodName()); + String shortClassName = traceElement.getClassName().substring(traceElement.getClassName().lastIndexOf(".") + 1); + errorVariable = String.format(errorVariable, shortClassName, traceElement.getMethodName()); + break; + } + } + + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, msg.toString()); + execution.setVariable(errorVariable, exception.getMessage()); + } catch (Exception ex){ + //log trace, allow process to complete gracefully + msoLogger.error(ex); + } + + if (exception.getMessage() != null) + msg = msg.concat(exception.getMessage()); + buildAndThrowWorkflowException(execution, errorCode, msg); + } + + public void buildAndThrowWorkflowException(BuildingBlockExecution execution, int errorCode, String errorMessage) { + if (execution instanceof DelegateExecutionImpl) { + buildAndThrowWorkflowException(((DelegateExecutionImpl) execution).getDelegateExecution(), errorCode, errorMessage); + } + } + + public void buildAndThrowWorkflowException(DelegateExecution execution, int errorCode, String errorMessage) { + String processKey = getProcessKey(execution); + msoLogger.info("Building a WorkflowException for Subflow"); + + WorkflowException exception = new WorkflowException(processKey, errorCode, errorMessage); + execution.setVariable("WorkflowException", exception); + msoLogger.info("Outgoing WorkflowException is " + exception); + msoLogger.info("Throwing MSOWorkflowException"); + throw new BpmnError("MSOWorkflowException"); + } + + public String getProcessKey(DelegateExecution execution) { + String testKey = (String) execution.getVariable("testProcessKey"); + if (testKey != null) { + return testKey; + } + return execution.getProcessEngineServices().getRepositoryService() + .getProcessDefinition(execution.getProcessDefinitionId()).getKey(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/package-info.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/MapperException.java index c6ee6ca015..3f3beadb92 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/package-info.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/MapperException.java @@ -18,5 +18,15 @@ * ============LICENSE_END========================================================= */ -@javax.xml.bind.annotation.XmlSchema(namespace = "http://org.openecomp.mso/vnfNotify") -package org.openecomp.mso.bpmn.common.adapter.vnf; +package org.onap.so.client.exception; + +public class MapperException extends Exception{ + + public MapperException() {} + + public MapperException(String message) + { + super(message); + } + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/OrchestrationStatusValidationException.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/OrchestrationStatusValidationException.java new file mode 100644 index 0000000000..fe7b079568 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/OrchestrationStatusValidationException.java @@ -0,0 +1,29 @@ +/*- + * ============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.client.exception; + +public class OrchestrationStatusValidationException extends Exception{ + public OrchestrationStatusValidationException() {} + + public OrchestrationStatusValidationException(String message) { + super(message); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/restproperties/AAIPropertiesImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/AAIPropertiesImpl.java index a1ef35a49d..b7164e327e 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/restproperties/AAIPropertiesImpl.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/AAIPropertiesImpl.java @@ -18,28 +18,27 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.client.restproperties; +package org.onap.so.client.restproperties; import java.net.MalformedURLException; import java.net.URL; -import java.util.Map; -import org.openecomp.mso.bpmn.core.PropertyConfiguration; -import org.openecomp.mso.client.aai.AAIProperties; -import org.openecomp.mso.client.aai.AAIVersion; +import org.onap.so.bpmn.core.UrnPropertiesReader; +import org.onap.so.client.aai.AAIProperties; +import org.onap.so.client.aai.AAIVersion; +import org.springframework.stereotype.Component; +@Component public class AAIPropertiesImpl implements AAIProperties { - final Map<String, String> props; - - public AAIPropertiesImpl() { - this.props = PropertyConfiguration.getInstance().getProperties("mso.bpmn.urn.properties"); - - } + public static final String MSO_MSO_KEY = "mso.msoKey"; + public static final String AAI_AUTH = "aai.auth"; + public static final String AAI_ENDPOINT = "aai.endpoint"; + private UrnPropertiesReader reader; @Override public URL getEndpoint() throws MalformedURLException { - return new URL(props.get("aai.endpoint")); + return new URL(reader.getVariable(AAI_ENDPOINT)); } @Override @@ -54,11 +53,11 @@ public class AAIPropertiesImpl implements AAIProperties { @Override public String getAuth() { - return props.get("aai.auth"); + return reader.getVariable(AAI_AUTH); } @Override public String getKey() { - return props.get("mso.msoKey"); + return reader.getVariable(MSO_MSO_KEY); } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/AaiPropertiesConfiguration.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/AaiPropertiesConfiguration.java new file mode 100644 index 0000000000..b7582922b1 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/AaiPropertiesConfiguration.java @@ -0,0 +1,42 @@ +/*- + * ============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.client.restproperties; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; + +@Service +public class AaiPropertiesConfiguration { + + @Value("${aai.endpoint}") + private String endpoint; + + @Value("${aai.auth}") + private String auth; + + public String getEndpoint() { + return endpoint; + } + + public String getAuth() { + return auth; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/restproperties/PolicyRestPropertiesImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/PolicyRestPropertiesImpl.java index eccf87c09d..1e43adceba 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/restproperties/PolicyRestPropertiesImpl.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/PolicyRestPropertiesImpl.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,27 +18,28 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.client.restproperties; +package org.onap.so.client.restproperties; import java.net.MalformedURLException; import java.net.URL; -import java.util.Map; -import org.openecomp.mso.bpmn.core.PropertyConfiguration; -import org.openecomp.mso.client.policy.PolicyRestProperties; +import org.onap.so.bpmn.core.UrnPropertiesReader; +import org.onap.so.client.policy.PolicyRestProperties; public class PolicyRestPropertiesImpl implements PolicyRestProperties { - - final Map<String, String> props; - public PolicyRestPropertiesImpl() { - this.props = PropertyConfiguration.getInstance().getProperties("mso.bpmn.urn.properties"); + public static final String POLICY_ENDPOINT = "policy.endpoint"; + public static final String POLICY_ENVIRONMENT = "policy.environment"; + public static final String POLICY_AUTH = "policy.auth"; + public static final String POLICY_CLIENT_AUTH = "policy.client.auth"; + public PolicyRestPropertiesImpl() { } + @Override public URL getEndpoint() { try { - return new URL(props.getOrDefault("policy.endpoint", "")); + return new URL(UrnPropertiesReader.getVariable(POLICY_ENDPOINT)); } catch (MalformedURLException e) { return null; } @@ -50,15 +51,15 @@ public class PolicyRestPropertiesImpl implements PolicyRestProperties { } public String getClientAuth() { - return props.get("policy.client.auth"); + return UrnPropertiesReader.getVariable(POLICY_CLIENT_AUTH); } public String getAuth() { - return props.get("policy.auth"); + return UrnPropertiesReader.getVariable(POLICY_AUTH); } public String getEnvironment() { - return props.get("policy.environment"); + return UrnPropertiesReader.getVariable(POLICY_ENVIRONMENT); } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/package-info.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/UrnPropertiesReaderWrapper.java index 42f4ce374f..030eff92e2 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/package-info.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/UrnPropertiesReaderWrapper.java @@ -18,5 +18,13 @@ * ============LICENSE_END========================================================= */ -@javax.xml.bind.annotation.XmlSchema(namespace = "http://org.openecomp/workflow/sdnc/adapter/schema/v1", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) -package org.openecomp.mso.bpmn.common.adapter.sdnc; +package org.onap.so.client.restproperties; + +import org.onap.so.bpmn.core.UrnPropertiesReader; + +public class UrnPropertiesReaderWrapper { + + public String getVariable(String key) { + return UrnPropertiesReader.getVariable(key); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/CallbackHeader.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/CallbackHeader.java deleted file mode 100644 index 67109d5578..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/CallbackHeader.java +++ /dev/null @@ -1,139 +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.common.adapter.sdnc; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - - -/** - * <p>Java class for anonymous complex type. - * - * <p>The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="RequestId" type="{http://www.w3.org/2001/XMLSchema}string"/> - * <element name="ResponseCode" type="{http://www.w3.org/2001/XMLSchema}string"/> - * <element name="ResponseMessage" type="{http://www.w3.org/2001/XMLSchema}string"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "requestId", - "responseCode", - "responseMessage" -}, namespace="http://org.openecomp/workflow/sdnc/adapter/schema/v1") -@XmlRootElement(name = "CallbackHeader") -public class CallbackHeader { - - @XmlElement(name = "RequestId", required = true, namespace="http://org.openecomp/workflow/sdnc/adapter/schema/v1") - protected String requestId; - @XmlElement(name = "ResponseCode", required = true,namespace="http://org.openecomp/workflow/sdnc/adapter/schema/v1") - protected String responseCode; - @XmlElement(name = "ResponseMessage", required = true,namespace="http://org.openecomp/workflow/sdnc/adapter/schema/v1") - protected String responseMessage; - - /** - * Gets the value of the requestId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getRequestId() { - return requestId; - } - - /** - * Sets the value of the requestId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setRequestId(String value) { - this.requestId = value; - } - - /** - * Gets the value of the responseCode property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getResponseCode() { - return responseCode; - } - - /** - * Sets the value of the responseCode property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setResponseCode(String value) { - this.responseCode = value; - } - - /** - * Gets the value of the responseMessage property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getResponseMessage() { - return responseMessage; - } - - /** - * Sets the value of the responseMessage property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setResponseMessage(String value) { - this.responseMessage = value; - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/ObjectFactory.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/ObjectFactory.java deleted file mode 100644 index 1835fbe41c..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/ObjectFactory.java +++ /dev/null @@ -1,91 +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.common.adapter.sdnc;
-
-import javax.xml.bind.annotation.XmlRegistry;
-
-
-/**
- * This object contains factory methods for each
- * Java content interface and Java element interface
- * generated in the org.openecomp.domain2.workflow.sdnc.adapter.schema.v1 package.
- * <p>An ObjectFactory allows you to programatically
- * construct new instances of the Java representation
- * for XML content. The Java representation of XML
- * content can consist of schema derived interfaces
- * and classes representing the binding of schema
- * type definitions, element declarations and model
- * groups. Factory methods for each of these are
- * provided in this class.
- *
- */
-@XmlRegistry
-public class ObjectFactory {
-
-
- /**
- * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.openecomp.domain2.workflow.sdnc.adapter.schema.v1
- *
- */
- public ObjectFactory() {
- }
-
- /**
- * Create an instance of {@link RequestHeader }
- *
- */
- public RequestHeader createRequestHeader() {
- return new RequestHeader();
- }
-
- /**
- * Create an instance of {@link SDNCAdapterResponse }
- *
- */
- public SDNCAdapterResponse createSDNCAdapterResponse() {
- return new SDNCAdapterResponse();
- }
-
- /**
- * Create an instance of {@link SDNCAdapterCallbackRequest }
- *
- */
- public SDNCAdapterCallbackRequest createSDNCAdapterCallbackRequest() {
- return new SDNCAdapterCallbackRequest();
- }
-
- /**
- * Create an instance of {@link CallbackHeader }
- *
- */
- public CallbackHeader createCallbackHeader() {
- return new CallbackHeader();
- }
-
- /**
- * Create an instance of {@link SDNCAdapterRequest }
- *
- */
- public SDNCAdapterRequest createSDNCAdapterRequest() {
- return new SDNCAdapterRequest();
- }
-
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/RequestHeader.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/RequestHeader.java deleted file mode 100644 index 12f2fef668..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/RequestHeader.java +++ /dev/null @@ -1,223 +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.common.adapter.sdnc;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * <p>Java class for anonymous complex type.
- *
- * <p>The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * <complexType>
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="RequestId" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * <element name="SvcInstanceId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * <element name="SvcAction" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * <element name="SvcOperation" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * <element name="CallbackUrl" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * <element name="MsoAction" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * </sequence>
- * </restriction>
- * </complexContent>
- * </complexType>
- * </pre>
- *
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "", propOrder = {
- "requestId",
- "svcInstanceId",
- "svcAction",
- "svcOperation",
- "callbackUrl",
- "msoAction"
-})
-@XmlRootElement(name = "RequestHeader")
-public class RequestHeader {
-
- @XmlElement(name = "RequestId", required = true)
- protected String requestId;
- @XmlElement(name = "SvcInstanceId")
- protected String svcInstanceId;
- @XmlElement(name = "SvcAction", required = true)
- protected String svcAction;
- @XmlElement(name = "SvcOperation", required = true)
- protected String svcOperation;
- @XmlElement(name = "CallbackUrl", required = true)
- protected String callbackUrl;
- @XmlElement(name = "MsoAction")
- protected String msoAction;
-
- /**
- * Gets the value of the requestId property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getRequestId() {
- return requestId;
- }
-
- /**
- * Sets the value of the requestId property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setRequestId(String value) {
- this.requestId = value;
- }
-
- /**
- * Gets the value of the svcInstanceId property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getSvcInstanceId() {
- return svcInstanceId;
- }
-
- /**
- * Sets the value of the svcInstanceId property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setSvcInstanceId(String value) {
- this.svcInstanceId = value;
- }
-
- /**
- * Gets the value of the svcAction property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getSvcAction() {
- return svcAction;
- }
-
- /**
- * Sets the value of the svcAction property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setSvcAction(String value) {
- this.svcAction = value;
- }
-
- /**
- * Gets the value of the svcOperation property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getSvcOperation() {
- return svcOperation;
- }
-
- /**
- * Sets the value of the svcOperation property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setSvcOperation(String value) {
- this.svcOperation = value;
- }
-
- /**
- * Gets the value of the callbackUrl property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getCallbackUrl() {
- return callbackUrl;
- }
-
- /**
- * Sets the value of the callbackUrl property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setCallbackUrl(String value) {
- this.callbackUrl = value;
- }
-
- /**
- * Gets the value of the msoAction property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getMsoAction() {
- return msoAction;
- }
-
- /**
- * Sets the value of the msoAction property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setMsoAction(String value) {
- this.msoAction = value;
- }
-
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/SDNCAdapterCallbackRequest.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/SDNCAdapterCallbackRequest.java deleted file mode 100644 index 8c9d4e2a50..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/SDNCAdapterCallbackRequest.java +++ /dev/null @@ -1,130 +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.common.adapter.sdnc; - -import java.io.StringWriter; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Marshaller; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - - -/** - * <p>Java class for anonymous complex type. - * - * <p>The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element ref="{http://org.openecomp/workflow/sdnc/adapter/schema/v1}CallbackHeader"/> - * <element name="RequestData" type="{http://www.w3.org/2001/XMLSchema}anyType" minOccurs="0"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", namespace="http://org.openecomp/workflow/sdnc/adapter/schema/v1", propOrder = { - "callbackHeader", - "requestData" -}) -@XmlRootElement(name = "SDNCAdapterCallbackRequest", namespace="http://org.openecomp/workflow/sdnc/adapter/schema/v1") -public class SDNCAdapterCallbackRequest { - - @XmlElement(name = "CallbackHeader", required = true, namespace="http://org.openecomp/workflow/sdnc/adapter/schema/v1") - protected CallbackHeader callbackHeader; - @XmlElement(name = "RequestData", required=false, namespace="http://org.openecomp/workflow/sdnc/adapter/schema/v1") - protected Object requestData; - - /** - * Gets the value of the callbackHeader property. - * - * @return - * possible object is - * {@link CallbackHeader } - * - */ - public CallbackHeader getCallbackHeader() { - return callbackHeader; - } - - /** - * Sets the value of the callbackHeader property. - * - * @param value - * allowed object is - * {@link CallbackHeader } - * - */ - public void setCallbackHeader(CallbackHeader value) { - this.callbackHeader = value; - } - - /** - * Gets the value of the requestData property. - * - * @return - * possible object is - * {@link Object } - * - */ - public Object getRequestData() { - return requestData; - } - - /** - * Sets the value of the requestData property. - * - * @param value - * allowed object is - * {@link Object } - * - */ - public void setRequestData(Object value) { - this.requestData = value; - } - - @Override - public String toString() { - StringWriter writer = new StringWriter(); - try { - JAXBContext context = JAXBContext - .newInstance(SDNCAdapterCallbackRequest.class); - Marshaller m = context.createMarshaller(); - m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); - m.marshal(this, writer); - return writer.getBuffer().toString(); - } catch (JAXBException e) { - return ""; - } - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/SDNCAdapterRequest.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/SDNCAdapterRequest.java deleted file mode 100644 index 1043b48944..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/SDNCAdapterRequest.java +++ /dev/null @@ -1,111 +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.common.adapter.sdnc; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - - -/** - * <p>Java class for anonymous complex type. - * - * <p>The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element ref="{http://org.openecomp/workflow/sdnc/adapter/schema/v1}RequestHeader"/> - * <element name="RequestData" type="{http://www.w3.org/2001/XMLSchema}anyType"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "requestHeader", - "requestData" -}) -@XmlRootElement(name = "SDNCAdapterRequest") -public class SDNCAdapterRequest { - - @XmlElement(name = "RequestHeader", required = true) - protected RequestHeader requestHeader; - @XmlElement(name = "RequestData", required = true) - protected Object requestData; - - /** - * Gets the value of the requestHeader property. - * - * @return - * possible object is - * {@link RequestHeader } - * - */ - public RequestHeader getRequestHeader() { - return requestHeader; - } - - /** - * Sets the value of the requestHeader property. - * - * @param value - * allowed object is - * {@link RequestHeader } - * - */ - public void setRequestHeader(RequestHeader value) { - this.requestHeader = value; - } - - /** - * Gets the value of the requestData property. - * - * @return - * possible object is - * {@link Object } - * - */ - public Object getRequestData() { - return requestData; - } - - /** - * Sets the value of the requestData property. - * - * @param value - * allowed object is - * {@link Object } - * - */ - public void setRequestData(Object value) { - this.requestData = value; - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/SDNCAdapterResponse.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/SDNCAdapterResponse.java deleted file mode 100644 index 34e68d68ef..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/SDNCAdapterResponse.java +++ /dev/null @@ -1,51 +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.common.adapter.sdnc;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * <p>Java class for anonymous complex type.
- *
- * <p>The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * <complexType>
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * </restriction>
- * </complexContent>
- * </complexType>
- * </pre>
- *
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "")
-@XmlRootElement(name = "SDNCAdapterResponse")
-public class SDNCAdapterResponse {
-
-
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/SDNCCallbackAdapterPortType.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/SDNCCallbackAdapterPortType.java deleted file mode 100644 index c2f68ff6a4..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/SDNCCallbackAdapterPortType.java +++ /dev/null @@ -1,53 +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.common.adapter.sdnc; - -import javax.jws.WebMethod; -import javax.jws.WebParam; -import javax.jws.WebResult; -import javax.jws.WebService; -import javax.jws.soap.SOAPBinding; - - -/** - * This class was generated by the JAX-WS RI. - * JAX-WS RI 2.2.4-b01 - * Generated source version: 2.2 - * - */ -@WebService(name = "SDNCCallbackAdapterPortType", targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/callback/wsdl/v1") -@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE) -public interface SDNCCallbackAdapterPortType { - - - /** - * - * @param sdncAdapterCallbackRequest - * @return - * returns org.openecomp.domain2.workflow.sdnc.adapter.schema.v1.SDNCAdapterResponse - */ - @WebMethod(operationName = "SDNCAdapterCallback") - @WebResult(name = "SDNCAdapterResponse", targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterCallbackResponse") - public SDNCAdapterResponse sdncAdapterCallback( - @WebParam(name = "SDNCAdapterCallbackRequest", targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterCallbackRequest") - SDNCAdapterCallbackRequest sdncAdapterCallbackRequest); - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/CreateVnfNotification.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/CreateVnfNotification.java deleted file mode 100644 index 1b5c080045..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/CreateVnfNotification.java +++ /dev/null @@ -1,462 +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.common.adapter.vnf; - -import java.util.ArrayList; -import java.util.List; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - * <p>Java class for createVnfNotification complex type. - * - * <p>The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType name="createVnfNotification"> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/> - * <element name="completed" type="{http://www.w3.org/2001/XMLSchema}boolean"/> - * <element name="exception" type="{http://org.openecomp.mso/vnfNotify}msoExceptionCategory" minOccurs="0"/> - * <element name="errorMessage" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * <element name="vnfId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * <element name="outputs" minOccurs="0"> - * <complexType> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="entry" maxOccurs="unbounded" minOccurs="0"> - * <complexType> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * <element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </element> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </element> - * <element name="rollback" type="{http://org.openecomp.mso/vnfNotify}vnfRollback" minOccurs="0"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "createVnfNotification1", propOrder = { - "messageId", - "completed", - "exception", - "errorMessage", - "vnfId", - "outputs", - "rollback" -}) -public class CreateVnfNotification { - - @XmlElement(required = true) - protected String messageId; - protected boolean completed; - protected MsoExceptionCategory exception; - protected String errorMessage; - protected String vnfId; - protected CreateVnfNotification.Outputs outputs; - protected VnfRollback rollback; - - /** - * Gets the value of the messageId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getMessageId() { - return messageId; - } - - /** - * Sets the value of the messageId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setMessageId(String value) { - this.messageId = value; - } - - /** - * Gets the value of the completed property. - * - */ - public boolean isCompleted() { - return completed; - } - - /** - * Sets the value of the completed property. - * - */ - public void setCompleted(boolean value) { - this.completed = value; - } - - /** - * Gets the value of the exception property. - * - * @return - * possible object is - * {@link MsoExceptionCategory } - * - */ - public MsoExceptionCategory getException() { - return exception; - } - - /** - * Sets the value of the exception property. - * - * @param value - * allowed object is - * {@link MsoExceptionCategory } - * - */ - public void setException(MsoExceptionCategory value) { - this.exception = value; - } - - /** - * Gets the value of the errorMessage property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getErrorMessage() { - return errorMessage; - } - - /** - * Sets the value of the errorMessage property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setErrorMessage(String value) { - this.errorMessage = value; - } - - /** - * Gets the value of the vnfId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getVnfId() { - return vnfId; - } - - /** - * Sets the value of the vnfId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setVnfId(String value) { - this.vnfId = value; - } - - /** - * Gets the value of the outputs property. - * - * @return - * possible object is - * {@link CreateVnfNotification.Outputs } - * - */ - public CreateVnfNotification.Outputs getOutputs() { - return outputs; - } - - /** - * Sets the value of the outputs property. - * - * @param value - * allowed object is - * {@link CreateVnfNotification.Outputs } - * - */ - public void setOutputs(CreateVnfNotification.Outputs value) { - this.outputs = value; - } - - /** - * Gets the value of the rollback property. - * - * @return - * possible object is - * {@link VnfRollback } - * - */ - public VnfRollback getRollback() { - return rollback; - } - - /** - * Sets the value of the rollback property. - * - * @param value - * allowed object is - * {@link VnfRollback } - * - */ - public void setRollback(VnfRollback value) { - this.rollback = value; - } - - - /** - * <p>Java class for anonymous complex type. - * - * <p>The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="entry" maxOccurs="unbounded" minOccurs="0"> - * <complexType> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * <element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </element> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ - @XmlAccessorType(XmlAccessType.FIELD) - @XmlType(name = "", propOrder = { - "entry" - }) - public static class Outputs { - - protected List<CreateVnfNotification.Outputs.Entry> entry; - - /** - * Gets the value of the entry property. - * - * <p> - * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a <CODE>set</CODE> method for the entry property. - * - * <p> - * For example, to add a new item, do as follows: - * <pre> - * getEntry().add(newItem); - * </pre> - * - * - * <p> - * Objects of the following type(s) are allowed in the list - * {@link CreateVnfNotification.Outputs.Entry } - * - * - */ - public List<CreateVnfNotification.Outputs.Entry> getEntry() { - if (entry == null) { - entry = new ArrayList<>(); - } - return this.entry; - } - - // Not a generated method - @Override - public String toString() { - StringBuilder out = new StringBuilder(); - out.append("<outputs>\n"); - if (entry != null) { - for (Entry e : entry) { - out.append(e.toString()); - out.append('\n'); - } - } - out.append("</outputs>"); - return out.toString(); - } - - /** - * <p>Java class for anonymous complex type. - * - * <p>The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * <element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ - @XmlAccessorType(XmlAccessType.FIELD) - @XmlType(name = "", propOrder = { - "key", - "value" - }) - public static class Entry { - - protected String key; - protected String value; - - /** - * Gets the value of the key property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getKey() { - return key; - } - - /** - * Sets the value of the key property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setKey(String value) { - this.key = value; - } - - /** - * Gets the value of the value property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getValue() { - return value; - } - - /** - * Sets the value of the value property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setValue(String value) { - this.value = value; - - } - - // Not a generated method - @Override - public String toString() { - String entrystr; - entrystr = - "<entry>"+ '\n' + - " <key>"+key+"</key>" + '\n' + - " <value>"+value+"</value>" + '\n' + - "</entry>"; - return entrystr; - } - - } - - } - - // Not a generated method - @Override - public String toString() { - String createVnfNotification; - if (exception==null) { - createVnfNotification = "<ns2:createVnfNotification xmlns:ns2=\"http://org.openecomp.mso/vnfNotify\"" + '\n' + - " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' + - " <messageId>"+messageId+"</messageId>" + '\n' + - " <completed>"+completed+"</completed>" + '\n' + - " <vnfId>"+vnfId+"</vnfId>" + '\n' + - (outputs == null ? "" : outputs.toString() + '\n') + - " <rollback>"+rollback+"</rollback>" + '\n' + - "</ns2:createVnfNotification>"; - } else { - createVnfNotification = "<ns2:createVnfNotification xmlns:ns2=\"http://org.openecomp.mso/vnfNotify\"" + '\n' + - " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' + - " <messageId>"+messageId+"</messageId>" + '\n' + - " <completed>"+completed+"</completed>" + '\n' + - (outputs == null ? "" : outputs.toString() + '\n') + - " <exception>"+exception+"</exception>" + '\n' + - " <errorMessage>"+errorMessage+"</errorMessage>" + '\n' + - "</ns2:createVnfNotification>"; - } - return createVnfNotification; - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/DeleteVnfNotification.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/DeleteVnfNotification.java deleted file mode 100644 index 651fd1aca7..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/DeleteVnfNotification.java +++ /dev/null @@ -1,198 +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.common.adapter.vnf;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * <p>Java class for deleteVnfNotification complex type.
- *
- * <p>The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * <complexType name="deleteVnfNotification">
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * <element name="completed" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
- * <element name="exception" type="{http://org.openecomp.mso/vnfNotify}msoExceptionCategory" minOccurs="0"/>
- * <element name="errorMessage" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * </sequence>
- * </restriction>
- * </complexContent>
- * </complexType>
- * </pre>
- *
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "deleteVnfNotification1", propOrder = {
- "messageId",
- "completed",
- "exception",
- "errorMessage"
-})
-public class DeleteVnfNotification {
-
- @XmlElement(required = true)
- protected String messageId;
- protected boolean completed;
- protected MsoExceptionCategory exception;
- protected String errorMessage;
-
- /**
- * Gets the value of the messageId property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getMessageId() {
- return messageId;
- }
-
- /**
- * Sets the value of the messageId property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setMessageId(String value) {
- this.messageId = value;
- }
-
- /**
- * Gets the value of the completed property.
- *
- */
- public boolean isCompleted() {
- return completed;
- }
-
- /**
- * Sets the value of the completed property.
- *
- */
- public void setCompleted(boolean value) {
- this.completed = value;
- }
-
- /**
- * Gets the value of the exception property.
- *
- * @return
- * possible object is
- * {@link MsoExceptionCategory }
- *
- */
- public MsoExceptionCategory getException() {
- return exception;
- }
-
- /**
- * Sets the value of the exception property.
- *
- * @param value
- * allowed object is
- * {@link MsoExceptionCategory }
- *
- */
- public void setException(MsoExceptionCategory value) {
- this.exception = value;
- }
-
- /**
- * Gets the value of the errorMessage property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getErrorMessage() {
- return errorMessage;
- }
-
- /**
- * Sets the value of the errorMessage property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setErrorMessage(String value) {
- this.errorMessage = value;
- }
-
- /**
- * Overrides toString() method
- * @return String type (deleteVnfNotification)
- */
-
- @Override
- public String toString() {
- String deleteVnfNotification;
- if (exception == null) {
- deleteVnfNotification = "<ns2:deleteVnfNotification xmlns:ns2=\"http://org.openecomp.mso/vnfNotify\"" + '\n' +
- " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' +
- " <messageId>"+messageId+"</messageId>" + '\n' +
- " <completed>"+completed+"</completed>" + '\n' +
- "</ns2:deleteVnfNotification>";
- } else {
- deleteVnfNotification = "<ns2:deleteVnfNotification xmlns:ns2=\"http://org.openecomp.mso/vnfNotify\"" + '\n' +
- " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' +
- " <messageId>"+messageId+"</messageId>" + '\n' +
- " <completed>"+completed+"</completed>" + '\n' +
- " <exception>"+exception+"</exception>" + '\n' +
- " <errorMessage>"+errorMessage+"</errorMessage>" + '\n' +
- "</ns2:deleteVnfNotification>";
- }
- return deleteVnfNotification;
- }
-
-/*
- public String toString() {
- StringWriter writer = new StringWriter();
- try {
- JAXBContext context = JAXBContext
- .newInstance(DeleteVnfNotification.class);
- Marshaller m = context.createMarshaller();
- m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
- m.marshal(this, writer);
- //System.out.println("toString() - " + writer.getBuffer().toString());
- return writer.getBuffer().toString();
- } catch (JAXBException e) {
- //System.out.println("JAXBException - " + e.getStackTrace());
- return "";
- }
- }
-*/
-
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/MsoExceptionCategory.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/MsoExceptionCategory.java deleted file mode 100644 index 02dc1edcb7..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/MsoExceptionCategory.java +++ /dev/null @@ -1,61 +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.common.adapter.vnf;
-
-import javax.xml.bind.annotation.XmlEnum;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * <p>Java class for msoExceptionCategory.
- *
- * <p>The following schema fragment specifies the expected content contained within this class.
- * <p>
- * <pre>
- * <simpleType name="msoExceptionCategory">
- * <restriction base="{http://www.w3.org/2001/XMLSchema}string">
- * <enumeration value="OPENSTACK"/>
- * <enumeration value="IO"/>
- * <enumeration value="INTERNAL"/>
- * <enumeration value="USERDATA"/>
- * </restriction>
- * </simpleType>
- * </pre>
- *
- */
-@XmlType(name = "msoExceptionCategory")
-@XmlEnum
-public enum MsoExceptionCategory {
-
- OPENSTACK,
- IO,
- INTERNAL,
- USERDATA;
-
- public String value() {
- return name();
- }
-
- public static MsoExceptionCategory fromValue(String v) {
- return valueOf(v);
- }
-
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/MsoRequest.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/MsoRequest.java deleted file mode 100644 index eabd465934..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/MsoRequest.java +++ /dev/null @@ -1,112 +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.common.adapter.vnf; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlType; - - -/** - * <p>Java class for msoRequest complex type. - * - * <p>The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType name="msoRequest"> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="requestId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * <element name="serviceInstanceId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "msoRequest", propOrder = { - "requestId", - "serviceInstanceId" -}) -public class MsoRequest { - - protected String requestId; - protected String serviceInstanceId; - - /** - * Gets the value of the requestId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getRequestId() { - return requestId; - } - - /** - * Sets the value of the requestId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setRequestId(String value) { - this.requestId = value; - } - - /** - * Gets the value of the serviceInstanceId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getServiceInstanceId() { - return serviceInstanceId; - } - - /** - * Sets the value of the serviceInstanceId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setServiceInstanceId(String value) { - this.serviceInstanceId = value; - } - - @Override - public String toString() { - return "<requestId>" + requestId + "</requestId>" + '\n' + "<serviceInstanceId>" + serviceInstanceId - + "</serviceInstanceId>"; - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/ObjectFactory.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/ObjectFactory.java deleted file mode 100644 index c22fd286cf..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/ObjectFactory.java +++ /dev/null @@ -1,208 +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.common.adapter.vnf; - -import javax.xml.bind.JAXBElement; -import javax.xml.bind.annotation.XmlElementDecl; -import javax.xml.bind.annotation.XmlRegistry; -import javax.xml.namespace.QName; - - -/** - * This object contains factory methods for each - * Java content interface and Java element interface - * generated in the org.openecomp.mso.adapters.vnf.async.client package. - * <p>An ObjectFactory allows you to programatically - * construct new instances of the Java representation - * for XML content. The Java representation of XML - * content can consist of schema derived interfaces - * and classes representing the binding of schema - * type definitions, element declarations and model - * groups. Factory methods for each of these are - * provided in this class. - * - */ -@XmlRegistry -public class ObjectFactory { - - private final static QName _RollbackVnfNotification_QNAME = new QName("http://org.openecomp.mso/vnfNotify", "rollbackVnfNotification"); - private final static QName _DeleteVnfNotification_QNAME = new QName("http://org.openecomp.mso/vnfNotify", "deleteVnfNotification"); - private final static QName _CreateVnfNotification_QNAME = new QName("http://org.openecomp.mso/vnfNotify", "createVnfNotification"); - private final static QName _UpdateVnfNotification_QNAME = new QName("http://org.openecomp.mso/vnfNotify", "updateVnfNotification"); - private final static QName _QueryVnfNotification_QNAME = new QName("http://org.openecomp.mso/vnfNotify", "queryVnfNotification"); - - /** - * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.openecomp.mso.adapters.vnf.async.client - * - */ - public ObjectFactory() { - } - - /** - * Create an instance of {@link UpdateVnfNotification } - * - */ - public UpdateVnfNotification createUpdateVnfNotification() { - return new UpdateVnfNotification(); - } - - /** - * Create an instance of {@link UpdateVnfNotification.Outputs } - * - */ - public UpdateVnfNotification.Outputs createUpdateVnfNotificationOutputs() { - return new UpdateVnfNotification.Outputs(); - } - - /** - * Create an instance of {@link QueryVnfNotification } - * - */ - public QueryVnfNotification createQueryVnfNotification() { - return new QueryVnfNotification(); - } - - /** - * Create an instance of {@link QueryVnfNotification.Outputs } - * - */ - public QueryVnfNotification.Outputs createQueryVnfNotificationOutputs() { - return new QueryVnfNotification.Outputs(); - } - - /** - * Create an instance of {@link CreateVnfNotification } - * - */ - public CreateVnfNotification createCreateVnfNotification() { - return new CreateVnfNotification(); - } - - /** - * Create an instance of {@link CreateVnfNotification.Outputs } - * - */ - public CreateVnfNotification.Outputs createCreateVnfNotificationOutputs() { - return new CreateVnfNotification.Outputs(); - } - - /** - * Create an instance of {@link DeleteVnfNotification } - * - */ - public DeleteVnfNotification createDeleteVnfNotification() { - return new DeleteVnfNotification(); - } - - /** - * Create an instance of {@link RollbackVnfNotification } - * - */ - public RollbackVnfNotification createRollbackVnfNotification() { - return new RollbackVnfNotification(); - } - - /** - * Create an instance of {@link MsoRequest } - * - */ - public MsoRequest createMsoRequest() { - return new MsoRequest(); - } - - /** - * Create an instance of {@link VnfRollback } - * - */ - public VnfRollback createVnfRollback() { - return new VnfRollback(); - } - - /** - * Create an instance of {@link UpdateVnfNotification.Outputs.Entry } - * - */ - public UpdateVnfNotification.Outputs.Entry createUpdateVnfNotificationOutputsEntry() { - return new UpdateVnfNotification.Outputs.Entry(); - } - - /** - * Create an instance of {@link QueryVnfNotification.Outputs.Entry } - * - */ - public QueryVnfNotification.Outputs.Entry createQueryVnfNotificationOutputsEntry() { - return new QueryVnfNotification.Outputs.Entry(); - } - - /** - * Create an instance of {@link CreateVnfNotification.Outputs.Entry } - * - */ - public CreateVnfNotification.Outputs.Entry createCreateVnfNotificationOutputsEntry() { - return new CreateVnfNotification.Outputs.Entry(); - } - - /** - * Create an instance of {@link JAXBElement }{@code <}{@link RollbackVnfNotification }{@code >}} - * - */ - @XmlElementDecl(namespace = "http://org.openecomp.mso/vnfNotify", name = "rollbackVnfNotification") - public JAXBElement<RollbackVnfNotification> createRollbackVnfNotification(RollbackVnfNotification value) { - return new JAXBElement<>(_RollbackVnfNotification_QNAME, RollbackVnfNotification.class, null, value); - } - - /** - * Create an instance of {@link JAXBElement }{@code <}{@link DeleteVnfNotification }{@code >}} - * - */ - @XmlElementDecl(namespace = "http://org.openecomp.mso/vnfNotify", name = "deleteVnfNotification") - public JAXBElement<DeleteVnfNotification> createDeleteVnfNotification(DeleteVnfNotification value) { - return new JAXBElement<>(_DeleteVnfNotification_QNAME, DeleteVnfNotification.class, null, value); - } - - /** - * Create an instance of {@link JAXBElement }{@code <}{@link CreateVnfNotification }{@code >}} - * - */ - @XmlElementDecl(namespace = "http://org.openecomp.mso/vnfNotify", name = "createVnfNotification") - public JAXBElement<CreateVnfNotification> createCreateVnfNotification(CreateVnfNotification value) { - return new JAXBElement<>(_CreateVnfNotification_QNAME, CreateVnfNotification.class, null, value); - } - - /** - * Create an instance of {@link JAXBElement }{@code <}{@link UpdateVnfNotification }{@code >}} - * - */ - @XmlElementDecl(namespace = "http://org.openecomp.mso/vnfNotify", name = "updateVnfNotification") - public JAXBElement<UpdateVnfNotification> createUpdateVnfNotification(UpdateVnfNotification value) { - return new JAXBElement<>(_UpdateVnfNotification_QNAME, UpdateVnfNotification.class, null, value); - } - - /** - * Create an instance of {@link JAXBElement }{@code <}{@link QueryVnfNotification }{@code >}} - * - */ - @XmlElementDecl(namespace = "http://org.openecomp.mso/vnfNotify", name = "queryVnfNotification") - public JAXBElement<QueryVnfNotification> createQueryVnfNotification(QueryVnfNotification value) { - return new JAXBElement<>(_QueryVnfNotification_QNAME, QueryVnfNotification.class, null, value); - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/QueryVnfNotification.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/QueryVnfNotification.java deleted file mode 100644 index 4e84234c81..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/QueryVnfNotification.java +++ /dev/null @@ -1,488 +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.common.adapter.vnf;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * <p>Java class for queryVnfNotification complex type.
- *
- * <p>The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * <complexType name="queryVnfNotification">
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * <element name="completed" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
- * <element name="exception" type="{http://org.openecomp.mso/vnfNotify}msoExceptionCategory" minOccurs="0"/>
- * <element name="errorMessage" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * <element name="vnfExists" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
- * <element name="vnfId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * <element name="status" type="{http://org.openecomp.mso/vnfNotify}vnfStatus" minOccurs="0"/>
- * <element name="outputs" minOccurs="0">
- * <complexType>
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="entry" maxOccurs="unbounded" minOccurs="0">
- * <complexType>
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * <element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * </sequence>
- * </restriction>
- * </complexContent>
- * </complexType>
- * </element>
- * </sequence>
- * </restriction>
- * </complexContent>
- * </complexType>
- * </element>
- * </sequence>
- * </restriction>
- * </complexContent>
- * </complexType>
- * </pre>
- *
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "queryVnfNotification1", propOrder = {
- "messageId",
- "completed",
- "exception",
- "errorMessage",
- "vnfExists",
- "vnfId",
- "status",
- "outputs"
-})
-public class QueryVnfNotification {
-
- @XmlElement(required = true)
- protected String messageId;
- protected boolean completed;
- protected MsoExceptionCategory exception;
- protected String errorMessage;
- protected Boolean vnfExists;
- protected String vnfId;
- protected VnfStatus status;
- protected QueryVnfNotification.Outputs outputs;
-
- /**
- * Gets the value of the messageId property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getMessageId() {
- return messageId;
- }
-
- /**
- * Sets the value of the messageId property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setMessageId(String value) {
- this.messageId = value;
- }
-
- /**
- * Gets the value of the completed property.
- *
- */
- public boolean isCompleted() {
- return completed;
- }
-
- /**
- * Sets the value of the completed property.
- *
- */
- public void setCompleted(boolean value) {
- this.completed = value;
- }
-
- /**
- * Gets the value of the exception property.
- *
- * @return
- * possible object is
- * {@link MsoExceptionCategory }
- *
- */
- public MsoExceptionCategory getException() {
- return exception;
- }
-
- /**
- * Sets the value of the exception property.
- *
- * @param value
- * allowed object is
- * {@link MsoExceptionCategory }
- *
- */
- public void setException(MsoExceptionCategory value) {
- this.exception = value;
- }
-
- /**
- * Gets the value of the errorMessage property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getErrorMessage() {
- return errorMessage;
- }
-
- /**
- * Sets the value of the errorMessage property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setErrorMessage(String value) {
- this.errorMessage = value;
- }
-
- /**
- * Gets the value of the vnfExists property.
- *
- * @return
- * possible object is
- * {@link Boolean }
- *
- */
- public Boolean isVnfExists() {
- return vnfExists;
- }
-
- /**
- * Sets the value of the vnfExists property.
- *
- * @param value
- * allowed object is
- * {@link Boolean }
- *
- */
- public void setVnfExists(Boolean value) {
- this.vnfExists = value;
- }
-
- /**
- * Gets the value of the vnfId property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getVnfId() {
- return vnfId;
- }
-
- /**
- * Sets the value of the vnfId property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setVnfId(String value) {
- this.vnfId = value;
- }
-
- /**
- * Gets the value of the status property.
- *
- * @return
- * possible object is
- * {@link VnfStatus }
- *
- */
- public VnfStatus getStatus() {
- return status;
- }
-
- /**
- * Sets the value of the status property.
- *
- * @param value
- * allowed object is
- * {@link VnfStatus }
- *
- */
- public void setStatus(VnfStatus value) {
- this.status = value;
- }
-
- /**
- * Gets the value of the outputs property.
- *
- * @return
- * possible object is
- * {@link QueryVnfNotification.Outputs }
- *
- */
- public QueryVnfNotification.Outputs getOutputs() {
- return outputs;
- }
-
- /**
- * Sets the value of the outputs property.
- *
- * @param value
- * allowed object is
- * {@link QueryVnfNotification.Outputs }
- *
- */
- public void setOutputs(QueryVnfNotification.Outputs value) {
- this.outputs = value;
- }
-
-
- /**
- * <p>Java class for anonymous complex type.
- *
- * <p>The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * <complexType>
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="entry" maxOccurs="unbounded" minOccurs="0">
- * <complexType>
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * <element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * </sequence>
- * </restriction>
- * </complexContent>
- * </complexType>
- * </element>
- * </sequence>
- * </restriction>
- * </complexContent>
- * </complexType>
- * </pre>
- *
- *
- */
- @XmlAccessorType(XmlAccessType.FIELD)
- @XmlType(name = "", propOrder = {
- "entry"
- })
- public static class Outputs {
-
- protected List<QueryVnfNotification.Outputs.Entry> entry;
-
- /**
- * Gets the value of the entry property.
- *
- * <p>
- * This accessor method returns a reference to the live list,
- * not a snapshot. Therefore any modification you make to the
- * returned list will be present inside the JAXB object.
- * This is why there is not a <CODE>set</CODE> method for the entry property.
- *
- * <p>
- * For example, to add a new item, do as follows:
- * <pre>
- * getEntry().add(newItem);
- * </pre>
- *
- *
- * <p>
- * Objects of the following type(s) are allowed in the list
- * {@link QueryVnfNotification.Outputs.Entry }
- *
- *
- */
- public List<QueryVnfNotification.Outputs.Entry> getEntry() {
- if (entry == null) {
- entry = new ArrayList<>();
- }
- return this.entry;
- }
-
- // Not a generated method
- public String toString() {
- StringBuilder out = new StringBuilder();
- out.append("<outputs>\n");
- if (entry != null) {
- for (Entry e : entry) {
- out.append(e.toString());
- out.append('\n');
- }
- }
- out.append("</outputs>");
- return out.toString();
- }
-
-
- /**
- * <p>Java class for anonymous complex type.
- *
- * <p>The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * <complexType>
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * <element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * </sequence>
- * </restriction>
- * </complexContent>
- * </complexType>
- * </pre>
- *
- *
- */
- @XmlAccessorType(XmlAccessType.FIELD)
- @XmlType(name = "", propOrder = {
- "key",
- "value"
- })
- public static class Entry {
-
- protected String key;
- protected String value;
-
- /**
- * Gets the value of the key property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getKey() {
- return key;
- }
-
- /**
- * Sets the value of the key property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setKey(String value) {
- this.key = value;
- }
-
- /**
- * Gets the value of the value property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getValue() {
- return value;
- }
-
- /**
- * Sets the value of the value property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setValue(String value) {
- this.value = value;
- }
-
- // Not a generated method
- public String toString() {
- String entry = "";
- entry =
- "<entry>"+ '\n' +
- " <key>"+key+"</key>" + '\n' +
- " <value>"+value+"</value>" + '\n' +
- "</entry>";
- return entry;
- }
-
- }
-
- }
-
- // Not a generated method
- public String toString() {
- String queryVnfNotification = "";
- if (exception==null) {
- queryVnfNotification = "<ns2:queryVnfNotification xmlns:ns2=\"http://org.openecomp.mso/vnfNotify\"" + '\n' +
- " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' +
- " <messageId>"+messageId+"</messageId>" + '\n' +
- " <completed>"+completed+"</completed>" + '\n' +
- " <vnfExists>"+vnfExists+"</vnfExists>" + '\n' +
- " <vnfId>"+vnfId+"</vnfId>" + '\n' +
- " <status>"+status+"</status>" + '\n' +
- (outputs == null ? "" : outputs.toString() + '\n') +
- "</ns2:queryVnfNotification>";
- } else {
- queryVnfNotification = "<ns2:queryVnfNotification xmlns:ns2=\"http://org.openecomp.mso/vnfNotify\"" + '\n' +
- " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' +
- " <messageId>"+messageId+"</messageId>" + '\n' +
- " <completed>"+completed+"</completed>" + '\n' +
- (outputs == null ? "" : outputs.toString() + '\n') +
- " <exception>"+exception+"</exception>" + '\n' +
- " <errorMessage>"+errorMessage+"</errorMessage>" + '\n' +
- "</ns2:queryVnfNotification>";
- }
- return queryVnfNotification;
- }
-
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/RollbackVnfNotification.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/RollbackVnfNotification.java deleted file mode 100644 index 0cf088d023..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/RollbackVnfNotification.java +++ /dev/null @@ -1,175 +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.common.adapter.vnf; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - * <p>Java class for rollbackVnfNotification complex type. - * - * <p>The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType name="rollbackVnfNotification"> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/> - * <element name="completed" type="{http://www.w3.org/2001/XMLSchema}boolean"/> - * <element name="exception" type="{http://org.openecomp.mso/vnfNotify}msoExceptionCategory" minOccurs="0"/> - * <element name="errorMessage" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "rollbackVnfNotification1", propOrder = { - "messageId", - "completed", - "exception", - "errorMessage" -}) -public class RollbackVnfNotification { - - @XmlElement(required = true) - protected String messageId; - protected boolean completed; - protected MsoExceptionCategory exception; - protected String errorMessage; - - /** - * Gets the value of the messageId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getMessageId() { - return messageId; - } - - /** - * Sets the value of the messageId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setMessageId(String value) { - this.messageId = value; - } - - /** - * Gets the value of the completed property. - * - */ - public boolean isCompleted() { - return completed; - } - - /** - * Sets the value of the completed property. - * - */ - public void setCompleted(boolean value) { - this.completed = value; - } - - /** - * Gets the value of the exception property. - * - * @return - * possible object is - * {@link MsoExceptionCategory } - * - */ - public MsoExceptionCategory getException() { - return exception; - } - - /** - * Sets the value of the exception property. - * - * @param value - * allowed object is - * {@link MsoExceptionCategory } - * - */ - public void setException(MsoExceptionCategory value) { - this.exception = value; - } - - /** - * Gets the value of the errorMessage property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getErrorMessage() { - return errorMessage; - } - - /** - * Sets the value of the errorMessage property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setErrorMessage(String value) { - this.errorMessage = value; - } - - public String toString() { - String rollbackVnfNotification = ""; - if (exception==null) { - rollbackVnfNotification = "<ns2:rollbackVnfNotification xmlns:ns2=\"http://org.openecomp.mso/vnfNotify\"" + '\n' + - " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' + - " <messageId>"+messageId+"</messageId>" + '\n' + - " <completed>"+completed+"</completed>" + '\n' + - "</ns2:rollbackVnfNotification>"; - } else { - rollbackVnfNotification = "<ns2:rollbackVnfNotification xmlns:ns2=\"http://org.openecomp.mso/vnfNotify\"" + '\n' + - " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' + - " <messageId>"+messageId+"</messageId>" + '\n' + - " <completed>"+completed+"</completed>" + '\n' + - " <exception>"+exception+"</exception>" + '\n' + - " <errorMessage>"+errorMessage+"</errorMessage>" + '\n' + - "</ns2:rollbackVnfNotification>"; - } - return rollbackVnfNotification; - - } - - } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/UpdateVnfNotification.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/UpdateVnfNotification.java deleted file mode 100644 index 79188e77b6..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/UpdateVnfNotification.java +++ /dev/null @@ -1,412 +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.common.adapter.vnf; - -import java.util.ArrayList; -import java.util.List; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - * <p>Java class for updateVnfNotification complex type. - * - * <p>The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType name="updateVnfNotification"> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/> - * <element name="completed" type="{http://www.w3.org/2001/XMLSchema}boolean"/> - * <element name="exception" type="{http://org.openecomp.mso/vnfNotify}msoExceptionCategory" minOccurs="0"/> - * <element name="errorMessage" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * <element name="outputs" minOccurs="0"> - * <complexType> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="entry" maxOccurs="unbounded" minOccurs="0"> - * <complexType> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * <element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </element> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </element> - * <element name="rollback" type="{http://org.openecomp.mso/vnfNotify}vnfRollback" minOccurs="0"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "updateVnfNotification1", propOrder = { - "messageId", - "completed", - "exception", - "errorMessage", - "outputs", - "rollback" -}) -public class UpdateVnfNotification { - - @XmlElement(required = true) - protected String messageId; - protected boolean completed; - protected MsoExceptionCategory exception; - protected String errorMessage; - protected UpdateVnfNotification.Outputs outputs; - protected VnfRollback rollback; - - /** - * Gets the value of the messageId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getMessageId() { - return messageId; - } - - /** - * Sets the value of the messageId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setMessageId(String value) { - this.messageId = value; - } - - /** - * Gets the value of the completed property. - * - */ - public boolean isCompleted() { - return completed; - } - - /** - * Sets the value of the completed property. - * - */ - public void setCompleted(boolean value) { - this.completed = value; - } - - /** - * Gets the value of the exception property. - * - * @return - * possible object is - * {@link MsoExceptionCategory } - * - */ - public MsoExceptionCategory getException() { - return exception; - } - - /** - * Sets the value of the exception property. - * - * @param value - * allowed object is - * {@link MsoExceptionCategory } - * - */ - public void setException(MsoExceptionCategory value) { - this.exception = value; - } - - /** - * Gets the value of the errorMessage property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getErrorMessage() { - return errorMessage; - } - - /** - * Sets the value of the errorMessage property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setErrorMessage(String value) { - this.errorMessage = value; - } - - /** - * Gets the value of the outputs property. - * - * @return - * possible object is - * {@link UpdateVnfNotification.Outputs } - * - */ - public UpdateVnfNotification.Outputs getOutputs() { - return outputs; - } - - /** - * Sets the value of the outputs property. - * - * @param value - * allowed object is - * {@link UpdateVnfNotification.Outputs } - * - */ - public void setOutputs(UpdateVnfNotification.Outputs value) { - this.outputs = value; - } - - /** - * Gets the value of the rollback property. - * - * @return - * possible object is - * {@link VnfRollback } - * - */ - public VnfRollback getRollback() { - return rollback; - } - - /** - * Sets the value of the rollback property. - * - * @param value - * allowed object is - * {@link VnfRollback } - * - */ - public void setRollback(VnfRollback value) { - this.rollback = value; - } - - - /** - * <p>Java class for anonymous complex type. - * - * <p>The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="entry" maxOccurs="unbounded" minOccurs="0"> - * <complexType> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * <element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </element> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ - @XmlAccessorType(XmlAccessType.FIELD) - @XmlType(name = "", propOrder = { - "entry" - }) - public static class Outputs { - - protected List<UpdateVnfNotification.Outputs.Entry> entry; - - /** - * Gets the value of the entry property. - * - * <p> - * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a <CODE>set</CODE> method for the entry property. - * - * <p> - * For example, to add a new item, do as follows: - * <pre> - * getEntry().add(newItem); - * </pre> - * - * - * <p> - * Objects of the following type(s) are allowed in the list - * {@link UpdateVnfNotification.Outputs.Entry } - * - * - */ - public List<UpdateVnfNotification.Outputs.Entry> getEntry() { - if (entry == null) { - entry = new ArrayList<>(); - } - return this.entry; - } - - - /** - * <p>Java class for anonymous complex type. - * - * <p>The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * <element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ - @XmlAccessorType(XmlAccessType.FIELD) - @XmlType(name = "", propOrder = { - "key", - "value" - }) - public static class Entry { - - protected String key; - protected String value; - - /** - * Gets the value of the key property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getKey() { - return key; - } - - /** - * Sets the value of the key property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setKey(String value) { - this.key = value; - } - - /** - * Gets the value of the value property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getValue() { - return value; - } - - /** - * Sets the value of the value property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setValue(String value) { - this.value = value; - } - - public String toString() { - String entry = ""; - entry = - " <key>"+key+"</key>" + '\n' + - " <value>"+value+"</value>"; - return entry; - } - } - - } - - public String toString(){ - String updateVnfNotification = ""; - if (exception==null) { - updateVnfNotification = "<ns2:updateVnfNotification xmlns:ns2=\"http://org.openecomp.mso/vnfNotify\"" + '\n' + - " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' + - " <messageId>"+messageId+"</messageId>" + '\n' + - " <completed>"+completed+"</completed>" + '\n' + - " <rollback>"+rollback+"</rollback>" + '\n' + - "</ns2:updateVnfNotification>"; - } else { - updateVnfNotification = "<ns2:updateVnfNotification xmlns:ns2=\"http://org.openecomp.mso/vnfNotify\"" + '\n' + - " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' + - " <messageId>"+messageId+"</messageId>" + '\n' + - " <completed>"+completed+"</completed>" + '\n' + - " <exception>"+exception+"</exception>" + '\n' + - " <errorMessage>"+errorMessage+"</errorMessage>" + '\n' + - "</ns2:updateVnfNotification>"; - } - - return updateVnfNotification; - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfAdapterNotify.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfAdapterNotify.java deleted file mode 100644 index d192bb34a9..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfAdapterNotify.java +++ /dev/null @@ -1,177 +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.common.adapter.vnf; - -import javax.jws.Oneway; -import javax.jws.WebMethod; -import javax.jws.WebParam; -import javax.jws.WebService; -import javax.xml.bind.annotation.XmlSeeAlso; -import javax.xml.ws.Action; -import javax.xml.ws.RequestWrapper; - - -/** - * This class was generated by the JAX-WS RI. - * JAX-WS RI 2.2.8 - * Generated source version: 2.2 - * - */ -@WebService(name = "vnfAdapterNotify", targetNamespace = "http://org.openecomp.mso/vnfNotify") -@XmlSeeAlso({ - ObjectFactory.class -}) -public interface VnfAdapterNotify { - - - /** - * - * @param errorMessage - * @param exception - * @param messageId - * @param completed - */ - @WebMethod - @Oneway - @RequestWrapper(localName = "rollbackVnfNotification", targetNamespace = "http://org.openecomp.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.RollbackVnfNotification") - @Action(input = "http://org.openecomp.mso/notify/adapterNotify/rollbackVnfNotificationRequest") - public void rollbackVnfNotification( - @WebParam(name = "messageId", targetNamespace = "") - String messageId, - @WebParam(name = "completed", targetNamespace = "") - boolean completed, - @WebParam(name = "exception", targetNamespace = "") - MsoExceptionCategory exception, - @WebParam(name = "errorMessage", targetNamespace = "") - String errorMessage); - - /** - * - * @param errorMessage - * @param vnfExists - * @param status - * @param exception - * @param outputs - * @param messageId - * @param vnfId - * @param completed - */ - @WebMethod - @Oneway - @RequestWrapper(localName = "queryVnfNotification", targetNamespace = "http://org.openecomp.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.QueryVnfNotification") - @Action(input = "http://org.openecomp.mso/notify/adapterNotify/queryVnfNotificationRequest") - public void queryVnfNotification( - @WebParam(name = "messageId", targetNamespace = "") - String messageId, - @WebParam(name = "completed", targetNamespace = "") - boolean completed, - @WebParam(name = "exception", targetNamespace = "") - MsoExceptionCategory exception, - @WebParam(name = "errorMessage", targetNamespace = "") - String errorMessage, - @WebParam(name = "vnfExists", targetNamespace = "") - Boolean vnfExists, - @WebParam(name = "vnfId", targetNamespace = "") - String vnfId, - @WebParam(name = "status", targetNamespace = "") - VnfStatus status, - @WebParam(name = "outputs", targetNamespace = "") - org.openecomp.mso.bpmn.common.adapter.vnf.QueryVnfNotification.Outputs outputs); - - /** - * - * @param errorMessage - * @param exception - * @param rollback - * @param outputs - * @param messageId - * @param vnfId - * @param completed - */ - @WebMethod - @Oneway - @RequestWrapper(localName = "createVnfNotification", targetNamespace = "http://org.openecomp.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.CreateVnfNotification") - @Action(input = "http://org.openecomp.mso/notify/adapterNotify/createVnfNotificationRequest") - public void createVnfNotification( - @WebParam(name = "messageId", targetNamespace = "") - String messageId, - @WebParam(name = "completed", targetNamespace = "") - boolean completed, - @WebParam(name = "exception", targetNamespace = "") - MsoExceptionCategory exception, - @WebParam(name = "errorMessage", targetNamespace = "") - String errorMessage, - @WebParam(name = "vnfId", targetNamespace = "") - String vnfId, - @WebParam(name = "outputs", targetNamespace = "") - org.openecomp.mso.bpmn.common.adapter.vnf.CreateVnfNotification.Outputs outputs, - @WebParam(name = "rollback", targetNamespace = "") - VnfRollback rollback); - - /** - * - * @param errorMessage - * @param exception - * @param rollback - * @param outputs - * @param messageId - * @param completed - */ - @WebMethod - @Oneway - @RequestWrapper(localName = "updateVnfNotification", targetNamespace = "http://org.openecomp.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.UpdateVnfNotification") - @Action(input = "http://org.openecomp.mso/notify/adapterNotify/updateVnfNotificationRequest") - public void updateVnfNotification( - @WebParam(name = "messageId", targetNamespace = "") - String messageId, - @WebParam(name = "completed", targetNamespace = "") - boolean completed, - @WebParam(name = "exception", targetNamespace = "") - MsoExceptionCategory exception, - @WebParam(name = "errorMessage", targetNamespace = "") - String errorMessage, - @WebParam(name = "outputs", targetNamespace = "") - org.openecomp.mso.bpmn.common.adapter.vnf.UpdateVnfNotification.Outputs outputs, - @WebParam(name = "rollback", targetNamespace = "") - VnfRollback rollback); - - /** - * - * @param errorMessage - * @param exception - * @param messageId - * @param completed - */ - @WebMethod - @Oneway - @RequestWrapper(localName = "deleteVnfNotification", targetNamespace = "http://org.openecomp.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.DeleteVnfNotification") - @Action(input = "http://org.openecomp.mso/notify/adapterNotify/deleteVnfNotificationRequest") - public void deleteVnfNotification( - @WebParam(name = "messageId", targetNamespace = "") - String messageId, - @WebParam(name = "completed", targetNamespace = "") - boolean completed, - @WebParam(name = "exception", targetNamespace = "") - MsoExceptionCategory exception, - @WebParam(name = "errorMessage", targetNamespace = "") - String errorMessage); - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfAdapterNotify_Service.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfAdapterNotify_Service.java deleted file mode 100644 index 38385fbe9c..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfAdapterNotify_Service.java +++ /dev/null @@ -1,108 +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.common.adapter.vnf; - -import java.net.URL; -import javax.xml.namespace.QName; -import javax.xml.ws.Service; -import javax.xml.ws.WebEndpoint; -import javax.xml.ws.WebServiceClient; -import javax.xml.ws.WebServiceException; -import javax.xml.ws.WebServiceFeature; - - -/** - * This class was generated by the JAX-WS RI. - * JAX-WS RI 2.2.8 - * Generated source version: 2.2 - * - */ -@WebServiceClient(name = "vnfAdapterNotify", targetNamespace = "http://org.openecomp.mso/vnfNotify", wsdlLocation = "/VnfAdapterNotify.wsdl") -public class VnfAdapterNotify_Service extends Service -{ - - private final static URL VNFADAPTERNOTIFY_WSDL_LOCATION; - private final static WebServiceException VNFADAPTERNOTIFY_EXCEPTION; - private final static QName VNFADAPTERNOTIFY_QNAME = new QName("http://org.openecomp.mso/vnfNotify", "vnfAdapterNotify"); - - static { - VNFADAPTERNOTIFY_WSDL_LOCATION = org.openecomp.mso.bpmn.common.adapter.vnf.VnfAdapterNotify_Service.class.getResource("/VnfAdapterNotify.wsdl"); - WebServiceException e = null; - if (VNFADAPTERNOTIFY_WSDL_LOCATION == null) { - e = new WebServiceException("Cannot find '/VnfAdapterNotify.wsdl' wsdl. Place the resource correctly in the classpath."); - } - VNFADAPTERNOTIFY_EXCEPTION = e; - } - - public VnfAdapterNotify_Service() { - super(__getWsdlLocation(), VNFADAPTERNOTIFY_QNAME); - } - - public VnfAdapterNotify_Service(WebServiceFeature... features) { - super(__getWsdlLocation(), VNFADAPTERNOTIFY_QNAME, features); - } - - public VnfAdapterNotify_Service(URL wsdlLocation) { - super(wsdlLocation, VNFADAPTERNOTIFY_QNAME); - } - - public VnfAdapterNotify_Service(URL wsdlLocation, WebServiceFeature... features) { - super(wsdlLocation, VNFADAPTERNOTIFY_QNAME, features); - } - - public VnfAdapterNotify_Service(URL wsdlLocation, QName serviceName) { - super(wsdlLocation, serviceName); - } - - public VnfAdapterNotify_Service(URL wsdlLocation, QName serviceName, WebServiceFeature... features) { - super(wsdlLocation, serviceName, features); - } - - /** - * - * @return - * returns VnfAdapterNotify - */ - @WebEndpoint(name = "MsoVnfAdapterAsyncImplPort") - public VnfAdapterNotify getMsoVnfAdapterAsyncImplPort() { - return super.getPort(new QName("http://org.openecomp.mso/vnfNotify", "MsoVnfAdapterAsyncImplPort"), VnfAdapterNotify.class); - } - - /** - * - * @param features - * A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the <code>features</code> parameter will have their default values. - * @return - * returns VnfAdapterNotify - */ - @WebEndpoint(name = "MsoVnfAdapterAsyncImplPort") - public VnfAdapterNotify getMsoVnfAdapterAsyncImplPort(WebServiceFeature... features) { - return super.getPort(new QName("http://org.openecomp.mso/vnfNotify", "MsoVnfAdapterAsyncImplPort"), VnfAdapterNotify.class, features); - } - - private static URL __getWsdlLocation() { - if (VNFADAPTERNOTIFY_EXCEPTION!= null) { - throw VNFADAPTERNOTIFY_EXCEPTION; - } - return VNFADAPTERNOTIFY_WSDL_LOCATION; - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfRollback.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfRollback.java deleted file mode 100644 index a546b82325..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfRollback.java +++ /dev/null @@ -1,210 +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.common.adapter.vnf; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlType; - - -/** - * <p>Java class for vnfRollback complex type. - * - * <p>The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType name="vnfRollback"> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="cloudSiteId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * <element name="msoRequest" type="{http://org.openecomp.mso/vnfNotify}msoRequest" minOccurs="0"/> - * <element name="tenantCreated" type="{http://www.w3.org/2001/XMLSchema}boolean"/> - * <element name="tenantId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * <element name="vnfCreated" type="{http://www.w3.org/2001/XMLSchema}boolean"/> - * <element name="vnfId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "vnfRollback", propOrder = { - "cloudSiteId", - "msoRequest", - "tenantCreated", - "tenantId", - "vnfCreated", - "vnfId" -}) -public class VnfRollback { - - protected String cloudSiteId; - protected MsoRequest msoRequest; - protected boolean tenantCreated; - protected String tenantId; - protected boolean vnfCreated; - protected String vnfId; - - /** - * Gets the value of the cloudSiteId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getCloudSiteId() { - return cloudSiteId; - } - - /** - * Sets the value of the cloudSiteId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setCloudSiteId(String value) { - this.cloudSiteId = value; - } - - /** - * Gets the value of the msoRequest property. - * - * @return - * possible object is - * {@link MsoRequest } - * - */ - public MsoRequest getMsoRequest() { - return msoRequest; - } - - /** - * Sets the value of the msoRequest property. - * - * @param value - * allowed object is - * {@link MsoRequest } - * - */ - public void setMsoRequest(MsoRequest value) { - this.msoRequest = value; - } - - /** - * Gets the value of the tenantCreated property. - * - */ - public boolean isTenantCreated() { - return tenantCreated; - } - - /** - * Sets the value of the tenantCreated property. - * - */ - public void setTenantCreated(boolean value) { - this.tenantCreated = value; - } - - /** - * Gets the value of the tenantId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getTenantId() { - return tenantId; - } - - /** - * Sets the value of the tenantId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setTenantId(String value) { - this.tenantId = value; - } - - /** - * Gets the value of the vnfCreated property. - * - */ - public boolean isVnfCreated() { - return vnfCreated; - } - - /** - * Sets the value of the vnfCreated property. - * - */ - public void setVnfCreated(boolean value) { - this.vnfCreated = value; - } - - /** - * Gets the value of the vnfId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getVnfId() { - return vnfId; - } - - /** - * Sets the value of the vnfId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setVnfId(String value) { - this.vnfId = value; - } - - public String toString() { - String msoRequestElement = msoRequest == null ? "" - : "<msoRequest>"+msoRequest+"</msoRequest>" + '\n'; - - return - "<cloudSiteId>"+cloudSiteId+"</cloudSiteId>" + '\n' + - msoRequestElement + - "<tenantCreated>"+tenantCreated+"</tenantCreated>" + '\n' + - "<tenantId>"+tenantId+"</tenantId>" + '\n' + - "<vnfCreated>"+vnfCreated+"</vnfCreated>" + '\n' + - "<vnfId>"+vnfId+"</vnfId>"; - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfStatus.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfStatus.java deleted file mode 100644 index aef85470a7..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfStatus.java +++ /dev/null @@ -1,61 +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.common.adapter.vnf;
-
-import javax.xml.bind.annotation.XmlEnum;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * <p>Java class for vnfStatus.
- *
- * <p>The following schema fragment specifies the expected content contained within this class.
- * <p>
- * <pre>
- * <simpleType name="vnfStatus">
- * <restriction base="{http://www.w3.org/2001/XMLSchema}string">
- * <enumeration value="ACTIVE"/>
- * <enumeration value="FAILED"/>
- * <enumeration value="NOTFOUND"/>
- * <enumeration value="UNKNOWN"/>
- * </restriction>
- * </simpleType>
- * </pre>
- *
- */
-@XmlType(name = "vnfStatus")
-@XmlEnum
-public enum VnfStatus {
-
- ACTIVE,
- FAILED,
- NOTFOUND,
- UNKNOWN;
-
- public String value() {
- return name();
- }
-
- public static VnfStatus fromValue(String v) {
- return valueOf(v);
- }
-
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoUtils.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoUtils.java deleted file mode 100644 index 846b87aba8..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoUtils.java +++ /dev/null @@ -1,98 +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.common.util;
-
-
-import java.security.GeneralSecurityException;
-import java.security.NoSuchAlgorithmException;
-
-import javax.crypto.Cipher;
-import javax.crypto.spec.SecretKeySpec;
-
-//Need to add BPM error handler
-
-/**
- * CryptoUtils adapted from RTTP client.
- *
- */
-public class CryptoUtils {
-
- public static final String AES = "AES";
-
- /**
- * encrypt a value and generate a keyfile
- * if the keyfile is not found then a new one is created
- * @throws GeneralSecurityException
- * */
- public static String encrypt(String value, String keyString) throws GeneralSecurityException
- {
- SecretKeySpec sks = getSecretKeySpec(keyString);
- Cipher cipher = Cipher.getInstance(CryptoUtils.AES);
- cipher.init(Cipher.ENCRYPT_MODE, sks, cipher.getParameters());
- byte[] encrypted = cipher.doFinal(value.getBytes());
- return byteArrayToHexString(encrypted);
- }
-
- /**
- * decrypt a value
- * @throws GeneralSecurityException
- */
- public static String decrypt(String message, String keyString) throws GeneralSecurityException
- {
- SecretKeySpec sks = getSecretKeySpec(keyString);
- Cipher cipher = Cipher.getInstance(CryptoUtils.AES);
- cipher.init(Cipher.DECRYPT_MODE, sks);
- byte[] decrypted = cipher.doFinal(hexStringToByteArray(message));
- return new String(decrypted);
- }
-
- private static SecretKeySpec getSecretKeySpec(String keyString) throws NoSuchAlgorithmException
- {
- byte [] key = hexStringToByteArray(keyString);
- SecretKeySpec sks = new SecretKeySpec(key, CryptoUtils.AES);
- return sks;
- }
-
-
- private static String byteArrayToHexString(byte[] b){
- StringBuilder sb = new StringBuilder(b.length * 2);
- for (byte aB : b) {
- int v = aB & 0xff;
- if (v < 16) {
- sb.append('0');
- }
- sb.append(Integer.toHexString(v));
- }
- return sb.toString().toUpperCase();
- }
-
- private static byte[] hexStringToByteArray(String s) {
- byte[] b = new byte[s.length() / 2];
- for (int i = 0; i < b.length; i++){
- int index = i * 2;
- int v = Integer.parseInt(s.substring(index, index + 2), 16);
- b[i] = (byte)v;
- }
- return b;
- }
-
-}
-
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/AbstractCallbackService.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/AbstractCallbackService.java deleted file mode 100644 index f61c692775..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/AbstractCallbackService.java +++ /dev/null @@ -1,421 +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.common.workflow.service;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.camunda.bpm.BpmPlatform;
-import org.camunda.bpm.engine.MismatchingMessageCorrelationException;
-import org.camunda.bpm.engine.OptimisticLockingException;
-import org.camunda.bpm.engine.RuntimeService;
-import org.camunda.bpm.engine.runtime.Execution;
-import org.camunda.bpm.engine.runtime.MessageCorrelationResult;
-import org.openecomp.mso.bpmn.core.PropertyConfiguration;
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoLogger;
-
-/**
- * Abstract base class for callback services.
- */
-public abstract class AbstractCallbackService extends ProcessEngineAwareService {
- public static final long DEFAULT_TIMEOUT_SECONDS = 60;
- public static final long FAST_POLL_DUR_SECONDS = 5;
- public static final long FAST_POLL_INT_MS = 100;
- public static final long SLOW_POLL_INT_MS = 1000;
-
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
-
- /**
- * Parameterized callback handler.
- */
- protected CallbackResult handleCallback(String method, Object message,
- String messageEventName, String messageVariable,
- String correlationVariable, String correlationValue,
- String logMarker) {
-
- return handleCallback(method, message, messageEventName, messageVariable,
- correlationVariable, correlationValue, logMarker, null);
- }
-
- /**
- * Parameterized callback handler.
- */
- protected CallbackResult handleCallback(String method, Object message,
- String messageEventName, String messageVariable,
- String correlationVariable, String correlationValue,
- String logMarker, Map<String, Object> injectedVariables) {
-
- long startTime = System.currentTimeMillis();
-
- LOGGER.debug(logMarker + " " + method + " received message: "
- + (message == null ? "" : System.lineSeparator()) + message);
-
- try {
- Map<String, Object> variables = new HashMap<>();
-
- if (injectedVariables != null) {
- variables.putAll(injectedVariables);
- }
-
- variables.put(correlationVariable, correlationValue);
- variables.put(messageVariable, message == null ? null : message.toString());
-
- boolean ok = correlate(messageEventName, correlationVariable,
- correlationValue, variables, logMarker);
-
- if (!ok) {
- String msg = "No process is waiting for " + messageEventName
- + " with " + correlationVariable + " = '" + correlationValue + "'";
- logCallbackError(method, startTime, msg);
- return new CallbackError(msg);
- }
-
- logCallbackSuccess(method, startTime);
- return new CallbackSuccess();
- } catch (Exception e) {
- LOGGER.debug("Exception :",e);
- String msg = "Caught " + e.getClass().getSimpleName()
- + " processing " + messageEventName + " with " + correlationVariable
- + " = '" + correlationValue + "'";
- logCallbackError(method, startTime, msg);
- return new CallbackError(msg);
- }
- }
-
- /**
- * Performs message correlation. Waits a limited amount of time for
- * a process to become ready for correlation. The return value indicates
- * whether or not a process was found to receive the message. Due to the
- * synchronous nature of message injection in Camunda, by the time this
- * method returns, one of 3 things will have happened: (1) the process
- * received the message and ended, (2) the process received the message
- * and reached an activity that suspended, or (3) an exception occurred
- * during correlation or while the process was executing. Correlation
- * exceptions are handled differently from process execution exceptions.
- * Correlation exceptions are thrown so the client knows something went
- * wrong with the delivery of the message. Process execution exceptions
- * are logged but not thrown.
- * @param messageEventName the message event name
- * @param correlationVariable the process variable used as the correlator
- * @param correlationValue the correlation value
- * @param variables variables to inject into the process
- * @param logMarker a marker for debug logging
- * @return true if a process could be found, false if not
- * @throws Exception for correlation errors
- */
- protected boolean correlate(String messageEventName, String correlationVariable,
- String correlationValue, Map<String, Object> variables, String logMarker)
- throws Exception {
- try{
- LOGGER.debug(logMarker + " Attempting to find process waiting"
- + " for " + messageEventName + " with " + correlationVariable
- + " = '" + correlationValue + "'");
-
- RuntimeService runtimeService =
- getProcessEngineServices().getRuntimeService();
-
- Map<String, String> properties =
- PropertyConfiguration.getInstance().getProperties("mso.bpmn.urn.properties");
-
- long timeout = DEFAULT_TIMEOUT_SECONDS;
-
- // The code is here in case we ever need to change the default.
- String s = properties.get("mso.correlation.timeout");
- if (s != null) {
- try {
- timeout = Long.parseLong(s);
- } catch (NumberFormatException e) {
- // Ignore
- }
- }
-
- long now = System.currentTimeMillis();
- long fastPollEndTime = now + (FAST_POLL_DUR_SECONDS * 1000);
- long endTime = now + (timeout * 1000);
- long sleep = FAST_POLL_INT_MS;
-
- List<Execution> waitingProcesses = null;
- Exception queryException = null;
- int queryCount = 0;
- int queryFailCount = 0;
-
- while (true) {
- try {
- ++queryCount;
- waitingProcesses = runtimeService.createExecutionQuery()
- .messageEventSubscriptionName(messageEventName)
- .processVariableValueEquals(correlationVariable, correlationValue)
- .list();
- } catch (Exception e) {
- ++queryFailCount;
- queryException = e;
- }
-
- if (waitingProcesses != null && waitingProcesses.size() > 0) {
- break;
- }
-
- if (now > endTime - sleep) {
- break;
- }
-
- Thread.sleep(sleep);
- now = System.currentTimeMillis();
-
- if (now > fastPollEndTime) {
- sleep = SLOW_POLL_INT_MS;
- }
- }
-
- if (waitingProcesses == null) {
- waitingProcesses = new ArrayList<Execution>(0);
- }
-
- int count = waitingProcesses.size();
-
- List<ExecInfo> execInfoList = new ArrayList<>(count);
- for (Execution execution : waitingProcesses) {
- execInfoList.add(new ExecInfo(execution));
- }
-
- LOGGER.debug(logMarker + " Found " + count + " process(es) waiting"
- + " for " + messageEventName + " with " + correlationVariable
- + " = '" + correlationValue + "': " + execInfoList);
-
- if (count == 0) {
- if (queryFailCount > 0) {
- String msg = queryFailCount + "/" + queryCount
- + " execution queries failed attempting to correlate "
- + messageEventName + " with " + correlationVariable
- + " = '" + correlationValue + "'; last exception was:"
- + queryException;
- LOGGER.debug(msg);
- LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(),
- MsoLogger.ErrorCode.UnknownError, msg, queryException);
- }
-
- return false;
- }
-
- if (count > 1) {
- // Only one process should be waiting. Throw an exception back to the client.
- throw new MismatchingMessageCorrelationException(messageEventName,
- "more than 1 process is waiting with " + correlationVariable
- + " = '" + correlationValue + "'");
- }
-
- // We prototyped an asynchronous solution, i.e. resuming the process
- // flow in a separate thread, but this affected too many existing tests,
- // and we went back to the synchronous solution. The synchronous solution
- // has some troublesome characteristics though. For example, the
- // resumed flow may send request #2 to a remote system before MSO has
- // acknowledged the notification associated with request #1.
-
- try {
- LOGGER.debug(logMarker + " Running " + execInfoList.get(0) + " to receive "
- + messageEventName + " with " + correlationVariable + " = '"
- + correlationValue + "'");
-
- @SuppressWarnings("unused")
- MessageCorrelationResult result = runtimeService
- .createMessageCorrelation(messageEventName)
- .setVariables(variables)
- .processInstanceVariableEquals(correlationVariable, correlationValue)
- .correlateWithResult();
-
- } catch (MismatchingMessageCorrelationException e) {
- // A correlation exception occurred even after we identified
- // one waiting process. Throw it back to the client.
- throw e;
- } catch (OptimisticLockingException ole) {
-
- String msg = "Caught " + ole.getClass().getSimpleName() + " after receiving " + messageEventName
- + " with " + correlationVariable + " = '" + correlationValue
- + "': " + ole;
- LOGGER.debug(msg);
- LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN CORRELATION ERROR -", MsoLogger.getServiceName(),
- MsoLogger.ErrorCode.UnknownError, msg, ole);
-
- //Retry for OptimisticLocking Exceptions
- int retryCount = 0;
- String retryStr = properties.get("mso.bpmn.optimisticlockingexception.retrycount");
- if (retryStr != null) {
- try {
- retryCount = Integer.parseInt(retryStr);
- } catch (NumberFormatException e) {
- // Ignore
- }
- }
-
- LOGGER.debug("Retry correlate for OptimisticLockingException, retryCount:" + retryCount);
-
- for (; retryCount >0 ; retryCount--) {
-
- try{
- Thread.sleep(SLOW_POLL_INT_MS);
-
- @SuppressWarnings("unused")
- MessageCorrelationResult result = runtimeService
- .createMessageCorrelation(messageEventName)
- .setVariables(variables)
- .processInstanceVariableEquals(correlationVariable, correlationValue)
- .correlateWithResult();
- retryCount = 0;
- LOGGER.debug("OptimisticLockingException retry was successful, seting retryCount: " + retryCount);
- } catch (OptimisticLockingException olex) {
- //oleFlag = ex instanceof org.camunda.bpm.engine.OptimisticLockingException;
- String strMsg = "Received exception, OptimisticLockingException retry failed, retryCount:" + retryCount + " | exception returned: " + olex;
- LOGGER.debug(strMsg);
- LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(),
- MsoLogger.ErrorCode.UnknownError, strMsg, olex);
- } catch (Exception excep) {
- retryCount = 0;
- //oleFlag = ex instanceof org.camunda.bpm.engine.OptimisticLockingException;
- String strMsg = "Received exception, OptimisticLockingException retry failed, retryCount:" + retryCount + " | exception returned: " + excep;
- LOGGER.debug(strMsg);
- LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(),
- MsoLogger.ErrorCode.UnknownError, strMsg, excep);
- }
-
- }
-
- }catch (Exception e) {
- // This must be an exception from the flow itself. Log it, but don't
- // report it back to the client.
- String msg = "Caught " + e.getClass().getSimpleName() + " running "
- + execInfoList.get(0) + " after receiving " + messageEventName
- + " with " + correlationVariable + " = '" + correlationValue
- + "': " + e;
- LOGGER.debug(msg);
- LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(),
- MsoLogger.ErrorCode.UnknownError, msg, e);
- }
- } catch (Exception e) {
- // This must be an exception from the flow itself. Log it, but don't
- // report it back to the client.
- String msg = "Caught " + e.getClass().getSimpleName() + " after receiving " + messageEventName
- + " with " + correlationVariable + " = '" + correlationValue
- + "': " + e;
- LOGGER.debug(msg);
- LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN CORRELATION ERROR -", MsoLogger.getServiceName(),
- MsoLogger.ErrorCode.UnknownError, msg, e);
- }
-
- return true;
- }
-
- /**
- * Records audit and metric events in the log for a callback success.
- * @param method the method name
- * @param startTime the request start time
- */
- protected void logCallbackSuccess(String method, long startTime) {
- LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE,
- MsoLogger.ResponseCode.Suc, "Completed " + method);
-
- LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE,
- MsoLogger.ResponseCode.Suc, "Completed " + method,
- "BPMN", MsoLogger.getServiceName(), null);
- }
-
- /**
- * Records error, audit and metric events in the log for a callback
- * internal error.
- * @param method the method name
- * @param startTime the request start time
- * @param msg the error message
- */
- protected void logCallbackError(String method, long startTime, String msg) {
- logCallbackError(method, startTime, msg, null);
- }
-
- /**
- * Records error, audit and metric events in the log for a callback
- * internal error.
- * @param method the method name
- * @param startTime the request start time
- * @param msg the error message
- * @param e the exception
- */
- protected void logCallbackError(String method, long startTime, String msg, Exception e) {
- if (e == null) {
- LOGGER.error(MessageEnum.BPMN_CALLBACK_EXCEPTION, "BPMN", MsoLogger.getServiceName(),
- MsoLogger.ErrorCode.UnknownError, msg);
- } else {
- LOGGER.error(MessageEnum.BPMN_CALLBACK_EXCEPTION, "BPMN", MsoLogger.getServiceName(),
- MsoLogger.ErrorCode.UnknownError, msg, e);
- }
-
- LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE,
- MsoLogger.ResponseCode.InternalError, "Completed " + method);
-
- LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE,
- MsoLogger.ResponseCode.InternalError, "Completed " + method,
- "BPMN", MsoLogger.getServiceName(), null);
- }
-
- /**
- * Abstract callback result object.
- */
- protected abstract class CallbackResult {
- }
-
- /**
- * Indicates that callback handling was successful.
- */
- protected class CallbackSuccess extends CallbackResult {
- }
-
- /**
- * Indicates that callback handling failed.
- */
- protected class CallbackError extends CallbackResult {
- private final String errorMessage;
-
- public CallbackError(String errorMessage) {
- this.errorMessage = errorMessage;
- }
-
- /**
- * Gets the error message.
- */
- public String getErrorMessage() {
- return errorMessage;
- }
- }
-
- private static class ExecInfo {
- private final Execution execution;
-
- public ExecInfo(Execution execution) {
- this.execution = execution;
- }
-
- @Override
- public String toString() {
- return "Process[" + execution.getProcessInstanceId()
- + ":" + execution.getId() + "]";
- }
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/ProcessEngineAwareService.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/ProcessEngineAwareService.java deleted file mode 100644 index dbb6674a64..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/ProcessEngineAwareService.java +++ /dev/null @@ -1,64 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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.common.workflow.service; - -import java.util.Optional; - -import org.camunda.bpm.engine.ProcessEngineServices; -import org.camunda.bpm.engine.ProcessEngines; - -/** - * Base class for services that must be process-engine aware. The only - * process engine currently supported is the "default" process engine. - */ -public class ProcessEngineAwareService { - - private final String processEngineName = "default"; - private volatile Optional<ProcessEngineServices> pes4junit = Optional.empty(); - - /** - * Gets the process engine name. - * @return the process engine name - */ - public String getProcessEngineName() { - return processEngineName; - } - - /** - * Gets process engine services. - * @return process engine services - */ - public ProcessEngineServices getProcessEngineServices() { - return pes4junit.orElse(ProcessEngines.getProcessEngine( - getProcessEngineName())); - } - - /** - * Allows a particular process engine to be specified, overriding the - * usual process engine lookup by name. Intended primarily for the - * unit test environment. - * @param pes process engine services - */ - public void setProcessEngineServices4junit(ProcessEngineServices pes) { - pes4junit = Optional.ofNullable(pes); - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/SDNCAdapterCallbackServiceImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/SDNCAdapterCallbackServiceImpl.java deleted file mode 100644 index c5f0d02dff..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/SDNCAdapterCallbackServiceImpl.java +++ /dev/null @@ -1,83 +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.common.workflow.service;
-
-import javax.jws.WebMethod;
-import javax.jws.WebParam;
-import javax.jws.WebResult;
-import javax.jws.WebService;
-import javax.ws.rs.core.Context;
-import javax.xml.ws.WebServiceContext;
-
-import org.openecomp.mso.bpmn.common.adapter.sdnc.SDNCAdapterCallbackRequest;
-import org.openecomp.mso.bpmn.common.adapter.sdnc.SDNCAdapterResponse;
-import org.openecomp.mso.bpmn.common.adapter.sdnc.SDNCCallbackAdapterPortType;
-import org.openecomp.mso.logger.MsoLogger;
-
-/**
- * Implementation of SDNCAdapterCallbackService.
- */
-@WebService(serviceName="SDNCAdapterCallbackService", targetNamespace="http://org.openecomp/workflow/sdnc/adapter/schema/v1")
-public class SDNCAdapterCallbackServiceImpl extends AbstractCallbackService implements SDNCCallbackAdapterPortType {
-
- private final String logMarker = "[SDNC-CALLBACK]";
-
- @Context WebServiceContext wsContext;
-
- @WebMethod(operationName = "SDNCAdapterCallback")
- @WebResult(name = "SDNCAdapterResponse", targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterCallbackResponse")
- public SDNCAdapterResponse sdncAdapterCallback(
- @WebParam(name = "SDNCAdapterCallbackRequest", targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterCallbackRequest")
- SDNCAdapterCallbackRequest sdncAdapterCallbackRequest) {
-
- String method = "sdncAdapterCallback";
- Object message = sdncAdapterCallbackRequest;
- String messageEventName = "sdncAdapterCallbackRequest";
- String messageVariable = "sdncAdapterCallbackRequest";
- String correlationVariable = "SDNCA_requestId";
- String correlationValue = sdncAdapterCallbackRequest.getCallbackHeader().getRequestId();
-
- MsoLogger.setServiceName("MSO." + method);
- MsoLogger.setLogContext(correlationValue, "N/A");
-
- CallbackResult result = handleCallback(method, message, messageEventName,
- messageVariable, correlationVariable, correlationValue, logMarker);
-
- if (result instanceof CallbackError) {
- return new SDNCAdapterErrorResponse(((CallbackError)result).getErrorMessage());
- } else {
- return new SDNCAdapterResponse();
- }
- }
-
- // This subclass allows unit tests to extract the error
- public class SDNCAdapterErrorResponse extends SDNCAdapterResponse {
- private String error;
-
- public SDNCAdapterErrorResponse(String error) {
- this.error = error;
- }
-
- public String getError() {
- return error;
- }
- }
-}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java deleted file mode 100644 index 621e35e57d..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java +++ /dev/null @@ -1,249 +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.common.workflow.service;
-
-import javax.jws.Oneway;
-import javax.jws.WebMethod;
-import javax.jws.WebParam;
-import javax.jws.WebService;
-import javax.ws.rs.core.Context;
-import javax.xml.ws.Action;
-import javax.xml.ws.RequestWrapper;
-import javax.xml.ws.WebServiceContext;
-
-import org.openecomp.mso.bpmn.common.adapter.vnf.CreateVnfNotification;
-import org.openecomp.mso.bpmn.common.adapter.vnf.DeleteVnfNotification;
-import org.openecomp.mso.bpmn.common.adapter.vnf.MsoExceptionCategory;
-import org.openecomp.mso.bpmn.common.adapter.vnf.QueryVnfNotification;
-import org.openecomp.mso.bpmn.common.adapter.vnf.RollbackVnfNotification;
-import org.openecomp.mso.bpmn.common.adapter.vnf.UpdateVnfNotification;
-import org.openecomp.mso.bpmn.common.adapter.vnf.VnfAdapterNotify;
-import org.openecomp.mso.bpmn.common.adapter.vnf.VnfRollback;
-import org.openecomp.mso.bpmn.common.adapter.vnf.VnfStatus;
-import org.openecomp.mso.logger.MsoLogger;
-
-/**
- * Implementation of the VnfAdapterNotify service.
- */
-@WebService(serviceName = "vnfAdapterNotify", targetNamespace = "http://org.openecomp.mso/vnfNotify")
-public class VnfAdapterNotifyServiceImpl extends AbstractCallbackService implements VnfAdapterNotify{
-
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); - - private final String logMarker = "[VNF-NOTIFY]";
-
- @Context WebServiceContext wsContext;
-
- @WebMethod(operationName = "rollbackVnfNotification")
- @Oneway
- @RequestWrapper(localName = "rollbackVnfNotification", targetNamespace = "http://org.openecomp.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.RollbackVnfNotification")
- @Action(input = "http://org.openecomp.mso/notify/adapterNotify/rollbackVnfNotificationRequest") - public void rollbackVnfNotification(
- @WebParam(name = "messageId", targetNamespace = "")
- String messageId,
- @WebParam(name = "completed", targetNamespace = "")
- boolean completed,
- @WebParam(name = "exception", targetNamespace = "")
- MsoExceptionCategory exception,
- @WebParam(name = "errorMessage", targetNamespace = "")
- String errorMessage) {
-
- RollbackVnfNotification rollbackVnfNotification = new RollbackVnfNotification();
-
- rollbackVnfNotification.setMessageId(messageId);
- rollbackVnfNotification.setCompleted(completed);
- rollbackVnfNotification.setException(exception);
- rollbackVnfNotification.setErrorMessage(errorMessage);
-
- String method = "rollbackVnfNotification";
- Object message = rollbackVnfNotification;
- String messageEventName = "rollbackVnfNotificationCallback";
- String messageVariable = "rollbackVnfNotificationCallback";
- String correlationVariable = "VNFRB_messageId";
- String correlationValue = messageId;
-
- handleCallback(method, message, messageEventName, messageVariable,
- correlationVariable, correlationValue, logMarker);
- }
-
- @WebMethod(operationName = "queryVnfNotification")
- @Oneway
- @RequestWrapper(localName = "queryVnfNotification", targetNamespace = "http://org.openecomp.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.QueryVnfNotification") - @Action(input = "http://org.openecomp.mso/notify/adapterNotify/queryVnfNotificationRequest") - public void queryVnfNotification(
- @WebParam(name = "messageId", targetNamespace = "")
- String messageId,
- @WebParam(name = "completed", targetNamespace = "")
- boolean completed,
- @WebParam(name = "exception", targetNamespace = "")
- MsoExceptionCategory exception,
- @WebParam(name = "errorMessage", targetNamespace = "")
- String errorMessage,
- @WebParam(name = "vnfExists", targetNamespace = "")
- Boolean vnfExists,
- @WebParam(name = "vnfId", targetNamespace = "")
- String vnfId,
- @WebParam(name = "status", targetNamespace = "")
- VnfStatus status,
- @WebParam(name = "outputs", targetNamespace = "")
- QueryVnfNotification.Outputs outputs){
-
- String method = "queryVnfNotification";
- String messageEventName = "queryVnfNotificationCallback";
- String messageVariable = "queryVnfNotificationCallback";
- String correlationVariable = "VNFQ_messageId";
- String correlationValue = messageId;
-
- MsoLogger.setServiceName("MSO." + method);
- MsoLogger.setLogContext(correlationValue, "N/A");
-
- QueryVnfNotification message = new QueryVnfNotification();
-
- message.setMessageId(messageId);
- message.setCompleted(completed);
- message.setException(exception);
- message.setErrorMessage(errorMessage);
- message.setVnfExists(vnfExists);
- message.setVnfId(vnfId);
- message.setStatus(status);
- message.setOutputs(outputs);
-
- handleCallback(method, message, messageEventName, messageVariable,
- correlationVariable, correlationValue, logMarker);
- }
-
- @WebMethod(operationName = "createVnfNotification")
- @Oneway
- @RequestWrapper(localName = "createVnfNotification", targetNamespace = "http://org.openecomp.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.CreateVnfNotification") - @Action(input = "http://org.openecomp.mso/notify/adapterNotify/createVnfNotificationRequest") - public void createVnfNotification(
- @WebParam(name = "messageId", targetNamespace = "")
- String messageId,
- @WebParam(name = "completed", targetNamespace = "")
- boolean completed,
- @WebParam(name = "exception", targetNamespace = "")
- MsoExceptionCategory exception,
- @WebParam(name = "errorMessage", targetNamespace = "")
- String errorMessage,
- @WebParam(name = "vnfId", targetNamespace = "")
- String vnfId,
- @WebParam(name = "outputs", targetNamespace = "")
- CreateVnfNotification.Outputs outputs,
- @WebParam(name = "rollback", targetNamespace = "")
- VnfRollback rollback){
-
- String method = "createVnfNotification";
- String messageEventName = "createVnfNotificationCallback";
- String messageVariable = "createVnfNotificationCallback";
- String correlationVariable = "VNFC_messageId";
- String correlationValue = messageId;
-
- MsoLogger.setServiceName("MSO." + method);
- MsoLogger.setLogContext(correlationValue, "N/A");
-
- CreateVnfNotification message = new CreateVnfNotification();
-
- message.setMessageId(messageId);
- message.setCompleted(completed);
- message.setException(exception);
- message.setErrorMessage(errorMessage);
- message.setVnfId(vnfId);
- message.setOutputs(outputs);
- message.setRollback(rollback);
-
- handleCallback(method, message, messageEventName, messageVariable,
- correlationVariable, correlationValue, logMarker);
- }
-
- @WebMethod(operationName = "updateVnfNotification")
- @Oneway
- @RequestWrapper(localName = "updateVnfNotification", targetNamespace = "http://org.openecomp.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.UpdateVnfNotification") - @Action(input = "http://org.openecomp.mso/notify/adapterNotify/updateVnfNotificationRequest") - public void updateVnfNotification(
- @WebParam(name = "messageId", targetNamespace = "")
- String messageId,
- @WebParam(name = "completed", targetNamespace = "")
- boolean completed,
- @WebParam(name = "exception", targetNamespace = "")
- MsoExceptionCategory exception,
- @WebParam(name = "errorMessage", targetNamespace = "")
- String errorMessage,
- @WebParam(name = "outputs", targetNamespace = "")
- UpdateVnfNotification.Outputs outputs,
- @WebParam(name = "rollback", targetNamespace = "")
- VnfRollback rollback){
-
- String method = "updateVnfNotification";
- String messageEventName = "updateVnfNotificationCallback";
- String messageVariable = "updateVnfNotificationCallback";
- String correlationVariable = "VNFU_messageId";
- String correlationValue = messageId;
-
- MsoLogger.setServiceName("MSO." + method);
- MsoLogger.setLogContext(correlationValue, "N/A");
-
- UpdateVnfNotification message = new UpdateVnfNotification();
-
- message.setMessageId(messageId);
- message.setCompleted(completed);
- message.setException(exception);
- message.setErrorMessage(errorMessage);
- message.setOutputs(outputs);
- message.setRollback(rollback);
-
- handleCallback(method, message, messageEventName, messageVariable,
- correlationVariable, correlationValue, logMarker);
- }
-
- @WebMethod(operationName = "deleteVnfNotification")
- @Oneway
- @RequestWrapper(localName = "deleteVnfNotification", targetNamespace = "http://org.openecomp.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.DeleteVnfNotification") - @Action(input = "http://org.openecomp.mso/notify/adapterNotify/deleteVnfNotificationRequest") - public void deleteVnfNotification(
- @WebParam(name = "messageId", targetNamespace = "")
- String messageId,
- @WebParam(name = "completed", targetNamespace = "")
- boolean completed,
- @WebParam(name = "exception", targetNamespace = "")
- MsoExceptionCategory exception,
- @WebParam(name = "errorMessage", targetNamespace = "")
- String errorMessage) {
-
- String method = "deleteVnfNotification";
- String messageEventName = "deleteVnfACallback";
- String messageVariable = "deleteVnfACallback";
- String correlationVariable = "VNFDEL_uuid";
- String correlationValue = messageId;
-
- MsoLogger.setServiceName("MSO." + method);
- MsoLogger.setLogContext(correlationValue, "N/A");
-
- DeleteVnfNotification message = new DeleteVnfNotification();
-
- message.setMessageId(messageId);
- message.setCompleted(completed);
- message.setException(exception);
- message.setErrorMessage(errorMessage);
-
- handleCallback(method, message, messageEventName, messageVariable,
- correlationVariable, correlationValue, logMarker);
- }
-}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowAsyncResource.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowAsyncResource.java deleted file mode 100644 index b4543b1445..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowAsyncResource.java +++ /dev/null @@ -1,289 +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.common.workflow.service;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Optional;
-import java.util.UUID;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.Response;
-
-import org.camunda.bpm.engine.ProcessEngineServices;
-import org.camunda.bpm.engine.RuntimeService;
-import org.camunda.bpm.engine.runtime.ProcessInstance;
-import org.camunda.bpm.engine.variable.impl.VariableMapImpl;
-import org.jboss.resteasy.annotations.Suspend;
-import org.jboss.resteasy.spi.AsynchronousResponse;
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoLogger;
-import org.slf4j.MDC;
-
-/**
- *
- * @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 WorkflowAsyncResource extends ProcessEngineAwareService {
-
- private static final WorkflowContextHolder contextHolder = WorkflowContextHolder.getInstance();
- protected Optional<ProcessEngineServices> pes4junit = Optional.empty();
-
- private final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
-
- private static final String logMarker = "[WRKFLOW-RESOURCE]";
- private static final long DEFAULT_WAIT_TIME = 30000; //default wait time
-
- /**
- * Asynchronous JAX-RS method that starts a process instance.
- * @param asyncResponse an object that will receive the asynchronous response
- * @param processKey the process key
- * @param variableMap input variables to the process
- */
- @POST
- @Path("/services/{processKey}")
- @Produces("application/json")
- @Consumes("application/json")
- public void startProcessInstanceByKey(final @Suspend(180000) AsynchronousResponse asyncResponse,
- @PathParam("processKey") String processKey, VariableMapImpl variableMap) {
-
- long startTime = System.currentTimeMillis();
- Map<String, Object> inputVariables = null;
- WorkflowContext workflowContext = null;
-
- try {
- inputVariables = getInputVariables(variableMap);
- setLogContext(processKey, inputVariables);
-
- // This variable indicates that the flow was invoked asynchronously
- inputVariables.put("isAsyncProcess", "true");
-
- workflowContext = new WorkflowContext(processKey, getRequestId(inputVariables),
- asyncResponse, getWaitTime(inputVariables));
-
- msoLogger.debug("Adding the workflow context into holder: "
- + workflowContext.getProcessKey() + ":"
- + workflowContext.getRequestId() + ":"
- + workflowContext.getTimeout());
-
- contextHolder.put(workflowContext);
-
- ProcessThread processThread = new ProcessThread(processKey, inputVariables);
- processThread.start();
- } catch (Exception e) {
- setLogContext(processKey, inputVariables);
-
- if (workflowContext != null) {
- contextHolder.remove(workflowContext);
- }
-
- msoLogger.debug(logMarker + "Exception in startProcessInstance by key");
- WorkflowResponse response = new WorkflowResponse();
- response.setMessage("Fail" );
- response.setContent("Error occurred while executing the process: " + e);
- response.setMessageCode(500);
- recordEvents(processKey, response, startTime);
-
- msoLogger.error (MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, logMarker
- + response.getMessage() + " for processKey: "
- + processKey + " with content: " + response.getContent());
-
- Response errorResponse = Response.serverError().entity(response).build();
- asyncResponse.setResponse(errorResponse);
- }
- }
-
- /**
- *
- * @version 1.0
- *
- */
- class ProcessThread extends Thread {
- private final String processKey;
- private final Map<String,Object> inputVariables;
-
- public ProcessThread(String processKey, Map<String, Object> inputVariables) {
- this.processKey = processKey;
- this.inputVariables = inputVariables;
- }
-
- public void run() {
-
- String processInstanceId = null;
- long startTime = System.currentTimeMillis();
-
- try {
- setLogContext(processKey, inputVariables);
-
- // Note: this creates a random businessKey if it wasn't specified.
- String businessKey = getBusinessKey(inputVariables);
-
- msoLogger.debug(logMarker + "***Received MSO startProcessInstanceByKey with processKey: "
- + processKey + " and variables: " + inputVariables);
-
- msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, logMarker
- + "Call to MSO workflow/services in Camunda. Received MSO startProcessInstanceByKey with processKey:"
- + processKey + " and variables: " + inputVariables);
-
- RuntimeService runtimeService = getProcessEngineServices().getRuntimeService();
- ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(
- processKey, businessKey, inputVariables);
- processInstanceId = processInstance.getId();
-
- msoLogger.debug(logMarker + "Process " + processKey + ":" + processInstanceId + " " +
- (processInstance.isEnded() ? "ENDED" : "RUNNING"));
- } catch (Exception e) {
-
- msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError,
- logMarker + "Error in starting the process: "+ e.getMessage());
-
- WorkflowCallbackResponse callbackResponse = new WorkflowCallbackResponse();
- callbackResponse.setStatusCode(500);
- callbackResponse.setMessage("Fail");
- callbackResponse.setResponse("Error occurred while executing the process: " + e);
-
- // TODO: is the processInstanceId used by the API handler? I don't think so.
- // It may be null here.
- WorkflowContextHolder.getInstance().processCallback(
- processKey, processInstanceId,
- getRequestId(inputVariables),
- callbackResponse);
- }
- }
- }
-
-
- /**
- * Callback resource which is invoked from BPMN to process to send the workflow response
- *
- * @param processKey
- * @param processInstanceId
- * @param requestId
- * @param callbackResponse
- * @return
- */
- @POST
- @Path("/services/callback/{processKey}/{processInstanceId}/{requestId}")
- @Produces("application/json")
- @Consumes("application/json")
- public Response processWorkflowCallback(
- @PathParam("processKey") String processKey,
- @PathParam("processInstanceId") String processInstanceId,
- @PathParam("requestId")String requestId,
- WorkflowCallbackResponse callbackResponse) {
-
- msoLogger.debug(logMarker + "Process instance ID:" + processInstanceId + ":" + requestId + ":" + processKey + ":" + isProcessEnded(processInstanceId));
- msoLogger.debug(logMarker + "About to process the callback request:" + callbackResponse.getResponse() + ":" + callbackResponse.getMessage() + ":" + callbackResponse.getStatusCode());
- return contextHolder.processCallback(processKey, processInstanceId, requestId, callbackResponse);
- }
-
- private static String getOrCreate(Map<String, Object> inputVariables, String key) {
- String value = Objects.toString(inputVariables.get(key), null);
- if (value == null) {
- value = UUID.randomUUID().toString();
- inputVariables.put(key, value);
- }
- return value;
- }
-
- // Note: the business key is used to identify the process in unit tests
- private static String getBusinessKey(Map<String, Object> inputVariables) {
- return getOrCreate(inputVariables, "mso-business-key");
- }
-
- private static String getRequestId(Map<String, Object> inputVariables) {
- return getOrCreate(inputVariables, "mso-request-id");
- }
-
- private long getWaitTime(Map<String, Object> inputVariables)
- {
-
- String timeout = Objects.toString(inputVariables.get("mso-service-request-timeout"), null);
-
- if (timeout != null) {
- try {
- return Long.parseLong(timeout)*1000;
- } catch (NumberFormatException nex) {
- msoLogger.debug("Invalid input for mso-service-request-timeout");
- }
- }
-
- return DEFAULT_WAIT_TIME;
- }
-
- private void recordEvents(String processKey, WorkflowResponse response,
- long startTime) {
-
- msoLogger.recordMetricEvent ( startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- logMarker + response.getMessage() + " for processKey: "
- + processKey + " with content: " + response.getContent(), "BPMN", MDC.get(processKey), null);
-
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- logMarker + response.getMessage() + "for processKey: " + processKey + " with content: " + response.getContent());
-
- }
-
- private static void setLogContext(String processKey,
- Map<String, Object> inputVariables) {
- MsoLogger.setServiceName("MSO." + processKey);
- if (inputVariables != null) {
- MsoLogger.setLogContext(getKeyValueFromInputVariables(inputVariables,"mso-request-id"), getKeyValueFromInputVariables(inputVariables,"mso-service-instance-id"));
- }
- }
-
- private static String getKeyValueFromInputVariables(Map<String,Object> inputVariables, String key) {
- if (inputVariables == null) {
- return "";
- }
-
- return Objects.toString(inputVariables.get(key), "N/A");
- }
-
- private boolean isProcessEnded(String processInstanceId) {
- ProcessEngineServices pes = getProcessEngineServices();
- return pes.getRuntimeService().createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult() == null;
- }
-
- private static Map<String, Object> getInputVariables(VariableMapImpl variableMap) {
- Map<String, Object> inputVariables = new HashMap<>();
- @SuppressWarnings("unchecked")
- Map<String, Object> vMap = (Map<String, Object>) variableMap.get("variables");
- for (Map.Entry<String, Object> entry : vMap.entrySet()) {
- String vName = entry.getKey();
- Object value = entry.getValue();
- @SuppressWarnings("unchecked")
- Map<String, Object> valueMap = (Map<String,Object>)value; // value, type
- inputVariables.put(vName, valueMap.get("value"));
- }
- return inputVariables;
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowMessageResource.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowMessageResource.java deleted file mode 100644 index 4ba35907b9..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowMessageResource.java +++ /dev/null @@ -1,108 +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.common.workflow.service;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.HeaderParam;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoLogger;
-
-/**
- * Generalized REST interface that injects a message event into a waiting BPMN process.
- * Examples:
- * <pre>
- * /WorkflowMessage/SDNCAResponse/6d10d075-100c-42d0-9d84-a52432681cae-1478486185286
- * /WorkflowMessage/SDNCAEvent/USOSTCDALTX0101UJZZ01
- * </pre>
- */
-@Path("/")
-public class WorkflowMessageResource extends AbstractCallbackService {
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
- private static final String LOGMARKER = "[WORKFLOW-MESSAGE]";
-
- @POST
- @Path("/WorkflowMessage/{messageType}/{correlator}")
- @Consumes("*/*")
- @Produces(MediaType.TEXT_PLAIN)
- public Response deliver(
- @HeaderParam("Content-Type") String contentType,
- @PathParam("messageType") String messageType,
- @PathParam("correlator") String correlator,
- String message) {
-
- String method = "receiveWorkflowMessage";
- MsoLogger.setServiceName("MSO." + method);
- MsoLogger.setLogContext(correlator, "N/A");
-
- LOGGER.debug(LOGMARKER + " Received workflow message"
- + " type='" + messageType + "'"
- + " correlator='" + correlator + "'"
- + (contentType == null ? "" : " contentType='" + contentType + "'")
- + " message=" + System.lineSeparator() + message);
-
- if (messageType == null || messageType.isEmpty()) {
- String msg = "Missing message type";
- LOGGER.debug(LOGMARKER + " " + msg);
- LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(),
- MsoLogger.ErrorCode.DataError, LOGMARKER + ":" + msg);
- return Response.status(400).entity(msg).build();
- }
-
- if (correlator == null || correlator.isEmpty()) {
- String msg = "Missing correlator";
- LOGGER.debug(LOGMARKER + " " + msg);
- LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(),
- MsoLogger.ErrorCode.DataError, LOGMARKER + ":" + msg);
- return Response.status(400).entity(msg).build();
- }
-
- String messageEventName = "WorkflowMessage";
- String messageVariable = messageType + "_MESSAGE";
- String correlationVariable = messageType + "_CORRELATOR";
- String correlationValue = correlator;
- String contentTypeVariable = messageType + "_CONTENT_TYPE";
-
- Map<String, Object> variables = new HashMap<>();
-
- if (contentType != null) {
- variables.put(contentTypeVariable, contentType);
- }
-
- CallbackResult result = handleCallback(method, message, messageEventName,
- messageVariable, correlationVariable, correlationValue, LOGMARKER, variables);
-
- if (result instanceof CallbackError) {
- return Response.status(500).entity(((CallbackError)result).getErrorMessage()).build();
- } else {
- return Response.status(204).build();
- }
- }
-}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResource.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResource.java deleted file mode 100644 index 25c67fed63..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResource.java +++ /dev/null @@ -1,615 +0,0 @@ -/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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.common.workflow.service;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-import java.util.concurrent.atomic.AtomicLong;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.UriInfo;
-
-import org.camunda.bpm.engine.HistoryService;
-import org.camunda.bpm.engine.ProcessEngineException;
-import org.camunda.bpm.engine.ProcessEngineServices;
-import org.camunda.bpm.engine.RuntimeService;
-import org.camunda.bpm.engine.history.HistoricVariableInstance;
-import org.camunda.bpm.engine.runtime.ProcessInstance;
-import org.camunda.bpm.engine.variable.VariableMap;
-import org.camunda.bpm.engine.variable.Variables;
-import org.camunda.bpm.engine.variable.Variables.SerializationDataFormats;
-import org.camunda.bpm.engine.variable.impl.VariableMapImpl;
-import org.openecomp.mso.bpmn.core.WorkflowException;
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoLogger;
-import org.slf4j.MDC;
-
-@Path("/workflow")
-public class WorkflowResource extends ProcessEngineAwareService {
-
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
- private static final String LOGMARKER = "[WRKFLOW-RESOURCE]";
-
- private static final int DEFAULT_WAIT_TIME = 30000;
-
- @Context
- private UriInfo uriInfo = null;
-
- /**
- * Starts the process instance and responds to client synchronously
- * If the request does not contain mso-service-request-timeout then it waits for the value specified in DEFAULT_WAIT_TIME
- * Note: value specified in mso-service-request-timeout is in seconds
- * During polling time, if there is an exception encountered in the process execution then polling is stopped and the error response is
- * returned to the client
- * @param processKey
- * @param variableMap
- * @return
- */
- @POST
- @Path("/services/{processKey}")
- @Produces("application/json")
- @Consumes("application/json")
- public Response startProcessInstanceByKey(@PathParam("processKey") String processKey,
- VariableMapImpl variableMap) {
-
- Map<String, Object> inputVariables = getInputVariables(variableMap);
- setLogContext(processKey, inputVariables);
-
- WorkflowResponse workflowResponse = new WorkflowResponse();
- long startTime = System.currentTimeMillis();
- ProcessInstance processInstance = null;
-
- try {
- //Kickoff the process
- ProcessThread thread = new ProcessThread(inputVariables,processKey,msoLogger);
- thread.start();
-
- Map<String, Object> responseMap = null;
-
- //wait for process to be completed
- long waitTime = getWaitTime(inputVariables);
- long now = System.currentTimeMillis();
- long start = now;
- long endTime = start + waitTime;
- long pollingInterval = 500;
-
- // TEMPORARY LOGIC FOR UNIT TEST REFACTORING
- // If this is a unit test (method is invoked directly), wait a max
- // of 5 seconds after process ended for a result. In production,
- // wait up to 60 seconds.
- long timeToWaitAfterProcessEnded = uriInfo == null ? 5000 : 60000;
- AtomicLong timeProcessEnded = new AtomicLong(0);
- boolean endedWithNoResponse = false;
-
- while (now <= endTime) {
- Thread.sleep(pollingInterval);
-
- now = System.currentTimeMillis();
-
- // Increase the polling interval over time
-
- long elapsed = now - start;
-
- if (elapsed > 60000) {
- pollingInterval = 5000;
- } else if (elapsed > 10000) {
- pollingInterval = 1000;
- }
- Exception exception = thread.getException();
- if (exception != null) {
- throw new Exception(exception);
- }
-
- processInstance = thread.getProcessInstance();
-
- if (processInstance == null) {
- msoLogger.debug(LOGMARKER + processKey + " process has not been created yet");
- continue;
- }
-
- String processInstanceId = processInstance.getId();
- workflowResponse.setProcessInstanceId(processInstanceId);
-
- responseMap = getResponseMap(processInstance, processKey, timeProcessEnded);
-
- if (responseMap == null) {
- msoLogger.debug(LOGMARKER + processKey + " has not produced a response yet");
-
- if (timeProcessEnded.longValue() != 0) {
- long elapsedSinceEnded = System.currentTimeMillis() - timeProcessEnded.longValue();
-
- if (elapsedSinceEnded > timeToWaitAfterProcessEnded) {
- endedWithNoResponse = true;
- break;
- }
- }
- } else {
- processResponseMap(workflowResponse, responseMap);
- recordEvents(processKey, workflowResponse, startTime);
- return Response.status(workflowResponse.getMessageCode()).entity(workflowResponse).build();
- }
- }
-
- //if we dont get response after waiting then send timeout response
-
- String state;
- String processInstanceId;
-
- if (processInstance == null) {
- processInstanceId = "N/A";
- state = "NOT STARTED";
- } else {
- processInstanceId = processInstance.getProcessInstanceId();
- state = isProcessEnded(processInstanceId) ? "ENDED" : "NOT ENDED";
- }
-
- workflowResponse.setMessage("Fail");
- if (endedWithNoResponse) {
- workflowResponse.setContent("Process ended without producing a response");
- } else {
- workflowResponse.setContent("Request timed out, process state: " + state);
- }
- workflowResponse.setProcessInstanceId(processInstanceId);
- recordEvents(processKey, workflowResponse, startTime);
- workflowResponse.setMessageCode(500);
- return Response.status(500).entity(workflowResponse).build();
- } catch (Exception ex) {
- msoLogger.debug(LOGMARKER + "Exception in startProcessInstance by key",ex);
- workflowResponse.setMessage("Fail" );
- workflowResponse.setContent("Error occurred while executing the process: " + ex.getMessage());
- if (processInstance != null) workflowResponse.setProcessInstanceId(processInstance.getId());
-
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "BPMN", MDC.get(processKey),
- MsoLogger.ErrorCode.UnknownError, LOGMARKER + workflowResponse.getMessage()
- + " for processKey: " + processKey + " with content: " + workflowResponse.getContent());
-
- workflowResponse.setMessageCode(500);
- recordEvents(processKey, workflowResponse, startTime);
- return Response.status(500).entity(workflowResponse).build();
- }
- }
-
- /**
- * Returns the wait time, this is used by the resource on how long it should wait to send a response
- * If none specified DEFAULT_WAIT_TIME is used
- * @param inputVariables
- * @return
- */
- private int getWaitTime(Map<String, Object> inputVariables)
- {
- String timeout = inputVariables.get("mso-service-request-timeout") == null
- ? null : inputVariables.get("mso-service-request-timeout").toString();
-
- if (timeout != null) {
- try {
- return Integer.parseInt(timeout)*1000;
- } catch (NumberFormatException nex) {
- msoLogger.debug("Invalid input for mso-service-request-timeout");
- }
- }
- return DEFAULT_WAIT_TIME;
- }
-
- private void recordEvents(String processKey, WorkflowResponse response, long startTime) {
-
- msoLogger.recordMetricEvent ( startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- LOGMARKER + response.getMessage() + " for processKey: "
- + processKey + " with content: " + response.getContent(), "BPMN", MDC.get(processKey), null);
-
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- LOGMARKER + response.getMessage() + " for processKey: "
- + processKey + " with content: " + response.getContent());
- }
-
- private void setLogContext(String processKey, Map<String, Object> inputVariables) {
- MsoLogger.setServiceName("MSO." + processKey);
- if (inputVariables != null) {
- MsoLogger.setLogContext(getValueFromInputVariables(inputVariables, "mso-request-id"),
- getValueFromInputVariables(inputVariables, "mso-service-instance-id"));
- }
- }
-
- private String getValueFromInputVariables(Map<String,Object> inputVariables, String key) {
- Object value = inputVariables.get(key);
- if (value == null) {
- return "N/A";
- } else {
- return value.toString();
- }
- }
-
- /**
- * Checks to see if the specified process is ended.
- * @param processInstanceId the process instance ID
- * @return true if the process is ended
- */
- private boolean isProcessEnded(String processInstanceId) {
- ProcessEngineServices pes = getProcessEngineServices();
- try {
- return pes.getRuntimeService().createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult() == null ? true : false ;
- } catch (Exception e) {
- msoLogger.debug("Exception :",e);
- return true;
- }
- }
-
- private void processResponseMap(WorkflowResponse workflowResponse, Map<String, Object> responseMap) {
- Object object = responseMap.get("Response");
- String content = object == null ? null : String.valueOf(object);
- if (content == null){
- object = responseMap.get("WorkflowResponse");
- content = object == null ? null : String.valueOf(object);
- }
-
- workflowResponse.setContent(content);
-
- object = responseMap.get("ResponseCode");
- String responseCode = object == null ? null : String.valueOf(object);
-
- try {
- workflowResponse.setMessageCode(Integer.parseInt(responseCode));
- } catch(NumberFormatException nex) {
- msoLogger.debug(LOGMARKER + "Failed to parse ResponseCode: " + responseCode);
- workflowResponse.setMessageCode(-1);
- }
-
- Object status = responseMap.get("Status");
-
- if ("Success".equalsIgnoreCase(String.valueOf(status))) {
- workflowResponse.setMessage("Success");
- } else if ("Fail".equalsIgnoreCase(String.valueOf(status))) {
- workflowResponse.setMessage("Fail");
- } else {
- msoLogger.debug(LOGMARKER + "Unrecognized Status: " + responseCode);
- workflowResponse.setMessage("Fail");
- }
- }
-
- /**
- * @version 1.0
- * Triggers the workflow in a separate thread
- */
- private class ProcessThread extends Thread {
- private final Map<String,Object> inputVariables;
- private final String processKey;
- private final MsoLogger msoLogger;
- private final String businessKey;
- private ProcessInstance processInstance = null;
- private Exception exception = null;
-
- public ProcessThread(Map<String, Object> inputVariables, String processKey, MsoLogger msoLogger) {
- this.inputVariables = inputVariables;
- this.processKey = processKey;
- this.msoLogger = msoLogger;
- this.businessKey = UUID.randomUUID().toString();
- }
-
- /**
- * If an exception occurs when starting the process instance, it may
- * be obtained by calling this method. Note that exceptions are only
- * recorded while the process is executing in its original thread.
- * Once a process is suspended, exception recording stops.
- * @return the exception, or null if none has occurred
- */
- public Exception getException() {
- return exception;
- }
-
-
- public ProcessInstance getProcessInstance() {
- return this.processInstance;
- }
-
- /**
- * Sets the process instance exception.
- * @param exception the exception
- */
- private void setException(Exception exception) {
- this.exception = exception;
- }
-
- public void run() {
- setLogContext(processKey, inputVariables);
-
- long startTime = System.currentTimeMillis();
-
- try {
- msoLogger.debug(LOGMARKER + "***Received MSO startProcessInstanceByKey with processKey:"
- + processKey + " and variables: " + inputVariables);
-
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, LOGMARKER
- + "Call to MSO workflow/services in Camunda. Received MSO startProcessInstanceByKey with"
- + " processKey:" + processKey
- + " businessKey:" + businessKey
- + " variables: " + inputVariables);
-
- RuntimeService runtimeService = getProcessEngineServices().getRuntimeService();
-
- // Note that this method doesn't return until the process suspends
- // itself or finishes. We provide a business key so we can identify
- // the process instance immediately.
- processInstance = runtimeService.startProcessInstanceByKey(
- processKey, inputVariables);
-
- } catch (Exception e) {
- msoLogger.debug(LOGMARKER + "ProcessThread caught an exception executing "
- + processKey + ": " + e);
- setException(e);
- }
- }
-
- }
-
- private Map<String, Object> getInputVariables(VariableMapImpl variableMap) {
- VariableMap inputVariables = Variables.createVariables();
- @SuppressWarnings("unchecked")
- Map<String, Object> vMap = (Map<String, Object>) variableMap.get("variables");
- for (String key : vMap.keySet()) { //variabe name vn
- @SuppressWarnings("unchecked")
- Map<String, Object> valueMap = (Map<String,Object>)vMap.get(key); //value, type
- inputVariables.putValueTyped(key, Variables
- .objectValue(valueMap.get("value"))
- .serializationDataFormat(SerializationDataFormats.JAVA) // tells the engine to use java serialization for persisting the value
- .create());
- }
- return inputVariables;
- }
-
- /**
- * Attempts to get a response map from the specified process instance.
- * @return the response map, or null if it is unavailable
- */
- private Map<String, Object> getResponseMap(ProcessInstance processInstance,
- String processKey, AtomicLong timeProcessEnded) {
-
- String responseMapVariable = processKey + "ResponseMap";
- String processInstanceId = processInstance.getId();
-
- // Query the runtime service to see if a response map is ready.
-
-/* RuntimeService runtimeService = getProcessEngineServices().getRuntimeService();
- List<Execution> executions = runtimeService.createExecutionQuery()
- .processInstanceId(processInstanceId).list();
-
- for (Execution execution : executions) {
- @SuppressWarnings("unchecked")
- Map<String, Object> responseMap = (Map<String, Object>)
- getVariableFromExecution(runtimeService, execution.getId(),
- responseMapVariable);
-
- if (responseMap != null) {
- msoLogger.debug(LOGMARKER + "Obtained " + responseMapVariable
- + " from process " + processInstanceId + " execution "
- + execution.getId());
- return responseMap;
- }
- }
-*/
- //Querying history seem to return consistent results compared to querying the runtime service
-
- boolean alreadyEnded = timeProcessEnded.longValue() != 0;
-
- if (alreadyEnded || isProcessEnded(processInstance.getId())) {
- if (!alreadyEnded) {
- timeProcessEnded.set(System.currentTimeMillis());
- }
-
- // Query the history service to see if a response map exists.
-
- HistoryService historyService = getProcessEngineServices().getHistoryService();
- @SuppressWarnings("unchecked")
- Map<String, Object> responseMap = (Map<String, Object>)
- getVariableFromHistory(historyService, processInstance.getId(),
- responseMapVariable);
-
- if (responseMap != null) {
- msoLogger.debug(LOGMARKER + "Obtained " + responseMapVariable
- + " from process " + processInstanceId + " history");
- return responseMap;
- }
-
- // Query the history service for old-style response variables.
-
- String prefix = (String) getVariableFromHistory(historyService, processInstanceId, "prefix");
-
- if (prefix != null) {
-
- // Check for 'WorkflowResponse' variable
- Object workflowResponseObject = getVariableFromHistory(historyService, processInstanceId, "WorkflowResponse");
- String workflowResponse = workflowResponseObject == null ? null : String.valueOf(workflowResponseObject);
- msoLogger.debug(LOGMARKER + "WorkflowResponse: " + workflowResponse);
-
- if (workflowResponse != null) {
- Object responseCodeObject = getVariableFromHistory(historyService, processInstanceId, prefix + "ResponseCode");
- String responseCode = responseCodeObject == null ? null : String.valueOf(responseCodeObject);
- msoLogger.debug(LOGMARKER + prefix + "ResponseCode: " + responseCode);
- responseMap = new HashMap<>();
- responseMap.put("WorkflowResponse", workflowResponse);
- responseMap.put("ResponseCode", responseCode);
- responseMap.put("Status", "Success");
- return responseMap;
- }
-
-
- // Check for 'WorkflowException' variable
- WorkflowException workflowException = null;
- String workflowExceptionText = null;
-
- Object workflowExceptionObject = getVariableFromHistory(historyService, processInstanceId, "WorkflowException");
- if(workflowExceptionObject != null) {
- if(workflowExceptionObject instanceof WorkflowException) {
- workflowException = (WorkflowException) workflowExceptionObject;
- workflowExceptionText = workflowException.toString();
- responseMap = new HashMap<>();
- responseMap.put("WorkflowException", workflowExceptionText);
- responseMap.put("ResponseCode", workflowException.getErrorCode());
- responseMap.put("Status", "Fail");
- return responseMap;
- }
- else if (workflowExceptionObject instanceof String) {
- Object object = getVariableFromHistory(historyService, processInstanceId, prefix + "ResponseCode");
- String responseCode = object == null ? null : String.valueOf(object);
- workflowExceptionText = (String) workflowExceptionObject;
- responseMap = new HashMap<>();
- responseMap.put("WorkflowException", workflowExceptionText);
- responseMap.put("ResponseCode", responseCode);
- responseMap.put("Status", "Fail");
- return responseMap;
- }
-
- }
- msoLogger.debug(LOGMARKER + "WorkflowException: " + workflowExceptionText);
-
- // BEGIN LEGACY SUPPORT. TODO: REMOVE THIS CODE
- Object object = getVariableFromHistory(historyService, processInstanceId, processKey + "Response");
- String response = object == null ? null : String.valueOf(object);
- msoLogger.debug(LOGMARKER + processKey + "Response: " + response);
-
- if (response != null) {
- object = getVariableFromHistory(historyService, processInstanceId, prefix + "ResponseCode");
- String responseCode = object == null ? null : String.valueOf(object);
- msoLogger.debug(LOGMARKER + prefix + "ResponseCode: " + responseCode);
- responseMap = new HashMap<>();
- responseMap.put("Response", response);
- responseMap.put("ResponseCode", responseCode);
- responseMap.put("Status", "Success");
- return responseMap;
- }
-
- object = getVariableFromHistory(historyService, processInstanceId, prefix + "ErrorResponse");
- String errorResponse = object == null ? null : String.valueOf(object);
- msoLogger.debug(LOGMARKER + prefix + "ErrorResponse: " + errorResponse);
-
- if (errorResponse != null) {
- object = getVariableFromHistory(historyService, processInstanceId, prefix + "ResponseCode");
- String responseCode = object == null ? null : String.valueOf(object);
- msoLogger.debug(LOGMARKER + prefix + "ResponseCode: " + responseCode);
- responseMap = new HashMap<>();
- responseMap.put("Response", errorResponse);
- responseMap.put("ResponseCode", responseCode);
- responseMap.put("Status", "Fail");
- return responseMap;
- }
- // END LEGACY SUPPORT. TODO: REMOVE THIS CODE
- }
- }
- return null;
- }
-
- /**
- * Gets a variable value from the specified execution.
- * @return the variable value, or null if the variable could not be
- * obtained
- */
- private Object getVariableFromExecution(RuntimeService runtimeService,
- String executionId, String variableName) {
- try {
- return runtimeService.getVariable(executionId, variableName);
- } catch (ProcessEngineException e) {
- // Most likely cause is that the execution no longer exists.
- msoLogger.debug("Error retrieving execution " + executionId
- + " variable " + variableName + ": " + e);
- return null;
- }
- }
- /**
- * Gets a variable value from specified historical process instance.
- * @return the variable value, or null if the variable could not be
- * obtained
- */
- private Object getVariableFromHistory(HistoryService historyService,
- String processInstanceId, String variableName) {
- try {
- HistoricVariableInstance v = historyService.createHistoricVariableInstanceQuery()
- .processInstanceId(processInstanceId).variableName(variableName).singleResult();
- return v == null ? null : v.getValue();
- } catch (Exception e) {
- msoLogger.debug("Error retrieving process " + processInstanceId
- + " variable " + variableName + " from history: " + e);
- return null;
- }
- }
-
- @POST
- @Path("/services/{processKey}/{processInstanceId}")
- @Produces("application/json")
- @Consumes("application/json")
- public WorkflowResponse getProcessVariables(@PathParam("processKey") String processKey, @PathParam("processInstanceId") String processInstanceId) {
- //TODO filter only set of variables
- WorkflowResponse response = new WorkflowResponse();
-
- long startTime = System.currentTimeMillis();
- try {
- ProcessEngineServices engine = getProcessEngineServices();
- List<HistoricVariableInstance> variables = engine.getHistoryService().createHistoricVariableInstanceQuery().processInstanceId(processInstanceId).list();
- Map<String,String> variablesMap = new HashMap<>();
- for (HistoricVariableInstance variableInstance: variables) {
- variablesMap.put(variableInstance.getName(), variableInstance.getValue().toString());
- }
-
- msoLogger.debug(LOGMARKER + "***Received MSO getProcessVariables with processKey:" + processKey + " and variables: " + variablesMap.toString());
-
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, LOGMARKER
- + "Call to MSO workflow/services in Camunda. Received MSO getProcessVariables with processKey:"
- + processKey + " and variables: "
- + variablesMap.toString());
-
-
- response.setVariables(variablesMap);
- response.setMessage("Success");
- response.setContent("Successfully retrieved the variables");
- response.setProcessInstanceId(processInstanceId);
-
- msoLogger.debug(LOGMARKER + response.getMessage() + " for processKey: " + processKey + " with content: " + response.getContent());
- } catch (Exception ex) {
- response.setMessage("Fail");
- response.setContent("Failed to retrieve the variables," + ex.getMessage());
- response.setProcessInstanceId(processInstanceId);
-
- msoLogger.error (MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "BPMN", MDC.get(processKey), MsoLogger.ErrorCode.UnknownError, LOGMARKER
- + response.getMessage()
- + " for processKey: "
- + processKey
- + " with content: "
- + response.getContent());
- msoLogger.debug("Exception :",ex);
- }
-
- msoLogger.recordMetricEvent ( startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- LOGMARKER + response.getMessage() + " for processKey: "
- + processKey + " with content: " + response.getContent(), "BPMN", MDC.get(processKey), null);
-
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- LOGMARKER + response.getMessage() + " for processKey: "
- + processKey + " with content: " + response.getContent());
-
- return response;
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/network/NetworkAdapterClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/network/NetworkAdapterClient.java deleted file mode 100644 index 5e3aca5613..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/network/NetworkAdapterClient.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.client.adapter.network;
-
-import org.openecomp.mso.adapters.nwrest.CreateNetworkRequest;
-import org.openecomp.mso.adapters.nwrest.CreateNetworkResponse;
-import org.openecomp.mso.adapters.nwrest.DeleteNetworkRequest;
-import org.openecomp.mso.adapters.nwrest.DeleteNetworkResponse;
-import org.openecomp.mso.adapters.nwrest.QueryNetworkResponse;
-import org.openecomp.mso.adapters.nwrest.RollbackNetworkRequest;
-import org.openecomp.mso.adapters.nwrest.RollbackNetworkResponse;
-import org.openecomp.mso.adapters.nwrest.UpdateNetworkRequest;
-import org.openecomp.mso.adapters.nwrest.UpdateNetworkResponse;
-
-public interface NetworkAdapterClient {
-
- CreateNetworkResponse createNetwork(CreateNetworkRequest req);
-
- DeleteNetworkResponse deleteNetwork(String aaiNetworkId, DeleteNetworkRequest req);
-
- RollbackNetworkResponse rollbackNetwork(String aaiNetworkId, RollbackNetworkRequest req);
-
- QueryNetworkResponse queryNetwork(String aaiNetworkId, String cloudSiteId, String tenantId, String networkStackId, boolean skipAAI, String requestId, String serviceInstanceId);
-
- UpdateNetworkResponse updateNetwork(String aaiNetworkId, UpdateNetworkRequest req);
-
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/network/NetworkAdapterClientImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/network/NetworkAdapterClientImpl.java deleted file mode 100644 index 6a1c862a66..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/network/NetworkAdapterClientImpl.java +++ /dev/null @@ -1,97 +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.client.adapter.network; - -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.UriBuilder; - -import org.openecomp.mso.adapters.nwrest.CreateNetworkRequest; -import org.openecomp.mso.adapters.nwrest.CreateNetworkResponse; -import org.openecomp.mso.adapters.nwrest.DeleteNetworkRequest; -import org.openecomp.mso.adapters.nwrest.DeleteNetworkResponse; -import org.openecomp.mso.adapters.nwrest.QueryNetworkResponse; -import org.openecomp.mso.adapters.nwrest.RollbackNetworkRequest; -import org.openecomp.mso.adapters.nwrest.RollbackNetworkResponse; -import org.openecomp.mso.adapters.nwrest.UpdateNetworkRequest; -import org.openecomp.mso.adapters.nwrest.UpdateNetworkResponse; -import org.openecomp.mso.client.adapter.vnf.AdapterRestClient; - -public class NetworkAdapterClientImpl implements NetworkAdapterClient { - - private final NetworkAdapterRestProperties props; - public NetworkAdapterClientImpl() { - this.props = new NetworkAdapterRestProperties(); - } - @Override - public CreateNetworkResponse createNetwork(CreateNetworkRequest req) { - return new AdapterRestClient(this.props, this.getUri("").build()).post(req, - CreateNetworkResponse.class); - } - - @Override - public DeleteNetworkResponse deleteNetwork(String aaiNetworkId, DeleteNetworkRequest req) { - return new AdapterRestClient(this.props, this.getUri("/" + aaiNetworkId).build()).delete(req, - DeleteNetworkResponse.class); - } - - @Override - public RollbackNetworkResponse rollbackNetwork(String aaiNetworkId, RollbackNetworkRequest req) { - return new AdapterRestClient(this.props, this.getUri("/" + aaiNetworkId).build()).delete(req, - RollbackNetworkResponse.class); - } - - @Override - public QueryNetworkResponse queryNetwork(String aaiNetworkId, String cloudSiteId, String tenantId, - String networkStackId, boolean skipAAI, String requestId, String serviceInstanceId) { - UriBuilder builder = this.getUri("/" + aaiNetworkId); - if (cloudSiteId != null) { - builder.queryParam("cloudSiteId", cloudSiteId); - } - if (tenantId != null) { - builder.queryParam("tenantId", tenantId); - } - if (networkStackId != null) { - builder.queryParam("networkStackId", networkStackId); - } - - builder.queryParam("skipAAI", skipAAI); - - if (requestId != null) { - builder.queryParam("msoRequest.requestId", requestId); - } - if (serviceInstanceId != null) { - builder.queryParam("msoRequest.serviceInstanceId", serviceInstanceId); - } - return new AdapterRestClient(this.props, builder.build(), MediaType.TEXT_XML, MediaType.TEXT_XML) - .get(QueryNetworkResponse.class); - } - - @Override - public UpdateNetworkResponse updateNetwork(String aaiNetworkId, UpdateNetworkRequest req) { - return new AdapterRestClient(this.props, this.getUri("/" + aaiNetworkId).build()).put(req, - UpdateNetworkResponse.class); - } - - protected UriBuilder getUri(String path) { - return UriBuilder.fromPath(path); - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/MsoRequestsDbAdapter.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/MsoRequestsDbAdapter.java deleted file mode 100644 index c3ba8e16ea..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/MsoRequestsDbAdapter.java +++ /dev/null @@ -1,35 +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.client.adapter.requests.db; - -import org.openecomp.mso.client.adapter.requests.db.entities.MsoRequestsDbException; -import org.openecomp.mso.client.adapter.requests.db.entities.UpdateInfraRequest; -import org.openecomp.mso.requestsdb.InfraActiveRequests; - -public interface MsoRequestsDbAdapter { - - public void updateInfraRequest(UpdateInfraRequest request) throws MsoRequestsDbException; - - public InfraActiveRequests getInfraRequest(String requestId) throws MsoRequestsDbException; - - public boolean getSiteStatus(String siteName); - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/MsoRequestsDbAdapterClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/MsoRequestsDbAdapterClient.java deleted file mode 100644 index 2443169151..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/MsoRequestsDbAdapterClient.java +++ /dev/null @@ -1,300 +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.client.adapter.requests.db;
-
-import java.sql.Timestamp;
-
-import org.hibernate.HibernateException;
-import org.hibernate.Query;
-import org.hibernate.Session;
-import org.openecomp.mso.client.adapter.requests.db.entities.MsoRequestsDbException;
-import org.openecomp.mso.client.adapter.requests.db.entities.RequestStatusType;
-import org.openecomp.mso.client.adapter.requests.db.entities.UpdateInfraRequest;
-import org.openecomp.mso.db.AbstractSessionFactoryManager;
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoLogger;
-import org.openecomp.mso.requestsdb.InfraActiveRequests;
-import org.openecomp.mso.requestsdb.RequestsDbSessionFactoryManager;
-import org.openecomp.mso.requestsdb.SiteStatus;
-import org.openecomp.mso.utils.UUIDChecker;
-
-public class MsoRequestsDbAdapterClient implements MsoRequestsDbAdapter {
-
- protected AbstractSessionFactoryManager requestsDbSessionFactoryManager = new RequestsDbSessionFactoryManager();
-
- private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA);
-
- @Override
- public void updateInfraRequest(UpdateInfraRequest request) throws MsoRequestsDbException {
- Session session = requestsDbSessionFactoryManager.getSessionFactory().openSession();
- int result = 0;
- long startTime = System.currentTimeMillis();
- if (request.getRequestId() != null && request.getLastModifiedBy() != null) {
- MsoLogger.setLogContext(request.getRequestId(), null);
- try {
- session.beginTransaction();
- StringBuilder queryString = new StringBuilder("update InfraActiveRequests set ");
- String statusMessage = null;
- String responseBody = null;
- RequestStatusType requestStatus = null;
- String progress = null;
- String vnfOutputs = null;
- String serviceInstanceId = null;
- String networkId = null;
- String vnfId = null;
- String vfModuleId = null;
- String volumeGroupId = null;
- String serviceInstanceName = null;
- String vfModuleName = null;
- String configurationId = null;
- String configurationName = null;
- if (request.getStatusMessage() != null) {
- queryString.append("statusMessage = :statusMessage, ");
- statusMessage = request.getStatusMessage();
- }
- if (request.getResponseBody() != null) {
- queryString.append("responseBody = :responseBody, ");
- responseBody = request.getResponseBody();
- }
- if (request.getRequestStatus() != null) {
- queryString.append("requestStatus = :requestStatus, ");
- requestStatus = request.getRequestStatus();
- }
- if (request.getProgress() != null) {
- queryString.append("progress = :progress, ");
- progress = request.getProgress();
- }
- if (request.getVnfOutputs() != null) {
- queryString.append("vnfOutputs = :vnfOutputs, ");
- vnfOutputs = request.getVnfOutputs();
- }
- if (request.getServiceInstanceId() != null) {
- queryString.append("serviceInstanceId = :serviceInstanceId, ");
- serviceInstanceId = request.getServiceInstanceId();
- }
- if (request.getNetworkId() != null) {
- queryString.append("networkId = :networkId, ");
- networkId = request.getNetworkId();
- }
- if (request.getVnfId() != null) {
- queryString.append("vnfId = :vnfId, ");
- vnfId = request.getVnfId();
- }
- if (request.getVfModuleId() != null) {
- queryString.append("vfModuleId = :vfModuleId, ");
- vfModuleId = request.getVfModuleId();
- }
- if (request.getVolumeGroupId() != null) {
- queryString.append("volumeGroupId = :volumeGroupId, ");
- volumeGroupId = request.getVolumeGroupId();
- }
- if (request.getServiceInstanceName() != null) {
- queryString.append("serviceInstanceName = :serviceInstanceName, ");
- serviceInstanceName = request.getServiceInstanceName();
- }
- if (request.getVfModuleName() != null) {
- queryString.append("vfModuleName = :vfModuleName, ");
- vfModuleName = request.getVfModuleName();
- }
- if (request.getConfigurationId() != null) {
- queryString.append("configurationId = :configurationId, ");
- configurationId = request.getConfigurationId();
- }
- if (request.getConfigurationName() != null) {
- queryString.append("configurationName = :configurationName, ");
- configurationName = request.getConfigurationName();
- }
- if (request.getRequestStatus() == RequestStatusType.COMPLETE
- || request.getRequestStatus() == RequestStatusType.FAILED) {
- queryString.append("endTime = :endTime, ");
- } else {
- queryString.append("modifyTime = :modifyTime, ");
- }
- queryString.append("lastModifiedBy = :lastModifiedBy where requestId = :requestId OR clientRequestId = :requestId");
-
- LOGGER.debug("Executing update: " + queryString.toString());
-
- Query query = session.createQuery(queryString.toString());
- query.setParameter("requestId", request.getRequestId());
- if (statusMessage != null) {
- query.setParameter("statusMessage", statusMessage);
- LOGGER.debug("StatusMessage in updateInfraRequest is set to: " + statusMessage);
- }
- if (responseBody != null) {
- query.setParameter("responseBody", responseBody);
- LOGGER.debug("ResponseBody in updateInfraRequest is set to: " + responseBody);
- }
- if (requestStatus != null) {
- query.setParameter("requestStatus", requestStatus.toString());
- LOGGER.debug("RequestStatus in updateInfraRequest is set to: " + requestStatus.toString());
- }
-
- if (progress != null) {
- query.setParameter("progress", Long.parseLong(progress));
- LOGGER.debug("Progress in updateInfraRequest is set to: " + progress);
- }
- if (vnfOutputs != null) {
- query.setParameter("vnfOutputs", vnfOutputs);
- LOGGER.debug("VnfOutputs in updateInfraRequest is set to: " + vnfOutputs);
- }
- if (serviceInstanceId != null) {
- query.setParameter("serviceInstanceId", serviceInstanceId);
- LOGGER.debug("ServiceInstanceId in updateInfraRequest is set to: " + serviceInstanceId);
- }
- if (networkId != null) {
- query.setParameter("networkId", networkId);
- LOGGER.debug("NetworkId in updateInfraRequest is set to: " + networkId);
- }
- if (vnfId != null) {
- query.setParameter("vnfId", vnfId);
- LOGGER.debug("VnfId in updateInfraRequest is set to: " + vnfId);
- }
- if (vfModuleId != null) {
- query.setParameter("vfModuleId", vfModuleId);
- LOGGER.debug("vfModuleId in updateInfraRequest is set to: " + vfModuleId);
- }
- if (volumeGroupId != null) {
- query.setParameter("volumeGroupId", volumeGroupId);
- LOGGER.debug("VolumeGroupId in updateInfraRequest is set to: " + volumeGroupId);
- }
- if (serviceInstanceName != null) {
- query.setParameter("serviceInstanceName", serviceInstanceName);
- LOGGER.debug("ServiceInstanceName in updateInfraRequest is set to: " + serviceInstanceName);
- }
- if (configurationId != null) {
- query.setParameter("configurationId", configurationId);
- LOGGER.debug("configurationId in updateInfraRequest is set to: " + configurationId);
- }
- if (configurationName != null) {
- query.setParameter("configurationName", configurationName);
- LOGGER.debug("configurationName in updateInfraRequest is set to: " + configurationName);
- }
- if (vfModuleName != null) {
- query.setParameter("vfModuleName", vfModuleName);
- LOGGER.debug("vfModuleName in updateInfraRequest is set to: " + vfModuleName);
- }
- Timestamp nowTimeStamp = new Timestamp(System.currentTimeMillis());
- if (request.getRequestStatus() == RequestStatusType.COMPLETE
- || request.getRequestStatus() == RequestStatusType.FAILED) {
- query.setParameter("endTime", nowTimeStamp);
- LOGGER.debug("EndTime in updateInfraRequest is set to: " + nowTimeStamp);
- } else {
- query.setParameter("modifyTime", nowTimeStamp);
- LOGGER.debug("ModifyTime in updateInfraRequest is set to: " + nowTimeStamp);
- }
- query.setParameter("lastModifiedBy", request.getLastModifiedBy());
- LOGGER.debug("LastModifiedBy in updateInfraRequest is set to: " + request.getLastModifiedBy());
- result = query.executeUpdate();
- checkIfExists(result, request.getRequestId(), startTime);
- session.getTransaction().commit();
- } catch (HibernateException e) {
- String error = "Unable to update MSO Requests DB: " + e.getMessage();
- LOGGER.error(MessageEnum.RA_CANT_UPDATE_REQUEST, "infra request parameters", request.getRequestId(), "",
- "", MsoLogger.ErrorCode.BusinessProcesssError, "HibernateException - " + error, e);
- LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError,
- error);
- throw new MsoRequestsDbException(error, e);
- } finally {
- if (session != null && session.isOpen()) {
- session.close();
- }
- }
- LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful");
- } else {
- LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BadRequest,
- "Required fields: requestId and lastModifiedBy");
- }
- }
-
- private void checkIfExists(int result, String requestId, long startTime) throws MsoRequestsDbException {
- if (result == 0) {
- String error = "Request ID does not exist in MSO Requests DB: " + requestId;
- LOGGER.error(MessageEnum.RA_DB_REQUEST_NOT_EXIST, requestId, "", "", MsoLogger.ErrorCode.DataError, error);
- throw new MsoRequestsDbException(error);
- }
- }
-
- @Override
- public InfraActiveRequests getInfraRequest(String requestId) throws MsoRequestsDbException {
- long startTime = System.currentTimeMillis();
- MsoLogger.setLogContext(requestId, null);
- Session session = requestsDbSessionFactoryManager.getSessionFactory().openSession();
-
- LOGGER.debug("Call to MSO Infra RequestsDb adapter get method with request Id: " + requestId);
-
- InfraActiveRequests request = null;
- try {
- session.beginTransaction();
- Query query = session.createQuery(
- "FROM InfraActiveRequests where requestId = :requestId OR clientRequestId = :requestId");
- query.setParameter("requestId", requestId);
- request = (InfraActiveRequests) query.uniqueResult();
- } catch (HibernateException e) {
- String error = "Unable to retrieve MSO Infra Requests DB for Request ID " + requestId;
- LOGGER.error(MessageEnum.RA_DB_REQUEST_NOT_EXIST, "Get Infra request", requestId, "", "",
- MsoLogger.ErrorCode.BusinessProcesssError, "HibernateException - " + error, e);
- LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, error);
- throw new MsoRequestsDbException(error, e);
- } finally {
- if (session != null && session.isOpen()) {
- session.close();
- }
- }
- LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful");
- return request;
- }
-
- /**
- * Get SiteStatus by SiteName.
- *
- * @param siteName
- * The unique name of the site
- * @return Status of that site
- */
- public boolean getSiteStatus(String siteName) {
- UUIDChecker.generateUUID(LOGGER);
- Session session = requestsDbSessionFactoryManager.getSessionFactory().openSession();
-
- long startTime = System.currentTimeMillis();
- SiteStatus siteStatus = null;
- LOGGER.debug("Request database - get Site Status with Site name:" + siteName);
- try {
- String hql = "FROM SiteStatus WHERE siteName = :site_name";
- Query query = session.createQuery(hql);
- query.setParameter("site_name", siteName);
-
- siteStatus = (SiteStatus) query.uniqueResult();
- } finally {
- if (session != null && session.isOpen()) {
- session.close();
- }
- }
- if (siteStatus == null) {
- // if not exist in DB, it means the site is not disabled, thus
- // return true
- LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful");
- return true;
- } else {
- LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful");
- return siteStatus.getStatus();
- }
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/MsoRequestsDbException.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/MsoRequestsDbException.java deleted file mode 100644 index a495d0eac1..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/MsoRequestsDbException.java +++ /dev/null @@ -1,62 +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.client.adapter.requests.db.entities; - - - -import javax.xml.ws.WebFault; - -/** - * This class simply extends Exception (without addition additional functionality) - * to provide an identifier for RequestsDB related exceptions on create, delete, query. - * - * - */ -@WebFault (name="MsoRequestsDbException", faultBean="org.openecomp.mso.adapters.requestsdb.exceptions.MsoRequestsDbExceptionBean", targetNamespace="http://org.openecomp.mso/requestsdb") -public class MsoRequestsDbException extends Exception { - - private static final long serialVersionUID = 1L; - - private MsoRequestsDbExceptionBean faultInfo; - - public MsoRequestsDbException (String msg) { - super(msg); - faultInfo = new MsoRequestsDbExceptionBean (msg); - } - - public MsoRequestsDbException (Throwable e) { - super(e); - faultInfo = new MsoRequestsDbExceptionBean (e.getMessage()); - } - - public MsoRequestsDbException (String msg, Throwable e) { - super (msg, e); - faultInfo = new MsoRequestsDbExceptionBean (msg); - } - - public MsoRequestsDbExceptionBean getFaultInfo() { - return faultInfo; - } - - public void setFaultInfo(MsoRequestsDbExceptionBean faultInfo) { - this.faultInfo = faultInfo; - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/RequestStatusType.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/RequestStatusType.java deleted file mode 100644 index 2fa6f2b6a2..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/RequestStatusType.java +++ /dev/null @@ -1,69 +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========================================================= - */ - -// -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 -// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.07.24 at 11:49:17 AM EDT -// - - -package org.openecomp.mso.client.adapter.requests.db.entities; - - - -import javax.xml.bind.annotation.XmlEnum; -import javax.xml.bind.annotation.XmlType; - - -/** - * <p>Java class for request-status-type. - * - * <p>The following schema fragment specifies the expected content contained within this class. - * <p> - * <pre> - * <simpleType name="request-status-type"> - * <restriction base="{http://www.w3.org/2001/XMLSchema}string"> - * <enumeration value="COMPLETE"/> - * <enumeration value="FAILED"/> - * <enumeration value="IN_PROGRESS"/> - * </restriction> - * </simpleType> - * </pre> - * - */ -@XmlType(name = "request-status-type") -@XmlEnum -public enum RequestStatusType { - - COMPLETE, - FAILED, - IN_PROGRESS; - - public String value() { - return name(); - } - - public static RequestStatusType fromValue(String v) { - return valueOf(v); - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/UpdateInfraRequest.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/UpdateInfraRequest.java deleted file mode 100644 index 15c57253f3..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/UpdateInfraRequest.java +++ /dev/null @@ -1,138 +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.client.adapter.requests.db.entities;
-
-public class UpdateInfraRequest {
-
- private String requestId;
- private String lastModifiedBy;
- private String statusMessage;
- private String responseBody;
- private RequestStatusType requestStatus;
- private String progress;
- private String vnfOutputs;
- private String serviceInstanceId;
- private String networkId;
- private String vnfId;
- private String vfModuleId;
- private String volumeGroupId;
- private String serviceInstanceName;
- private String configurationId;
- private String configurationName;
- private String vfModuleName;
-
- public String getRequestId() {
- return requestId;
- }
- public void setRequestId(String requestId) {
- this.requestId = requestId;
- }
- public String getLastModifiedBy() {
- return lastModifiedBy;
- }
- public void setLastModifiedBy(String lastModifiedBy) {
- this.lastModifiedBy = lastModifiedBy;
- }
- public String getStatusMessage() {
- return statusMessage;
- }
- public void setStatusMessage(String statusMessage) {
- this.statusMessage = statusMessage;
- }
- public String getResponseBody() {
- return responseBody;
- }
- public void setResponseBody(String responseBody) {
- this.responseBody = responseBody;
- }
- public RequestStatusType getRequestStatus() {
- return requestStatus;
- }
- public void setRequestStatus(RequestStatusType requestStatus) {
- this.requestStatus = requestStatus;
- }
- public String getProgress() {
- return progress;
- }
- public void setProgress(String progress) {
- this.progress = progress;
- }
- public String getVnfOutputs() {
- return vnfOutputs;
- }
- public void setVnfOutputs(String vnfOutputs) {
- this.vnfOutputs = vnfOutputs;
- }
- public String getServiceInstanceId() {
- return serviceInstanceId;
- }
- public void setServiceInstanceId(String serviceInstanceId) {
- this.serviceInstanceId = serviceInstanceId;
- }
- public String getNetworkId() {
- return networkId;
- }
- public void setNetworkId(String networkId) {
- this.networkId = networkId;
- }
- public String getVnfId() {
- return vnfId;
- }
- public void setVnfId(String vnfId) {
- this.vnfId = vnfId;
- }
- public String getVfModuleId() {
- return vfModuleId;
- }
- public void setVfModuleId(String vfModuleId) {
- this.vfModuleId = vfModuleId;
- }
- public String getVolumeGroupId() {
- return volumeGroupId;
- }
- public void setVolumeGroupId(String volumeGroupId) {
- this.volumeGroupId = volumeGroupId;
- }
- public String getServiceInstanceName() {
- return serviceInstanceName;
- }
- public void setServiceInstanceName(String serviceInstanceName) {
- this.serviceInstanceName = serviceInstanceName;
- }
- public String getConfigurationId() {
- return configurationId;
- }
- public void setConfigurationId(String configurationId) {
- this.configurationId = configurationId;
- }
- public String getConfigurationName() {
- return configurationName;
- }
- public void setConfigurationName(String configurationName) {
- this.configurationName = configurationName;
- }
- public String getVfModuleName() {
- return vfModuleName;
- }
- public void setVfModuleName(String vfModuleName) {
- this.vfModuleName = vfModuleName;
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/AdapterRestClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/AdapterRestClient.java deleted file mode 100644 index 16fd351b43..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/AdapterRestClient.java +++ /dev/null @@ -1,69 +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.client.adapter.vnf; - -import java.net.URI; -import java.util.Map; -import java.util.Optional; -import java.util.UUID; - -import javax.ws.rs.client.ClientResponseFilter; -import javax.ws.rs.ext.ContextResolver; - -import org.openecomp.mso.client.ResponseExceptionMapperImpl; -import org.openecomp.mso.client.policy.JettisonStyleMapperProvider; -import org.openecomp.mso.client.policy.RestClient; - -import com.fasterxml.jackson.databind.ObjectMapper; - -public class AdapterRestClient extends RestClient { - - private final AdapterRestProperties props; - public AdapterRestClient(AdapterRestProperties props, URI uri) { - super(props, UUID.randomUUID(), Optional.of(uri)); - this.props = props; - } - - public AdapterRestClient(AdapterRestProperties props, URI uri, String accept, String contentType) { - super(props, UUID.randomUUID(), Optional.of(uri), accept, contentType); - this.props = props; - } - - @Override - protected void initializeHeaderMap(Map<String, String> headerMap) { - addBasicAuthHeader(props.getAuth(), props.getKey()); - } - - @Override - protected Optional<ClientResponseFilter> addResponseFilter() { - return Optional.of(new ResponseExceptionMapperImpl()); - } - - @Override - public RestClient addRequestId(UUID requestId) { - return null; - } - - @Override - protected ContextResolver<ObjectMapper> getMapper() { - return new JettisonStyleMapperProvider(); - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/VnfAdapterClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/VnfAdapterClient.java deleted file mode 100644 index 5ee38fe0fb..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/VnfAdapterClient.java +++ /dev/null @@ -1,48 +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.client.adapter.vnf;
-
-import org.openecomp.mso.adapters.vnfrest.CreateVfModuleRequest;
-import org.openecomp.mso.adapters.vnfrest.CreateVfModuleResponse;
-import org.openecomp.mso.adapters.vnfrest.DeleteVfModuleRequest;
-import org.openecomp.mso.adapters.vnfrest.DeleteVfModuleResponse;
-import org.openecomp.mso.adapters.vnfrest.QueryVfModuleResponse;
-import org.openecomp.mso.adapters.vnfrest.RollbackVfModuleRequest;
-import org.openecomp.mso.adapters.vnfrest.RollbackVfModuleResponse;
-import org.openecomp.mso.adapters.vnfrest.UpdateVfModuleRequest;
-import org.openecomp.mso.adapters.vnfrest.UpdateVfModuleResponse;
-
-public interface VnfAdapterClient {
-
- CreateVfModuleResponse createVfModule(String aaiVnfId, CreateVfModuleRequest req);
-
- RollbackVfModuleResponse rollbackVfModule(String aaiVnfId, String aaiVfModuleId, RollbackVfModuleRequest req);
-
- DeleteVfModuleResponse deleteVfModule(String aaiVnfId, String aaiVfModuleId, DeleteVfModuleRequest req);
-
- UpdateVfModuleResponse updateVfModule(String aaiVnfId, String aaiVfModuleId, UpdateVfModuleRequest req);
-
- QueryVfModuleResponse queryVfModule(String aaiVnfId, String aaiVfModuleId, String cloudSiteId, String tenantId,
- String vfModuleName, boolean skipAAI, String requestId, String serviceInstanceId);
-
- String healthCheck();
-
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/VnfAdapterClientImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/VnfAdapterClientImpl.java deleted file mode 100644 index 2b391d302d..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/VnfAdapterClientImpl.java +++ /dev/null @@ -1,106 +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.client.adapter.vnf; - -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.UriBuilder; - -import org.openecomp.mso.adapters.vnfrest.CreateVfModuleRequest; -import org.openecomp.mso.adapters.vnfrest.CreateVfModuleResponse; -import org.openecomp.mso.adapters.vnfrest.DeleteVfModuleRequest; -import org.openecomp.mso.adapters.vnfrest.DeleteVfModuleResponse; -import org.openecomp.mso.adapters.vnfrest.QueryVfModuleResponse; -import org.openecomp.mso.adapters.vnfrest.RollbackVfModuleRequest; -import org.openecomp.mso.adapters.vnfrest.RollbackVfModuleResponse; -import org.openecomp.mso.adapters.vnfrest.UpdateVfModuleRequest; -import org.openecomp.mso.adapters.vnfrest.UpdateVfModuleResponse; - -public class VnfAdapterClientImpl implements VnfAdapterClient { - - private static final String VF_MODULES = "/vf-modules/"; - - private final VnfAdapterRestProperties props; - public VnfAdapterClientImpl() { - this.props = new VnfAdapterRestProperties(); - } - - @Override - public CreateVfModuleResponse createVfModule(String aaiVnfId, CreateVfModuleRequest req) { - return new AdapterRestClient(this.props, this.getUri("/" + aaiVnfId + "/vf-modules").build()).post(req, - CreateVfModuleResponse.class); - } - - @Override - public RollbackVfModuleResponse rollbackVfModule(String aaiVnfId, String aaiVfModuleId, - RollbackVfModuleRequest req) { - return new AdapterRestClient(this.props, - this.getUri("/" + aaiVnfId + VF_MODULES + aaiVfModuleId + "/rollback").build()).delete(req, - RollbackVfModuleResponse.class); - } - - @Override - public DeleteVfModuleResponse deleteVfModule(String aaiVnfId, String aaiVfModuleId, DeleteVfModuleRequest req) { - return new AdapterRestClient(this.props, this.getUri("/" + aaiVnfId + VF_MODULES + aaiVfModuleId).build()) - .delete(req, DeleteVfModuleResponse.class); - } - - @Override - public UpdateVfModuleResponse updateVfModule(String aaiVnfId, String aaiVfModuleId, UpdateVfModuleRequest req) { - return new AdapterRestClient(this.props, this.getUri("/" + aaiVnfId + VF_MODULES + aaiVfModuleId).build()) - .put(req, UpdateVfModuleResponse.class); - } - - @Override - public QueryVfModuleResponse queryVfModule(String aaiVnfId, String aaiVfModuleId, String cloudSiteId, - String tenantId, String vfModuleName, boolean skipAAI, String requestId, String serviceInstanceId) { - UriBuilder builder = this.getUri("/" + aaiVnfId + VF_MODULES + aaiVfModuleId); - if (cloudSiteId != null) { - builder.queryParam("cloudSiteId", cloudSiteId); - } - if (tenantId != null) { - builder.queryParam("tenantId", tenantId); - } - if (vfModuleName != null) { - builder.queryParam("vfModuleName", vfModuleName); - } - - builder.queryParam("skipAAI", skipAAI); - - if (requestId != null) { - builder.queryParam("msoRequest.requestId", requestId); - } - if (serviceInstanceId != null) { - builder.queryParam("msoRequest.serviceInstanceId", serviceInstanceId); - } - return new AdapterRestClient(this.props, builder.build(), MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON) - .get(QueryVfModuleResponse.class); - } - - @Override - public String healthCheck() { - return new AdapterRestClient(this.props, this.getUri("/healthcheck").build()).get(String.class); - } - - public UriBuilder getUri(String path) { - return UriBuilder.fromPath(path); - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/VnfAdapterRestProperties.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/VnfAdapterRestProperties.java deleted file mode 100644 index e342aeedac..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/VnfAdapterRestProperties.java +++ /dev/null @@ -1,56 +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.client.adapter.vnf; - -import java.net.MalformedURLException; -import java.net.URL; -import java.util.Map; - -import org.openecomp.mso.bpmn.core.PropertyConfiguration; -import org.openecomp.mso.client.adapter.vnf.AdapterRestProperties; - -public class VnfAdapterRestProperties implements AdapterRestProperties { - - private final Map<String, String> props; - - public VnfAdapterRestProperties() { - this.props = PropertyConfiguration.getInstance().getProperties("mso.bpmn.urn.properties"); - } - - @Override - public String getAuth() { - return props.get("mso.adapters.po.auth"); - } - @Override - public String getKey() { - return props.get("mso.msoKey"); - } - @Override - public URL getEndpoint() throws MalformedURLException { - return new URL(props.get("mso.adapters.vnf.rest.endpoint")); - } - - @Override - public String getSystemName() { - return "MSO"; - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/orchestration/AAIOrchestrator.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/orchestration/AAIOrchestrator.java deleted file mode 100644 index 73bad21c87..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/orchestration/AAIOrchestrator.java +++ /dev/null @@ -1,114 +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.client.orchestration; - -import java.util.Optional; -import java.util.logging.Logger; - -import org.modelmapper.ModelMapper; -import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition; -import org.openecomp.mso.client.aai.AAIResourcesClient; -import org.openecomp.mso.client.aai.entities.AAIEntityObject; -import org.openecomp.mso.client.aai.objects.AAIOwningEntity; -import org.openecomp.mso.client.aai.objects.AAIProject; -import org.openecomp.mso.client.aai.objects.AAIServiceInstance; - -public class AAIOrchestrator { - - private static Logger LOGGER = Logger.getLogger("AAIOrchestrator"); - - public void createServiceInstance(ServiceDecomposition serviceDecomp) { - try{ - ModelMapper modelMapper = new ModelMapper(); - AAIEntityObject serviceInstance = modelMapper.map(serviceDecomp.getServiceInstance(), AAIServiceInstance.class); - AAIResourcesClient aaiRC = this.getClient(); - aaiRC.createIfNotExists(serviceInstance.getUri(), Optional.of(serviceInstance)); - }catch(Exception ex) { - String msg = "Failed to create service instance in A&AI."; - throw new IllegalStateException(msg); - } - } - - public void deleteServiceInstance(ServiceDecomposition serviceDecomp) { - try{ - ModelMapper modelMapper = new ModelMapper(); - AAIEntityObject serviceInstance = modelMapper.map(serviceDecomp.getServiceInstance(), AAIServiceInstance.class); - AAIResourcesClient aaiRC = this.getClient(); - aaiRC.delete(serviceInstance.getUri()); - } catch (Exception ex) { - String msg = "Failed to delete service instance in A&AI."; - throw new IllegalStateException(msg); - } - } - - public void createProject(ServiceDecomposition serviceDecomp) { - try{ - ModelMapper modelMapper = new ModelMapper(); - AAIEntityObject project = modelMapper.map(serviceDecomp.getProject(), AAIProject.class); - AAIResourcesClient aaiRC = this.getClient(); - aaiRC.createIfNotExists(project.getUri(), Optional.of(project)); - }catch(Exception ex) { - String msg = "Failed to create project in A&AI."; - throw new IllegalStateException(msg); } - } - - public void createProjectandConnectServiceInstance(ServiceDecomposition serviceDecomp) { - try{ - ModelMapper modelMapper = new ModelMapper(); - AAIEntityObject project = modelMapper.map(serviceDecomp.getProject(), AAIProject.class); - AAIEntityObject serviceInstance = modelMapper.map(serviceDecomp.getServiceInstance(), AAIServiceInstance.class); - AAIResourcesClient aaiRC = this.getClient(); - aaiRC.createIfNotExists(project.getUri(), Optional.of(project)).connect(project.getUri(), serviceInstance.getUri()); - } catch(Exception ex) { - String msg = "Failed to create project and connect service instance in A&AI."; - throw new IllegalStateException(msg); - } - } - - public void createOwningEntity(ServiceDecomposition serviceDecomp) { - try{ - ModelMapper modelMapper = new ModelMapper(); - AAIEntityObject owningEntity = modelMapper.map(serviceDecomp.getOwningEntity(), AAIOwningEntity.class); - AAIResourcesClient aaiRC = this.getClient(); - aaiRC.createIfNotExists(owningEntity.getUri(), Optional.of(owningEntity)); - }catch(Exception ex) { - String msg = "Failed to create owning entity in A&AI."; - throw new IllegalStateException(msg); - } - } - - public void createOwningEntityandConnectServiceInstance(ServiceDecomposition serviceDecomp) { - try{ - ModelMapper modelMapper = new ModelMapper(); - AAIEntityObject owningEntity = modelMapper.map(serviceDecomp.getOwningEntity(), AAIOwningEntity.class); - AAIEntityObject serviceInstance = modelMapper.map(serviceDecomp.getServiceInstance(), AAIServiceInstance.class); - AAIResourcesClient aaiRC = this.getClient(); - aaiRC.createIfNotExists(owningEntity.getUri(), Optional.of(owningEntity)).connect(owningEntity.getUri(), serviceInstance.getUri()); - }catch(Exception ex) { - String msg = "Failed to create owning entity and connect service instance in A&AI."; - throw new IllegalStateException(msg); } - } - - protected AAIResourcesClient getClient() { - return new AAIResourcesClient(); - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/orchestration/SDNCOrchestrator.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/orchestration/SDNCOrchestrator.java deleted file mode 100644 index 4cefad2a3b..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/orchestration/SDNCOrchestrator.java +++ /dev/null @@ -1,61 +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.client.orchestration;
-
-import java.util.Optional;
-import java.util.logging.Logger;
-
-import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition;
-import org.openecomp.mso.client.sdnc.beans.SDNCRequest;
-import org.openecomp.mso.client.sdnc.beans.SDNCSvcAction;
-import org.openecomp.mso.client.sdnc.beans.SDNCSvcOperation;
-import org.openecomp.mso.client.sdnc.mapper.ServiceTopologyOperationRequestMapper;
-import org.openecomp.mso.client.sdnc.sync.SDNCSyncRpcClient;
-import org.openecomp.mso.properties.MsoPropertiesFactory;
-
-public class SDNCOrchestrator {
-
- private static MsoPropertiesFactory msoPF = new MsoPropertiesFactory();
-
- public void createServiceInstance (ServiceDecomposition serviceDecomp) {
-
- try{
- msoPF.initializeMsoProperties("MSO_PROP_SDNC_ADAPTER", "mso.sdnc.properties");
- Optional<String> msoAction = getMSOAction(serviceDecomp);
- ServiceTopologyOperationRequestMapper sdncRM = new ServiceTopologyOperationRequestMapper(msoAction, SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, "CreateServiceInstance");
- SDNCRequest request = sdncRM.reqMapper(serviceDecomp);
- SDNCSyncRpcClient sdncRC = new SDNCSyncRpcClient (request, msoPF);
- sdncRC.run();
- } catch (Exception ex) {
- throw new IllegalStateException();
- }
- }
-
- private Optional<String> getMSOAction (ServiceDecomposition serviceDecomp){
- String serviceType = serviceDecomp.getServiceInstance().getServiceType();
- if(serviceType == null || serviceType.equals("")){
- return Optional.empty();
- }
-
- return Optional.of(serviceType);
- }
-
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/beans/SDNCRequest.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/beans/SDNCRequest.java deleted file mode 100644 index cd04fc5ef0..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/beans/SDNCRequest.java +++ /dev/null @@ -1,95 +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.client.sdnc.beans;
-
-public class SDNCRequest {
- private String requestId;
- private String svcInstanceId;
- private SDNCSvcAction svcAction;
- private SDNCSvcOperation svcOperation;
- private String callbackUrl;
- private String msoAction;
- private String requestData;
-
- public SDNCRequest(String requestId, String svcInstanceId, SDNCSvcAction svcAction, SDNCSvcOperation svcOperation,
- String callbackUrl, String msoAction, String requestData) {
- this.requestId = requestId;
- this.svcInstanceId = svcInstanceId;
- this.svcAction = svcAction;
- this.svcOperation = svcOperation;
- this.callbackUrl = callbackUrl;
- this.msoAction = msoAction;
- this.requestData = requestData;
- }
- public SDNCRequest(){
-
- }
-
- public String getRequestId() {
- return requestId;
- }
- public void setRequestId(String requestId) {
- this.requestId = requestId;
- }
- public String getSvcInstanceId() {
- return svcInstanceId;
- }
- public void setSvcInstanceId(String svcInstanceId) {
- this.svcInstanceId = svcInstanceId;
- }
- public SDNCSvcAction getSvcAction() {
- return svcAction;
- }
- public void setSvcAction(SDNCSvcAction svcAction) {
- this.svcAction = svcAction;
- }
- public SDNCSvcOperation getSvcOperation() {
- return svcOperation;
- }
- public void setSvcOperation(SDNCSvcOperation svcOperation) {
- this.svcOperation = svcOperation;
- }
- public String getCallbackUrl() {
- return callbackUrl;
- }
- public void setCallbackUrl(String callbackUrl) {
- this.callbackUrl = callbackUrl;
- }
- public String getMsoAction() {
- return msoAction;
- }
- public void setMsoAction(String msoAction) {
- this.msoAction = msoAction;
- }
-
- public String getRequestData() {
- return requestData;
- }
- public void setRequestData(String requestData) {
- this.requestData = requestData;
- }
- @Override
- public String toString() {
- return "SDNCRequest [requestId=" + requestId + ", svcInstanceId=" + svcInstanceId + ", svcAction=" + svcAction
- + ", svcOperation=" + svcOperation + ", callbackUrl=" + callbackUrl + ", msoAction=" + msoAction
- + ", requestData=" + requestData + "]";
- }
-
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/beans/SDNCSvcOperation.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/beans/SDNCSvcOperation.java deleted file mode 100644 index 8cf1052064..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/beans/SDNCSvcOperation.java +++ /dev/null @@ -1,43 +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.client.sdnc.beans;
-
-public enum SDNCSvcOperation {
-
- VF_MODULE_TOPOLOGY_OPERATION("vf-module-topology-operation"),
- NETWORK_TOPOLOGY_OPERATION("network-topology-operation"),
- VNF_TOPOLOGY_OPERATION("vnf-topology-operation"),
- CONTRAIL_ROUTE_TOPOLOGY_OPERATION("contrail-route-topology-operation"),
- SECURITY_ZONE_TOPOLOGY_OPERATION("security-zone-topology-operation"),
- PORT_MIRROR_TOPOLOGY_OPERATION("port-mirror-topology-operation"),
- SERVICE_TOPOLOGY_OPERATION("service-topology-operation");
-
- private final String name;
-
- private SDNCSvcOperation(String name) {
- this.name = name;
- }
-
- @Override
- public String toString() {
- return name;
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/mapper/SDNCRequestMapper.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/mapper/SDNCRequestMapper.java deleted file mode 100644 index 3e714e901d..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/mapper/SDNCRequestMapper.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.client.sdnc.mapper;
-
-import java.util.Optional;
-
-import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition;
-import org.openecomp.mso.client.sdnc.beans.SDNCRequest;
-import org.openecomp.mso.client.sdnc.beans.SDNCSvcAction;
-import org.openecomp.mso.client.sdnc.beans.SDNCSvcOperation;
-
-public abstract class SDNCRequestMapper {
-
- protected final Optional<String> msoAction;
- protected final SDNCSvcOperation svcOperation;
- protected final SDNCSvcAction svcAction;
- protected final String requestAction;
-
- public SDNCRequestMapper (Optional<String> msoAction, SDNCSvcOperation svcOperation,
- SDNCSvcAction svcAction, String requestAction) {
- this.msoAction = msoAction;
- this.svcOperation = svcOperation;
- this.svcAction = svcAction;
- this.requestAction = requestAction;
- }
-
- public abstract SDNCRequest reqMapper (ServiceDecomposition serviceDecomp);
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/mapper/ServiceTopologyOperationRequestMapper.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/mapper/ServiceTopologyOperationRequestMapper.java deleted file mode 100644 index b87ed00650..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/mapper/ServiceTopologyOperationRequestMapper.java +++ /dev/null @@ -1,98 +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.client.sdnc.mapper;
-
-import java.io.StringWriter;
-import java.util.Optional;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Marshaller;
-
-import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition;
-import org.openecomp.mso.client.sdnc.beans.SDNCRequest;
-import org.openecomp.mso.client.sdnc.beans.SDNCSvcAction;
-import org.openecomp.mso.client.sdnc.beans.SDNCSvcOperation;
-
-import openecomp.org.mso.workflow.schema.v1.EcompModelInformation;
-import openecomp.org.mso.workflow.schema.v1.RequestInformation;
-import openecomp.org.mso.workflow.schema.v1.SDNCServiceInstanceRequestData;
-import openecomp.org.mso.workflow.schema.v1.ServiceInformation;
-import openecomp.org.mso.workflow.schema.v1.ServiceRequestInput;
-
-public class ServiceTopologyOperationRequestMapper extends SDNCRequestMapper{
-
- public ServiceTopologyOperationRequestMapper(Optional<String> msoAction, SDNCSvcOperation svcOperation,
- SDNCSvcAction svcAction, String requestAction) {
- super(msoAction, svcOperation, svcAction, requestAction);
- }
-
- @Override
- public SDNCRequest reqMapper (ServiceDecomposition serviceDecomp) {
- SDNCRequest req = new SDNCRequest();
- req.setCallbackUrl(serviceDecomp.getCallbackURN());
- if(msoAction.isPresent()){
- req.setMsoAction(msoAction.get());
- }
- req.setRequestId(serviceDecomp.getRequest().getSdncRequestId());
- req.setSvcInstanceId(serviceDecomp.getServiceInstance().getInstanceId());
- req.setSvcAction(svcAction);
- req.setSvcOperation(svcOperation);
- String reqData ="";
-
- RequestInformation reqInfo = new RequestInformation();
- reqInfo.setRequestAction(requestAction);
- reqInfo.setSource("MSO");
- reqInfo.setRequestId(serviceDecomp.getRequest().getRequestId());
- ServiceInformation servInfo = new ServiceInformation();
- EcompModelInformation emi = new EcompModelInformation();
- emi.setModelInvariantUuid(serviceDecomp.getRequest().getModelInfo().getModelInvariantUuid());
- emi.setModelName(serviceDecomp.getRequest().getModelInfo().getModelName());
- emi.setModelVersion(serviceDecomp.getRequest().getModelInfo().getModelVersion() );
- servInfo.setEcompModelInformation(emi);
- servInfo.setServiceId(serviceDecomp.getServiceInstance().getServiceId());
- servInfo.setSubscriptionServiceType(serviceDecomp.getCustomer().getSubscriptionServiceType());
- servInfo.setServiceInstanceId(serviceDecomp.getServiceInstance().getInstanceName());
- servInfo.setGlobalCustomerId(serviceDecomp.getCustomer().getGlobalSubscriberId());
- ServiceRequestInput servReqInput = new ServiceRequestInput();
- servReqInput.setServiceInstanceName(serviceDecomp.getServiceInstance().getInstanceName());
- SDNCServiceInstanceRequestData sdncSIRD = new SDNCServiceInstanceRequestData();
- sdncSIRD.setRequestInformation(reqInfo);
- sdncSIRD.setServiceInformation(servInfo);
- sdncSIRD.setServiceRequestInput(servReqInput);
-
- try {
- JAXBContext context = JAXBContext.newInstance(SDNCServiceInstanceRequestData.class);
-
- Marshaller jaxbMarshaller = context.createMarshaller();
- jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
-
- StringWriter sw = new StringWriter();
- jaxbMarshaller.marshal(sdncSIRD, sw);
- reqData = sw.toString();
- req.setRequestData(reqData);
- } catch (JAXBException e) {
- e.printStackTrace();
- }
-
- return req;
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/CallbackHeader.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/CallbackHeader.java deleted file mode 100644 index 2ddafc1c17..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/CallbackHeader.java +++ /dev/null @@ -1,154 +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.client.sdnc.sync; - - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - -/** - * <p>Java class for anonymous complex type. - * - * <p>The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="RequestId" type="{http://www.w3.org/2001/XMLSchema}string"/> - * <element name="ResponseCode" type="{http://www.w3.org/2001/XMLSchema}string"/> - * <element name="ResponseMessage" type="{http://www.w3.org/2001/XMLSchema}string"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ -//SDNCAdapter to BPEL Async response header -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "requestId", - "responseCode", - "responseMessage" -}) -@XmlRootElement(name = "CallbackHeader") -public class CallbackHeader { - - @XmlElement(name = "RequestId", required = true) - protected String requestId; - @XmlElement(name = "ResponseCode", required = true) - protected String responseCode; - @XmlElement(name = "ResponseMessage", required = true) - protected String responseMessage; - - public CallbackHeader() { - } - - public CallbackHeader(String reqId, String respCode, String respMsg) { - this.requestId = reqId; - this.responseCode = respCode; - this.responseMessage = respMsg; - } - - /** - * Gets the value of the requestId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getRequestId() { - return requestId; - } - - /** - * Sets the value of the requestId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setRequestId(String value) { - this.requestId = value; - } - - /** - * Gets the value of the responseCode property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getResponseCode() { - return responseCode; - } - - /** - * Sets the value of the responseCode property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setResponseCode(String value) { - this.responseCode = value; - } - - /** - * Gets the value of the responseMessage property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getResponseMessage() { - return responseMessage; - } - - /** - * Sets the value of the responseMessage property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setResponseMessage(String value) { - this.responseMessage = value; - } - - @Override - public String toString() { - return "CallbackHeader [requestId=" + requestId + ", responseCode=" - + responseCode + ", responseMessage=" + responseMessage + "]"; - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/Constants.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/Constants.java deleted file mode 100644 index 331fefa677..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/Constants.java +++ /dev/null @@ -1,48 +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.client.sdnc.sync; - - -public interface Constants { - - public static final String BPEL_REST_URL_PROP = "org.openecomp.mso.adapters.sdnc.rest.bpelurl"; - public static final String BPEL_URL_PROP = "org.openecomp.mso.adapters.sdnc.bpelurl"; - public static final String DEFAULT_BPEL_URL = "http://localhost:8080//active-bpel/services/SDNCAdapterCallbackV1"; - - public static final String MY_URL_PROP = "org.openecomp.mso.adapters.sdnc.myurl"; - public static final String DEFAULT_MY_URL = "https://localhost:8443/adapters/rest/SDNCNotify"; - - public static final String SDNC_AUTH_PROP = "org.openecomp.mso.adapters.sdnc.sdncauth"; - public static final String DEFAULT_SDNC_AUTH = "406B2AE613211B6FB52466DE6E1769AC"; - - public static final String DEFAULT_BPEL_AUTH = "05FDA034C27D1CA51AAB8FAE512EDE45241E16FC8C137D292AA3A964431C82DB"; - public static final String BPEL_AUTH_PROP = "org.openecomp.mso.adapters.sdnc.bpelauth"; - - - public static final String SDNC_SVCCFGRESP_ROOT = "input"; - public static final String SDNC_REQ_ID = "/svc-request-id"; - public static final String SDNC_RESP_CODE = "/response-code"; - public static final String SDNC_RESP_MSG = "/response-message"; - public static final String SDNC_CONNECTTIME_PROP = "org.openecomp.mso.adapters.sdnc.sdncconnecttime"; - public static final String ENCRYPTION_KEY = "aa3871669d893c7fb8abbcda31b88b4f"; - - public static final String REQUEST_TUNABLES = "org.openecomp.mso.adapters.sdnc"; -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/ObjectFactory.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/ObjectFactory.java deleted file mode 100644 index 3ddfdb2925..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/ObjectFactory.java +++ /dev/null @@ -1,77 +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.client.sdnc.sync; - - -import javax.xml.bind.annotation.XmlRegistry; - - - -/** - * This object contains factory methods for each - * Java content interface and Java element interface - * generated in the org.openecomp.mso.adapters.sdnc package. - * <p>An ObjectFactory allows you to programatically - * construct new instances of the Java representation - * for XML content. The Java representation of XML - * content can consist of schema derived interfaces - * and classes representing the binding of schema - * type definitions, element declarations and model - * groups. Factory methods for each of these are - * provided in this class. - * - */ -@XmlRegistry -public class ObjectFactory { - - - /** - * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.openecomp.mso.adapters.sdnc - * - */ - public ObjectFactory() { - } - - /** - * Create an instance of {@link RequestHeader } - * - */ - public RequestHeader createRequestHeader() { - return new RequestHeader(); - } - - /** - * Create an instance of {@link SDNCAdapterResponse } - * - */ - public SDNCAdapterResponse createSDNCAdapterResponse() { - return new SDNCAdapterResponse(); - } - - /** - * Create an instance of {@link SDNCAdapterRequest } - * - */ - public SDNCAdapterRequest createSDNCAdapterRequest() { - return new SDNCAdapterRequest(); - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/RequestHeader.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/RequestHeader.java deleted file mode 100644 index dee79898fa..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/RequestHeader.java +++ /dev/null @@ -1,219 +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.client.sdnc.sync; - - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - - -/** - * <p>Java class for anonymous complex type. - * - * <p>The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="RequestId" type="{http://www.w3.org/2001/XMLSchema}string"/> - * <element name="SvcInstanceId" type="{http://www.w3.org/2001/XMLSchema}string"/> - * <element name="SvcAction" type="{http://www.w3.org/2001/XMLSchema}string"/> - * <element name="SvcOperation" type="{http://www.w3.org/2001/XMLSchema}string"/> - * <element name="CallbackUrl" type="{http://www.w3.org/2001/XMLSchema}string"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ -//BPEL to SDNCAdapter request header -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "requestId", - "svcInstanceId", - "svcAction", - "svcOperation", - "callbackUrl", - "msoAction" -}) -@XmlRootElement(name = "RequestHeader") -public class RequestHeader { - - @XmlElement(name = "RequestId", required = true) - protected String requestId; - @XmlElement(name = "SvcInstanceId") - protected String svcInstanceId; - @XmlElement(name = "SvcAction", required = true) - protected String svcAction; - @XmlElement(name = "SvcOperation", required = true) - protected String svcOperation; - @XmlElement(name = "CallbackUrl", required = true) - protected String callbackUrl; - @XmlElement(name = "MsoAction") - protected String msoAction; - - /** - * Gets the value of the requestId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getRequestId() { - return requestId; - } - - /** - * Sets the value of the requestId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setRequestId(String value) { - this.requestId = value; - } - - public String getSvcInstanceId() { - return svcInstanceId; - } - - public void setSvcInstanceId(String svcInstanceId) { - this.svcInstanceId = svcInstanceId; - } - - /** - * Gets the value of the svcAction property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getSvcAction() { - return svcAction; - } - - /** - * Sets the value of the svcAction property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setSvcAction(String value) { - this.svcAction = value; - } - - /** - * Gets the value of the svcOperation property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getSvcOperation() { - return svcOperation; - } - - /** - * Sets the value of the svcOperation property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setSvcOperation(String value) { - this.svcOperation = value; - } - - /** - * Gets the value of the callbackUrl property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getCallbackUrl() { - return callbackUrl; - } - - /** - * Sets the value of the callbackUrl property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setCallbackUrl(String value) { - this.callbackUrl = value; - } - - /** - * Gets the value of the callbackUrl property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getMsoAction() { - return msoAction; - } - - /** - * Sets the value of the callbackUrl property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setMsoAction(String value) { - this.msoAction = value; - } - - - @Override - public String toString() { - return "RequestHeader [requestId=" + requestId + - ", svcInstanceId=" + svcInstanceId + - ", svcAction=" + svcAction + - ", svcOperation=" + svcOperation + - ", callbackUrl=" + callbackUrl + - ", msoAction=" + msoAction + "]"; - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/RequestTunables.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/RequestTunables.java deleted file mode 100644 index 55d42df6e1..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/RequestTunables.java +++ /dev/null @@ -1,222 +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.client.sdnc.sync; - - -import org.openecomp.mso.logger.MsoAlarmLogger; -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.properties.MsoJavaProperties; -import org.openecomp.mso.properties.MsoPropertiesException; -import org.openecomp.mso.properties.MsoPropertiesFactory; - -import org.openecomp.mso.logger.MessageEnum; -public class RequestTunables { - - private MsoPropertiesFactory msoPropertiesFactory; - - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); - private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger(); - public static final String MSO_PROP_SDNC_ADAPTER="MSO_PROP_SDNC_ADAPTER"; - - //criteria - private String reqId = ""; - private String msoAction = ""; - private String operation = ""; - private String action = ""; - - //tunables - private String reqMethod = "POST"; - private String sdncUrl = null; - private String timeout = "60000"; - private String headerName = "sdnc-request-header"; - private String namespace = ""; - private String asyncInd = "N"; //future use - - private String sdncaNotificationUrl = null; - - public RequestTunables(String reqId, String msoAction, String operation, String action, MsoPropertiesFactory msoPropFactory) { - super(); - msoPropertiesFactory = msoPropFactory; - if (reqId != null) { - this.reqId = reqId; - } - if (msoAction != null) { - this.msoAction = msoAction; - } - if (operation != null) { - this.operation = operation; - } - if (action != null) { - this.action = action; - } - } - - public String getReqId() { - return reqId; - } - public void setReqId(String reqId) { - this.reqId = reqId; - } - public String getReqMethod() { - return reqMethod; - } - public void setReqMethod(String reqMethod) { - this.reqMethod = reqMethod; - } - public String getMsoAction() { - return msoAction; - } - public void setMsoAction(String msoAction) { - this.msoAction = msoAction; - } - public String getAction() { - return action; - } - public void setAction(String action) { - this.action = action; - } - public String getOperation() { - return operation; - } - public void setOperation(String operation) { - this.operation = operation; - } - public String getSdncUrl() { - return sdncUrl; - } - public void setSdncUrl(String sdncUrl) { - this.sdncUrl = sdncUrl; - } - public String getTimeout() { - return timeout; - } - public void setTimeout(String timeout) { - this.timeout = timeout; - } - public String getAsyncInd() { - return asyncInd; - } - public void setAsyncInd(String asyncInd) { - this.asyncInd = asyncInd; - } - public String getHeaderName() { - return headerName; - } - public void setHeaderName(String headerName) { - this.headerName = headerName; - } - - - public String getSdncaNotificationUrl() { - return sdncaNotificationUrl; - } - - public void setSdncaNotificationUrl(String sdncaNotificationUrl) { - this.sdncaNotificationUrl = sdncaNotificationUrl; - } - - public String getNamespace() { - return namespace; - } - - public void setNamespace(String namespace) { - this.namespace = namespace; - } - - @Override - public String toString() { - return "RequestTunables [reqId=" + reqId + ", msoAction=" + msoAction - + ", operation=" + operation + ", action=" + action - + ", reqMethod=" + reqMethod + ", sdncUrl=" + sdncUrl - + ", timeout=" + timeout + ", headerName=" + headerName - + ", sdncaNotificationUrl=" + sdncaNotificationUrl - + ", namespace=" + namespace + "]"; - } - - public void setTunables() - { - String error = null; - String key = null; - if ("query".equals(action)) { //due to variable format for operation eg services/layer3-service-list/8fe4ba4f-35cf-4d9b-a04a-fd3f5d4c5cc9 - key = Constants.REQUEST_TUNABLES + "." + msoAction + ".." + action; - msoLogger.debug("Generated key: " + key); - } - else if ("put".equals(action) || "restdelete".equals(action)) { //due to variable format for operation eg services/layer3-service-list/8fe4ba4f-35cf-4d9b-a04a-fd3f5d4c5cc9 - key = Constants.REQUEST_TUNABLES + "..." + action; - msoLogger.debug("Generated key: " + key); - } else { - key = Constants.REQUEST_TUNABLES + "." + msoAction + "." + operation +"." + action; - msoLogger.debug("Generated key: " + key); - } - - String value; - try { - value = msoPropertiesFactory.getMsoJavaProperties(MSO_PROP_SDNC_ADAPTER).getProperty(key, ""); - } catch (MsoPropertiesException e) { - msoLogger.error (MessageEnum.LOAD_PROPERTIES_FAIL, "Unknown. Mso Properties ID not found in cache: " + MSO_PROP_SDNC_ADAPTER, "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception - Mso Properties ID not found in cache", e); - value=""; - } - - if (value != null && value.length() > 0) { - - String[] parts = value.split("\\|"); //escape pipe - if (parts.length < 3) { - msoLogger.warn(MessageEnum.RA_SDNC_INVALID_CONFIG, key, value, "SDNC", "", MsoLogger.ErrorCode.DataError, "Invalid config"); - } - - for (int i = 0; i < parts.length; i++) { - if (i == 0) { - reqMethod = parts[i]; - msoLogger.debug("Request Method is set to: " + reqMethod); - } else if (i == 1) { - timeout = parts[i]; - msoLogger.debug("Timeout is set to: " + timeout); - } else if (i == 2) { - sdncUrl = SDNCAdapterPortTypeImpl.getProperty(Constants.REQUEST_TUNABLES + "." + parts[i], "",msoPropertiesFactory); - if (operation != null && sdncUrl != null) { - sdncUrl = sdncUrl + operation; - } - msoLogger.debug("SDNC Url is set to: " + sdncUrl); - } else if (i == 3) { - headerName = parts[i]; - msoLogger.debug("HeaderName is set to: " + headerName); - } else if (i == 4) { - namespace = parts[i]; - msoLogger.debug("NameSpace is set to: " + namespace); - } else if (i == 5) { - asyncInd = parts[i]; - msoLogger.debug("AsyncInd is set to: " + asyncInd); - } - } - if (sdncUrl == null) { - error = "Invalid configuration, sdncUrl required for:" + key + " value:" + value; - } - } else { - error = "Missing configuration for:" + key; - } - if (error != null) { - msoLogger.error(MessageEnum.RA_SDNC_MISS_CONFIG_PARAM, key, "SDNC", "", MsoLogger.ErrorCode.DataError, "Missing config param"); - alarmLogger.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, error); - } - msoLogger.debug ("RequestTunables Key:" + key + " Value:" + value + " Tunables:" + this.toString()); - return; - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterCallbackRequest.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterCallbackRequest.java deleted file mode 100644 index 6e9d6757ad..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterCallbackRequest.java +++ /dev/null @@ -1,136 +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.client.sdnc.sync; - - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.Marshaller; -import java.io.StringWriter; -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.logger.MessageEnum; -/** - * <p>Java class for anonymous complex type. - * - * <p>The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element ref="{http://org.openecomp/workflow/sdnc/adapter/schema/v1}CallbackHeader"/> - * <element name="RequestData" type="{http://www.w3.org/2001/XMLSchema}anyType"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ -//SDNCAdapter to BPEL Async response -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "callbackHeader", - "requestData" -}) -@XmlRootElement(name = "SDNCAdapterCallbackRequest") -public class SDNCAdapterCallbackRequest { - - @XmlElement(name = "CallbackHeader", required = true) - protected CallbackHeader callbackHeader; - @XmlElement(name = "RequestData") - protected Object requestData; - - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); - - /** - * Gets the value of the callbackHeader property. - * - * @return - * possible object is - * {@link CallbackHeader } - * - */ - public CallbackHeader getCallbackHeader() { - return callbackHeader; - } - - /** - * Sets the value of the callbackHeader property. - * - * @param value - * allowed object is - * {@link CallbackHeader } - * - */ - public void setCallbackHeader(CallbackHeader value) { - this.callbackHeader = value; - } - - /** - * Gets the value of the requestData property. - * - * @return - * possible object is - * {@link Object } - * - */ - public Object getRequestData() { - return requestData; - } - - /** - * Sets the value of the requestData property. - * - * @param value - * allowed object is - * {@link Object } - * - */ - public void setRequestData(Object value) { - this.requestData = value; - } - - @Override - public String toString() { - try { - JAXBContext ctx = JAXBContext.newInstance("org.openecomp.mso.adapters.sdnc.client"); - Marshaller m = ctx.createMarshaller(); - m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); - m.setProperty(Marshaller.JAXB_ENCODING, "UTF-8"); - StringWriter w = new StringWriter(); - m.marshal(this, w); - return (w.toString()); - } - catch (Exception e) - { - msoLogger.error(MessageEnum.RA_MARSHING_ERROR, "", "", MsoLogger.ErrorCode.DataError, "Exception - MARSHING_ERROR", e); - } - return(""); - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterPortType.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterPortType.java deleted file mode 100644 index 8b56932769..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterPortType.java +++ /dev/null @@ -1,57 +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.client.sdnc.sync; - - -import javax.jws.WebMethod; -import javax.jws.WebParam; -import javax.jws.WebResult; -import javax.jws.WebService; -import javax.jws.soap.SOAPBinding; -import javax.xml.bind.annotation.XmlSeeAlso; - -import org.openecomp.mso.client.sdnc.beans.SDNCRequest; - - -/** - * This class was generated by Apache CXF 2.7.11.redhat-3 - * 2015-01-27T18:25:50.914-05:00 - * Generated source version: 2.7.11.redhat-3 - * - */ -//BPEL SDNCAdapter SOAP WebService - impl class in impl pkg -@WebService(targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/wsdl/v1", name = "SDNCAdapterPortType") -@XmlSeeAlso({ObjectFactory.class}) -@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE) -public interface SDNCAdapterPortType { - - @WebResult(name = "SDNCAdapterResponse", targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterResponse") - @WebMethod(operationName = "SDNCAdapter") - public SDNCAdapterResponse sdncAdapter( - @WebParam(partName = "SDNCAdapterRequest", name = "SDNCAdapterRequest", targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/schema/v1") - SDNCAdapterRequest sdncAdapterRequest - ); - - @WebMethod - public void healthCheck(); - - SDNCAdapterResponse sdncAdapter(SDNCRequest bpelRequest); -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterPortTypeImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterPortTypeImpl.java deleted file mode 100644 index 3d9aab666a..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterPortTypeImpl.java +++ /dev/null @@ -1,108 +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.client.sdnc.sync; - -import javax.annotation.PostConstruct; -import javax.jws.WebService; -import javax.servlet.http.HttpServletResponse; - -import org.openecomp.mso.client.sdnc.beans.SDNCRequest; -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoAlarmLogger; -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.properties.MsoPropertiesException; -import org.openecomp.mso.properties.MsoPropertiesFactory; - -//BPEL SDNCAdapter SOAP Web Service implementation -@WebService(serviceName = "SDNCAdapterService", endpointInterface = "org.openecomp.mso.client.sdnc.sync.SDNCAdapterPortType", targetNamespace = "http://org.openecomp/workflow/sdnc/ad") -public class SDNCAdapterPortTypeImpl implements SDNCAdapterPortType { - - private MsoPropertiesFactory msoPropertiesFactory=new MsoPropertiesFactory(); - - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); - private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger(); - private static final String LOG_SERVICE_NAME = "MSO-BPMN:MSO-SDNCAdapter."; - private static final String LOG_REPLY_NAME = "MSO-SDNCAdapter:MSO-BPMN."; - public static final String MSO_PROP_SDNC_ADAPTER="MSO_PROP_SDNC_ADAPTER"; - - @PostConstruct - public void init () { - msoLogger.info(MessageEnum.RA_INIT_SDNC_ADAPTER, "SDNC", "SDNCAdapterPortType"); - } - - /** - * Health Check web method. Does nothing but return to show the adapter is deployed. - */ - @Override - public void healthCheck () - { - msoLogger.debug("Health check call in SDNC Adapter"); - } - - public static String getProperty(String key, String defaultValue, MsoPropertiesFactory msoPropertiesFactoryp) { - String value; - try { - value = msoPropertiesFactoryp.getMsoJavaProperties(MSO_PROP_SDNC_ADAPTER).getProperty(key, defaultValue); - } catch (MsoPropertiesException e) { - msoLogger.error (MessageEnum.NO_PROPERTIES, "Unknown. Mso Properties ID not found in cache: " + MSO_PROP_SDNC_ADAPTER, "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception - Mso Properties ID not found in cache", e); - return null; - } - msoLogger.debug("Config read for " + MSO_PROP_SDNC_ADAPTER + " - key:" + key + " value:" + value); - return value; - } - - @Override - public SDNCAdapterResponse sdncAdapter(SDNCRequest bpelRequest) { - String bpelReqId = bpelRequest.getRequestId(); - String callbackUrl = bpelRequest.getCallbackUrl(); - long startTime = System.currentTimeMillis (); - MsoLogger.setLogContext(SDNCRequestIdUtil.getSDNCOriginalRequestId (bpelReqId), bpelRequest.getSvcInstanceId()); - MsoLogger.setServiceName (bpelRequest.getSvcAction().toString()); - msoLogger.info(MessageEnum.RA_RECEIVE_BPEL_REQUEST, bpelReqId, callbackUrl, "SDNC", ""); - - SDNCSyncRpcClient sdncClient = new SDNCSyncRpcClient(bpelRequest,msoPropertiesFactory); - long subStartTime = System.currentTimeMillis (); - try { - Thread sdncClientThread = new Thread(sdncClient); - sdncClientThread.start(); - } - catch (Exception e){ - String respMsg = "Error sending request to SDNC. Failed to start SDNC Client thread " + e.getMessage(); - msoLogger.error(MessageEnum.RA_SEND_REQUEST_SDNC_ERR, "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception sending request to SDNC. Failed to start SDNC Client thread", e); - alarmLogger.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, respMsg); - SDNCResponse sdncResp = new SDNCResponse(bpelReqId); - sdncResp.setRespCode(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); - sdncResp.setRespMsg(respMsg); - } - - msoLogger.debug("Sending synchronous response to BPEL"); - SDNCAdapterResponse wsResp = new SDNCAdapterResponse(); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful"); - return (wsResp); - } - - @Override - public org.openecomp.mso.client.sdnc.sync.SDNCAdapterResponse sdncAdapter( - org.openecomp.mso.client.sdnc.sync.SDNCAdapterRequest sdncAdapterRequest) { - // TODO Auto-generated method stub - return null; - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterRequest.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterRequest.java deleted file mode 100644 index 5beedb12be..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterRequest.java +++ /dev/null @@ -1,128 +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.client.sdnc.sync; - - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - -import org.w3c.dom.Document; -import org.w3c.dom.Node; - -/** - * <p>Java class for anonymous complex type. - * - * <p>The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element ref="{http://org.openecomp/workflow/sdnc/adapter/schema/v1}RequestHeader"/> - * <element name="RequestData" type="{http://www.w3.org/2001/XMLSchema}anyType"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ -//BPEL to SDNCAdapter request -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "requestHeader", - "requestData" -}) -@XmlRootElement(name = "SDNCAdapterRequest") -public class SDNCAdapterRequest { - - @XmlElement(name = "RequestHeader", required = true) - protected RequestHeader requestHeader; - @XmlElement(name = "RequestData", required = true) - protected Object requestData; - - /** - * Gets the value of the requestHeader property. - * - * @return - * possible object is - * {@link RequestHeader } - * - */ - public RequestHeader getRequestHeader() { - return requestHeader; - } - - /** - * Sets the value of the requestHeader property. - * - * @param value - * allowed object is - * {@link RequestHeader } - * - */ - public void setRequestHeader(RequestHeader value) { - this.requestHeader = value; - } - - /** - * Gets the value of the requestData property. - * - * @return - * possible object is - * {@link Object } - * - */ - public Object getRequestData() { - return requestData; - } - - /** - * Sets the value of the requestData property. - * - * @param value - * allowed object is - * {@link Object } - * - */ - public void setRequestData(Object value) { - this.requestData = value; - } - - @Override - public String toString() { - - String rd = ""; - if (requestData != null) - { - Node node = (Node) requestData; - Document doc = node.getOwnerDocument(); - rd = Utils.domToStr(doc); - } - return "SDNCAdapterRequest [requestHeader=" + requestHeader.toString() - + ", requestData=" + rd + "]"; - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCCallbackAdapterPortType.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCCallbackAdapterPortType.java deleted file mode 100644 index 08d3bdbad7..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCCallbackAdapterPortType.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.client.sdnc.sync; - - -import javax.jws.WebMethod; -import javax.jws.WebParam; -import javax.jws.WebResult; -import javax.jws.WebService; -import javax.jws.soap.SOAPBinding; -import javax.xml.bind.annotation.XmlSeeAlso; - - - -//SDNCAdapter to BPEL Async response WEB Service -@WebService(targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/callback/wsdl/v1", name = "SDNCCallbackAdapterPortType") -@XmlSeeAlso({ObjectFactory.class}) -@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE) -public interface SDNCCallbackAdapterPortType { - - @WebResult(name = "SDNCAdapterResponse", targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterCallbackResponse") - @WebMethod(operationName = "SDNCAdapterCallback") - public SDNCAdapterResponse sdncAdapterCallback( - @WebParam(partName = "SDNCAdapterCallbackRequest", name = "SDNCAdapterCallbackRequest", targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/schema/v1") - SDNCAdapterCallbackRequest sdncAdapterCallbackRequest - ); -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCCallbackAdapterService.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCCallbackAdapterService.java deleted file mode 100644 index 0e65a3080f..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCCallbackAdapterService.java +++ /dev/null @@ -1,126 +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.client.sdnc.sync; - - -import java.net.URL; - -import javax.xml.namespace.QName; -import javax.xml.ws.Service; -import javax.xml.ws.WebEndpoint; -import javax.xml.ws.WebServiceClient; -import javax.xml.ws.WebServiceFeature; -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoLogger; - -/** - * This class was generated by Apache CXF 2.7.11.redhat-3 - * 2015-01-28T11:07:02.074-05:00 - * Generated source version: 2.7.11.redhat-3 - * - */ -//SDNCAdapter to BPEL Async response WEB Service -@WebServiceClient(name = "SDNCCallbackAdapterService", - wsdlLocation = "main/resources/SDNCCallbackAdapter.wsdl", - targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/callback/wsdl/v1") -public class SDNCCallbackAdapterService extends Service { - - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); - - public final static URL WSDL_LOCATION; - public final static QName SERVICE = new QName("http://org.openecomp/workflow/sdnc/adapter/callback/wsdl/v1", "SDNCCallbackAdapterService"); - public final static QName SDNCCallbackAdapterSoapHttpPort = new QName("http://org.openecomp/workflow/sdnc/adapter/callback/wsdl/v1", "SDNCCallbackAdapterSoapHttpPort"); - static { - URL wsdlUrl = null; - try { - wsdlUrl = Thread.currentThread().getContextClassLoader().getResource("main/resources/SDNCCallbackAdapter.wsdl"); - //wsdlUrl = SDNCCallbackAdapterService.class.getClassLoader().getResource("SDNCCallbackAdapter.wsdl"); - } catch (Exception e) { - msoLogger.error(MessageEnum.RA_WSDL_NOT_FOUND, "SDNCCallbackAdapter.wsdl", "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception - WSDL not found", e); - } - if(wsdlUrl == null) { - msoLogger.error(MessageEnum.RA_WSDL_NOT_FOUND, "SDNCCallbackAdapter.wsdl", "SDNC", "", MsoLogger.ErrorCode.DataError, "WSDL not found"); - } else { - try { - msoLogger.info(MessageEnum.RA_PRINT_URL, "SDNCCallbackAdapter.wsdl", wsdlUrl.toURI().toString(), "SDNC", ""); - } catch (Exception e) { - msoLogger.error(MessageEnum.RA_WSDL_URL_CONVENTION_EXC, "SDNCCallbackAdapter.wsdl", "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception - URL convention problem", e); - } - } - WSDL_LOCATION = wsdlUrl; - } - - public SDNCCallbackAdapterService(URL wsdlLocation) { - super(wsdlLocation, SERVICE); - } - - public SDNCCallbackAdapterService(URL wsdlLocation, QName serviceName) { - super(wsdlLocation, serviceName); - } - - public SDNCCallbackAdapterService() { - super(WSDL_LOCATION, SERVICE); - } - - //This constructor requires JAX-WS API 2.2. You will need to endorse the 2.2 - //API jar or re-run wsdl2java with "-frontend jaxws21" to generate JAX-WS 2.1 - //compliant code instead. - public SDNCCallbackAdapterService(WebServiceFeature ... features) { - super(WSDL_LOCATION, SERVICE, features); - } - - //This constructor requires JAX-WS API 2.2. You will need to endorse the 2.2 - //API jar or re-run wsdl2java with "-frontend jaxws21" to generate JAX-WS 2.1 - //compliant code instead. - public SDNCCallbackAdapterService(URL wsdlLocation, WebServiceFeature ... features) { - super(wsdlLocation, SERVICE, features); - } - - //This constructor requires JAX-WS API 2.2. You will need to endorse the 2.2 - //API jar or re-run wsdl2java with "-frontend jaxws21" to generate JAX-WS 2.1 - //compliant code instead. - public SDNCCallbackAdapterService(URL wsdlLocation, QName serviceName, WebServiceFeature ... features) { - super(wsdlLocation, serviceName, features); - } - - /** - * - * @return - * returns SDNCCallbackAdapterPortType - */ - @WebEndpoint(name = "SDNCCallbackAdapterSoapHttpPort") - public SDNCCallbackAdapterPortType getSDNCCallbackAdapterSoapHttpPort() { - return super.getPort(SDNCCallbackAdapterSoapHttpPort, SDNCCallbackAdapterPortType.class); - } - - /** - * - * @param features - * A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the <code>features</code> parameter will have their default values. - * @return - * returns SDNCCallbackAdapterPortType - */ - @WebEndpoint(name = "SDNCCallbackAdapterSoapHttpPort") - public SDNCCallbackAdapterPortType getSDNCCallbackAdapterSoapHttpPort(WebServiceFeature... features) { - return super.getPort(SDNCCallbackAdapterSoapHttpPort, SDNCCallbackAdapterPortType.class, features); - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCRequestIdUtil.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCRequestIdUtil.java deleted file mode 100644 index d905748591..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCRequestIdUtil.java +++ /dev/null @@ -1,39 +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.client.sdnc.sync; - - -public class SDNCRequestIdUtil { - // Add private constructor to prevent instance creation. - private SDNCRequestIdUtil () {} - - public static String getSDNCOriginalRequestId (String newRequestId) { - - // Camunda scripts will add postfix, such as -1, -2, on the original requestID, to make sure requestID is unique while sending request to SDNC - // In order to use the unique requestID in logging, need to remove the postfix added by the Camunda scripts - // Verify whether the requestId is a valid UUID with postfix (-1, -2). If yes, it should contain 5 times char '-', since valid UUID contains 4 times '-' - // If the requestId is not a valid UUID with postfix, we do nothing - if (newRequestId.split("-").length == 6) { - return newRequestId.substring(0, newRequestId.lastIndexOf('-')); - } - return newRequestId; - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCResponse.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCResponse.java deleted file mode 100644 index 850f5b4734..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCResponse.java +++ /dev/null @@ -1,73 +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.client.sdnc.sync; - - -import java.io.Serializable; - -public class SDNCResponse implements Serializable { - - private static final long serialVersionUID = 1L; - private String reqId = null; - private int respCode = 0; - private String respMsg = null; - private String sdncResp = null; - - public SDNCResponse(String reqId) { - this.reqId = reqId; - } - public SDNCResponse(String reqId, int respCode, String respMsg) { - this.reqId = reqId; - this.respCode = respCode; - this.respMsg = respMsg; - } - - public String getReqId() { - return reqId; - } - public void setReqId(String reqId) { - this.reqId = reqId; - } - public int getRespCode() { - return respCode; - } - public void setRespCode(int respCode) { - this.respCode = respCode; - } - public String getRespMsg() { - return respMsg; - } - public void setRespMsg(String respMsg) { - this.respMsg = respMsg; - } - public String getSdncResp() { - return sdncResp; - } - public void setSdncResp(String sdncResp) { - this.sdncResp = sdncResp; - } - - @Override - public String toString() { - return "SDNCResponse [reqId=" + reqId + ", respCode=" + respCode - + ", respMsg=" + respMsg + ", sdncResp=" + sdncResp + "]"; - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCSyncRpcClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCSyncRpcClient.java deleted file mode 100644 index ce9b706760..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCSyncRpcClient.java +++ /dev/null @@ -1,317 +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.client.sdnc.sync; - - -import java.io.BufferedReader; -import java.io.DataOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.StringReader; -import java.net.HttpURLConnection; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.xml.XMLConstants; -import javax.xml.bind.DatatypeConverter; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.ws.BindingProvider; -import javax.xml.ws.handler.MessageContext; -import javax.xml.xpath.XPath; -import javax.xml.xpath.XPathConstants; -import javax.xml.xpath.XPathFactory; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; -import org.json.JSONArray; -import org.json.JSONObject; -import org.openecomp.mso.client.sdnc.beans.SDNCRequest; -import org.openecomp.mso.client.sdnc.beans.SDNCSvcAction; -import org.openecomp.mso.client.sdnc.beans.SDNCSvcOperation; -import org.openecomp.mso.logger.MsoAlarmLogger; -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.properties.MsoJavaProperties; -import org.openecomp.mso.properties.MsoPropertiesFactory; - -//SDNCAdapter to SDNC Rest Client -public class SDNCSyncRpcClient implements Runnable { - - private MsoPropertiesFactory msoPropertiesFactory; - - private SDNCRequest bpelRequest; - - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); - private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger(); - public static final String MSO_PROP_SDNC_ADAPTER="MSO_PROP_SDNC_ADAPTER"; - - - public SDNCSyncRpcClient(SDNCRequest bpelRequest,MsoPropertiesFactory msoPropFactory) { - this.bpelRequest = bpelRequest; - msoPropertiesFactory = msoPropFactory; - } - - @Override - public void run() - { - String action = bpelRequest.getSvcAction().toString(); - String operation = bpelRequest.getSvcOperation().toString(); - String bpelReqId = bpelRequest.getRequestId(); - String msoAction = bpelRequest.getMsoAction(); - MsoLogger.setLogContext(SDNCRequestIdUtil.getSDNCOriginalRequestId (bpelReqId), bpelRequest.getSvcInstanceId()); - MsoLogger.setServiceName("SDNCRestClient"); - String sdncReqBody = ""; - - msoLogger.debug("BPEL Request:" + bpelRequest.toString()); - RequestTunables rt = new RequestTunables(bpelReqId, msoAction, operation, action, msoPropertiesFactory); - rt.setTunables(); - rt.setSdncaNotificationUrl(SDNCAdapterPortTypeImpl.getProperty(Constants.MY_URL_PROP, Constants.DEFAULT_MY_URL,msoPropertiesFactory)); - - if ("POST".equals(rt.getReqMethod())) { - try { - DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder(); - InputSource is = new InputSource(); - is.setCharacterStream(new StringReader(bpelRequest.getRequestData())); - Document reqDoc = db.parse(is); - sdncReqBody = Utils.genSdncReq(reqDoc, rt); - }catch(Exception ex) { - throw new IllegalStateException(); - } - } else if("PUT".equals(rt.getReqMethod())) { - try { - DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder(); - InputSource is = new InputSource(); - is.setCharacterStream(new StringReader(bpelRequest.getRequestData())); - Document reqDoc = db.parse(is); - sdncReqBody = Utils.genSdncPutReq(reqDoc, rt); - }catch(Exception ex) { - throw new IllegalStateException(); - } - } - long sdncStartTime = System.currentTimeMillis(); - SDNCResponse sdncResp = getSdncResp(sdncReqBody, rt, msoPropertiesFactory); - msoLogger.recordMetricEvent (sdncStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from SDNC", "SDNC", action + "." + operation, null); - msoLogger.debug ("Got the SDNC Code : " + sdncResp.getRespCode()); - msoLogger.debug ("Got the SDNC Response Message:" + sdncResp.getRespMsg()); - validateSDNCResponse(sdncResp.getSdncResp()); - return; - } - - public static SDNCResponse getSdncResp(String sdncReqBody, RequestTunables rt, MsoPropertiesFactory msoPropertiesFactoryp) { - URL url; - HttpURLConnection con = null; - DataOutputStream out = null; - BufferedReader in = null; - SDNCResponse sdncResp = new SDNCResponse(rt.getReqId()); - StringBuffer response = new StringBuffer(); - - msoLogger.info(MessageEnum.RA_SEND_REQUEST_SDNC, rt.toString(), "SDNC", ""); - msoLogger.debug("SDNC Request Body:\n" + sdncReqBody); - - try { - msoLogger.debug("url is: " + rt.getSdncUrl()); - url = new URL(rt.getSdncUrl()); - con = (HttpURLConnection) url.openConnection(); - con.setConnectTimeout(Integer.parseInt(SDNCAdapterPortTypeImpl.getProperty(Constants.SDNC_CONNECTTIME_PROP, "2000",msoPropertiesFactoryp))); - con.setReadTimeout(Integer.parseInt(rt.getTimeout())); - con.setRequestProperty("Accept", "application/json"); - String userCredentials = msoPropertiesFactoryp.getMsoJavaProperties(MSO_PROP_SDNC_ADAPTER).getEncryptedProperty(Constants.SDNC_AUTH_PROP, Constants.DEFAULT_SDNC_AUTH, Constants.ENCRYPTION_KEY); - - String basicAuth = "Basic " + DatatypeConverter.printBase64Binary(userCredentials.getBytes()); - con.setRequestProperty ("Authorization", basicAuth); - con.setRequestMethod(rt.getReqMethod()); - - if ("POST".equals(rt.getReqMethod()) || "PUT".equals(rt.getReqMethod())) { - con.setRequestProperty("Content-type", "application/json"); - con.setRequestProperty("Content-length",String.valueOf(sdncReqBody.length())); - con.setDoOutput(true); - out = new DataOutputStream(con.getOutputStream()); - out.writeBytes(sdncReqBody); - out.flush(); - out.close(); - } - - //Get response - sdncResp.setRespCode(con.getResponseCode()); - sdncResp.setRespMsg(con.getResponseMessage()); - - if (con.getResponseCode()>= 200 && con.getResponseCode()<=299) { - in = new BufferedReader(new InputStreamReader(con.getInputStream())); - String inputLine; - //Not parsing the response -it contains a responseHdr section and data section - while ((inputLine = in.readLine()) != null) { - response.append(inputLine); - } - in.close(); - } - - sdncResp.setSdncResp(response.toString()); - msoLogger.info(MessageEnum.RA_RESPONSE_FROM_SDNC, sdncResp.toString(), "SDNC", ""); - return(sdncResp); - } catch (Exception e) { - msoLogger.error(MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC, "SDNC", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception processing request to SDNC", e); - //default - sdncResp.setRespCode(HttpURLConnection.HTTP_INTERNAL_ERROR); - String respMsg = "Error processing request to SDNC. "; - String sdncErrMsg = null; - - if (e instanceof java.net.SocketTimeoutException ) { - sdncResp.setRespCode(HttpURLConnection.HTTP_CLIENT_TIMEOUT); - respMsg = "Request to SDNC timed out. "; - } - if (con != null) { - try { //e1 - if (con.getResponseCode() != HttpURLConnection.HTTP_OK) //seen in SocketException connection reset - sdncResp.setRespCode(con.getResponseCode()); - respMsg = respMsg + con.getResponseMessage() + ". "; - InputStream is = con.getErrorStream(); - if (is != null) { - XPathFactory xpathFactory = XPathFactory.newInstance(); - XPath xpath = xpathFactory.newXPath(); - DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); - dbf.setFeature (XMLConstants.FEATURE_SECURE_PROCESSING, true); - DocumentBuilder db; - Document doc = null; - try { //e2 - db = dbf.newDocumentBuilder(); - doc = db.parse(is); - NodeList errors = (NodeList)xpath.evaluate("errors/error", doc, XPathConstants.NODESET); - for (int i = 0; i < errors.getLength(); i++) { - Element error = (Element) errors.item(i); - String eType = null; - try { - eType = xpath.evaluate("error-type", error); - sdncErrMsg = ". SDNC Returned-[error-type:" + eType; - } catch (Exception e3) { - msoLogger.error (MessageEnum.RA_EVALUATE_XPATH_ERROR, "error-type", error.toString(), "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception while evaluate xpath", e3); - } - - String eTag = null; - try { - eTag = xpath.evaluate( "error-tag", error); - sdncErrMsg = sdncErrMsg + ", error-tag:" + eTag; - } catch (Exception e3) { - msoLogger.error (MessageEnum.RA_EVALUATE_XPATH_ERROR, "error-tag", error.toString(), "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception while evaluate xpath", e3); - } - - String eMsg = null; - try { - eMsg = xpath.evaluate("error-message", error); - sdncErrMsg = sdncErrMsg + ", error-message:" + eMsg + "]"; - } catch (Exception e3) { - msoLogger.error (MessageEnum.RA_EVALUATE_XPATH_ERROR, "error-message", error.toString(), "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception while evaluate xpath", e3); - } - } - } catch (Exception e2) { - msoLogger.error (MessageEnum.RA_ANALYZE_ERROR_EXC, "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception while analyse error", e2); - } - } //is != null - } catch (Exception e1) { - msoLogger.error (MessageEnum.RA_ERROR_GET_RESPONSE_SDNC, "SDNC", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception while get SDNC response", e1); - } - } //con != null - - if (e.getMessage() != null) { - respMsg = respMsg + e.getMessage(); - } - if (sdncErrMsg != null) { - respMsg = respMsg + sdncErrMsg; - } - - sdncResp.setRespMsg(respMsg); - - msoLogger.error(MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC, "SDNC", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communicate with SDNC", e); - alarmLogger.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, respMsg); - return(sdncResp); - } - finally { - if (con != null) { - con.disconnect(); - } - } - } - public void validateSDNCResponse (String sdncResponse){ - String msg; - msoLogger.debug ("Starting validate sdnc response"); - String responseMessage = ""; - String responseCode = ""; - if (sdncResponse != null || !sdncResponse.equals("")){ - try{ - msoLogger.debug ("Got the SDNC Response: " + sdncResponse); - JSONObject jsonObj = new JSONObject(sdncResponse); - msoLogger.debug ("jsonObj has been created"); - - JSONObject requestData = jsonObj.getJSONObject("v1:RequestData"); - JSONObject output = requestData.getJSONObject("output"); - try{ - responseMessage = output.getString("response-message"); - responseCode = output.getString("response-code"); - } catch (Exception ex) { - msoLogger.debug("Response not in lower hyphen"); - } - if(responseMessage.equals("")&&responseCode.equals("")){ - try{ - responseMessage = output.getString("ResponseMessage"); - responseCode = output.getString("ResponseCode"); - } catch (Exception ex) { - msoLogger.debug("Response does not exist"); - } - } - msoLogger.debug("ResponseMessage is: " + responseMessage); - msoLogger.debug("Response Code is: " + responseCode); - if(responseMessage.equals("")){ - msg = "Error from SDNC: Response Message is empty."; - msoLogger.debug(msg); - throw new IllegalStateException(msg); - } - - if(responseCode.equals("")){ - responseCode = "0"; - } - - int code = Integer.parseInt(responseCode); - if(code >=200 && code <=299 || code ==0){ - msoLogger.debug ("Successful Response from SDNC"); - - } else { - msg = "Error from SDNC: Code is not 200-299 or 0."; - msoLogger.debug(msg); - throw new IllegalStateException(msg); - } - } catch (Exception ex) { - msg = "Validate SDNC Response has failed."; - msoLogger.debug(msg); - throw new IllegalStateException(msg); - } - } - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/Utils.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/Utils.java deleted file mode 100644 index 7457b59390..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/Utils.java +++ /dev/null @@ -1,195 +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.client.sdnc.sync; - - -import java.io.StringWriter; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.logger.MessageEnum; -public class Utils { - - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); - - public static String genSdncReq(Document reqDoc, RequestTunables rt) { - try { - - DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); - DocumentBuilder db = dbf.newDocumentBuilder(); - - //NewDoc for output - //Root - Document newdoc = db.newDocument(); - Element root = newdoc.createElementNS(rt.getNamespace(), "input"); - newdoc.appendChild(root); - - //Header - Element hdr = newdoc.createElement(rt.getHeaderName()); - root.appendChild(hdr); - - String elemData = rt.getReqId(); - Element hdrChild; - if (elemData != null && elemData.length() > 0) - { - hdrChild = newdoc.createElement("svc-request-id"); - hdrChild.appendChild(newdoc.createTextNode(elemData)); - hdr.appendChild(hdrChild); - } - - elemData = rt.getAction(); - if (elemData != null && elemData.length() > 0) - { - hdrChild = newdoc.createElement("svc-action"); - hdrChild.appendChild(newdoc.createTextNode(elemData)); - hdr.appendChild(hdrChild); - } - - elemData = rt.getSdncaNotificationUrl(); - if (elemData != null && elemData.length() > 0) - { - hdrChild = newdoc.createElement("svc-notification-url"); - hdrChild.appendChild(newdoc.createTextNode(elemData)); - hdr.appendChild(hdrChild); - } - - //RequestData - NodeList nodes = reqDoc.getDocumentElement().getChildNodes(); - for (int i = 0; i < nodes.getLength(); i++) { - Node n = nodes.item(i); - Node newNode = newdoc.importNode(n, true); - root.appendChild(newNode); - } - - String s = domToStr(newdoc); - msoLogger.debug("Formatted SdncReq:\n" + s); - return (s); - - } catch (Exception e) { - msoLogger.error(MessageEnum.RA_ERROR_CREATE_SDNC_REQUEST, "SDNC", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception in genSdncReq", e); - } - return(null); - } - - public static String genSdncPutReq(Document reqDoc, RequestTunables rt) { - try { - - DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); - DocumentBuilder db = dbf.newDocumentBuilder(); - - //NewDoc for output - //Root - Document newdoc = db.newDocument(); - - //RequestData - NodeList nodes = reqDoc.getDocumentElement().getChildNodes(); - - - Element root = newdoc.createElement(nodes.item(0).getNodeName()); - newdoc.appendChild(root); - - NodeList childNodes = nodes.item(0).getChildNodes(); - for (int i = 0; i < childNodes.getLength(); i++) { - Node n = childNodes.item(i); - Node newNode = newdoc.importNode(n, true); - root.appendChild(newNode); - } - - String s = domToStr(newdoc); - msoLogger.debug("Formatted SdncPutReq:\n" + s); - return (s); - - } catch (Exception e) { - msoLogger.error(MessageEnum.RA_ERROR_CREATE_SDNC_REQUEST, "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception in genSdncPutReq", e); - } - return(null); - } - - public static String genMsoFailResp(SDNCResponse resp) { - try { - - DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); - DocumentBuilder db = dbf.newDocumentBuilder(); - - //NewDoc for output - //Root - Document newdoc = db.newDocument(); - Element root = newdoc.createElement("output"); - newdoc.appendChild(root); - - Element elem1 = newdoc.createElement("svc-request-id"); - elem1.appendChild(newdoc.createTextNode(resp.getReqId())); - root.appendChild(elem1); - - Element elem2 = newdoc.createElement("response-code"); - elem2.appendChild(newdoc.createTextNode(String.valueOf(resp.getRespCode()))); - root.appendChild(elem2); - - Element elem3 = newdoc.createElement("response-message"); - elem3.appendChild(newdoc.createTextNode(String.valueOf(resp.getRespMsg()))); - root.appendChild(elem3); - - String s = domToStr(newdoc); - msoLogger.debug("Formatted SdncReq:" + s); - return (s); - - } catch (Exception e) { - msoLogger.error(MessageEnum.RA_ERROR_CREATE_SDNC_RESPONSE, "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception in genMsoFailResp", e); - } - return(null); - } - - - public static String domToStr(Document doc) - { - if (doc != null) - { - try { - DOMSource ds = new DOMSource(doc); - StringWriter sw = new StringWriter(); - StreamResult sr = new StreamResult(sw); - TransformerFactory tf = TransformerFactory.newInstance(); - Transformer t = tf.newTransformer(); - //t.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");//<?xml version="1.0" encoding="UTF-8"?> - t.transform(ds, sr); - String s = sw.toString(); - - // This is an awful fix for now but we don't want that xmlns="" to be generated - s = s.replaceAll("xmlns=\"\"", ""); - return(s); - } catch (Exception e) { - msoLogger.error(MessageEnum.RA_ERROR_CONVERT_XML2STR, "", "", MsoLogger.ErrorCode.DataError, "Exception - domToStr", e); - } - } - return(null); - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/resources/META-INF/persistence.xml b/bpmn/MSOCommonBPMN/src/main/resources/META-INF/persistence.xml index d7166d81a9..fb027b8ed0 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/META-INF/persistence.xml +++ b/bpmn/MSOCommonBPMN/src/main/resources/META-INF/persistence.xml @@ -1,37 +1,37 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ============LICENSE_START=======================================================
- ECOMP MSO
- ================================================================================
- 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=========================================================
- -->
-
-<persistence version="2.0"
- xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="
- http://java.sun.com/xml/ns/persistence
- http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
-
- <persistence-unit name="common">
- <jta-data-source>java:jboss/datasources/ProcessEngine</jta-data-source>
- <properties>
- <!-- Properties for Hibernate -->
- <property name="hibernate.hbm2ddl.auto" value="create-drop" />
- <property name="hibernate.show_sql" value="true" />
- </properties>
- </persistence-unit>
-
-</persistence>
+<?xml version="1.0" encoding="UTF-8"?> +<!-- + ============LICENSE_START======================================================= + ECOMP MSO + ================================================================================ + 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========================================================= + --> + +<persistence version="2.0" + xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation=" + http://java.sun.com/xml/ns/persistence + http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"> + + <persistence-unit name="common"> + <jta-data-source>java:jboss/datasources/ProcessEngine</jta-data-source> + <properties> + <!-- Properties for Hibernate --> + <property name="hibernate.hbm2ddl.auto" value="create-drop" /> + <property name="hibernate.show_sql" value="true" /> + </properties> + </persistence-unit> + +</persistence> diff --git a/bpmn/MSOCommonBPMN/src/main/resources/META-INF/processes.xml b/bpmn/MSOCommonBPMN/src/main/resources/META-INF/processes.xml index 772867d3f2..33c8cb1ac0 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/META-INF/processes.xml +++ b/bpmn/MSOCommonBPMN/src/main/resources/META-INF/processes.xml @@ -22,7 +22,6 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <process-archive name="MSOCommonBPMN"> - <process-engine>default</process-engine> <properties> <property name="isDeleteUponUndeploy">false</property> <property name="isScanForProcessDefinitions">true</property> diff --git a/bpmn/MSOCommonBPMN/src/main/resources/META-INF/services/org.onap.so.client.RestProperties b/bpmn/MSOCommonBPMN/src/main/resources/META-INF/services/org.onap.so.client.RestProperties new file mode 100644 index 0000000000..bdc72c86a4 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/resources/META-INF/services/org.onap.so.client.RestProperties @@ -0,0 +1,2 @@ +org.onap.so.client.restproperties.AAIPropertiesImpl +org.onap.so.client.restproperties.PolicyRestPropertiesImpl
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/resources/META-INF/services/org.onap.so.client.dmaap.DmaapProperties b/bpmn/MSOCommonBPMN/src/main/resources/META-INF/services/org.onap.so.client.dmaap.DmaapProperties new file mode 100644 index 0000000000..878841f563 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/resources/META-INF/services/org.onap.so.client.dmaap.DmaapProperties @@ -0,0 +1 @@ +org.onap.so.client.dmaapproperties.DefaultDmaapPropertiesImpl
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/resources/META-INF/services/org.openecomp.mso.client.RestProperties b/bpmn/MSOCommonBPMN/src/main/resources/META-INF/services/org.openecomp.mso.client.RestProperties deleted file mode 100644 index 2668367d16..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/resources/META-INF/services/org.openecomp.mso.client.RestProperties +++ /dev/null @@ -1,2 +0,0 @@ -org.openecomp.mso.client.restproperties.AAIPropertiesImpl -org.openecomp.mso.client.restproperties.PolicyRestPropertiesImpl
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/resources/META-INF/services/org.openecomp.mso.client.dmaap.DmaapProperties b/bpmn/MSOCommonBPMN/src/main/resources/META-INF/services/org.openecomp.mso.client.dmaap.DmaapProperties deleted file mode 100644 index 8010194263..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/resources/META-INF/services/org.openecomp.mso.client.dmaap.DmaapProperties +++ /dev/null @@ -1 +0,0 @@ -org.openecomp.mso.client.dmaaproperties.DefaultDmaapPropertiesImpl
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/resources/logback.xml b/bpmn/MSOCommonBPMN/src/main/resources/logback.xml deleted file mode 100644 index 133fa54003..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/resources/logback.xml +++ /dev/null @@ -1,159 +0,0 @@ -<!-- - ============LICENSE_START======================================================= - ECOMP MSO - ================================================================================ - 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========================================================= - --> - -<configuration scan="true" scanPeriod="3 seconds" debug="true"> - <!--<jmxConfigurator /> --> - <!-- directory path for all other type logs --> - <property name="logDir" value="/var/log/ecomp" /> - - <!-- directory path for debugging type logs --> - <property name="debugDir" value="/var/log/ecomp" /> - - <!-- specify the component name - <ECOMP-component-name>::= "MSO" | "DCAE" | "ASDC " | "AAI" |"Policy" | "SDNC" | "AC" --> - <property name="componentName" value="MSO"></property> - <property name="subComponentName" value="BPMN"></property> - <!-- log file names --> - <property name="errorLogName" value="error" /> - <property name="metricsLogName" value="metrics" /> - <property name="auditLogName" value="audit" /> - <property name="debugLogName" value="debug" /> - - <property name="errorPattern" value="%d{"yyyy-MM-dd'T'HH:mm:ss.SSSXXX", UTC}|%X{RequestId}|%thread|%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%.-5level|%X{ErrorCode}|%X{ErrorDesc}|%msg%n" /> - <property name="debugPattern" value="%d{"yyyy-MM-dd'T'HH:mm:ss.SSSXXX", UTC}|%X{RequestId}|%msg%n" /> - - <property name="auditPattern" value="%X{BeginTimestamp}|%X{EndTimestamp}|%X{RequestId}|%X{ServiceInstanceId}|%thread||%X{ServiceName}|%X{PartnerName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDesc}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{Timer}|%X{ServerFQDN}|%X{RemoteHost}||||||||%msg%n" /> - <property name="metricPattern" value="%X{BeginTimestamp}|%X{EndTimestamp}|%X{RequestId}|%X{ServiceInstanceId}|%thread||%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDesc}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{Timer}|%X{ServerFQDN}|%X{RemoteHost}||||%X{TargetVirtualEntity}|||||%msg%n" /> - <property name="logDirectory" value="${logDir}/${componentName}/${subComponentName}" /> - <property name="debugLogDirectory" value="${debugDir}/${componentName}/${subComponentName}" /> - - - <!-- ============================================================================ --> - <!-- EELF Appenders --> - <!-- ============================================================================ --> - - <!-- The EELFAppender is used to record events to the general application - log --> - - <!-- EELF Audit Appender. This appender is used to record audit engine - related logging events. The audit logger and appender are specializations - of the EELF application root logger and appender. This can be used to segregate - Policy engine events from other components, or it can be eliminated to record - these events as part of the application root log. --> - - <appender name="EELFAudit" - class="ch.qos.logback.core.rolling.RollingFileAppender"> - <file>${logDirectory}/${auditLogName}${jboss.server.name}.log</file> - <rollingPolicy - class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> - <fileNamePattern>${logDirectory}/${auditLogName}${jboss.server.name}.log.%d</fileNamePattern> - <!--<maxHistory>30</maxHistory>--> - </rollingPolicy> - <encoder> - <pattern>${auditPattern}</pattern> - </encoder> - </appender> - <appender name="asyncEELFAudit" class="ch.qos.logback.classic.AsyncAppender"> - <queueSize>256</queueSize> - <appender-ref ref="EELFAudit" /> - </appender> - - <appender name="EELFMetrics" - class="ch.qos.logback.core.rolling.RollingFileAppender"> - <file>${logDirectory}/${metricsLogName}${jboss.server.name}.log</file> - <rollingPolicy - class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> - <fileNamePattern>${logDirectory}/${metricsLogName}${jboss.server.name}.log.%d</fileNamePattern> - <!--<maxHistory>30</maxHistory>--> - </rollingPolicy> - <encoder> - <!-- <pattern>"%d{HH:mm:ss.SSS} [%thread] %-5level %logger{1024} - - %msg%n"</pattern> --> - <pattern>${metricPattern}</pattern> - </encoder> - </appender> - - - <appender name="asyncEELFMetrics" class="ch.qos.logback.classic.AsyncAppender"> - <queueSize>256</queueSize> - <appender-ref ref="EELFMetrics"/> - </appender> - - <appender name="EELFError" - class="ch.qos.logback.core.rolling.RollingFileAppender"> - <file>${logDirectory}/${errorLogName}${jboss.server.name}.log</file> - <rollingPolicy - class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> - <fileNamePattern>${logDirectory}/${errorLogName}${jboss.server.name}.log.%d</fileNamePattern> - <!--<maxHistory>30</maxHistory>--> - </rollingPolicy> - <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> - <level>INFO</level> - </filter> - <encoder> - <pattern>${errorPattern}</pattern> - </encoder> - </appender> - - <appender name="asyncEELFError" class="ch.qos.logback.classic.AsyncAppender"> - <queueSize>256</queueSize> - <appender-ref ref="EELFError"/> - </appender> - - <appender name="EELFDebug" - class="ch.qos.logback.core.rolling.RollingFileAppender"> - <file>${debugLogDirectory}/${debugLogName}${jboss.server.name}.log</file> - <rollingPolicy - class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> - <fileNamePattern>${debugLogDirectory}/${debugLogName}${jboss.server.name}.log.%d</fileNamePattern> - <!--<maxHistory>30</maxHistory>--> - </rollingPolicy> - <encoder> - <pattern>${debugPattern}</pattern> - </encoder> - </appender> - - <appender name="asyncEELFDebug" class="ch.qos.logback.classic.AsyncAppender"> - <queueSize>256</queueSize> - <appender-ref ref="EELFDebug" /> - <includeCallerData>true</includeCallerData> - </appender> - - - <!-- ============================================================================ --> - <!-- EELF loggers --> - <!-- ============================================================================ --> - - <logger name="com.att.eelf.audit" level="info" additivity="false"> - <appender-ref ref="asyncEELFAudit" /> - </logger> - - <logger name="com.att.eelf.metrics" level="info" additivity="false"> - <appender-ref ref="asyncEELFMetrics" /> - </logger> - - <logger name="com.att.eelf.error" level="debug" additivity="false"> - <appender-ref ref="asyncEELFError" /> - </logger> - <root level="INFO"> - <appender-ref ref="asyncEELFDebug" /> - </root> - -</configuration> diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/BuildingBlock/AppCClient.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/BuildingBlock/AppCClient.bpmn index fb25363a76..db811b10e7 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/BuildingBlock/AppCClient.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/BuildingBlock/AppCClient.bpmn @@ -8,7 +8,7 @@ <bpmn:scriptTask id="PreProcessRequest" name="PreProcessRequest" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_1wz1rfg</bpmn:incoming> <bpmn:outgoing>SequenceFlow_14vlkf4</bpmn:outgoing> - <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn:script><![CDATA[import org.onap.so.bpmn.common.scripts.* def acc = new AppCClient() acc.preProcessRequest(execution)]]></bpmn:script> </bpmn:scriptTask> @@ -21,7 +21,7 @@ acc.preProcessRequest(execution)]]></bpmn:script> <bpmn:incoming>SequenceFlow_14vlkf4</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1j937vi</bpmn:outgoing> <bpmn:script><![CDATA[import org.onap.appc.client.lcm.model.Action -import org.openecomp.mso.bpmn.common.scripts.* +import org.onap.so.bpmn.common.scripts.* def acc = new AppCClient() acc.runAppcCommand(execution)]]></bpmn:script> </bpmn:scriptTask> @@ -38,7 +38,7 @@ acc.runAppcCommand(execution)]]></bpmn:script> <bpmn:scriptTask id="Task_0a36o0m" name="Process Error" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_1wi3avf</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1gq753e</bpmn:outgoing> - <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn:script><![CDATA[import org.onap.so.bpmn.common.scripts.* ExceptionUtil ex = new ExceptionUtil() ex.processSubflowsBPMNException(execution)]]></bpmn:script> diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/BuildingBlock/DecomposeService.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/BuildingBlock/DecomposeService.bpmn index 841964211e..d5223bca14 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/BuildingBlock/DecomposeService.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/BuildingBlock/DecomposeService.bpmn @@ -1,142 +1,142 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
- <bpmn2:process id="DecomposeService" name="DecomposeService" isExecutable="true">
- <bpmn2:startEvent id="createSI_startEvent" name="Start Flow">
- <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing>
- </bpmn2:startEvent>
- <bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="createSI_startEvent" targetRef="preProcessRequest_ScriptTask" />
- <bpmn2:endEvent id="EndEvent_3">
- <bpmn2:incoming>SequenceFlow_0tj2l1j</bpmn2:incoming>
- </bpmn2:endEvent>
- <bpmn2:subProcess id="SubProcess_06d8lk8" name="Java Exception Handling Sub Process" triggeredByEvent="true">
- <bpmn2:startEvent id="StartEvent_0yljq9y">
- <bpmn2:outgoing>SequenceFlow_0tgrn11</bpmn2:outgoing>
- <bpmn2:errorEventDefinition errorRef="Error_1" />
- </bpmn2:startEvent>
- <bpmn2:endEvent id="EndEvent_117lkk3">
- <bpmn2:incoming>SequenceFlow_0g4aus9</bpmn2:incoming>
- </bpmn2:endEvent>
- <bpmn2:sequenceFlow id="SequenceFlow_0tgrn11" sourceRef="StartEvent_0yljq9y" targetRef="processJavaError" />
- <bpmn2:scriptTask id="processJavaError" name="Process Error" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_0tgrn11</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_0g4aus9</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-ExceptionUtil exceptionUtil = new ExceptionUtil()
-exceptionUtil.processJavaException(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_0g4aus9" sourceRef="processJavaError" targetRef="EndEvent_117lkk3" />
- </bpmn2:subProcess>
- <bpmn2:scriptTask id="decomposeService_ScriptTask" name="Decompose Service" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_12vj619</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_0tj2l1j</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-def dds = new DecomposeService()
-dds.actuallyDecomposeService(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_0tj2l1j" sourceRef="decomposeService_ScriptTask" targetRef="EndEvent_3" />
- <bpmn2:scriptTask id="preProcessRequest_ScriptTask" name="PreProcess Incoming Request" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_0yxffj2</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-def dds = new DecomposeService()
-dds.preProcessRequest(execution)
-]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_0yxffj2" sourceRef="preProcessRequest_ScriptTask" targetRef="queryCatalogDB_ScriptTask" />
- <bpmn2:sequenceFlow id="SequenceFlow_12vj619" sourceRef="queryCatalogDB_ScriptTask" targetRef="decomposeService_ScriptTask" />
- <bpmn2:scriptTask id="queryCatalogDB_ScriptTask" name="Query Catalog DB" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_0yxffj2</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_12vj619</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-def dds = new DecomposeService()
-dds.queryCatalogDb(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- </bpmn2:process>
- <bpmn2:error id="Error_2" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
- <bpmn2:error id="Error_1" name="java.lang.Exception" errorCode="java.lang.Exception" />
- <bpmndi:BPMNDiagram id="BPMNDiagram_1">
- <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DecomposeService">
- <bpmndi:BPMNShape id="_BPMNShape_StartEvent_47" bpmnElement="createSI_startEvent">
- <dc:Bounds x="152" y="79" width="36" height="36" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="147" y="120" width="48" height="14" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_StartEvent_47" targetElement="_BPMNShape_ScriptTask_61">
- <di:waypoint xsi:type="dc:Point" x="188" y="97" />
- <di:waypoint xsi:type="dc:Point" x="301" y="97" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="245" y="82" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_177" bpmnElement="EndEvent_3">
- <dc:Bounds x="898" y="79" width="36" height="36" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="916" y="120" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="SubProcess_06d8lk8_di" bpmnElement="SubProcess_06d8lk8" isExpanded="true">
- <dc:Bounds x="142" y="243" width="417" height="161" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="StartEvent_0yljq9y_di" bpmnElement="StartEvent_0yljq9y">
- <dc:Bounds x="179" y="310" width="36" height="36" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="197" y="351" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="EndEvent_117lkk3_di" bpmnElement="EndEvent_117lkk3">
- <dc:Bounds x="465" y="310" width="36" height="36" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="483" y="351" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_0tgrn11_di" bpmnElement="SequenceFlow_0tgrn11">
- <di:waypoint xsi:type="dc:Point" x="215" y="328" />
- <di:waypoint xsi:type="dc:Point" x="290" y="328" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="253" y="313" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="ScriptTask_0twd3su_di" bpmnElement="decomposeService_ScriptTask">
- <dc:Bounds x="708" y="57" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_0tj2l1j_di" bpmnElement="SequenceFlow_0tj2l1j">
- <di:waypoint xsi:type="dc:Point" x="808" y="97" />
- <di:waypoint xsi:type="dc:Point" x="898" y="97" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="853" y="82" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_61" bpmnElement="preProcessRequest_ScriptTask">
- <dc:Bounds x="301" y="57" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_0yxffj2_di" bpmnElement="SequenceFlow_0yxffj2">
- <di:waypoint xsi:type="dc:Point" x="401" y="97" />
- <di:waypoint xsi:type="dc:Point" x="513" y="97" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="457" y="82" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="ScriptTask_0b5155c_di" bpmnElement="processJavaError">
- <dc:Bounds x="290" y="288" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_0g4aus9_di" bpmnElement="SequenceFlow_0g4aus9">
- <di:waypoint xsi:type="dc:Point" x="390" y="328" />
- <di:waypoint xsi:type="dc:Point" x="465" y="328" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="428" y="313" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_12vj619_di" bpmnElement="SequenceFlow_12vj619">
- <di:waypoint xsi:type="dc:Point" x="613" y="97" />
- <di:waypoint xsi:type="dc:Point" x="708" y="97" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="661" y="82" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="ScriptTask_17xngtx_di" bpmnElement="queryCatalogDB_ScriptTask">
- <dc:Bounds x="513" y="57" width="100" height="80" />
- </bpmndi:BPMNShape>
- </bpmndi:BPMNPlane>
- </bpmndi:BPMNDiagram>
-</bpmn2:definitions>
+<?xml version="1.0" encoding="UTF-8"?> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> + <bpmn2:process id="DecomposeService" name="DecomposeService" isExecutable="true"> + <bpmn2:startEvent id="createSI_startEvent" name="Start Flow"> + <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing> + </bpmn2:startEvent> + <bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="createSI_startEvent" targetRef="preProcessRequest_ScriptTask" /> + <bpmn2:endEvent id="EndEvent_3"> + <bpmn2:incoming>SequenceFlow_0tj2l1j</bpmn2:incoming> + </bpmn2:endEvent> + <bpmn2:subProcess id="SubProcess_06d8lk8" name="Java Exception Handling Sub Process" triggeredByEvent="true"> + <bpmn2:startEvent id="StartEvent_0yljq9y"> + <bpmn2:outgoing>SequenceFlow_0tgrn11</bpmn2:outgoing> + <bpmn2:errorEventDefinition errorRef="Error_1" /> + </bpmn2:startEvent> + <bpmn2:endEvent id="EndEvent_117lkk3"> + <bpmn2:incoming>SequenceFlow_0g4aus9</bpmn2:incoming> + </bpmn2:endEvent> + <bpmn2:sequenceFlow id="SequenceFlow_0tgrn11" sourceRef="StartEvent_0yljq9y" targetRef="processJavaError" /> + <bpmn2:scriptTask id="processJavaError" name="Process Error" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_0tgrn11</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_0g4aus9</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* +ExceptionUtil exceptionUtil = new ExceptionUtil() +exceptionUtil.processJavaException(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_0g4aus9" sourceRef="processJavaError" targetRef="EndEvent_117lkk3" /> + </bpmn2:subProcess> + <bpmn2:scriptTask id="decomposeService_ScriptTask" name="Decompose Service" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_12vj619</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_0tj2l1j</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* +def dds = new DecomposeService() +dds.actuallyDecomposeService(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_0tj2l1j" sourceRef="decomposeService_ScriptTask" targetRef="EndEvent_3" /> + <bpmn2:scriptTask id="preProcessRequest_ScriptTask" name="PreProcess Incoming Request" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_0yxffj2</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* +def dds = new DecomposeService() +dds.preProcessRequest(execution) +]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_0yxffj2" sourceRef="preProcessRequest_ScriptTask" targetRef="queryCatalogDB_ScriptTask" /> + <bpmn2:sequenceFlow id="SequenceFlow_12vj619" sourceRef="queryCatalogDB_ScriptTask" targetRef="decomposeService_ScriptTask" /> + <bpmn2:scriptTask id="queryCatalogDB_ScriptTask" name="Query Catalog DB" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_0yxffj2</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_12vj619</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* +def dds = new DecomposeService() +dds.queryCatalogDb(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + </bpmn2:process> + <bpmn2:error id="Error_2" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> + <bpmn2:error id="Error_1" name="java.lang.Exception" errorCode="java.lang.Exception" /> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DecomposeService"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_47" bpmnElement="createSI_startEvent"> + <dc:Bounds x="152" y="79" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="147" y="120" width="48" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_StartEvent_47" targetElement="_BPMNShape_ScriptTask_61"> + <di:waypoint xsi:type="dc:Point" x="188" y="97" /> + <di:waypoint xsi:type="dc:Point" x="301" y="97" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="245" y="82" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_EndEvent_177" bpmnElement="EndEvent_3"> + <dc:Bounds x="898" y="79" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="916" y="120" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="SubProcess_06d8lk8_di" bpmnElement="SubProcess_06d8lk8" isExpanded="true"> + <dc:Bounds x="142" y="243" width="417" height="161" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_0yljq9y_di" bpmnElement="StartEvent_0yljq9y"> + <dc:Bounds x="179" y="310" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="197" y="351" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_117lkk3_di" bpmnElement="EndEvent_117lkk3"> + <dc:Bounds x="465" y="310" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="483" y="351" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0tgrn11_di" bpmnElement="SequenceFlow_0tgrn11"> + <di:waypoint xsi:type="dc:Point" x="215" y="328" /> + <di:waypoint xsi:type="dc:Point" x="290" y="328" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="253" y="313" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0twd3su_di" bpmnElement="decomposeService_ScriptTask"> + <dc:Bounds x="708" y="57" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0tj2l1j_di" bpmnElement="SequenceFlow_0tj2l1j"> + <di:waypoint xsi:type="dc:Point" x="808" y="97" /> + <di:waypoint xsi:type="dc:Point" x="898" y="97" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="853" y="82" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_61" bpmnElement="preProcessRequest_ScriptTask"> + <dc:Bounds x="301" y="57" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0yxffj2_di" bpmnElement="SequenceFlow_0yxffj2"> + <di:waypoint xsi:type="dc:Point" x="401" y="97" /> + <di:waypoint xsi:type="dc:Point" x="513" y="97" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="457" y="82" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0b5155c_di" bpmnElement="processJavaError"> + <dc:Bounds x="290" y="288" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0g4aus9_di" bpmnElement="SequenceFlow_0g4aus9"> + <di:waypoint xsi:type="dc:Point" x="390" y="328" /> + <di:waypoint xsi:type="dc:Point" x="465" y="328" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="428" y="313" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_12vj619_di" bpmnElement="SequenceFlow_12vj619"> + <di:waypoint xsi:type="dc:Point" x="613" y="97" /> + <di:waypoint xsi:type="dc:Point" x="708" y="97" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="661" y="82" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_17xngtx_di" bpmnElement="queryCatalogDB_ScriptTask"> + <dc:Bounds x="513" y="57" width="100" height="80" /> + </bpmndi:BPMNShape> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn2:definitions> diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/BuildingBlock/Homing.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/BuildingBlock/Homing.bpmn index 91a6546621..fdb54116b8 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/BuildingBlock/Homing.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/BuildingBlock/Homing.bpmn @@ -1,17 +1,22 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="_vwRmIBsREeeIQtzUKIjH4g" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.11.3" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="_vwRmIBsREeeIQtzUKIjH4g" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> <bpmn2:process id="Homing" name="Homing" isExecutable="true"> <bpmn2:startEvent id="StartEvent_1"> <bpmn2:outgoing>SequenceFlow_1x9usa6</bpmn2:outgoing> </bpmn2:startEvent> - <bpmn2:scriptTask id="callSniro" name="Call Sniro" scriptFormat="groovy"> - <bpmn2:incoming>sniroCall</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_0gajic6</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* -SniroHoming homing = new SniroHoming() -homing.callSniro(execution)]]></bpmn2:script> + <bpmn2:scriptTask id="callSniro" name=" Call Sniro/Oof " scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_1x9usa6</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_0lc15i7</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* +if(execution.getVariable("homingService") == "oof"){ + OofHoming oofHoming = new OofHoming() + oofHoming.callOof(execution) +}else{ + SniroHomingV1 sniroHoming = new SniroHomingV1() + sniroHoming.callSniro(execution) +}]]></bpmn2:script> </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_1x9usa6" sourceRef="StartEvent_1" targetRef="homingSolutionCheck" /> + <bpmn2:sequenceFlow id="SequenceFlow_1x9usa6" sourceRef="StartEvent_1" targetRef="callSniro" /> <bpmn2:subProcess id="bpmnErrorSubprocess" name="Error Handling Subprocess" triggeredByEvent="true"> <bpmn2:endEvent id="EndEvent_07tjq3v"> <bpmn2:incoming>SequenceFlow_1rf4vs8</bpmn2:incoming> @@ -24,7 +29,7 @@ homing.callSniro(execution)]]></bpmn2:script> <bpmn2:scriptTask id="processMsoWorkflowException" name="Process Error" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_00nlh7l</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_1rf4vs8</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* ExceptionUtil ex = new ExceptionUtil() ex.processSubflowsBPMNException(execution)]]></bpmn2:script> </bpmn2:scriptTask> @@ -35,7 +40,7 @@ ex.processSubflowsBPMNException(execution)]]></bpmn2:script> <bpmn2:scriptTask id="processJavaException" name="Process Error" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_0kamg53</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_1o7154s</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* ExceptionUtil ex = new ExceptionUtil() ex.processJavaException(execution)]]></bpmn2:script> </bpmn2:scriptTask> @@ -50,37 +55,18 @@ ex.processJavaException(execution)]]></bpmn2:script> <bpmn2:sequenceFlow id="SequenceFlow_0kamg53" name="" sourceRef="StartEvent_1fbpeuw" targetRef="processJavaException" /> <bpmn2:sequenceFlow id="SequenceFlow_1o7154s" name="" sourceRef="processJavaException" targetRef="EndEvent_0jbvnr0" /> </bpmn2:subProcess> - <bpmn2:scriptTask id="processSniroHomingSolution" name="Process Sniro Homing Solution " scriptFormat="groovy"> - <bpmn2:incoming>sniroProcess</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_1h9opg9</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* -SniroHoming homing = new SniroHoming() -homing.processHomingSolution(execution)]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:exclusiveGateway id="responseCheck" name="Response Ok?" default="badResponse"> - <bpmn2:incoming>SequenceFlow_12t0lqb</bpmn2:incoming> - <bpmn2:incoming>SequenceFlow_0gajic6</bpmn2:incoming> - <bpmn2:outgoing>badResponse</bpmn2:outgoing> - <bpmn2:outgoing>goodResponse</bpmn2:outgoing> - </bpmn2:exclusiveGateway> - <bpmn2:scriptTask id="assignError" name="Assign Error" scriptFormat="groovy"> - <bpmn2:incoming>badResponse</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_0clfkld</bpmn2:outgoing> - <bpmn2:script><![CDATA[int responseCode = execution.getVariable("syncResponseCode") - -import org.openecomp.mso.bpmn.common.scripts.* -ExceptionUtil ex = new ExceptionUtil() -ex.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from Sniro/OOF.")]]></bpmn2:script> + <bpmn2:scriptTask id="processSniroHomingSolution" name=" Process Solution " scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_1fipbmk</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_01apjvo</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* +if(execution.getVariable("homingService") == "oof"){ + OofHoming oofHoming = new OofHoming() + oofHoming.processHomingSolution(execution) +}else{ + SniroHomingV1 sniroHoming = new SniroHomingV1 () + sniroHoming.processHomingSolution(execution) +}]]></bpmn2:script> </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="badResponse" name="No" sourceRef="responseCheck" targetRef="assignError" /> - <bpmn2:sequenceFlow id="SequenceFlow_0clfkld" sourceRef="assignError" targetRef="throwMSOWorkflowException2" /> - <bpmn2:endEvent id="throwMSOWorkflowException2"> - <bpmn2:incoming>SequenceFlow_0clfkld</bpmn2:incoming> - <bpmn2:errorEventDefinition errorRef="Error_10hit0u" /> - </bpmn2:endEvent> - <bpmn2:sequenceFlow id="goodResponse" name="Yes" sourceRef="responseCheck" targetRef="receiveAsyncCallback"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("syncResponseCode") == 202}]]></bpmn2:conditionExpression> - </bpmn2:sequenceFlow> <bpmn2:callActivity id="receiveAsyncCallback" name="Receive Async Callback" camunda:modelerTemplate="receiveWorkflowMessage" calledElement="ReceiveWorkflowMessage"> <bpmn2:extensionElements> <camunda:in source="true" target="isDebugLogEnabled" /> @@ -90,71 +76,16 @@ ex.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync <camunda:in source="timeout" target="RCVWFMSG_timeout" /> <camunda:out source="WorkflowResponse" target="asyncCallbackResponse" /> </bpmn2:extensionElements> - <bpmn2:incoming>goodResponse</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_0lc15i7</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_1fipbmk</bpmn2:outgoing> </bpmn2:callActivity> - <bpmn2:sequenceFlow id="SequenceFlow_1h9opg9" sourceRef="processSniroHomingSolution" targetRef="EndEvent_0n56tas" /> - <bpmn2:endEvent id="EndEvent_0n56tas"> - <bpmn2:incoming>SequenceFlow_1h9opg9</bpmn2:incoming> - <bpmn2:incoming>SequenceFlow_07u9d7f</bpmn2:incoming> + <bpmn2:sequenceFlow id="SequenceFlow_1fipbmk" sourceRef="receiveAsyncCallback" targetRef="processSniroHomingSolution" /> + <bpmn2:sequenceFlow id="SequenceFlow_01apjvo" sourceRef="processSniroHomingSolution" targetRef="EndEvent_0rrbz2a" /> + <bpmn2:endEvent id="EndEvent_0rrbz2a"> + <bpmn2:incoming>SequenceFlow_01apjvo</bpmn2:incoming> <bpmn2:terminateEventDefinition /> </bpmn2:endEvent> - <bpmn2:exclusiveGateway id="homingSolutionCheck" name="Which homing Solution?" default="SequenceFlow_02eywxz"> - <bpmn2:incoming>SequenceFlow_1x9usa6</bpmn2:incoming> - <bpmn2:outgoing>sniroCall</bpmn2:outgoing> - <bpmn2:outgoing>oofCall</bpmn2:outgoing> - <bpmn2:outgoing>SequenceFlow_02eywxz</bpmn2:outgoing> - </bpmn2:exclusiveGateway> - <bpmn2:scriptTask id="ScriptTask_1pkjo1d" name="Call OOF" scriptFormat="groovy"> - <bpmn2:incoming>oofCall</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_12t0lqb</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* -OofHoming homing = new OofHoming() -homing.callOof(execution)]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="sniroCall" name="Sniro" sourceRef="homingSolutionCheck" targetRef="callSniro"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("homingService") == "sniro"}]]></bpmn2:conditionExpression> - </bpmn2:sequenceFlow> - <bpmn2:sequenceFlow id="oofCall" name="OOF" sourceRef="homingSolutionCheck" targetRef="ScriptTask_1pkjo1d"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("homingService") == "oof"}]]></bpmn2:conditionExpression> - </bpmn2:sequenceFlow> - <bpmn2:sequenceFlow id="SequenceFlow_12t0lqb" sourceRef="ScriptTask_1pkjo1d" targetRef="responseCheck" /> - <bpmn2:sequenceFlow id="SequenceFlow_0gajic6" sourceRef="callSniro" targetRef="responseCheck" /> - <bpmn2:exclusiveGateway id="processHomingCheck" name="Which homing Solution?"> - <bpmn2:incoming>SequenceFlow_1fipbmk</bpmn2:incoming> - <bpmn2:outgoing>sniroProcess</bpmn2:outgoing> - <bpmn2:outgoing>oofProcess</bpmn2:outgoing> - </bpmn2:exclusiveGateway> - <bpmn2:sequenceFlow id="SequenceFlow_1fipbmk" sourceRef="receiveAsyncCallback" targetRef="processHomingCheck" /> - <bpmn2:sequenceFlow id="sniroProcess" name="Sniro" sourceRef="processHomingCheck" targetRef="processSniroHomingSolution"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("homingService") == "sniro"}]]></bpmn2:conditionExpression> - </bpmn2:sequenceFlow> - <bpmn2:sequenceFlow id="oofProcess" name="OOF" sourceRef="processHomingCheck" targetRef="processOofHomingSolution"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("homingService") == "oof"}]]></bpmn2:conditionExpression> - </bpmn2:sequenceFlow> - <bpmn2:scriptTask id="processOofHomingSolution" name="Process OOF Homing Solution " scriptFormat="groovy"> - <bpmn2:incoming>oofProcess</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_07u9d7f</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* -OofHoming homing = new OofHoming() -homing.processHomingSolution(execution)]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_07u9d7f" sourceRef="processOofHomingSolution" targetRef="EndEvent_0n56tas" /> - <bpmn2:endEvent id="throwMSOWorkflowException1"> - <bpmn2:incoming>SequenceFlow_1bub8mj</bpmn2:incoming> - <bpmn2:errorEventDefinition errorRef="Error_10hit0u" /> - </bpmn2:endEvent> - <bpmn2:scriptTask id="ScriptTask_0t0fs4n" name="Assign Error" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_02eywxz</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_1bub8mj</bpmn2:outgoing> - <bpmn2:script><![CDATA[int responseCode = execution.getVariable("sniroHomingSolution") - -import org.openecomp.mso.bpmn.common.scripts.* -ExceptionUtil ex = new ExceptionUtil() -ex.buildAndThrowWorkflowException(execution, responseCode, "No sniroHomingSolution found for Sniro/OOF.")]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_1bub8mj" sourceRef="ScriptTask_0t0fs4n" targetRef="throwMSOWorkflowException1" /> - <bpmn2:sequenceFlow id="SequenceFlow_02eywxz" sourceRef="homingSolutionCheck" targetRef="ScriptTask_0t0fs4n" /> + <bpmn2:sequenceFlow id="SequenceFlow_0lc15i7" sourceRef="callSniro" targetRef="receiveAsyncCallback" /> </bpmn2:process> <bpmn2:error id="Error_10hit0u" name="MSO Workflow Exception" errorCode="MSOWorkflowException" /> <bpmn2:error id="Error_1lwpypa" name="Java Lang Exception" errorCode="java.lang.Exception" /> @@ -164,239 +95,112 @@ ex.buildAndThrowWorkflowException(execution, responseCode, "No sniroHomingSoluti <dc:Bounds x="147" y="275" width="36" height="36" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_0qmfpdr_di" bpmnElement="callSniro"> - <dc:Bounds x="391" y="137" width="100" height="80" /> + <dc:Bounds x="313" y="253" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1x9usa6_di" bpmnElement="SequenceFlow_1x9usa6"> <di:waypoint xsi:type="dc:Point" x="183" y="293" /> - <di:waypoint xsi:type="dc:Point" x="274" y="293" /> + <di:waypoint xsi:type="dc:Point" x="313" y="293" /> <bpmndi:BPMNLabel> - <dc:Bounds x="183.5" y="278" width="90" height="0" /> + <dc:Bounds x="203" y="278" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="SubProcess_16p12qo_di" bpmnElement="bpmnErrorSubprocess" isExpanded="true"> - <dc:Bounds x="254" y="496" width="409" height="168" /> + <dc:Bounds x="254" y="449" width="409" height="168" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="SubProcess_12gjiy8_di" bpmnElement="javaExceptionSubProcess" isExpanded="true"> - <dc:Bounds x="284" y="679" width="350" height="159" /> + <dc:Bounds x="284" y="632" width="350" height="159" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_07tjq3v_di" bpmnElement="EndEvent_07tjq3v"> - <dc:Bounds x="579" y="570" width="36" height="36" /> + <dc:Bounds x="579" y="523" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="597" y="611" width="0" height="0" /> + <dc:Bounds x="552" y="564" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="StartEvent_1qiitb2_di" bpmnElement="StartEvent_1qiitb2"> - <dc:Bounds x="299" y="570" width="36" height="36" /> + <dc:Bounds x="299" y="523" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="317" y="611" width="0" height="0" /> + <dc:Bounds x="272" y="564" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_03hs6s9_di" bpmnElement="processMsoWorkflowException"> - <dc:Bounds x="406" y="548" width="100" height="80" /> + <dc:Bounds x="406" y="501" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_19gqykh_di" bpmnElement="processJavaException"> - <dc:Bounds x="410" y="727" width="100" height="80" /> + <dc:Bounds x="410" y="680" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="StartEvent_1fbpeuw_di" bpmnElement="StartEvent_1fbpeuw"> - <dc:Bounds x="318" y="749" width="36" height="36" /> + <dc:Bounds x="318" y="702" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="336" y="790" width="0" height="0" /> + <dc:Bounds x="291" y="743" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_0jbvnr0_di" bpmnElement="EndEvent_0jbvnr0"> - <dc:Bounds x="567" y="749" width="36" height="36" /> + <dc:Bounds x="567" y="702" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="585" y="790" width="0" height="0" /> + <dc:Bounds x="540" y="743" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1rf4vs8_di" bpmnElement="SequenceFlow_1rf4vs8"> - <di:waypoint xsi:type="dc:Point" x="506" y="588" /> - <di:waypoint xsi:type="dc:Point" x="579" y="588" /> + <di:waypoint xsi:type="dc:Point" x="506" y="541" /> + <di:waypoint xsi:type="dc:Point" x="579" y="541" /> <bpmndi:BPMNLabel> - <dc:Bounds x="543" y="573" width="0" height="0" /> + <dc:Bounds x="498" y="526" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_00nlh7l_di" bpmnElement="SequenceFlow_00nlh7l"> - <di:waypoint xsi:type="dc:Point" x="335" y="588" /> - <di:waypoint xsi:type="dc:Point" x="363" y="588" /> - <di:waypoint xsi:type="dc:Point" x="363" y="588" /> - <di:waypoint xsi:type="dc:Point" x="406" y="588" /> + <di:waypoint xsi:type="dc:Point" x="335" y="541" /> + <di:waypoint xsi:type="dc:Point" x="363" y="541" /> + <di:waypoint xsi:type="dc:Point" x="363" y="541" /> + <di:waypoint xsi:type="dc:Point" x="406" y="541" /> <bpmndi:BPMNLabel> - <dc:Bounds x="378" y="588" width="0" height="0" /> + <dc:Bounds x="333" y="541" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0kamg53_di" bpmnElement="SequenceFlow_0kamg53"> - <di:waypoint xsi:type="dc:Point" x="354" y="767" /> - <di:waypoint xsi:type="dc:Point" x="410" y="767" /> + <di:waypoint xsi:type="dc:Point" x="354" y="720" /> + <di:waypoint xsi:type="dc:Point" x="410" y="720" /> <bpmndi:BPMNLabel> - <dc:Bounds x="382" y="752" width="0" height="0" /> + <dc:Bounds x="337" y="705" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1o7154s_di" bpmnElement="SequenceFlow_1o7154s"> - <di:waypoint xsi:type="dc:Point" x="510" y="767" /> - <di:waypoint xsi:type="dc:Point" x="567" y="767" /> + <di:waypoint xsi:type="dc:Point" x="510" y="720" /> + <di:waypoint xsi:type="dc:Point" x="567" y="720" /> <bpmndi:BPMNLabel> - <dc:Bounds x="539" y="752" width="0" height="0" /> + <dc:Bounds x="494" y="705" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_1aapkvq_di" bpmnElement="processSniroHomingSolution"> - <dc:Bounds x="1293" y="253" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ExclusiveGateway_03gt5b8_di" bpmnElement="responseCheck" isMarkerVisible="true"> - <dc:Bounds x="566" y="268" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="554" y="328" width="74" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_0ikcqeo_di" bpmnElement="assignError"> - <dc:Bounds x="777" y="184" width="100" height="80" /> + <dc:Bounds x="597" y="253" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1m1c9nu_di" bpmnElement="badResponse"> - <di:waypoint xsi:type="dc:Point" x="610" y="287" /> - <di:waypoint xsi:type="dc:Point" x="777" y="239" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="665.309770337371" y="246.39875517690592" width="14" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0clfkld_di" bpmnElement="SequenceFlow_0clfkld"> - <di:waypoint xsi:type="dc:Point" x="877" y="224" /> - <di:waypoint xsi:type="dc:Point" x="949" y="224" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="868" y="209" width="90" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="EndEvent_13ejfwp_di" bpmnElement="throwMSOWorkflowException2"> - <dc:Bounds x="949" y="206" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="922" y="242" width="90" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1o3br3u_di" bpmnElement="goodResponse"> - <di:waypoint xsi:type="dc:Point" x="610" y="299" /> - <di:waypoint xsi:type="dc:Point" x="777" y="356" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="667.027112499105" y="300.1275453507" width="19" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="CallActivity_031b5m3_di" bpmnElement="receiveAsyncCallback"> - <dc:Bounds x="777" y="333" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1h9opg9_di" bpmnElement="SequenceFlow_1h9opg9"> - <di:waypoint xsi:type="dc:Point" x="1393" y="293" /> - <di:waypoint xsi:type="dc:Point" x="1509" y="293" /> - <di:waypoint xsi:type="dc:Point" x="1509" y="355" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1406" y="278" width="90" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="EndEvent_0ougemc_di" bpmnElement="EndEvent_0n56tas"> - <dc:Bounds x="1491" y="355" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1464" y="391" width="90" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ExclusiveGateway_03vhlpt_di" bpmnElement="homingSolutionCheck" isMarkerVisible="true"> - <dc:Bounds x="274" y="268" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="266" y="322" width="69" height="24" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_1pkjo1d_di" bpmnElement="ScriptTask_1pkjo1d"> - <dc:Bounds x="391" y="370" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1x12ld7_di" bpmnElement="sniroCall"> - <di:waypoint xsi:type="dc:Point" x="299" y="268" /> - <di:waypoint xsi:type="dc:Point" x="299" y="177" /> - <di:waypoint xsi:type="dc:Point" x="391" y="177" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="329" y="192" width="25" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0iu4ms3_di" bpmnElement="oofCall"> - <di:waypoint xsi:type="dc:Point" x="299" y="318" /> - <di:waypoint xsi:type="dc:Point" x="299" y="410" /> - <di:waypoint xsi:type="dc:Point" x="391" y="410" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="333" y="378" width="25" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_12t0lqb_di" bpmnElement="SequenceFlow_12t0lqb"> - <di:waypoint xsi:type="dc:Point" x="491" y="410" /> - <di:waypoint xsi:type="dc:Point" x="591" y="410" /> - <di:waypoint xsi:type="dc:Point" x="591" y="318" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="496" y="389" width="90" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0gajic6_di" bpmnElement="SequenceFlow_0gajic6"> - <di:waypoint xsi:type="dc:Point" x="491" y="177" /> - <di:waypoint xsi:type="dc:Point" x="591" y="177" /> - <di:waypoint xsi:type="dc:Point" x="591" y="268" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="496" y="156" width="90" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ExclusiveGateway_0dwcgfe_di" bpmnElement="processHomingCheck" isMarkerVisible="true"> - <dc:Bounds x="942" y="348" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="934" y="402" width="69" height="24" /> - </bpmndi:BPMNLabel> + <dc:Bounds x="455" y="253" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1fipbmk_di" bpmnElement="SequenceFlow_1fipbmk"> - <di:waypoint xsi:type="dc:Point" x="877" y="373" /> - <di:waypoint xsi:type="dc:Point" x="942" y="373" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="909.5" y="352" width="0" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_14jzswu_di" bpmnElement="sniroProcess"> - <di:waypoint xsi:type="dc:Point" x="967" y="348" /> - <di:waypoint xsi:type="dc:Point" x="967" y="293" /> - <di:waypoint xsi:type="dc:Point" x="1293" y="293" /> + <di:waypoint xsi:type="dc:Point" x="555" y="293" /> + <di:waypoint xsi:type="dc:Point" x="597" y="293" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1034" y="312" width="25" height="12" /> + <dc:Bounds x="531" y="272" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_158imry_di" bpmnElement="oofProcess"> - <di:waypoint xsi:type="dc:Point" x="967" y="398" /> - <di:waypoint xsi:type="dc:Point" x="967" y="469" /> - <di:waypoint xsi:type="dc:Point" x="1293" y="469" /> + <bpmndi:BPMNEdge id="SequenceFlow_01apjvo_di" bpmnElement="SequenceFlow_01apjvo"> + <di:waypoint xsi:type="dc:Point" x="697" y="293" /> + <di:waypoint xsi:type="dc:Point" x="860" y="293" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1039" y="432" width="25" height="12" /> + <dc:Bounds x="778.5" y="272" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_0ihb64o_di" bpmnElement="processOofHomingSolution"> - <dc:Bounds x="1293" y="429" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_07u9d7f_di" bpmnElement="SequenceFlow_07u9d7f"> - <di:waypoint xsi:type="dc:Point" x="1393" y="469" /> - <di:waypoint xsi:type="dc:Point" x="1509" y="469" /> - <di:waypoint xsi:type="dc:Point" x="1509" y="391" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1451" y="448" width="0" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="EndEvent_1rxyas7_di" bpmnElement="throwMSOWorkflowException1"> - <dc:Bounds x="507" y="275" width="36" height="36" /> + <bpmndi:BPMNShape id="EndEvent_07i1a5x_di" bpmnElement="EndEvent_0rrbz2a"> + <dc:Bounds x="860" y="275" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="480" y="311" width="0" height="12" /> + <dc:Bounds x="877.17" y="315" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_0t0fs4n_di" bpmnElement="ScriptTask_0t0fs4n"> - <dc:Bounds x="364" y="253" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1bub8mj_di" bpmnElement="SequenceFlow_1bub8mj"> - <di:waypoint xsi:type="dc:Point" x="464" y="293" /> - <di:waypoint xsi:type="dc:Point" x="507" y="293" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="485.5" y="272" width="0" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_02eywxz_di" bpmnElement="SequenceFlow_02eywxz"> - <di:waypoint xsi:type="dc:Point" x="324" y="293" /> - <di:waypoint xsi:type="dc:Point" x="364" y="293" /> + <bpmndi:BPMNEdge id="SequenceFlow_0lc15i7_di" bpmnElement="SequenceFlow_0lc15i7"> + <di:waypoint xsi:type="dc:Point" x="413" y="293" /> + <di:waypoint xsi:type="dc:Point" x="455" y="293" /> <bpmndi:BPMNLabel> - <dc:Bounds x="344" y="272" width="0" height="12" /> + <dc:Bounds x="434" y="272" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/BuildingBlock/HomingV2.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/BuildingBlock/HomingV2.bpmn new file mode 100644 index 0000000000..9481ad892e --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/BuildingBlock/HomingV2.bpmn @@ -0,0 +1,194 @@ +<?xml version="1.0" encoding="UTF-8"?> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0"> + <bpmn:process id="HomingV2" name="HomingV2" isExecutable="true"> + <bpmn:startEvent id="start"> + <bpmn:outgoing>SequenceFlow_0gpuwes</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:subProcess id="subprocessBpmnError" name="Error Handling Subprocess" triggeredByEvent="true"> + <bpmn:endEvent id="endBpmnError"> + <bpmn:incoming>SequenceFlow_14dg22y</bpmn:incoming> + <bpmn:terminateEventDefinition /> + </bpmn:endEvent> + <bpmn:startEvent id="catchBpmnError"> + <bpmn:outgoing>SequenceFlow_0g3mn4b</bpmn:outgoing> + <bpmn:errorEventDefinition /> + </bpmn:startEvent> + <bpmn:scriptTask id="processBpmnError" name="Process Error" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0g3mn4b</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_14dg22y</bpmn:outgoing> + <bpmn:script><![CDATA[import org.onap.so.bpmn.common.scripts.* +ExceptionUtil ex = new ExceptionUtil() +ex.processSubflowsBPMNException(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_14dg22y" sourceRef="processBpmnError" targetRef="endBpmnError" /> + <bpmn:sequenceFlow id="SequenceFlow_0g3mn4b" sourceRef="catchBpmnError" targetRef="processBpmnError" /> + </bpmn:subProcess> + <bpmn:subProcess id="subprocessJavaException" triggeredByEvent="true"> + <bpmn:scriptTask id="processJavaException" name="Process Error" scriptFormat="groovy"> + <bpmn:incoming>seq</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1epbfhx</bpmn:outgoing> + <bpmn:script><![CDATA[import org.onap.so.bpmn.common.scripts.* +ExceptionUtil ex = new ExceptionUtil() +ex.processJavaException(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:startEvent id="catchJavaException"> + <bpmn:outgoing>seq</bpmn:outgoing> + <bpmn:errorEventDefinition errorRef="Error_0jmwlex" /> + </bpmn:startEvent> + <bpmn:endEvent id="endJavaException"> + <bpmn:incoming>SequenceFlow_1epbfhx</bpmn:incoming> + <bpmn:terminateEventDefinition /> + </bpmn:endEvent> + <bpmn:sequenceFlow id="seq" name="" sourceRef="catchJavaException" targetRef="processJavaException" /> + <bpmn:sequenceFlow id="SequenceFlow_1epbfhx" name="" sourceRef="processJavaException" targetRef="endJavaException" /> + </bpmn:subProcess> + <bpmn:callActivity id="callReceiveAsync" name="Receive Async Callback" camunda:modelerTemplate="receiveWorkflowMessage" calledElement="ReceiveWorkflowMessage"> + <bpmn:extensionElements> + <camunda:in source="true" target="isDebugLogEnabled" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:out source="WorkflowResponse" target="asyncResponse" /> + <camunda:in source="asyncCorrelator" target="RCVWFMSG_correlator" /> + <camunda:in source="asyncMessageType" target="RCVWFMSG_messageType" /> + <camunda:in source="asyncTimeout" target="RCVWFMSG_timeout" /> + </bpmn:extensionElements> + <bpmn:incoming>sequence_2</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0m9c6gt</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:endEvent id="end"> + <bpmn:incoming>updateExecution</bpmn:incoming> + <bpmn:terminateEventDefinition /> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_0gpuwes" sourceRef="start" targetRef="callSniro" /> + <bpmn:sequenceFlow id="sequence_2" sourceRef="callSniro" targetRef="callReceiveAsync" /> + <bpmn:sequenceFlow id="SequenceFlow_0m9c6gt" sourceRef="callReceiveAsync" targetRef="processSolution" /> + <bpmn:sequenceFlow id="updateExecution" sourceRef="processSolution" targetRef="end" /> + <bpmn:serviceTask id="callSniro" name=" Call Sniro " camunda:expression="${SniroHoming.callSniro(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:incoming>SequenceFlow_0gpuwes</bpmn:incoming> + <bpmn:outgoing>sequence_2</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:serviceTask id="processSolution" name=" Process Solution " camunda:expression="${SniroHoming.processSolution(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")), asyncResponse)}"> + <bpmn:incoming>SequenceFlow_0m9c6gt</bpmn:incoming> + <bpmn:outgoing>updateExecution</bpmn:outgoing> + </bpmn:serviceTask> + </bpmn:process> + <bpmn:error id="Error_0jmwlex" name="Java Exception" errorCode="java.lang.Exception" /> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="HomingV2"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="start"> + <dc:Bounds x="135" y="225" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="108" y="261" width="90" height="20" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="SubProcess_1se9fyh_di" bpmnElement="subprocessBpmnError" isExpanded="true"> + <dc:Bounds x="246" y="399" width="409" height="168" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="SubProcess_0rphl19_di" bpmnElement="subprocessJavaException" isExpanded="true"> + <dc:Bounds x="276" y="582" width="350" height="159" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_1o5l6xd_di" bpmnElement="callReceiveAsync"> + <dc:Bounds x="447" y="203" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_0jdabkl_di" bpmnElement="end"> + <dc:Bounds x="852" y="225" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="824" y="265" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0gpuwes_di" bpmnElement="SequenceFlow_0gpuwes"> + <di:waypoint xsi:type="dc:Point" x="171" y="243" /> + <di:waypoint xsi:type="dc:Point" x="305" y="243" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="238" y="222" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1ohpzke_di" bpmnElement="sequence_2"> + <di:waypoint xsi:type="dc:Point" x="405" y="243" /> + <di:waypoint xsi:type="dc:Point" x="447" y="243" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="426" y="222" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0m9c6gt_di" bpmnElement="SequenceFlow_0m9c6gt"> + <di:waypoint xsi:type="dc:Point" x="547" y="243" /> + <di:waypoint xsi:type="dc:Point" x="589" y="243" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="568" y="222" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0f9pput_di" bpmnElement="updateExecution"> + <di:waypoint xsi:type="dc:Point" x="689" y="243" /> + <di:waypoint xsi:type="dc:Point" x="852" y="243" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="770.5" y="222" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="EndEvent_0q9vsib_di" bpmnElement="endBpmnError"> + <dc:Bounds x="571" y="473" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="544" y="514" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_1p10ecj_di" bpmnElement="catchBpmnError"> + <dc:Bounds x="291" y="473" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="264" y="514" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_112ioi2_di" bpmnElement="processBpmnError"> + <dc:Bounds x="398" y="451" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0nil5vh_di" bpmnElement="processJavaException"> + <dc:Bounds x="402" y="630" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_0ekzjqo_di" bpmnElement="catchJavaException"> + <dc:Bounds x="310" y="652" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="283" y="693" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_0mrji6a_di" bpmnElement="endJavaException"> + <dc:Bounds x="559" y="652" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="532" y="693" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_14dg22y_di" bpmnElement="SequenceFlow_14dg22y"> + <di:waypoint xsi:type="dc:Point" x="498" y="491" /> + <di:waypoint xsi:type="dc:Point" x="571" y="491" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="490.5" y="476" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0g3mn4b_di" bpmnElement="SequenceFlow_0g3mn4b"> + <di:waypoint xsi:type="dc:Point" x="327" y="491" /> + <di:waypoint xsi:type="dc:Point" x="355" y="491" /> + <di:waypoint xsi:type="dc:Point" x="355" y="491" /> + <di:waypoint xsi:type="dc:Point" x="398" y="491" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="325" y="491" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1bsc30u_di" bpmnElement="seq"> + <di:waypoint xsi:type="dc:Point" x="346" y="670" /> + <di:waypoint xsi:type="dc:Point" x="402" y="670" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="329" y="655" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1epbfhx_di" bpmnElement="SequenceFlow_1epbfhx"> + <di:waypoint xsi:type="dc:Point" x="502" y="670" /> + <di:waypoint xsi:type="dc:Point" x="559" y="670" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="486.5" y="655" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_1mclgnq_di" bpmnElement="callSniro"> + <dc:Bounds x="305" y="203" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_08lua6t_di" bpmnElement="processSolution"> + <dc:Bounds x="589" y="203" width="100" height="80" /> + </bpmndi:BPMNShape> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/BuildingBlock/ManualHandling.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/BuildingBlock/ManualHandling.bpmn index 4d31eee45a..cec3e249ea 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/BuildingBlock/ManualHandling.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/BuildingBlock/ManualHandling.bpmn @@ -19,7 +19,7 @@ <bpmn2:scriptTask id="processJavaError" name="Process Error" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_0tgrn11</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0g4aus9</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* ExceptionUtil exceptionUtil = new ExceptionUtil() exceptionUtil.processJavaException(execution)]]></bpmn2:script> </bpmn2:scriptTask> @@ -30,7 +30,7 @@ exceptionUtil.processJavaException(execution)]]></bpmn2:script> <bpmn2:userTask id="ManualHandlingUserTask" name="Manual Handling User Task"> <bpmn2:extensionElements> <camunda:taskListener event="complete"> - <camunda:script scriptFormat="groovy"><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <camunda:script scriptFormat="groovy"><![CDATA[import org.onap.so.bpmn.common.scripts.* def mh = new ManualHandling() mh.completeTask(task)]]></camunda:script> </camunda:taskListener> @@ -38,7 +38,7 @@ mh.completeTask(task)]]></camunda:script> <camunda:property /> </camunda:properties> <camunda:taskListener event="create"> - <camunda:script scriptFormat="groovy"><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <camunda:script scriptFormat="groovy"><![CDATA[import org.onap.so.bpmn.common.scripts.* def mh = new ManualHandling() mh.setTaskVariables(task)]]></camunda:script> </camunda:taskListener> @@ -54,7 +54,7 @@ mh.setTaskVariables(task)]]></camunda:script> <bpmn2:extensionElements> <camunda:connector> <camunda:inputOutput> - <camunda:inputParameter name="url">${URN_mso_adapters_openecomp_db_endpoint}</camunda:inputParameter> + <camunda:inputParameter name="url"><![CDATA[${UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution)}]]></camunda:inputParameter> <camunda:inputParameter name="payload"><![CDATA[${execution.getVariable("setUpdateDBstatusPayload")}]]></camunda:inputParameter> <camunda:inputParameter name="headers"> <camunda:map> @@ -75,14 +75,14 @@ mh.setTaskVariables(task)]]></camunda:script> <bpmn2:scriptTask id="Task_137bzdi" name="Prepare Requests DB Status Update to PENDING_MANUAL_TASK" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_0zgg47r</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0mbjrvr</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* def mh = new ManualHandling() mh.prepareRequestsDBStatusUpdate(execution, "PENDING_MANUAL_TASK")]]></bpmn2:script> </bpmn2:scriptTask> <bpmn2:scriptTask id="Task_0r60vxk" name="Prepare Requests DB Status Update to IN_PROGRESS" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_192yimz</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0zer29a</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* def mh = new ManualHandling() mh.prepareRequestsDBStatusUpdate(execution, "IN_PROGRESS")]]></bpmn2:script> </bpmn2:scriptTask> @@ -90,7 +90,7 @@ mh.prepareRequestsDBStatusUpdate(execution, "IN_PROGRESS")]]></bpmn2:script> <bpmn2:extensionElements> <camunda:connector> <camunda:inputOutput> - <camunda:inputParameter name="url">${URN_mso_adapters_openecomp_db_endpoint}</camunda:inputParameter> + <camunda:inputParameter name="url"><![CDATA[${UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution)}]]></camunda:inputParameter> <camunda:inputParameter name="payload"><![CDATA[${execution.getVariable("setUpdateDBstatusPayload")}]]></camunda:inputParameter> <camunda:inputParameter name="headers"> <camunda:map> @@ -111,7 +111,7 @@ mh.prepareRequestsDBStatusUpdate(execution, "IN_PROGRESS")]]></bpmn2:script> <bpmn2:scriptTask id="Task_1qrt7xw" name="PreProcess Request" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_0jav6cu</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0zgg47r</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* def mh = new ManualHandling() mh.preProcessRequest(execution)]]></bpmn2:script> </bpmn2:scriptTask> @@ -120,7 +120,7 @@ mh.preProcessRequest(execution)]]></bpmn2:script> <bpmn2:scriptTask id="CreateAOTSRubyTicket" name="Create AOTS Ruby Ticket" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_0b84ki5</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0igra4l</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* def mh = new ManualHandling() mh.createAOTSTicket(execution)]]></bpmn2:script> </bpmn2:scriptTask> diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/BuildingBlock/Orchestration.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/BuildingBlock/Orchestration.bpmn new file mode 100644 index 0000000000..c2214aac26 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/BuildingBlock/Orchestration.bpmn @@ -0,0 +1,56 @@ +<?xml version="1.0" encoding="UTF-8"?> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0"> + <bpmn:process id="Orchestration" isExecutable="true"> + <bpmn:startEvent id="StartEvent_1"> + <bpmn:outgoing>SequenceFlow_10gblml</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:endEvent id="EndEvent_0eak8i4"> + <bpmn:incoming>SequenceFlow_0x1lx7c</bpmn:incoming> + </bpmn:endEvent> + <bpmn:serviceTask id="Task_06qhrqm" name="Decompose Request" camunda:class="org.onap.so.bpmn.servicedecomposition.tasks.DecomposeRequest"> + <bpmn:extensionElements> + <camunda:inputOutput> + <camunda:inputParameter name="request" /> + <camunda:inputParameter name="buildingblock" /> + </camunda:inputOutput> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_10gblml</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0x1lx7c</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_10gblml" sourceRef="StartEvent_1" targetRef="Task_06qhrqm" /> + <bpmn:sequenceFlow id="SequenceFlow_0x1lx7c" sourceRef="Task_06qhrqm" targetRef="EndEvent_0eak8i4" /> + </bpmn:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Orchestration"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1"> + <dc:Bounds x="631" y="407" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="604" y="443" width="90" height="20" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_0eak8i4_di" bpmnElement="EndEvent_0eak8i4"> + <dc:Bounds x="928" y="407" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="946" y="447" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_0y0800u_di" bpmnElement="Task_06qhrqm"> + <dc:Bounds x="746" y="385" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_10gblml_di" bpmnElement="SequenceFlow_10gblml"> + <di:waypoint xsi:type="dc:Point" x="667" y="425" /> + <di:waypoint xsi:type="dc:Point" x="746" y="425" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="706.5" y="404" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0x1lx7c_di" bpmnElement="SequenceFlow_0x1lx7c"> + <di:waypoint xsi:type="dc:Point" x="846" y="425" /> + <di:waypoint xsi:type="dc:Point" x="928" y="425" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="887" y="404" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/BuildingBlock/RainyDayHandler.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/BuildingBlock/RainyDayHandler.bpmn index 8183469798..b4a3fc7721 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/BuildingBlock/RainyDayHandler.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/BuildingBlock/RainyDayHandler.bpmn @@ -21,7 +21,7 @@ <bpmn2:scriptTask id="processJavaError" name="Process Error" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_0tgrn11</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0g4aus9</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* ExceptionUtil exceptionUtil = new ExceptionUtil() exceptionUtil.processJavaException(execution)]]></bpmn2:script> </bpmn2:scriptTask> @@ -30,7 +30,7 @@ exceptionUtil.processJavaException(execution)]]></bpmn2:script> <bpmn2:scriptTask id="preProcessRequest_ScriptTask" name="PreProcess Incoming Request" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0yxffj2</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* def rdh = new RainyDayHandler() rdh.preProcessRequest(execution) ]]></bpmn2:script> @@ -40,7 +40,7 @@ rdh.preProcessRequest(execution) <bpmn2:scriptTask id="QueryPolicyEngine" name="Query Policy " scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_0yxffj2</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_12vj619</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* def rdh = new RainyDayHandler() rdh.queryPolicy(execution)]]></bpmn2:script> </bpmn2:scriptTask> diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CompleteMsoProcess.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CompleteMsoProcess.bpmn index 9bfd4535ea..31a981729b 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CompleteMsoProcess.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CompleteMsoProcess.bpmn @@ -1,17 +1,17 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_EsMs0HcuEeW2U_kkOHX1ZQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_EsMs0HcuEeW2U_kkOHX1ZQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.7.1" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> <bpmn2:process id="CompleteMsoProcess" name="CompleteMsoProcess" isExecutable="true"> <bpmn2:scriptTask id="preProcessRequest" name="Pre-Process Request" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_18</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_2</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* def preProcessRequestData = new CompleteMsoProcess() preProcessRequestData.preProcessRequest(execution) ]]></bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="preProcessRequest" targetRef="ExclusiveGateway_1r258d4" /> - <bpmn2:startEvent id="StartEvent_1" name="Start With Message "> + <bpmn2:startEvent id="StartEvent_1" name="Start With message"> <bpmn2:outgoing>SequenceFlow_18</bpmn2:outgoing> <bpmn2:messageEventDefinition id="MessageEventDefinition_1" messageRef="Message_2" /> </bpmn2:startEvent> @@ -41,7 +41,7 @@ preProcessRequestData.preProcessRequest(execution) <bpmn2:scriptTask id="ScriptTask_3" name="Prepare Infra Update DB Request" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_127i45q</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_10</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* def completeMsoProcess = new CompleteMsoProcess() completeMsoProcess.setUpdateDBstatustoSuccessPayload(execution)]]></bpmn2:script> </bpmn2:scriptTask> @@ -50,7 +50,7 @@ completeMsoProcess.setUpdateDBstatustoSuccessPayload(execution)]]></bpmn2:script <bpmn2:extensionElements> <camunda:connector> <camunda:inputOutput> - <camunda:inputParameter name="url">${URN_mso_adapters_openecomp_db_endpoint}</camunda:inputParameter> + <camunda:inputParameter name="url"><![CDATA[${UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution)}]]></camunda:inputParameter> <camunda:inputParameter name="payload"><![CDATA[${execution.getVariable("CMSO_setUpdateDBstatustoSuccessPayload")}]]></camunda:inputParameter> <camunda:inputParameter name="headers"> <camunda:map> @@ -75,7 +75,7 @@ completeMsoProcess.setUpdateDBstatustoSuccessPayload(execution)]]></bpmn2:script <bpmn2:outgoing>SequenceFlow_9</bpmn2:outgoing> <bpmn2:script><![CDATA[//println "INSIDE --> Build Error Message @@@@" //println "CMSO_updateRequestResponse IS --> " + execution.getVariable("CMSO_updateRequestResponse") -import org.openecomp.mso.bpmn.common.scripts.* +import org.onap.so.bpmn.common.scripts.* def buildDataErrorMessage = new CompleteMsoProcess() buildDataErrorMessage.buildDataError(execution, "Complete MSO -- Update DB status to SUCCESS -- Failed")]]></bpmn2:script> </bpmn2:scriptTask> @@ -95,7 +95,7 @@ buildDataErrorMessage.buildDataError(execution, "Complete MSO -- Update DB stat <bpmn2:terminateEventDefinition id="_TerminateEventDefinition_2" /> </bpmn2:endEvent> <bpmn2:sequenceFlow id="SequenceFlow_0mipf25" name="Connect Fault" sourceRef="BoundaryEvent_7" targetRef="BuildErrorMessage" /> - <bpmn2:callActivity id="CallActivity_101qf6x" name="Call Notification Service" calledElement="${URN_mso_workflow_notification_name}"> + <bpmn2:callActivity id="CallActivity_101qf6x" name="Call Notification Service" calledElement="${UrnPropertiesReader.getVariable("mso.workflow.notification.name", execution)}"> <bpmn2:extensionElements> <camunda:in source="mso-request-id" target="mso-request-id" /> <camunda:in source="mso-service-instance-id" target="mso-service-instance-id" /> @@ -132,7 +132,7 @@ buildDataErrorMessage.buildDataError(execution, "Complete MSO -- Update DB stat </bpmn2:parallelGateway> <bpmn2:sequenceFlow id="SequenceFlow_1g8ig3h" sourceRef="ExclusiveGateway_019d74x" targetRef="ScriptTask_0vyk0lo" /> <bpmn2:sequenceFlow id="SequenceFlow_067veaf" sourceRef="ExclusiveGateway_1r258d4" targetRef="ExclusiveGateway_3" /> - <bpmn2:exclusiveGateway id="ExclusiveGateway_08yqzk9" name="Infra Check" default="SequenceFlow_1ffkc0n"> + <bpmn2:exclusiveGateway id="ExclusiveGateway_08yqzk9" name="Infra Check Check" default="SequenceFlow_1ffkc0n"> <bpmn2:incoming>SequenceFlow_0xe5zck</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_127i45q</bpmn2:outgoing> <bpmn2:outgoing>SequenceFlow_1ffkc0n</bpmn2:outgoing> @@ -156,7 +156,7 @@ buildDataErrorMessage.buildDataError(execution, "Complete MSO -- Update DB stat <bpmn2:incoming>SequenceFlow_1g8ig3h</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_1pzb94j</bpmn2:outgoing> <bpmn2:script><![CDATA[println "INSIDE --> Complete MSO Process Done SUCCESSFULLY" -import org.openecomp.mso.bpmn.common.scripts.* +import org.onap.so.bpmn.common.scripts.* def postProcessResponseData = new CompleteMsoProcess() postProcessResponseData.postProcessResponse(execution) println "CompleteMsoProcess Response -->" + "\n" + execution.getVariable("CompletionHandlerResponse")]]></bpmn2:script> @@ -171,7 +171,7 @@ println "CompleteMsoProcess Response -->" + "\n" + execution.getVariable("Comple <bpmndi:BPMNShape id="_BPMNShape_StartEvent_41" bpmnElement="StartEvent_1"> <dc:Bounds x="67" y="297" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="93" y="338" width="50" height="24" /> + <dc:Bounds x="94" y="338" width="49" height="25" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_34" bpmnElement="preProcessRequest"> diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/ConfirmVolumeGroupName.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/ConfirmVolumeGroupName.bpmn index b190107d5e..0e99ce9683 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/ConfirmVolumeGroupName.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/ConfirmVolumeGroupName.bpmn @@ -12,7 +12,7 @@ <bpmn2:scriptTask id="AAIQueryFailure" name="AAI Query Failure" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_23</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_18</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* def cvgn= new ConfirmVolumeGroupName() cvgn.handleAAIQueryFailure(execution)]]></bpmn2:script> </bpmn2:scriptTask> @@ -24,7 +24,7 @@ cvgn.handleAAIQueryFailure(execution)]]></bpmn2:script> <bpmn2:scriptTask id="QueryAAIForVolumeGroupId" name="Query AAI for
Volume Group Id" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_38</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_39</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* def cvgn= new ConfirmVolumeGroupName() cvgn.queryAAIForVolumeGroupId(execution)]]></bpmn2:script> </bpmn2:scriptTask> @@ -32,7 +32,7 @@ cvgn.queryAAIForVolumeGroupId(execution)]]></bpmn2:script> <bpmn2:scriptTask id="InitializeVariables" name="Initialize Variables" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_38</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* def cvgn= new ConfirmVolumeGroupName() cvgn.preProcessRequest(execution)]]></bpmn2:script> </bpmn2:scriptTask> @@ -41,7 +41,7 @@ cvgn.preProcessRequest(execution)]]></bpmn2:script> <bpmn2:scriptTask id="CheckAAIQueryResult" name="Check AAI Query Result" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_4</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* def cvgn= new ConfirmVolumeGroupName() cvgn.checkAAIQueryResult(execution)]]></bpmn2:script> </bpmn2:scriptTask> @@ -49,7 +49,7 @@ cvgn.checkAAIQueryResult(execution)]]></bpmn2:script> <bpmn2:scriptTask id="VolumeGroupNotInName" name="Volume Group Not In Name" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_7</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_11</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* def cvgn= new ConfirmVolumeGroupName() cvgn.handleVolumeGroupNameNoMatch(execution)]]></bpmn2:script> </bpmn2:scriptTask> @@ -66,7 +66,7 @@ cvgn.handleVolumeGroupNameNoMatch(execution)]]></bpmn2:script> <bpmn2:extensionElements> <camunda:connector> <camunda:inputOutput> - <camunda:outputParameter name="WorkflowResponse"><![CDATA[<aetgt:CreateVfModuleResponse xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1" xmlns:ns="http://org.openecomp/mso/workflow/schema/v1"> + <camunda:outputParameter name="WorkflowResponse"><![CDATA[<aetgt:CreateVfModuleResponse xmlns:aetgt="http://org.onap/so/workflow/schema/v1" xmlns:ns="http://org.onap/so/workflow/schema/v1"> <ns:response>SUCCESS</ns:response> </aetgt:CreateVfModuleResponse>]]></camunda:outputParameter> </camunda:inputOutput> diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/ConfirmVolumeGroupTenant.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/ConfirmVolumeGroupTenant.bpmn index df55046a7b..eb83adf2d4 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/ConfirmVolumeGroupTenant.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/ConfirmVolumeGroupTenant.bpmn @@ -1,190 +1,190 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd" id="_jPy0EB7JEeaR94RQz1cKqQ" exporter="camunda modeler" exporterVersion="2.7.0" targetNamespace="http://camunda.org/schema/1.0/bpmn">
- <bpmn2:process id="ConfirmVolumeGroupTenant" name="ConfirmVolumeGroupTenant" isExecutable="true">
- <bpmn2:scriptTask id="queryAAIForVolumeGroup" name="Query AAI Volume Group" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_2</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* +<?xml version="1.0" encoding="UTF-8"?> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd" id="_jPy0EB7JEeaR94RQz1cKqQ" exporter="camunda modeler" exporterVersion="2.7.0" targetNamespace="http://camunda.org/schema/1.0/bpmn"> + <bpmn2:process id="ConfirmVolumeGroupTenant" name="ConfirmVolumeGroupTenant" isExecutable="true"> + <bpmn2:scriptTask id="queryAAIForVolumeGroup" name="Query AAI Volume Group" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_2</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* ConfirmVolumeGroupTenant volume = new ConfirmVolumeGroupTenant() -volume.preProcessRequest(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:exclusiveGateway id="tenantIdMatchCheck" name="Tenant Ids
Match?" default="idsMatchNo">
- <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming>
- <bpmn2:outgoing>idsMatchNo</bpmn2:outgoing>
- <bpmn2:outgoing>idsMatchYes</bpmn2:outgoing>
- </bpmn2:exclusiveGateway>
- <bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="queryAAIForVolumeGroup" targetRef="tenantIdMatchCheck"/>
- <bpmn2:sequenceFlow id="idsMatchNo" name="No" sourceRef="tenantIdMatchCheck" targetRef="assignError"/>
- <bpmn2:sequenceFlow id="idsMatchYes" name="Yes" sourceRef="tenantIdMatchCheck" targetRef="tenantNamesMatchCheck">
- <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("tenantIdsMatch")==true}]]></bpmn2:conditionExpression>
- </bpmn2:sequenceFlow>
- <bpmn2:endEvent id="EndEvent_1">
- <bpmn2:incoming>SequenceFlow_7</bpmn2:incoming>
- <bpmn2:terminateEventDefinition id="_TerminateEventDefinition_2"/>
- </bpmn2:endEvent>
- <bpmn2:scriptTask id="assignError" name="Assign Workflow Exception" scriptFormat="groovy">
- <bpmn2:incoming>idsMatchNo</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_8</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* +volume.preProcessRequest(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:exclusiveGateway id="tenantIdMatchCheck" name="Tenant Ids
Match?" default="idsMatchNo"> + <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming> + <bpmn2:outgoing>idsMatchNo</bpmn2:outgoing> + <bpmn2:outgoing>idsMatchYes</bpmn2:outgoing> + </bpmn2:exclusiveGateway> + <bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="queryAAIForVolumeGroup" targetRef="tenantIdMatchCheck"/> + <bpmn2:sequenceFlow id="idsMatchNo" name="No" sourceRef="tenantIdMatchCheck" targetRef="assignError"/> + <bpmn2:sequenceFlow id="idsMatchYes" name="Yes" sourceRef="tenantIdMatchCheck" targetRef="tenantNamesMatchCheck"> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("tenantIdsMatch")==true}]]></bpmn2:conditionExpression> + </bpmn2:sequenceFlow> + <bpmn2:endEvent id="EndEvent_1"> + <bpmn2:incoming>SequenceFlow_7</bpmn2:incoming> + <bpmn2:terminateEventDefinition id="_TerminateEventDefinition_2"/> + </bpmn2:endEvent> + <bpmn2:scriptTask id="assignError" name="Assign Workflow Exception" scriptFormat="groovy"> + <bpmn2:incoming>idsMatchNo</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_8</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* ConfirmVolumeGroupTenant volume = new ConfirmVolumeGroupTenant() -volume.assignWorkflowException(execution, "does not belong to your tenant")]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_8" name="" sourceRef="assignError" targetRef="EndEvent_3"/>
- <bpmn2:endEvent id="EndEvent_3">
- <bpmn2:incoming>SequenceFlow_8</bpmn2:incoming>
- <bpmn2:errorEventDefinition id="_ErrorEventDefinition_75" errorRef="Error_1"/>
- </bpmn2:endEvent>
- <bpmn2:scriptTask id="assignVolumeHeatId" name="Assign Volume Heat Id" scriptFormat="groovy">
- <bpmn2:incoming>groupNamesMatchYes</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_7</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* +volume.assignWorkflowException(execution, "does not belong to your tenant")]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_8" name="" sourceRef="assignError" targetRef="EndEvent_3"/> + <bpmn2:endEvent id="EndEvent_3"> + <bpmn2:incoming>SequenceFlow_8</bpmn2:incoming> + <bpmn2:errorEventDefinition id="_ErrorEventDefinition_75" errorRef="Error_1"/> + </bpmn2:endEvent> + <bpmn2:scriptTask id="assignVolumeHeatId" name="Assign Volume Heat Id" scriptFormat="groovy"> + <bpmn2:incoming>groupNamesMatchYes</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_7</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* ConfirmVolumeGroupTenant volume = new ConfirmVolumeGroupTenant() -volume.assignVolumeHeatId(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_7" name="" sourceRef="assignVolumeHeatId" targetRef="EndEvent_1"/>
- <bpmn2:scriptTask id="assignErrorNames" name="Assign Workflow Exception" scriptFormat="groovy">
- <bpmn2:incoming>groupNamesMatchNo</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_9</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* +volume.assignVolumeHeatId(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_7" name="" sourceRef="assignVolumeHeatId" targetRef="EndEvent_1"/> + <bpmn2:scriptTask id="assignErrorNames" name="Assign Workflow Exception" scriptFormat="groovy"> + <bpmn2:incoming>groupNamesMatchNo</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_9</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* ConfirmVolumeGroupTenant volume = new ConfirmVolumeGroupTenant() -volume.assignWorkflowException(execution, "name does not match")]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_9" name="" sourceRef="assignErrorNames" targetRef="EndEvent_2"/>
- <bpmn2:endEvent id="EndEvent_2">
- <bpmn2:incoming>SequenceFlow_9</bpmn2:incoming>
- <bpmn2:errorEventDefinition id="_ErrorEventDefinition_74" errorRef="Error_1"/>
- </bpmn2:endEvent>
- <bpmn2:exclusiveGateway id="tenantNamesMatchCheck" name="Volume Group
Names Match?" default="groupNamesMatchNo">
- <bpmn2:incoming>idsMatchYes</bpmn2:incoming>
- <bpmn2:outgoing>groupNamesMatchNo</bpmn2:outgoing>
- <bpmn2:outgoing>groupNamesMatchYes</bpmn2:outgoing>
- </bpmn2:exclusiveGateway>
- <bpmn2:sequenceFlow id="groupNamesMatchNo" name="No" sourceRef="tenantNamesMatchCheck" targetRef="assignErrorNames"/>
- <bpmn2:sequenceFlow id="groupNamesMatchYes" name="Yes" sourceRef="tenantNamesMatchCheck" targetRef="assignVolumeHeatId">
- <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("groupNamesMatch")==true}]]></bpmn2:conditionExpression>
- </bpmn2:sequenceFlow>
- <bpmn2:startEvent id="StartEvent_1">
- <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing>
- </bpmn2:startEvent>
- <bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="StartEvent_1" targetRef="queryAAIForVolumeGroup"/>
- </bpmn2:process>
- <bpmn2:error id="Error_1" errorCode="MSOWorkflowException" name="MSO Workflow Exception"/>
- <bpmndi:BPMNDiagram id="BPMNDiagram_1">
- <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="ConfirmVolumeGroupTenant">
- <bpmndi:BPMNShape id="_BPMNShape_StartEvent_61" bpmnElement="StartEvent_1">
- <dc:Bounds height="36.0" width="36.0" x="129.0" y="324.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="147.0" y="365.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_237" bpmnElement="queryAAIForVolumeGroup">
- <dc:Bounds height="80.0" width="100.0" x="252.0" y="302.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_StartEvent_61" targetElement="_BPMNShape_ScriptTask_237">
- <di:waypoint xsi:type="dc:Point" x="165.0" y="342.0"/>
- <di:waypoint xsi:type="dc:Point" x="252.0" y="342.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="179.0" y="342.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_209" bpmnElement="tenantIdMatchCheck" isMarkerVisible="true">
- <dc:Bounds height="50.0" width="50.0" x="384.0" y="316.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="38.0" width="76.0" x="414.0" y="347.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_ScriptTask_237" targetElement="_BPMNShape_ExclusiveGateway_209">
- <di:waypoint xsi:type="dc:Point" x="352.0" y="342.0"/>
- <di:waypoint xsi:type="dc:Point" x="368.0" y="342.0"/>
- <di:waypoint xsi:type="dc:Point" x="368.0" y="341.0"/>
- <di:waypoint xsi:type="dc:Point" x="384.0" y="341.0"/>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_210" bpmnElement="tenantNamesMatchCheck" isMarkerVisible="true">
- <dc:Bounds height="50.0" width="50.0" x="460.0" y="216.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="38.0" width="99.0" x="494.0" y="246.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_238" bpmnElement="assignError">
- <dc:Bounds height="80.0" width="100.0" x="456.0" y="400.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="idsMatchNo" sourceElement="_BPMNShape_ExclusiveGateway_209" targetElement="_BPMNShape_ScriptTask_238">
- <di:waypoint xsi:type="dc:Point" x="409.0" y="366.0"/>
- <di:waypoint xsi:type="dc:Point" x="409.0" y="440.0"/>
- <di:waypoint xsi:type="dc:Point" x="456.0" y="440.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="22.0" width="22.0" x="414.0" y="400.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_4" bpmnElement="idsMatchYes" sourceElement="_BPMNShape_ExclusiveGateway_209" targetElement="_BPMNShape_ExclusiveGateway_210">
- <di:waypoint xsi:type="dc:Point" x="409.0" y="316.0"/>
- <di:waypoint xsi:type="dc:Point" x="409.0" y="241.0"/>
- <di:waypoint xsi:type="dc:Point" x="460.0" y="241.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="22.0" width="29.0" x="411.0" y="266.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_239" bpmnElement="assignErrorNames">
- <dc:Bounds height="80.0" width="100.0" x="555.0" y="296.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_5" bpmnElement="groupNamesMatchNo" sourceElement="_BPMNShape_ExclusiveGateway_210" targetElement="_BPMNShape_ScriptTask_239">
- <di:waypoint xsi:type="dc:Point" x="485.0" y="266.0"/>
- <di:waypoint xsi:type="dc:Point" x="485.0" y="336.0"/>
- <di:waypoint xsi:type="dc:Point" x="555.0" y="336.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="22.0" width="22.0" x="491.0" y="296.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_240" bpmnElement="assignVolumeHeatId">
- <dc:Bounds height="80.0" width="100.0" x="555.0" y="120.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_6" bpmnElement="groupNamesMatchYes" sourceElement="_BPMNShape_ExclusiveGateway_210" targetElement="_BPMNShape_ScriptTask_240">
- <di:waypoint xsi:type="dc:Point" x="485.0" y="216.0"/>
- <di:waypoint xsi:type="dc:Point" x="485.0" y="160.0"/>
- <di:waypoint xsi:type="dc:Point" x="555.0" y="160.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="22.0" width="29.0" x="487.0" y="173.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_200" bpmnElement="EndEvent_1">
- <dc:Bounds height="36.0" width="36.0" x="738.0" y="142.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="756.0" y="183.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_7" bpmnElement="SequenceFlow_7" sourceElement="_BPMNShape_ScriptTask_240" targetElement="_BPMNShape_EndEvent_200">
- <di:waypoint xsi:type="dc:Point" x="655.0" y="160.0"/>
- <di:waypoint xsi:type="dc:Point" x="738.0" y="160.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="692.0" y="160.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_210" bpmnElement="EndEvent_2">
- <dc:Bounds height="36.0" width="36.0" x="709.0" y="318.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="727.0" y="359.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_211" bpmnElement="EndEvent_3">
- <dc:Bounds height="36.0" width="36.0" x="605.0" y="422.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="623.0" y="463.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_8" bpmnElement="SequenceFlow_8" sourceElement="_BPMNShape_ScriptTask_238" targetElement="_BPMNShape_EndEvent_211">
- <di:waypoint xsi:type="dc:Point" x="556.0" y="440.0"/>
- <di:waypoint xsi:type="dc:Point" x="605.0" y="440.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="591.0" y="440.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_9" bpmnElement="SequenceFlow_9" sourceElement="_BPMNShape_ScriptTask_239" targetElement="_BPMNShape_EndEvent_210">
- <di:waypoint xsi:type="dc:Point" x="655.0" y="336.0"/>
- <di:waypoint xsi:type="dc:Point" x="709.0" y="336.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="680.0" y="336.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- </bpmndi:BPMNPlane>
- </bpmndi:BPMNDiagram>
+volume.assignWorkflowException(execution, "name does not match")]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_9" name="" sourceRef="assignErrorNames" targetRef="EndEvent_2"/> + <bpmn2:endEvent id="EndEvent_2"> + <bpmn2:incoming>SequenceFlow_9</bpmn2:incoming> + <bpmn2:errorEventDefinition id="_ErrorEventDefinition_74" errorRef="Error_1"/> + </bpmn2:endEvent> + <bpmn2:exclusiveGateway id="tenantNamesMatchCheck" name="Volume Group
Names Match?" default="groupNamesMatchNo"> + <bpmn2:incoming>idsMatchYes</bpmn2:incoming> + <bpmn2:outgoing>groupNamesMatchNo</bpmn2:outgoing> + <bpmn2:outgoing>groupNamesMatchYes</bpmn2:outgoing> + </bpmn2:exclusiveGateway> + <bpmn2:sequenceFlow id="groupNamesMatchNo" name="No" sourceRef="tenantNamesMatchCheck" targetRef="assignErrorNames"/> + <bpmn2:sequenceFlow id="groupNamesMatchYes" name="Yes" sourceRef="tenantNamesMatchCheck" targetRef="assignVolumeHeatId"> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("groupNamesMatch")==true}]]></bpmn2:conditionExpression> + </bpmn2:sequenceFlow> + <bpmn2:startEvent id="StartEvent_1"> + <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing> + </bpmn2:startEvent> + <bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="StartEvent_1" targetRef="queryAAIForVolumeGroup"/> + </bpmn2:process> + <bpmn2:error id="Error_1" errorCode="MSOWorkflowException" name="MSO Workflow Exception"/> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="ConfirmVolumeGroupTenant"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_61" bpmnElement="StartEvent_1"> + <dc:Bounds height="36.0" width="36.0" x="129.0" y="324.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="0.0" width="0.0" x="147.0" y="365.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_237" bpmnElement="queryAAIForVolumeGroup"> + <dc:Bounds height="80.0" width="100.0" x="252.0" y="302.0"/> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_StartEvent_61" targetElement="_BPMNShape_ScriptTask_237"> + <di:waypoint xsi:type="dc:Point" x="165.0" y="342.0"/> + <di:waypoint xsi:type="dc:Point" x="252.0" y="342.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="6.0" width="6.0" x="179.0" y="342.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_209" bpmnElement="tenantIdMatchCheck" isMarkerVisible="true"> + <dc:Bounds height="50.0" width="50.0" x="384.0" y="316.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="38.0" width="76.0" x="414.0" y="347.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_ScriptTask_237" targetElement="_BPMNShape_ExclusiveGateway_209"> + <di:waypoint xsi:type="dc:Point" x="352.0" y="342.0"/> + <di:waypoint xsi:type="dc:Point" x="368.0" y="342.0"/> + <di:waypoint xsi:type="dc:Point" x="368.0" y="341.0"/> + <di:waypoint xsi:type="dc:Point" x="384.0" y="341.0"/> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_210" bpmnElement="tenantNamesMatchCheck" isMarkerVisible="true"> + <dc:Bounds height="50.0" width="50.0" x="460.0" y="216.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="38.0" width="99.0" x="494.0" y="246.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_238" bpmnElement="assignError"> + <dc:Bounds height="80.0" width="100.0" x="456.0" y="400.0"/> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="idsMatchNo" sourceElement="_BPMNShape_ExclusiveGateway_209" targetElement="_BPMNShape_ScriptTask_238"> + <di:waypoint xsi:type="dc:Point" x="409.0" y="366.0"/> + <di:waypoint xsi:type="dc:Point" x="409.0" y="440.0"/> + <di:waypoint xsi:type="dc:Point" x="456.0" y="440.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="22.0" width="22.0" x="414.0" y="400.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_4" bpmnElement="idsMatchYes" sourceElement="_BPMNShape_ExclusiveGateway_209" targetElement="_BPMNShape_ExclusiveGateway_210"> + <di:waypoint xsi:type="dc:Point" x="409.0" y="316.0"/> + <di:waypoint xsi:type="dc:Point" x="409.0" y="241.0"/> + <di:waypoint xsi:type="dc:Point" x="460.0" y="241.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="22.0" width="29.0" x="411.0" y="266.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_239" bpmnElement="assignErrorNames"> + <dc:Bounds height="80.0" width="100.0" x="555.0" y="296.0"/> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_5" bpmnElement="groupNamesMatchNo" sourceElement="_BPMNShape_ExclusiveGateway_210" targetElement="_BPMNShape_ScriptTask_239"> + <di:waypoint xsi:type="dc:Point" x="485.0" y="266.0"/> + <di:waypoint xsi:type="dc:Point" x="485.0" y="336.0"/> + <di:waypoint xsi:type="dc:Point" x="555.0" y="336.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="22.0" width="22.0" x="491.0" y="296.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_240" bpmnElement="assignVolumeHeatId"> + <dc:Bounds height="80.0" width="100.0" x="555.0" y="120.0"/> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_6" bpmnElement="groupNamesMatchYes" sourceElement="_BPMNShape_ExclusiveGateway_210" targetElement="_BPMNShape_ScriptTask_240"> + <di:waypoint xsi:type="dc:Point" x="485.0" y="216.0"/> + <di:waypoint xsi:type="dc:Point" x="485.0" y="160.0"/> + <di:waypoint xsi:type="dc:Point" x="555.0" y="160.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="22.0" width="29.0" x="487.0" y="173.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_EndEvent_200" bpmnElement="EndEvent_1"> + <dc:Bounds height="36.0" width="36.0" x="738.0" y="142.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="0.0" width="0.0" x="756.0" y="183.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_7" bpmnElement="SequenceFlow_7" sourceElement="_BPMNShape_ScriptTask_240" targetElement="_BPMNShape_EndEvent_200"> + <di:waypoint xsi:type="dc:Point" x="655.0" y="160.0"/> + <di:waypoint xsi:type="dc:Point" x="738.0" y="160.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="6.0" width="6.0" x="692.0" y="160.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_EndEvent_210" bpmnElement="EndEvent_2"> + <dc:Bounds height="36.0" width="36.0" x="709.0" y="318.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="0.0" width="0.0" x="727.0" y="359.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_EndEvent_211" bpmnElement="EndEvent_3"> + <dc:Bounds height="36.0" width="36.0" x="605.0" y="422.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="0.0" width="0.0" x="623.0" y="463.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_8" bpmnElement="SequenceFlow_8" sourceElement="_BPMNShape_ScriptTask_238" targetElement="_BPMNShape_EndEvent_211"> + <di:waypoint xsi:type="dc:Point" x="556.0" y="440.0"/> + <di:waypoint xsi:type="dc:Point" x="605.0" y="440.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="6.0" width="6.0" x="591.0" y="440.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_9" bpmnElement="SequenceFlow_9" sourceElement="_BPMNShape_ScriptTask_239" targetElement="_BPMNShape_EndEvent_210"> + <di:waypoint xsi:type="dc:Point" x="655.0" y="336.0"/> + <di:waypoint xsi:type="dc:Point" x="709.0" y="336.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="6.0" width="6.0" x="680.0" y="336.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> </bpmn2:definitions>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CreateAAIVfModule.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CreateAAIVfModule.bpmn index 3ac1fe7781..6f1db9da07 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CreateAAIVfModule.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CreateAAIVfModule.bpmn @@ -1,519 +1,519 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd" id="_Wblj8GyfEeWUWLTvug7ZOg" exporter="camunda modeler" exporterVersion="2.7.0" targetNamespace="http://camunda.org/schema/1.0/bpmn">
- <bpmn2:process id="CreateAAIVfModule" name="CreateAAIVfModule" isExecutable="true">
- <bpmn2:exclusiveGateway id="ExclusiveGateway_5" default="SequenceFlow_7">
- <bpmn2:incoming>SequenceFlow_24</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_6</bpmn2:outgoing>
- <bpmn2:outgoing>SequenceFlow_7</bpmn2:outgoing>
- <bpmn2:outgoing>SequenceFlow_28</bpmn2:outgoing>
- </bpmn2:exclusiveGateway>
- <bpmn2:sequenceFlow id="SequenceFlow_6" name="" sourceRef="ExclusiveGateway_5" targetRef="ExclusiveGateway_6">
- <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{(execution.getVariable("CAAIVfMod_newGenericVnf") == true && execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") == 404) || execution.getVariable("CAAIVfMod_isBaseVfModule") == true}]]></bpmn2:conditionExpression>
- </bpmn2:sequenceFlow>
- <bpmn2:sequenceFlow id="SequenceFlow_7" name="" sourceRef="ExclusiveGateway_5" targetRef="ScriptTask_2"/>
- <bpmn2:exclusiveGateway id="ExclusiveGateway_3" default="SequenceFlow_22">
- <bpmn2:incoming>SequenceFlow_39</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_22</bpmn2:outgoing>
- <bpmn2:outgoing>SequenceFlow_23</bpmn2:outgoing>
- </bpmn2:exclusiveGateway>
- <bpmn2:sequenceFlow id="SequenceFlow_22" name="" sourceRef="ExclusiveGateway_3" targetRef="ProcessAAISearch"/>
- <bpmn2:sequenceFlow id="SequenceFlow_23" name="" sourceRef="ExclusiveGateway_3" targetRef="AAIQueryFailure">
- <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") != 200 && execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") != 404}]]></bpmn2:conditionExpression>
- </bpmn2:sequenceFlow>
- <bpmn2:scriptTask id="AAIQueryFailure" name="AAI Query Failure" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_23</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_18</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-def cvm = new CreateAAIVfModule()
-cvm.handleAAIQueryFailure(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_18" name="" sourceRef="AAIQueryFailure" targetRef="EndEvent_7"/>
- <bpmn2:endEvent id="EndEvent_7">
- <bpmn2:incoming>SequenceFlow_18</bpmn2:incoming>
- <bpmn2:errorEventDefinition id="_ErrorEventDefinition_68" errorRef="Error_1"/>
- </bpmn2:endEvent>
- <bpmn2:scriptTask id="ProcessAAISearch" name="Process AAI Generic Vnf Query" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_22</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_24</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-def cvm = new CreateAAIVfModule()
-cvm.processAAIGenericVnfQuery(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_24" name="" sourceRef="ProcessAAISearch" targetRef="ExclusiveGateway_5"/>
- <bpmn2:exclusiveGateway id="ExclusiveGateway_1" default="SequenceFlow_5">
- <bpmn2:incoming>SequenceFlow_8</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_5</bpmn2:outgoing>
- <bpmn2:outgoing>SequenceFlow_10</bpmn2:outgoing>
- </bpmn2:exclusiveGateway>
- <bpmn2:exclusiveGateway id="ExclusiveGateway_7">
- <bpmn2:incoming>SequenceFlow_4</bpmn2:incoming>
- <bpmn2:incoming>SequenceFlow_35</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_8</bpmn2:outgoing>
- </bpmn2:exclusiveGateway>
- <bpmn2:sequenceFlow id="SequenceFlow_28" name="Generic Vnf does not exist
 and Vnf Id != null or
Generic Vnf does exist
and Vnf Id == null" sourceRef="ExclusiveGateway_5" targetRef="CreateGenericVnfFailure">
- <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{(execution.getVariable("CAAIVfMod_newGenericVnf") == false && execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") == 404) || (execution.getVariable("CAAIVfMod_newGenericVnf") == true && execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") == 200)}]]></bpmn2:conditionExpression>
- </bpmn2:sequenceFlow>
- <bpmn2:scriptTask id="CreateGenericVnfFailure" name="Create Generic Vnf Failure" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_28</bpmn2:incoming>
- <bpmn2:incoming>SequenceFlow_26</bpmn2:incoming>
- <bpmn2:incoming>SequenceFlow_33</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_29</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-def cvm = new CreateAAIVfModule()
-cvm.handleCreateVfModuleFailure(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:endEvent id="EndEvent_8">
- <bpmn2:incoming>SequenceFlow_29</bpmn2:incoming>
- <bpmn2:errorEventDefinition id="_ErrorEventDefinition_69" errorRef="Error_1"/>
- </bpmn2:endEvent>
- <bpmn2:sequenceFlow id="SequenceFlow_29" name="" sourceRef="CreateGenericVnfFailure" targetRef="EndEvent_8"/>
- <bpmn2:scriptTask id="ScriptTask_2" name="Parse For Add-on Module" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_7</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_31</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-def cvm = new CreateAAIVfModule()
-cvm.parseForAddOnModule(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_31" name="" sourceRef="ScriptTask_2" targetRef="ExclusiveGateway_4"/>
- <bpmn2:scriptTask id="ScriptTask_8" name="Create Add-on Module" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_34</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_35</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-def cvm = new CreateAAIVfModule()
-cvm.createVfModule(execution, false)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_35" name="" sourceRef="ScriptTask_8" targetRef="ExclusiveGateway_7"/>
- <bpmn2:exclusiveGateway id="ExclusiveGateway_4" default="SequenceFlow_33">
- <bpmn2:incoming>SequenceFlow_31</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_33</bpmn2:outgoing>
- <bpmn2:outgoing>SequenceFlow_34</bpmn2:outgoing>
- </bpmn2:exclusiveGateway>
- <bpmn2:sequenceFlow id="SequenceFlow_33" name="Vnf Module Exists
" sourceRef="ExclusiveGateway_4" targetRef="CreateGenericVnfFailure"/>
- <bpmn2:sequenceFlow id="SequenceFlow_34" name="" sourceRef="ExclusiveGateway_4" targetRef="ScriptTask_8">
- <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("CAAIVfMod_moduleExists") != true}]]></bpmn2:conditionExpression>
- </bpmn2:sequenceFlow>
- <bpmn2:scriptTask id="QueryAAIForGenericVnf" name="Query AAI for
Generic Vnf" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_38</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_39</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-def cvm = new CreateAAIVfModule()
-cvm.queryAAIForGenericVnf(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_39" name="" sourceRef="QueryAAIForGenericVnf" targetRef="ExclusiveGateway_3"/>
- <bpmn2:scriptTask id="InitializeVariables" name="Initialize Variables" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_38</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-def cvm = new CreateAAIVfModule()
-cvm.preProcessRequest(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_38" name="" sourceRef="InitializeVariables" targetRef="QueryAAIForGenericVnf"/>
- <bpmn2:endEvent id="EndEvent_2">
- <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming>
- <bpmn2:errorEventDefinition id="_ErrorEventDefinition_50" errorRef="Error_1"/>
- </bpmn2:endEvent>
- <bpmn2:scriptTask id="CreateVfModuleFailure" name="Create Vf Module Failure" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_5</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_2</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-def cvm = new CreateAAIVfModule()
-cvm.handleCreateVfModuleFailure(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="CreateVfModuleFailure" targetRef="EndEvent_2"/>
- <bpmn2:sequenceFlow id="SequenceFlow_5" name="" sourceRef="ExclusiveGateway_1" targetRef="CreateVfModuleFailure"/>
- <bpmn2:sequenceFlow id="SequenceFlow_8" name="" sourceRef="ExclusiveGateway_7" targetRef="ExclusiveGateway_1"/>
- <bpmn2:endEvent id="EndEvent_1">
- <bpmn2:incoming>SequenceFlow_10</bpmn2:incoming>
- </bpmn2:endEvent>
- <bpmn2:sequenceFlow id="SequenceFlow_10" name="" sourceRef="ExclusiveGateway_1" targetRef="EndEvent_1">
- <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("CAAIVfMod_createVfModuleResponseCode") == 200 || execution.getVariable("CAAIVfMod_createVfModuleResponseCode") == 201}]]></bpmn2:conditionExpression>
- </bpmn2:sequenceFlow>
- <bpmn2:exclusiveGateway id="ExclusiveGateway_2" default="SequenceFlow_26">
- <bpmn2:incoming>SequenceFlow_20</bpmn2:incoming>
- <bpmn2:incoming>SequenceFlow_13</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_26</bpmn2:outgoing>
- <bpmn2:outgoing>SequenceFlow_27</bpmn2:outgoing>
- </bpmn2:exclusiveGateway>
- <bpmn2:sequenceFlow id="SequenceFlow_26" name="Create Generic Vnf
Failure" sourceRef="ExclusiveGateway_2" targetRef="CreateGenericVnfFailure"/>
- <bpmn2:sequenceFlow id="SequenceFlow_27" name="" sourceRef="ExclusiveGateway_2" targetRef="ScriptTask_4">
- <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("CAAIVfMod_createGenericVnfResponseCode") == 200 || execution.getVariable("CAAIVfMod_createGenericVnfResponseCode") == 201}]]></bpmn2:conditionExpression>
- </bpmn2:sequenceFlow>
- <bpmn2:exclusiveGateway id="ExclusiveGateway_6" name="Is VID Request?" default="SequenceFlow_9">
- <bpmn2:incoming>SequenceFlow_6</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_9</bpmn2:outgoing>
- <bpmn2:outgoing>SequenceFlow_11</bpmn2:outgoing>
- </bpmn2:exclusiveGateway>
- <bpmn2:sequenceFlow id="SequenceFlow_9" name="No" sourceRef="ExclusiveGateway_6" targetRef="ScriptTask_3"/>
- <bpmn2:scriptTask id="ScriptTask_3" name="Create Generic Vnf" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_9</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_20</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-def cvm = new CreateAAIVfModule()
-cvm.createGenericVnf(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_20" name="" sourceRef="ScriptTask_3" targetRef="ExclusiveGateway_2"/>
- <bpmn2:sequenceFlow id="SequenceFlow_11" name="Yes" sourceRef="ExclusiveGateway_6" targetRef="ScriptTask_1">
- <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("isVidRequest") =="true"}]]></bpmn2:conditionExpression>
- </bpmn2:sequenceFlow>
- <bpmn2:scriptTask id="ScriptTask_4" name="Create Base Module" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_27</bpmn2:incoming>
- <bpmn2:incoming>SequenceFlow_12</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_4</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-def cvm = new CreateAAIVfModule()
-cvm.createVfModule(execution, true)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_4" name="" sourceRef="ScriptTask_4" targetRef="ExclusiveGateway_7"/>
- <bpmn2:startEvent id="StartEvent_1">
- <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing>
- <bpmn2:messageEventDefinition id="_MessageEventDefinition_6" messageRef="Message_1"/>
- </bpmn2:startEvent>
- <bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="StartEvent_1" targetRef="InitializeVariables"/>
- <bpmn2:scriptTask id="ScriptTask_1" name="Parse for Base Module" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_11</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_3</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-def cvm = new CreateAAIVfModule()
-cvm.parseForBaseModule(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_3" name="" sourceRef="ScriptTask_1" targetRef="ExclusiveGateway_8"/>
- <bpmn2:exclusiveGateway id="ExclusiveGateway_8" default="SequenceFlow_13">
- <bpmn2:incoming>SequenceFlow_3</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_12</bpmn2:outgoing>
- <bpmn2:outgoing>SequenceFlow_13</bpmn2:outgoing>
- </bpmn2:exclusiveGateway>
- <bpmn2:sequenceFlow id="SequenceFlow_12" name="" sourceRef="ExclusiveGateway_8" targetRef="ScriptTask_4">
- <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{(execution.getVariable("CAAIVfMod_baseModuleConflict") != true) && (execution.getVariable("CAAIVfMod_moduleExists") != true)}]]></bpmn2:conditionExpression>
- </bpmn2:sequenceFlow>
- <bpmn2:sequenceFlow id="SequenceFlow_13" name="Base Module Conflict" sourceRef="ExclusiveGateway_8" targetRef="ExclusiveGateway_2"/>
- </bpmn2:process>
- <bpmn2:message id="Message_1" name="CreateAAIVfModuleRequest"/>
- <bpmn2:error id="Error_1" errorCode="MSOWorkflowException" name="MSO Workflow Exception"/>
- <bpmndi:BPMNDiagram id="BPMNDiagram_1">
- <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="CreateAAIVfModule">
- <bpmndi:BPMNShape id="_BPMNShape_StartEvent_37" bpmnElement="StartEvent_1">
- <dc:Bounds height="36.0" width="36.0" x="65.0" y="240.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="83.0" y="281.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_22" bpmnElement="InitializeVariables">
- <dc:Bounds height="80.0" width="100.0" x="204.0" y="216.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_StartEvent_37" targetElement="_BPMNShape_ScriptTask_22">
- <di:waypoint xsi:type="dc:Point" x="101.0" y="258.0"/>
- <di:waypoint xsi:type="dc:Point" x="160.0" y="258.0"/>
- <di:waypoint xsi:type="dc:Point" x="160.0" y="256.0"/>
- <di:waypoint xsi:type="dc:Point" x="204.0" y="256.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="123.0" y="258.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_Task_2" bpmnElement="ProcessAAISearch">
- <dc:Bounds height="80.0" width="100.0" x="518.0" y="117.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_50" bpmnElement="ExclusiveGateway_5" isMarkerVisible="true">
- <dc:Bounds height="50.0" width="50.0" x="630.0" y="230.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="655.0" y="285.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_52" bpmnElement="ExclusiveGateway_7" isMarkerVisible="true">
- <dc:Bounds height="50.0" width="50.0" x="1120.0" y="230.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="1145.0" y="285.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_47" bpmnElement="ScriptTask_3">
- <dc:Bounds height="80.0" width="100.0" x="718.0" y="93.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_7" bpmnElement="SequenceFlow_6" sourceElement="_BPMNShape_ExclusiveGateway_50" targetElement="_BPMNShape_ExclusiveGateway_225">
- <di:waypoint xsi:type="dc:Point" x="655.0" y="230.0"/>
- <di:waypoint xsi:type="dc:Point" x="655.0" y="88.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="601.0" y="133.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_48" bpmnElement="ScriptTask_2">
- <dc:Bounds height="80.0" width="100.0" x="695.0" y="391.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_8" bpmnElement="SequenceFlow_7" sourceElement="_BPMNShape_ExclusiveGateway_50" targetElement="_BPMNShape_ScriptTask_48">
- <di:waypoint xsi:type="dc:Point" x="655.0" y="280.0"/>
- <di:waypoint xsi:type="dc:Point" x="655.0" y="431.0"/>
- <di:waypoint xsi:type="dc:Point" x="695.0" y="431.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="574.0" y="256.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_54" bpmnElement="ExclusiveGateway_1" isMarkerVisible="true">
- <dc:Bounds height="50.0" width="50.0" x="1216.0" y="230.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="1241.0" y="285.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_120" bpmnElement="EndEvent_2">
- <dc:Bounds height="36.0" width="36.0" x="1224.0" y="454.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="1242.0" y="495.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_115" bpmnElement="ScriptTask_4">
- <dc:Bounds height="80.0" width="100.0" x="996.0" y="24.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_5" bpmnElement="SequenceFlow_4" sourceElement="_BPMNShape_ScriptTask_115" targetElement="_BPMNShape_ExclusiveGateway_52">
- <di:waypoint xsi:type="dc:Point" x="1096.0" y="64.0"/>
- <di:waypoint xsi:type="dc:Point" x="1145.0" y="64.0"/>
- <di:waypoint xsi:type="dc:Point" x="1145.0" y="177.0"/>
- <di:waypoint xsi:type="dc:Point" x="1145.0" y="230.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="1282.0" y="51.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_86" bpmnElement="ExclusiveGateway_3" isMarkerVisible="true">
- <dc:Bounds height="50.0" width="50.0" x="468.0" y="229.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="493.0" y="284.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_23" bpmnElement="SequenceFlow_22" sourceElement="_BPMNShape_ExclusiveGateway_86" targetElement="_BPMNShape_Task_2">
- <di:waypoint xsi:type="dc:Point" x="493.0" y="229.0"/>
- <di:waypoint xsi:type="dc:Point" x="493.0" y="158.0"/>
- <di:waypoint xsi:type="dc:Point" x="518.0" y="158.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="490.0" y="192.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_155" bpmnElement="AAIQueryFailure">
- <dc:Bounds height="80.0" width="100.0" x="518.0" y="335.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_24" bpmnElement="SequenceFlow_23" sourceElement="_BPMNShape_ExclusiveGateway_86" targetElement="_BPMNShape_ScriptTask_155">
- <di:waypoint xsi:type="dc:Point" x="493.0" y="279.0"/>
- <di:waypoint xsi:type="dc:Point" x="493.0" y="297.0"/>
- <di:waypoint xsi:type="dc:Point" x="568.0" y="297.0"/>
- <di:waypoint xsi:type="dc:Point" x="568.0" y="335.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="547.0" y="297.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_25" bpmnElement="SequenceFlow_24" sourceElement="_BPMNShape_Task_2" targetElement="_BPMNShape_ExclusiveGateway_50">
- <di:waypoint xsi:type="dc:Point" x="568.0" y="197.0"/>
- <di:waypoint xsi:type="dc:Point" x="568.0" y="255.0"/>
- <di:waypoint xsi:type="dc:Point" x="630.0" y="255.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="565.0" y="250.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_160" bpmnElement="EndEvent_7">
- <dc:Bounds height="36.0" width="36.0" x="550.0" y="454.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="568.0" y="495.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_18" bpmnElement="SequenceFlow_18" sourceElement="_BPMNShape_ScriptTask_155" targetElement="_BPMNShape_EndEvent_160">
- <di:waypoint xsi:type="dc:Point" x="568.0" y="415.0"/>
- <di:waypoint xsi:type="dc:Point" x="568.0" y="454.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="565.0" y="426.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_158" bpmnElement="CreateGenericVnfFailure">
- <dc:Bounds height="80.0" width="100.0" x="837.0" y="213.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_99" bpmnElement="ExclusiveGateway_2" isMarkerVisible="true">
- <dc:Bounds height="50.0" width="50.0" x="861.0" y="107.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="886.0" y="162.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_20" bpmnElement="SequenceFlow_20" sourceElement="_BPMNShape_ScriptTask_47" targetElement="_BPMNShape_ExclusiveGateway_99">
- <di:waypoint xsi:type="dc:Point" x="818.0" y="133.0"/>
- <di:waypoint xsi:type="dc:Point" x="839.0" y="133.0"/>
- <di:waypoint xsi:type="dc:Point" x="839.0" y="132.0"/>
- <di:waypoint xsi:type="dc:Point" x="861.0" y="132.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="839.0" y="132.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_21" bpmnElement="SequenceFlow_26" sourceElement="_BPMNShape_ExclusiveGateway_99" targetElement="_BPMNShape_ScriptTask_158">
- <di:waypoint xsi:type="dc:Point" x="886.0" y="157.0"/>
- <di:waypoint xsi:type="dc:Point" x="887.0" y="213.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="38.0" width="126.0" x="899.0" y="162.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_27" bpmnElement="SequenceFlow_27" sourceElement="_BPMNShape_ExclusiveGateway_99" targetElement="_BPMNShape_ScriptTask_115">
- <di:waypoint xsi:type="dc:Point" x="911.0" y="132.0"/>
- <di:waypoint xsi:type="dc:Point" x="953.0" y="132.0"/>
- <di:waypoint xsi:type="dc:Point" x="1045.0" y="132.0"/>
- <di:waypoint xsi:type="dc:Point" x="1045.0" y="104.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="959.0" y="132.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_28" bpmnElement="SequenceFlow_28" sourceElement="_BPMNShape_ExclusiveGateway_50" targetElement="_BPMNShape_ScriptTask_158">
- <di:waypoint xsi:type="dc:Point" x="680.0" y="255.0"/>
- <di:waypoint xsi:type="dc:Point" x="758.0" y="255.0"/>
- <di:waypoint xsi:type="dc:Point" x="758.0" y="253.0"/>
- <di:waypoint xsi:type="dc:Point" x="837.0" y="253.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="38.0" width="170.0" x="669.0" y="260.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_161" bpmnElement="EndEvent_8">
- <dc:Bounds height="36.0" width="36.0" x="987.0" y="235.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_29" bpmnElement="SequenceFlow_29" sourceElement="_BPMNShape_ScriptTask_158" targetElement="_BPMNShape_EndEvent_161">
- <di:waypoint xsi:type="dc:Point" x="937.0" y="253.0"/>
- <di:waypoint xsi:type="dc:Point" x="987.0" y="253.0"/>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_100" bpmnElement="ExclusiveGateway_4" isMarkerVisible="true">
- <dc:Bounds height="50.0" width="50.0" x="863.0" y="403.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="888.0" y="458.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_31" bpmnElement="SequenceFlow_31" sourceElement="_BPMNShape_ScriptTask_48" targetElement="_BPMNShape_ExclusiveGateway_100">
- <di:waypoint xsi:type="dc:Point" x="795.0" y="431.0"/>
- <di:waypoint xsi:type="dc:Point" x="822.0" y="431.0"/>
- <di:waypoint xsi:type="dc:Point" x="822.0" y="428.0"/>
- <di:waypoint xsi:type="dc:Point" x="863.0" y="428.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="817.0" y="431.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_33" bpmnElement="SequenceFlow_33" sourceElement="_BPMNShape_ExclusiveGateway_100" targetElement="_BPMNShape_ScriptTask_158">
- <di:waypoint xsi:type="dc:Point" x="888.0" y="403.0"/>
- <di:waypoint xsi:type="dc:Point" x="888.0" y="348.0"/>
- <di:waypoint xsi:type="dc:Point" x="887.0" y="348.0"/>
- <di:waypoint xsi:type="dc:Point" x="887.0" y="293.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="22.0" width="122.0" x="889.0" y="344.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_159" bpmnElement="ScriptTask_8">
- <dc:Bounds height="80.0" width="100.0" x="996.0" y="389.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_34" bpmnElement="SequenceFlow_34" sourceElement="_BPMNShape_ExclusiveGateway_100" targetElement="_BPMNShape_ScriptTask_159">
- <di:waypoint xsi:type="dc:Point" x="913.0" y="428.0"/>
- <di:waypoint xsi:type="dc:Point" x="954.0" y="428.0"/>
- <di:waypoint xsi:type="dc:Point" x="954.0" y="429.0"/>
- <di:waypoint xsi:type="dc:Point" x="996.0" y="429.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="955.0" y="429.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_35" bpmnElement="SequenceFlow_35" sourceElement="_BPMNShape_ScriptTask_159" targetElement="_BPMNShape_ExclusiveGateway_52">
- <di:waypoint xsi:type="dc:Point" x="1096.0" y="429.0"/>
- <di:waypoint xsi:type="dc:Point" x="1108.0" y="429.0"/>
- <di:waypoint xsi:type="dc:Point" x="1145.0" y="429.0"/>
- <di:waypoint xsi:type="dc:Point" x="1145.0" y="280.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="1142.0" y="379.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_160" bpmnElement="QueryAAIForGenericVnf">
- <dc:Bounds height="80.0" width="100.0" x="336.0" y="216.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_38" bpmnElement="SequenceFlow_38" sourceElement="_BPMNShape_ScriptTask_22" targetElement="_BPMNShape_ScriptTask_160">
- <di:waypoint xsi:type="dc:Point" x="304.0" y="256.0"/>
- <di:waypoint xsi:type="dc:Point" x="336.0" y="256.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="324.0" y="256.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_39" bpmnElement="SequenceFlow_39" sourceElement="_BPMNShape_ScriptTask_160" targetElement="_BPMNShape_ExclusiveGateway_86">
- <di:waypoint xsi:type="dc:Point" x="436.0" y="256.0"/>
- <di:waypoint xsi:type="dc:Point" x="452.0" y="256.0"/>
- <di:waypoint xsi:type="dc:Point" x="452.0" y="254.0"/>
- <di:waypoint xsi:type="dc:Point" x="468.0" y="254.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="449.0" y="255.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_161" bpmnElement="CreateVfModuleFailure">
- <dc:Bounds height="80.0" width="100.0" x="1192.0" y="324.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_ScriptTask_161" targetElement="_BPMNShape_EndEvent_120">
- <di:waypoint xsi:type="dc:Point" x="1242.0" y="404.0"/>
- <di:waypoint xsi:type="dc:Point" x="1242.0" y="454.0"/>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="SequenceFlow_5" sourceElement="_BPMNShape_ExclusiveGateway_54" targetElement="_BPMNShape_ScriptTask_161">
- <di:waypoint xsi:type="dc:Point" x="1241.0" y="280.0"/>
- <di:waypoint xsi:type="dc:Point" x="1241.0" y="302.0"/>
- <di:waypoint xsi:type="dc:Point" x="1242.0" y="302.0"/>
- <di:waypoint xsi:type="dc:Point" x="1242.0" y="324.0"/>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_6" bpmnElement="SequenceFlow_8" sourceElement="_BPMNShape_ExclusiveGateway_52" targetElement="_BPMNShape_ExclusiveGateway_54">
- <di:waypoint xsi:type="dc:Point" x="1170.0" y="255.0"/>
- <di:waypoint xsi:type="dc:Point" x="1216.0" y="255.0"/>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_164" bpmnElement="EndEvent_1">
- <dc:Bounds height="36.0" width="36.0" x="1316.0" y="237.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_10" bpmnElement="SequenceFlow_10" sourceElement="_BPMNShape_ExclusiveGateway_54" targetElement="_BPMNShape_EndEvent_164">
- <di:waypoint xsi:type="dc:Point" x="1266.0" y="255.0"/>
- <di:waypoint xsi:type="dc:Point" x="1316.0" y="255.0"/>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_225" bpmnElement="ExclusiveGateway_6" isMarkerVisible="true">
- <dc:Bounds height="50.0" width="50.0" x="630.0" y="38.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="22.0" width="100.0" x="617.0" y="18.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_9" bpmnElement="SequenceFlow_9" sourceElement="_BPMNShape_ExclusiveGateway_225" targetElement="_BPMNShape_ScriptTask_47">
- <di:waypoint xsi:type="dc:Point" x="680.0" y="64.0"/>
- <di:waypoint xsi:type="dc:Point" x="699.0" y="64.0"/>
- <di:waypoint xsi:type="dc:Point" x="699.0" y="133.0"/>
- <di:waypoint xsi:type="dc:Point" x="718.0" y="133.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="22.0" width="22.0" x="669.0" y="93.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_11" bpmnElement="SequenceFlow_11" sourceElement="_BPMNShape_ExclusiveGateway_225" targetElement="_BPMNShape_ScriptTask_162">
- <di:waypoint xsi:type="dc:Point" x="680.0" y="63.0"/>
- <di:waypoint xsi:type="dc:Point" x="702.0" y="63.0"/>
- <di:waypoint xsi:type="dc:Point" x="702.0" y="40.0"/>
- <di:waypoint xsi:type="dc:Point" x="724.0" y="40.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="22.0" width="29.0" x="688.0" y="54.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_226" bpmnElement="ExclusiveGateway_8" isMarkerVisible="true">
- <dc:Bounds height="50.0" width="50.0" x="863.0" y="14.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="888.0" y="69.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_162" bpmnElement="ScriptTask_1">
- <dc:Bounds height="80.0" width="100.0" x="724.0" y="0.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_4" bpmnElement="SequenceFlow_3" sourceElement="_BPMNShape_ScriptTask_162" targetElement="_BPMNShape_ExclusiveGateway_226">
- <di:waypoint xsi:type="dc:Point" x="824.0" y="40.0"/>
- <di:waypoint xsi:type="dc:Point" x="843.0" y="40.0"/>
- <di:waypoint xsi:type="dc:Point" x="843.0" y="39.0"/>
- <di:waypoint xsi:type="dc:Point" x="863.0" y="39.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="840.0" y="39.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_12" bpmnElement="SequenceFlow_12" sourceElement="_BPMNShape_ExclusiveGateway_226" targetElement="_BPMNShape_ScriptTask_115">
- <di:waypoint xsi:type="dc:Point" x="913.0" y="39.0"/>
- <di:waypoint xsi:type="dc:Point" x="954.0" y="39.0"/>
- <di:waypoint xsi:type="dc:Point" x="954.0" y="64.0"/>
- <di:waypoint xsi:type="dc:Point" x="996.0" y="64.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="951.0" y="52.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_13" bpmnElement="SequenceFlow_13" sourceElement="_BPMNShape_ExclusiveGateway_226" targetElement="_BPMNShape_ExclusiveGateway_99">
- <di:waypoint xsi:type="dc:Point" x="888.0" y="64.0"/>
- <di:waypoint xsi:type="dc:Point" x="888.0" y="85.0"/>
- <di:waypoint xsi:type="dc:Point" x="886.0" y="85.0"/>
- <di:waypoint xsi:type="dc:Point" x="886.0" y="107.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="884.0" y="85.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- </bpmndi:BPMNPlane>
- </bpmndi:BPMNDiagram>
+<?xml version="1.0" encoding="UTF-8"?> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd" id="_Wblj8GyfEeWUWLTvug7ZOg" exporter="camunda modeler" exporterVersion="2.7.0" targetNamespace="http://camunda.org/schema/1.0/bpmn"> + <bpmn2:process id="CreateAAIVfModule" name="CreateAAIVfModule" isExecutable="true"> + <bpmn2:exclusiveGateway id="ExclusiveGateway_5" default="SequenceFlow_7"> + <bpmn2:incoming>SequenceFlow_24</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_6</bpmn2:outgoing> + <bpmn2:outgoing>SequenceFlow_7</bpmn2:outgoing> + <bpmn2:outgoing>SequenceFlow_28</bpmn2:outgoing> + </bpmn2:exclusiveGateway> + <bpmn2:sequenceFlow id="SequenceFlow_6" name="" sourceRef="ExclusiveGateway_5" targetRef="ExclusiveGateway_6"> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{(execution.getVariable("CAAIVfMod_newGenericVnf") == true && execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") == 404) || execution.getVariable("CAAIVfMod_isBaseVfModule") == true}]]></bpmn2:conditionExpression> + </bpmn2:sequenceFlow> + <bpmn2:sequenceFlow id="SequenceFlow_7" name="" sourceRef="ExclusiveGateway_5" targetRef="ScriptTask_2"/> + <bpmn2:exclusiveGateway id="ExclusiveGateway_3" default="SequenceFlow_22"> + <bpmn2:incoming>SequenceFlow_39</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_22</bpmn2:outgoing> + <bpmn2:outgoing>SequenceFlow_23</bpmn2:outgoing> + </bpmn2:exclusiveGateway> + <bpmn2:sequenceFlow id="SequenceFlow_22" name="" sourceRef="ExclusiveGateway_3" targetRef="ProcessAAISearch"/> + <bpmn2:sequenceFlow id="SequenceFlow_23" name="" sourceRef="ExclusiveGateway_3" targetRef="AAIQueryFailure"> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") != 200 && execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") != 404}]]></bpmn2:conditionExpression> + </bpmn2:sequenceFlow> + <bpmn2:scriptTask id="AAIQueryFailure" name="AAI Query Failure" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_23</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_18</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* +def cvm = new CreateAAIVfModule() +cvm.handleAAIQueryFailure(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_18" name="" sourceRef="AAIQueryFailure" targetRef="EndEvent_7"/> + <bpmn2:endEvent id="EndEvent_7"> + <bpmn2:incoming>SequenceFlow_18</bpmn2:incoming> + <bpmn2:errorEventDefinition id="_ErrorEventDefinition_68" errorRef="Error_1"/> + </bpmn2:endEvent> + <bpmn2:scriptTask id="ProcessAAISearch" name="Process AAI Generic Vnf Query" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_22</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_24</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* +def cvm = new CreateAAIVfModule() +cvm.processAAIGenericVnfQuery(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_24" name="" sourceRef="ProcessAAISearch" targetRef="ExclusiveGateway_5"/> + <bpmn2:exclusiveGateway id="ExclusiveGateway_1" default="SequenceFlow_5"> + <bpmn2:incoming>SequenceFlow_8</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_5</bpmn2:outgoing> + <bpmn2:outgoing>SequenceFlow_10</bpmn2:outgoing> + </bpmn2:exclusiveGateway> + <bpmn2:exclusiveGateway id="ExclusiveGateway_7"> + <bpmn2:incoming>SequenceFlow_4</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_35</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_8</bpmn2:outgoing> + </bpmn2:exclusiveGateway> + <bpmn2:sequenceFlow id="SequenceFlow_28" name="Generic Vnf does not exist
 and Vnf Id != null or
Generic Vnf does exist
and Vnf Id == null" sourceRef="ExclusiveGateway_5" targetRef="CreateGenericVnfFailure"> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{(execution.getVariable("CAAIVfMod_newGenericVnf") == false && execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") == 404) || (execution.getVariable("CAAIVfMod_newGenericVnf") == true && execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") == 200)}]]></bpmn2:conditionExpression> + </bpmn2:sequenceFlow> + <bpmn2:scriptTask id="CreateGenericVnfFailure" name="Create Generic Vnf Failure" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_28</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_26</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_33</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_29</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* +def cvm = new CreateAAIVfModule() +cvm.handleCreateVfModuleFailure(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:endEvent id="EndEvent_8"> + <bpmn2:incoming>SequenceFlow_29</bpmn2:incoming> + <bpmn2:errorEventDefinition id="_ErrorEventDefinition_69" errorRef="Error_1"/> + </bpmn2:endEvent> + <bpmn2:sequenceFlow id="SequenceFlow_29" name="" sourceRef="CreateGenericVnfFailure" targetRef="EndEvent_8"/> + <bpmn2:scriptTask id="ScriptTask_2" name="Parse For Add-on Module" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_7</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_31</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* +def cvm = new CreateAAIVfModule() +cvm.parseForAddOnModule(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_31" name="" sourceRef="ScriptTask_2" targetRef="ExclusiveGateway_4"/> + <bpmn2:scriptTask id="ScriptTask_8" name="Create Add-on Module" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_34</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_35</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* +def cvm = new CreateAAIVfModule() +cvm.createVfModule(execution, false)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_35" name="" sourceRef="ScriptTask_8" targetRef="ExclusiveGateway_7"/> + <bpmn2:exclusiveGateway id="ExclusiveGateway_4" default="SequenceFlow_33"> + <bpmn2:incoming>SequenceFlow_31</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_33</bpmn2:outgoing> + <bpmn2:outgoing>SequenceFlow_34</bpmn2:outgoing> + </bpmn2:exclusiveGateway> + <bpmn2:sequenceFlow id="SequenceFlow_33" name="Vnf Module Exists
" sourceRef="ExclusiveGateway_4" targetRef="CreateGenericVnfFailure"/> + <bpmn2:sequenceFlow id="SequenceFlow_34" name="" sourceRef="ExclusiveGateway_4" targetRef="ScriptTask_8"> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("CAAIVfMod_moduleExists") != true}]]></bpmn2:conditionExpression> + </bpmn2:sequenceFlow> + <bpmn2:scriptTask id="QueryAAIForGenericVnf" name="Query AAI for
Generic Vnf" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_38</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_39</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* +def cvm = new CreateAAIVfModule() +cvm.queryAAIForGenericVnf(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_39" name="" sourceRef="QueryAAIForGenericVnf" targetRef="ExclusiveGateway_3"/> + <bpmn2:scriptTask id="InitializeVariables" name="Initialize Variables" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_38</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* +def cvm = new CreateAAIVfModule() +cvm.preProcessRequest(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_38" name="" sourceRef="InitializeVariables" targetRef="QueryAAIForGenericVnf"/> + <bpmn2:endEvent id="EndEvent_2"> + <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming> + <bpmn2:errorEventDefinition id="_ErrorEventDefinition_50" errorRef="Error_1"/> + </bpmn2:endEvent> + <bpmn2:scriptTask id="CreateVfModuleFailure" name="Create Vf Module Failure" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_5</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_2</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* +def cvm = new CreateAAIVfModule() +cvm.handleCreateVfModuleFailure(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="CreateVfModuleFailure" targetRef="EndEvent_2"/> + <bpmn2:sequenceFlow id="SequenceFlow_5" name="" sourceRef="ExclusiveGateway_1" targetRef="CreateVfModuleFailure"/> + <bpmn2:sequenceFlow id="SequenceFlow_8" name="" sourceRef="ExclusiveGateway_7" targetRef="ExclusiveGateway_1"/> + <bpmn2:endEvent id="EndEvent_1"> + <bpmn2:incoming>SequenceFlow_10</bpmn2:incoming> + </bpmn2:endEvent> + <bpmn2:sequenceFlow id="SequenceFlow_10" name="" sourceRef="ExclusiveGateway_1" targetRef="EndEvent_1"> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("CAAIVfMod_createVfModuleResponseCode") == 200 || execution.getVariable("CAAIVfMod_createVfModuleResponseCode") == 201}]]></bpmn2:conditionExpression> + </bpmn2:sequenceFlow> + <bpmn2:exclusiveGateway id="ExclusiveGateway_2" default="SequenceFlow_26"> + <bpmn2:incoming>SequenceFlow_20</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_13</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_26</bpmn2:outgoing> + <bpmn2:outgoing>SequenceFlow_27</bpmn2:outgoing> + </bpmn2:exclusiveGateway> + <bpmn2:sequenceFlow id="SequenceFlow_26" name="Create Generic Vnf
Failure" sourceRef="ExclusiveGateway_2" targetRef="CreateGenericVnfFailure"/> + <bpmn2:sequenceFlow id="SequenceFlow_27" name="" sourceRef="ExclusiveGateway_2" targetRef="ScriptTask_4"> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("CAAIVfMod_createGenericVnfResponseCode") == 200 || execution.getVariable("CAAIVfMod_createGenericVnfResponseCode") == 201}]]></bpmn2:conditionExpression> + </bpmn2:sequenceFlow> + <bpmn2:exclusiveGateway id="ExclusiveGateway_6" name="Is VID Request?" default="SequenceFlow_9"> + <bpmn2:incoming>SequenceFlow_6</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_9</bpmn2:outgoing> + <bpmn2:outgoing>SequenceFlow_11</bpmn2:outgoing> + </bpmn2:exclusiveGateway> + <bpmn2:sequenceFlow id="SequenceFlow_9" name="No" sourceRef="ExclusiveGateway_6" targetRef="ScriptTask_3"/> + <bpmn2:scriptTask id="ScriptTask_3" name="Create Generic Vnf" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_9</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_20</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* +def cvm = new CreateAAIVfModule() +cvm.createGenericVnf(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_20" name="" sourceRef="ScriptTask_3" targetRef="ExclusiveGateway_2"/> + <bpmn2:sequenceFlow id="SequenceFlow_11" name="Yes" sourceRef="ExclusiveGateway_6" targetRef="ScriptTask_1"> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("isVidRequest") =="true"}]]></bpmn2:conditionExpression> + </bpmn2:sequenceFlow> + <bpmn2:scriptTask id="ScriptTask_4" name="Create Base Module" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_27</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_12</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_4</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* +def cvm = new CreateAAIVfModule() +cvm.createVfModule(execution, true)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_4" name="" sourceRef="ScriptTask_4" targetRef="ExclusiveGateway_7"/> + <bpmn2:startEvent id="StartEvent_1"> + <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing> + <bpmn2:messageEventDefinition id="_MessageEventDefinition_6" messageRef="Message_1"/> + </bpmn2:startEvent> + <bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="StartEvent_1" targetRef="InitializeVariables"/> + <bpmn2:scriptTask id="ScriptTask_1" name="Parse for Base Module" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_11</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_3</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* +def cvm = new CreateAAIVfModule() +cvm.parseForBaseModule(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_3" name="" sourceRef="ScriptTask_1" targetRef="ExclusiveGateway_8"/> + <bpmn2:exclusiveGateway id="ExclusiveGateway_8" default="SequenceFlow_13"> + <bpmn2:incoming>SequenceFlow_3</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_12</bpmn2:outgoing> + <bpmn2:outgoing>SequenceFlow_13</bpmn2:outgoing> + </bpmn2:exclusiveGateway> + <bpmn2:sequenceFlow id="SequenceFlow_12" name="" sourceRef="ExclusiveGateway_8" targetRef="ScriptTask_4"> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{(execution.getVariable("CAAIVfMod_baseModuleConflict") != true) && (execution.getVariable("CAAIVfMod_moduleExists") != true)}]]></bpmn2:conditionExpression> + </bpmn2:sequenceFlow> + <bpmn2:sequenceFlow id="SequenceFlow_13" name="Base Module Conflict" sourceRef="ExclusiveGateway_8" targetRef="ExclusiveGateway_2"/> + </bpmn2:process> + <bpmn2:message id="Message_1" name="CreateAAIVfModuleRequest"/> + <bpmn2:error id="Error_1" errorCode="MSOWorkflowException" name="MSO Workflow Exception"/> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="CreateAAIVfModule"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_37" bpmnElement="StartEvent_1"> + <dc:Bounds height="36.0" width="36.0" x="65.0" y="240.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="0.0" width="0.0" x="83.0" y="281.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_22" bpmnElement="InitializeVariables"> + <dc:Bounds height="80.0" width="100.0" x="204.0" y="216.0"/> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_StartEvent_37" targetElement="_BPMNShape_ScriptTask_22"> + <di:waypoint xsi:type="dc:Point" x="101.0" y="258.0"/> + <di:waypoint xsi:type="dc:Point" x="160.0" y="258.0"/> + <di:waypoint xsi:type="dc:Point" x="160.0" y="256.0"/> + <di:waypoint xsi:type="dc:Point" x="204.0" y="256.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="6.0" width="6.0" x="123.0" y="258.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_Task_2" bpmnElement="ProcessAAISearch"> + <dc:Bounds height="80.0" width="100.0" x="518.0" y="117.0"/> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_50" bpmnElement="ExclusiveGateway_5" isMarkerVisible="true"> + <dc:Bounds height="50.0" width="50.0" x="630.0" y="230.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="0.0" width="0.0" x="655.0" y="285.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_52" bpmnElement="ExclusiveGateway_7" isMarkerVisible="true"> + <dc:Bounds height="50.0" width="50.0" x="1120.0" y="230.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="0.0" width="0.0" x="1145.0" y="285.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_47" bpmnElement="ScriptTask_3"> + <dc:Bounds height="80.0" width="100.0" x="718.0" y="93.0"/> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_7" bpmnElement="SequenceFlow_6" sourceElement="_BPMNShape_ExclusiveGateway_50" targetElement="_BPMNShape_ExclusiveGateway_225"> + <di:waypoint xsi:type="dc:Point" x="655.0" y="230.0"/> + <di:waypoint xsi:type="dc:Point" x="655.0" y="88.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="6.0" width="6.0" x="601.0" y="133.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_48" bpmnElement="ScriptTask_2"> + <dc:Bounds height="80.0" width="100.0" x="695.0" y="391.0"/> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_8" bpmnElement="SequenceFlow_7" sourceElement="_BPMNShape_ExclusiveGateway_50" targetElement="_BPMNShape_ScriptTask_48"> + <di:waypoint xsi:type="dc:Point" x="655.0" y="280.0"/> + <di:waypoint xsi:type="dc:Point" x="655.0" y="431.0"/> + <di:waypoint xsi:type="dc:Point" x="695.0" y="431.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="6.0" width="6.0" x="574.0" y="256.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_54" bpmnElement="ExclusiveGateway_1" isMarkerVisible="true"> + <dc:Bounds height="50.0" width="50.0" x="1216.0" y="230.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="0.0" width="0.0" x="1241.0" y="285.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_EndEvent_120" bpmnElement="EndEvent_2"> + <dc:Bounds height="36.0" width="36.0" x="1224.0" y="454.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="0.0" width="0.0" x="1242.0" y="495.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_115" bpmnElement="ScriptTask_4"> + <dc:Bounds height="80.0" width="100.0" x="996.0" y="24.0"/> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_5" bpmnElement="SequenceFlow_4" sourceElement="_BPMNShape_ScriptTask_115" targetElement="_BPMNShape_ExclusiveGateway_52"> + <di:waypoint xsi:type="dc:Point" x="1096.0" y="64.0"/> + <di:waypoint xsi:type="dc:Point" x="1145.0" y="64.0"/> + <di:waypoint xsi:type="dc:Point" x="1145.0" y="177.0"/> + <di:waypoint xsi:type="dc:Point" x="1145.0" y="230.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="6.0" width="6.0" x="1282.0" y="51.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_86" bpmnElement="ExclusiveGateway_3" isMarkerVisible="true"> + <dc:Bounds height="50.0" width="50.0" x="468.0" y="229.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="0.0" width="0.0" x="493.0" y="284.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_23" bpmnElement="SequenceFlow_22" sourceElement="_BPMNShape_ExclusiveGateway_86" targetElement="_BPMNShape_Task_2"> + <di:waypoint xsi:type="dc:Point" x="493.0" y="229.0"/> + <di:waypoint xsi:type="dc:Point" x="493.0" y="158.0"/> + <di:waypoint xsi:type="dc:Point" x="518.0" y="158.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="6.0" width="6.0" x="490.0" y="192.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_155" bpmnElement="AAIQueryFailure"> + <dc:Bounds height="80.0" width="100.0" x="518.0" y="335.0"/> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_24" bpmnElement="SequenceFlow_23" sourceElement="_BPMNShape_ExclusiveGateway_86" targetElement="_BPMNShape_ScriptTask_155"> + <di:waypoint xsi:type="dc:Point" x="493.0" y="279.0"/> + <di:waypoint xsi:type="dc:Point" x="493.0" y="297.0"/> + <di:waypoint xsi:type="dc:Point" x="568.0" y="297.0"/> + <di:waypoint xsi:type="dc:Point" x="568.0" y="335.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="6.0" width="6.0" x="547.0" y="297.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_25" bpmnElement="SequenceFlow_24" sourceElement="_BPMNShape_Task_2" targetElement="_BPMNShape_ExclusiveGateway_50"> + <di:waypoint xsi:type="dc:Point" x="568.0" y="197.0"/> + <di:waypoint xsi:type="dc:Point" x="568.0" y="255.0"/> + <di:waypoint xsi:type="dc:Point" x="630.0" y="255.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="6.0" width="6.0" x="565.0" y="250.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_EndEvent_160" bpmnElement="EndEvent_7"> + <dc:Bounds height="36.0" width="36.0" x="550.0" y="454.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="0.0" width="0.0" x="568.0" y="495.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_18" bpmnElement="SequenceFlow_18" sourceElement="_BPMNShape_ScriptTask_155" targetElement="_BPMNShape_EndEvent_160"> + <di:waypoint xsi:type="dc:Point" x="568.0" y="415.0"/> + <di:waypoint xsi:type="dc:Point" x="568.0" y="454.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="6.0" width="6.0" x="565.0" y="426.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_158" bpmnElement="CreateGenericVnfFailure"> + <dc:Bounds height="80.0" width="100.0" x="837.0" y="213.0"/> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_99" bpmnElement="ExclusiveGateway_2" isMarkerVisible="true"> + <dc:Bounds height="50.0" width="50.0" x="861.0" y="107.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="0.0" width="0.0" x="886.0" y="162.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_20" bpmnElement="SequenceFlow_20" sourceElement="_BPMNShape_ScriptTask_47" targetElement="_BPMNShape_ExclusiveGateway_99"> + <di:waypoint xsi:type="dc:Point" x="818.0" y="133.0"/> + <di:waypoint xsi:type="dc:Point" x="839.0" y="133.0"/> + <di:waypoint xsi:type="dc:Point" x="839.0" y="132.0"/> + <di:waypoint xsi:type="dc:Point" x="861.0" y="132.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="6.0" width="6.0" x="839.0" y="132.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_21" bpmnElement="SequenceFlow_26" sourceElement="_BPMNShape_ExclusiveGateway_99" targetElement="_BPMNShape_ScriptTask_158"> + <di:waypoint xsi:type="dc:Point" x="886.0" y="157.0"/> + <di:waypoint xsi:type="dc:Point" x="887.0" y="213.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="38.0" width="126.0" x="899.0" y="162.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_27" bpmnElement="SequenceFlow_27" sourceElement="_BPMNShape_ExclusiveGateway_99" targetElement="_BPMNShape_ScriptTask_115"> + <di:waypoint xsi:type="dc:Point" x="911.0" y="132.0"/> + <di:waypoint xsi:type="dc:Point" x="953.0" y="132.0"/> + <di:waypoint xsi:type="dc:Point" x="1045.0" y="132.0"/> + <di:waypoint xsi:type="dc:Point" x="1045.0" y="104.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="6.0" width="6.0" x="959.0" y="132.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_28" bpmnElement="SequenceFlow_28" sourceElement="_BPMNShape_ExclusiveGateway_50" targetElement="_BPMNShape_ScriptTask_158"> + <di:waypoint xsi:type="dc:Point" x="680.0" y="255.0"/> + <di:waypoint xsi:type="dc:Point" x="758.0" y="255.0"/> + <di:waypoint xsi:type="dc:Point" x="758.0" y="253.0"/> + <di:waypoint xsi:type="dc:Point" x="837.0" y="253.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="38.0" width="170.0" x="669.0" y="260.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_EndEvent_161" bpmnElement="EndEvent_8"> + <dc:Bounds height="36.0" width="36.0" x="987.0" y="235.0"/> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_29" bpmnElement="SequenceFlow_29" sourceElement="_BPMNShape_ScriptTask_158" targetElement="_BPMNShape_EndEvent_161"> + <di:waypoint xsi:type="dc:Point" x="937.0" y="253.0"/> + <di:waypoint xsi:type="dc:Point" x="987.0" y="253.0"/> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_100" bpmnElement="ExclusiveGateway_4" isMarkerVisible="true"> + <dc:Bounds height="50.0" width="50.0" x="863.0" y="403.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="0.0" width="0.0" x="888.0" y="458.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_31" bpmnElement="SequenceFlow_31" sourceElement="_BPMNShape_ScriptTask_48" targetElement="_BPMNShape_ExclusiveGateway_100"> + <di:waypoint xsi:type="dc:Point" x="795.0" y="431.0"/> + <di:waypoint xsi:type="dc:Point" x="822.0" y="431.0"/> + <di:waypoint xsi:type="dc:Point" x="822.0" y="428.0"/> + <di:waypoint xsi:type="dc:Point" x="863.0" y="428.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="6.0" width="6.0" x="817.0" y="431.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_33" bpmnElement="SequenceFlow_33" sourceElement="_BPMNShape_ExclusiveGateway_100" targetElement="_BPMNShape_ScriptTask_158"> + <di:waypoint xsi:type="dc:Point" x="888.0" y="403.0"/> + <di:waypoint xsi:type="dc:Point" x="888.0" y="348.0"/> + <di:waypoint xsi:type="dc:Point" x="887.0" y="348.0"/> + <di:waypoint xsi:type="dc:Point" x="887.0" y="293.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="22.0" width="122.0" x="889.0" y="344.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_159" bpmnElement="ScriptTask_8"> + <dc:Bounds height="80.0" width="100.0" x="996.0" y="389.0"/> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_34" bpmnElement="SequenceFlow_34" sourceElement="_BPMNShape_ExclusiveGateway_100" targetElement="_BPMNShape_ScriptTask_159"> + <di:waypoint xsi:type="dc:Point" x="913.0" y="428.0"/> + <di:waypoint xsi:type="dc:Point" x="954.0" y="428.0"/> + <di:waypoint xsi:type="dc:Point" x="954.0" y="429.0"/> + <di:waypoint xsi:type="dc:Point" x="996.0" y="429.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="6.0" width="6.0" x="955.0" y="429.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_35" bpmnElement="SequenceFlow_35" sourceElement="_BPMNShape_ScriptTask_159" targetElement="_BPMNShape_ExclusiveGateway_52"> + <di:waypoint xsi:type="dc:Point" x="1096.0" y="429.0"/> + <di:waypoint xsi:type="dc:Point" x="1108.0" y="429.0"/> + <di:waypoint xsi:type="dc:Point" x="1145.0" y="429.0"/> + <di:waypoint xsi:type="dc:Point" x="1145.0" y="280.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="6.0" width="6.0" x="1142.0" y="379.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_160" bpmnElement="QueryAAIForGenericVnf"> + <dc:Bounds height="80.0" width="100.0" x="336.0" y="216.0"/> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_38" bpmnElement="SequenceFlow_38" sourceElement="_BPMNShape_ScriptTask_22" targetElement="_BPMNShape_ScriptTask_160"> + <di:waypoint xsi:type="dc:Point" x="304.0" y="256.0"/> + <di:waypoint xsi:type="dc:Point" x="336.0" y="256.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="6.0" width="6.0" x="324.0" y="256.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_39" bpmnElement="SequenceFlow_39" sourceElement="_BPMNShape_ScriptTask_160" targetElement="_BPMNShape_ExclusiveGateway_86"> + <di:waypoint xsi:type="dc:Point" x="436.0" y="256.0"/> + <di:waypoint xsi:type="dc:Point" x="452.0" y="256.0"/> + <di:waypoint xsi:type="dc:Point" x="452.0" y="254.0"/> + <di:waypoint xsi:type="dc:Point" x="468.0" y="254.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="6.0" width="6.0" x="449.0" y="255.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_161" bpmnElement="CreateVfModuleFailure"> + <dc:Bounds height="80.0" width="100.0" x="1192.0" y="324.0"/> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_ScriptTask_161" targetElement="_BPMNShape_EndEvent_120"> + <di:waypoint xsi:type="dc:Point" x="1242.0" y="404.0"/> + <di:waypoint xsi:type="dc:Point" x="1242.0" y="454.0"/> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="SequenceFlow_5" sourceElement="_BPMNShape_ExclusiveGateway_54" targetElement="_BPMNShape_ScriptTask_161"> + <di:waypoint xsi:type="dc:Point" x="1241.0" y="280.0"/> + <di:waypoint xsi:type="dc:Point" x="1241.0" y="302.0"/> + <di:waypoint xsi:type="dc:Point" x="1242.0" y="302.0"/> + <di:waypoint xsi:type="dc:Point" x="1242.0" y="324.0"/> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_6" bpmnElement="SequenceFlow_8" sourceElement="_BPMNShape_ExclusiveGateway_52" targetElement="_BPMNShape_ExclusiveGateway_54"> + <di:waypoint xsi:type="dc:Point" x="1170.0" y="255.0"/> + <di:waypoint xsi:type="dc:Point" x="1216.0" y="255.0"/> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_EndEvent_164" bpmnElement="EndEvent_1"> + <dc:Bounds height="36.0" width="36.0" x="1316.0" y="237.0"/> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_10" bpmnElement="SequenceFlow_10" sourceElement="_BPMNShape_ExclusiveGateway_54" targetElement="_BPMNShape_EndEvent_164"> + <di:waypoint xsi:type="dc:Point" x="1266.0" y="255.0"/> + <di:waypoint xsi:type="dc:Point" x="1316.0" y="255.0"/> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_225" bpmnElement="ExclusiveGateway_6" isMarkerVisible="true"> + <dc:Bounds height="50.0" width="50.0" x="630.0" y="38.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="22.0" width="100.0" x="617.0" y="18.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_9" bpmnElement="SequenceFlow_9" sourceElement="_BPMNShape_ExclusiveGateway_225" targetElement="_BPMNShape_ScriptTask_47"> + <di:waypoint xsi:type="dc:Point" x="680.0" y="64.0"/> + <di:waypoint xsi:type="dc:Point" x="699.0" y="64.0"/> + <di:waypoint xsi:type="dc:Point" x="699.0" y="133.0"/> + <di:waypoint xsi:type="dc:Point" x="718.0" y="133.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="22.0" width="22.0" x="669.0" y="93.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_11" bpmnElement="SequenceFlow_11" sourceElement="_BPMNShape_ExclusiveGateway_225" targetElement="_BPMNShape_ScriptTask_162"> + <di:waypoint xsi:type="dc:Point" x="680.0" y="63.0"/> + <di:waypoint xsi:type="dc:Point" x="702.0" y="63.0"/> + <di:waypoint xsi:type="dc:Point" x="702.0" y="40.0"/> + <di:waypoint xsi:type="dc:Point" x="724.0" y="40.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="22.0" width="29.0" x="688.0" y="54.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_226" bpmnElement="ExclusiveGateway_8" isMarkerVisible="true"> + <dc:Bounds height="50.0" width="50.0" x="863.0" y="14.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="0.0" width="0.0" x="888.0" y="69.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_162" bpmnElement="ScriptTask_1"> + <dc:Bounds height="80.0" width="100.0" x="724.0" y="0.0"/> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_4" bpmnElement="SequenceFlow_3" sourceElement="_BPMNShape_ScriptTask_162" targetElement="_BPMNShape_ExclusiveGateway_226"> + <di:waypoint xsi:type="dc:Point" x="824.0" y="40.0"/> + <di:waypoint xsi:type="dc:Point" x="843.0" y="40.0"/> + <di:waypoint xsi:type="dc:Point" x="843.0" y="39.0"/> + <di:waypoint xsi:type="dc:Point" x="863.0" y="39.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="6.0" width="6.0" x="840.0" y="39.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_12" bpmnElement="SequenceFlow_12" sourceElement="_BPMNShape_ExclusiveGateway_226" targetElement="_BPMNShape_ScriptTask_115"> + <di:waypoint xsi:type="dc:Point" x="913.0" y="39.0"/> + <di:waypoint xsi:type="dc:Point" x="954.0" y="39.0"/> + <di:waypoint xsi:type="dc:Point" x="954.0" y="64.0"/> + <di:waypoint xsi:type="dc:Point" x="996.0" y="64.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="6.0" width="6.0" x="951.0" y="52.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_13" bpmnElement="SequenceFlow_13" sourceElement="_BPMNShape_ExclusiveGateway_226" targetElement="_BPMNShape_ExclusiveGateway_99"> + <di:waypoint xsi:type="dc:Point" x="888.0" y="64.0"/> + <di:waypoint xsi:type="dc:Point" x="888.0" y="85.0"/> + <di:waypoint xsi:type="dc:Point" x="886.0" y="85.0"/> + <di:waypoint xsi:type="dc:Point" x="886.0" y="107.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="6.0" width="6.0" x="884.0" y="85.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> </bpmn2:definitions>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CreateAAIVfModuleVolumeGroup.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CreateAAIVfModuleVolumeGroup.bpmn index dc94c898c2..232ae027cd 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CreateAAIVfModuleVolumeGroup.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CreateAAIVfModuleVolumeGroup.bpmn @@ -5,7 +5,7 @@ <bpmn2:scriptTask id="QueryAAIForVfModule" name="Query AAI for VF Module" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_38</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_39</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* def cvfvg = new CreateAAIVfModuleVolumeGroup() cvfvg.getVfModule(execution)]]></bpmn2:script> </bpmn2:scriptTask> @@ -17,7 +17,7 @@ cvfvg.getVfModule(execution)]]></bpmn2:script> <bpmn2:scriptTask id="AAIQueryFailure" name="Handle AAI Query Failure" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_23</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_18</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* def cvfvg = new CreateAAIVfModuleVolumeGroup() cvfvg.handleAAIQueryFailure(execution)]]></bpmn2:script> </bpmn2:scriptTask> @@ -30,7 +30,7 @@ cvfvg.handleAAIQueryFailure(execution)]]></bpmn2:script> <bpmn2:extensionElements> <camunda:connector> <camunda:inputOutput> - <camunda:outputParameter name="CreateCustomerV1Response"><![CDATA[<aetgt:CreateCustomerResponse xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1" xmlns:ns="http://org.openecomp/mso/workflow/schema/v1"> + <camunda:outputParameter name="CreateCustomerV1Response"><![CDATA[<aetgt:CreateCustomerResponse xmlns:aetgt="http://org.onap/so/workflow/schema/v1" xmlns:ns="http://org.onap/so/workflow/schema/v1"> <ns:GlobalCustomerId>${CCV1_subscriberglobalid}</ns:GlobalCustomerId> </aetgt:CreateCustomerResponse>]]></camunda:outputParameter> </camunda:inputOutput> @@ -50,7 +50,7 @@ cvfvg.handleAAIQueryFailure(execution)]]></bpmn2:script> <bpmn2:scriptTask id="HandleUpdateVfModuleFailure" name="Handle Update VF Module Failure" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_4</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_8</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* def cvfvg = new CreateAAIVfModuleVolumeGroup() cvfvg.handleUpdateVfModuleFailure(execution)]]></bpmn2:script> </bpmn2:scriptTask> @@ -62,7 +62,7 @@ cvfvg.handleUpdateVfModuleFailure(execution)]]></bpmn2:script> <bpmn2:scriptTask id="ProcessReceivedRequest" name="Process Received Request" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_38</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* def cvfvg = new CreateAAIVfModuleVolumeGroup() cvfvg.preProcessRequest(execution)]]></bpmn2:script> </bpmn2:scriptTask> @@ -70,7 +70,7 @@ cvfvg.preProcessRequest(execution)]]></bpmn2:script> <bpmn2:scriptTask id="UpdateVfModule" name="Update VF Module with Volume Group" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_22</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_14</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* def cvfvg = new CreateAAIVfModuleVolumeGroup() cvfvg.updateVfModule(execution)]]></bpmn2:script> </bpmn2:scriptTask> diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CustomE2EGetService.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CustomE2EGetService.bpmn index 37c6605a0e..90722a95f3 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CustomE2EGetService.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CustomE2EGetService.bpmn @@ -4,7 +4,7 @@ <bpmn2:scriptTask id="intialization" name="Initialization" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_2</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* CustomE2EGetService getService = new CustomE2EGetService() getService.preProcessRequest(execution) ]]></bpmn2:script> @@ -23,7 +23,7 @@ getService.preProcessRequest(execution) <bpmn2:scriptTask id="processBPMNException" name="Process Error" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_7</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_8</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* ExceptionUtil ex = new ExceptionUtil() ex.processSubflowsBPMNException(execution)]]></bpmn2:script> @@ -41,7 +41,7 @@ ex.processSubflowsBPMNException(execution)]]></bpmn2:script> <bpmn2:scriptTask id="toggleSuccess" name="Toggle Success Indicator" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_3</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_6</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* CustomE2EGetService getService = new CustomE2EGetService() getService.setSuccessIndicator(execution, true) ]]></bpmn2:script> @@ -50,7 +50,7 @@ getService.setSuccessIndicator(execution, true) <bpmn2:scriptTask id="getServiceInstance" name="GET Object" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_5</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_3</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* CustomE2EGetService getService = new CustomE2EGetService() getService.getServiceObject(execution)]]></bpmn2:script> </bpmn2:scriptTask> @@ -64,7 +64,7 @@ getService.getServiceObject(execution)]]></bpmn2:script> <bpmn2:scriptTask id="obtainServiceUrlById" name="Node Query Using Id " scriptFormat="groovy"> <bpmn2:incoming>obtainById</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_4</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* CustomE2EGetService getService = new CustomE2EGetService() getService.obtainServiceInstanceUrlById(execution)]]></bpmn2:script> </bpmn2:scriptTask> @@ -72,7 +72,7 @@ getService.obtainServiceInstanceUrlById(execution)]]></bpmn2:script> <bpmn2:scriptTask id="obtainServiceUrlByName" name="Node Query Using Name" scriptFormat="groovy"> <bpmn2:incoming>obtainByName</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_13</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* CustomE2EGetService getService = new CustomE2EGetService() getService.obtainServiceInstanceUrlByName(execution)]]></bpmn2:script> </bpmn2:scriptTask> diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CustomE2EPutService.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CustomE2EPutService.bpmn index 9d989d2aac..f519bc9dbe 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CustomE2EPutService.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CustomE2EPutService.bpmn @@ -12,7 +12,7 @@ <bpmn2:scriptTask id="toggleSuccess" name="Toggle Success Indicator" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_4</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_5</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* def serviceInstance= new CustomE2EPutService() serviceInstance.setSuccessIndicator(execution, true) @@ -23,7 +23,7 @@ execution.setVariable("WorkflowResponse", " ") //for junits]]></bpmn2:script> <bpmn2:scriptTask id="putServiceInstance" name="Put Service Instance" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_3</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_4</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* def serviceInstance= new CustomE2EPutService() serviceInstance.putServiceInstance(execution)]]></bpmn2:script> @@ -32,7 +32,7 @@ serviceInstance.putServiceInstance(execution)]]></bpmn2:script> <bpmn2:scriptTask id="Initialization" name="Initialization" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_3</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* def serviceInstance= new CustomE2EPutService() serviceInstance.preProcessRequest(execution) @@ -51,9 +51,9 @@ serviceInstance.preProcessRequest(execution) <bpmn2:scriptTask id="processError" name="Process Error" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_6</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_7</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-
-ExceptionUtil ex = new ExceptionUtil()
+ <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* + +ExceptionUtil ex = new ExceptionUtil() ex.processSubflowsBPMNException(execution)]]></bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_7" name="" sourceRef="processError" targetRef="EndEvent_2" /> @@ -67,9 +67,9 @@ ex.processSubflowsBPMNException(execution)]]></bpmn2:script> <bpmn2:scriptTask id="processJavaError" name="Process Java Error" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_9</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_10</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-
-ExceptionUtil ex = new ExceptionUtil()
+ <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* + +ExceptionUtil ex = new ExceptionUtil() ex.processJavaException(execution)]]></bpmn2:script> </bpmn2:scriptTask> <bpmn2:endEvent id="EndEvent_3"> diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/DeleteAAIVfModule.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/DeleteAAIVfModule.bpmn index 297e04c0f7..9c60284e20 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/DeleteAAIVfModule.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/DeleteAAIVfModule.bpmn @@ -1,482 +1,482 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd" id="_Wblj8GyfEeWUWLTvug7ZOg" exporter="camunda modeler" exporterVersion="2.7.0" targetNamespace="http://camunda.org/schema/1.0/bpmn">
- <bpmn2:process id="DeleteAAIVfModule" name="DeleteAAIVfModule" isExecutable="true">
- <bpmn2:exclusiveGateway id="ExclusiveGateway_5" default="SequenceFlow_8">
- <bpmn2:incoming>SequenceFlow_24</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_6</bpmn2:outgoing>
- <bpmn2:outgoing>SequenceFlow_8</bpmn2:outgoing>
- </bpmn2:exclusiveGateway>
- <bpmn2:sequenceFlow id="SequenceFlow_6" name="" sourceRef="ExclusiveGateway_5" targetRef="DeleteVfModule">
- <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("DAAIVfMod_moduleExists") == true && (execution.getVariable("DAAIVfMod_isBaseModule") == false || (execution.getVariable("DAAIVfMod_isBaseModule") == true && execution.getVariable("DAAIVfMod_isLastModule") == true ))}]]></bpmn2:conditionExpression>
- </bpmn2:sequenceFlow>
- <bpmn2:exclusiveGateway id="ExclusiveGateway_3" default="SequenceFlow_22">
- <bpmn2:incoming>SequenceFlow_39</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_22</bpmn2:outgoing>
- <bpmn2:outgoing>SequenceFlow_23</bpmn2:outgoing>
- </bpmn2:exclusiveGateway>
- <bpmn2:sequenceFlow id="SequenceFlow_22" name="" sourceRef="ExclusiveGateway_3" targetRef="ParseForAddonModule"/>
- <bpmn2:sequenceFlow id="SequenceFlow_23" name="" sourceRef="ExclusiveGateway_3" targetRef="AAIQueryFailure">
- <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("DAAIVfMod_queryGenericVnfResponseCode") != 200}]]></bpmn2:conditionExpression>
- </bpmn2:sequenceFlow>
- <bpmn2:scriptTask id="AAIQueryFailure" name="AAI Query Failure" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_23</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_18</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* +<?xml version="1.0" encoding="UTF-8"?> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd" id="_Wblj8GyfEeWUWLTvug7ZOg" exporter="camunda modeler" exporterVersion="2.7.0" targetNamespace="http://camunda.org/schema/1.0/bpmn"> + <bpmn2:process id="DeleteAAIVfModule" name="DeleteAAIVfModule" isExecutable="true"> + <bpmn2:exclusiveGateway id="ExclusiveGateway_5" default="SequenceFlow_8"> + <bpmn2:incoming>SequenceFlow_24</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_6</bpmn2:outgoing> + <bpmn2:outgoing>SequenceFlow_8</bpmn2:outgoing> + </bpmn2:exclusiveGateway> + <bpmn2:sequenceFlow id="SequenceFlow_6" name="" sourceRef="ExclusiveGateway_5" targetRef="DeleteVfModule"> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("DAAIVfMod_moduleExists") == true && (execution.getVariable("DAAIVfMod_isBaseModule") == false || (execution.getVariable("DAAIVfMod_isBaseModule") == true && execution.getVariable("DAAIVfMod_isLastModule") == true ))}]]></bpmn2:conditionExpression> + </bpmn2:sequenceFlow> + <bpmn2:exclusiveGateway id="ExclusiveGateway_3" default="SequenceFlow_22"> + <bpmn2:incoming>SequenceFlow_39</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_22</bpmn2:outgoing> + <bpmn2:outgoing>SequenceFlow_23</bpmn2:outgoing> + </bpmn2:exclusiveGateway> + <bpmn2:sequenceFlow id="SequenceFlow_22" name="" sourceRef="ExclusiveGateway_3" targetRef="ParseForAddonModule"/> + <bpmn2:sequenceFlow id="SequenceFlow_23" name="" sourceRef="ExclusiveGateway_3" targetRef="AAIQueryFailure"> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("DAAIVfMod_queryGenericVnfResponseCode") != 200}]]></bpmn2:conditionExpression> + </bpmn2:sequenceFlow> + <bpmn2:scriptTask id="AAIQueryFailure" name="AAI Query Failure" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_23</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_18</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* def dvm = new DeleteAAIVfModule() -dvm.handleAAIQueryFailure(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_18" name="" sourceRef="AAIQueryFailure" targetRef="EndEvent_7"/>
- <bpmn2:endEvent id="EndEvent_7">
- <bpmn2:incoming>SequenceFlow_18</bpmn2:incoming>
- <bpmn2:errorEventDefinition id="_ErrorEventDefinition_68" errorRef="Error_1"/>
- </bpmn2:endEvent>
- <bpmn2:scriptTask id="ParseForAddonModule" name="Parse For Vf Module" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_22</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_24</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* +dvm.handleAAIQueryFailure(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_18" name="" sourceRef="AAIQueryFailure" targetRef="EndEvent_7"/> + <bpmn2:endEvent id="EndEvent_7"> + <bpmn2:incoming>SequenceFlow_18</bpmn2:incoming> + <bpmn2:errorEventDefinition id="_ErrorEventDefinition_68" errorRef="Error_1"/> + </bpmn2:endEvent> + <bpmn2:scriptTask id="ParseForAddonModule" name="Parse For Vf Module" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_22</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_24</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* def dvm = new DeleteAAIVfModule() -dvm.parseForVfModule(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_24" name="" sourceRef="ParseForAddonModule" targetRef="ExclusiveGateway_5"/>
- <bpmn2:scriptTask id="DeleteVfModule" name="Delete Vf Module" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_6</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_20</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* +dvm.parseForVfModule(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_24" name="" sourceRef="ParseForAddonModule" targetRef="ExclusiveGateway_5"/> + <bpmn2:scriptTask id="DeleteVfModule" name="Delete Vf Module" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_6</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_20</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* def dvm = new DeleteAAIVfModule() -dvm.deleteVfModule(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_20" name="" sourceRef="DeleteVfModule" targetRef="ExclusiveGateway_2"/>
- <bpmn2:exclusiveGateway id="ExclusiveGateway_2" default="SequenceFlow_26">
- <bpmn2:incoming>SequenceFlow_20</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_26</bpmn2:outgoing>
- <bpmn2:outgoing>SequenceFlow_27</bpmn2:outgoing>
- <bpmn2:outgoing>SequenceFlow_11</bpmn2:outgoing>
- </bpmn2:exclusiveGateway>
- <bpmn2:sequenceFlow id="SequenceFlow_26" name="Delete Vf Module
Failure" sourceRef="ExclusiveGateway_2" targetRef="DeleteVfModuleFailure"/>
- <bpmn2:sequenceFlow id="SequenceFlow_27" name="" sourceRef="ExclusiveGateway_2" targetRef="ExclusiveGateway_6">
- <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{(execution.getVariable("DAAIVfMod_deleteVfModuleResponseCode") == 200 || execution.getVariable("DAAIVfMod_deleteVfModuleResponseCode") == 204) && execution.getVariable("DAAIVfMod_isLastModule") == true}]]></bpmn2:conditionExpression>
- </bpmn2:sequenceFlow>
- <bpmn2:scriptTask id="DeleteVfModuleFailure" name="Delete Vf Module Failure" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_26</bpmn2:incoming>
- <bpmn2:incoming>SequenceFlow_8</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_29</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* +dvm.deleteVfModule(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_20" name="" sourceRef="DeleteVfModule" targetRef="ExclusiveGateway_2"/> + <bpmn2:exclusiveGateway id="ExclusiveGateway_2" default="SequenceFlow_26"> + <bpmn2:incoming>SequenceFlow_20</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_26</bpmn2:outgoing> + <bpmn2:outgoing>SequenceFlow_27</bpmn2:outgoing> + <bpmn2:outgoing>SequenceFlow_11</bpmn2:outgoing> + </bpmn2:exclusiveGateway> + <bpmn2:sequenceFlow id="SequenceFlow_26" name="Delete Vf Module
Failure" sourceRef="ExclusiveGateway_2" targetRef="DeleteVfModuleFailure"/> + <bpmn2:sequenceFlow id="SequenceFlow_27" name="" sourceRef="ExclusiveGateway_2" targetRef="ExclusiveGateway_6"> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{(execution.getVariable("DAAIVfMod_deleteVfModuleResponseCode") == 200 || execution.getVariable("DAAIVfMod_deleteVfModuleResponseCode") == 204) && execution.getVariable("DAAIVfMod_isLastModule") == true}]]></bpmn2:conditionExpression> + </bpmn2:sequenceFlow> + <bpmn2:scriptTask id="DeleteVfModuleFailure" name="Delete Vf Module Failure" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_26</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_8</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_29</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* def dvm = new DeleteAAIVfModule() -dvm.handleDeleteVfModuleFailure(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_29" name="" sourceRef="DeleteVfModuleFailure" targetRef="EndEvent_8"/>
- <bpmn2:scriptTask id="QueryAAIForGenericVnf" name="Query AAI for
Generic Vnf" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_38</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_39</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* +dvm.handleDeleteVfModuleFailure(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_29" name="" sourceRef="DeleteVfModuleFailure" targetRef="EndEvent_8"/> + <bpmn2:scriptTask id="QueryAAIForGenericVnf" name="Query AAI for
Generic Vnf" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_38</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_39</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* def dvm = new DeleteAAIVfModule() -dvm.queryAAIForGenericVnf(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_39" name="" sourceRef="QueryAAIForGenericVnf" targetRef="ExclusiveGateway_3"/>
- <bpmn2:sequenceFlow id="SequenceFlow_8" name="Vf Module
Does Not Exist or
Base Module is Not
the Last Vf Module" sourceRef="ExclusiveGateway_5" targetRef="DeleteVfModuleFailure"/>
- <bpmn2:endEvent id="EndEvent_8">
- <bpmn2:incoming>SequenceFlow_29</bpmn2:incoming>
- <bpmn2:errorEventDefinition id="_ErrorEventDefinition_69" errorRef="Error_1"/>
- </bpmn2:endEvent>
- <bpmn2:sequenceFlow id="SequenceFlow_11" name="" sourceRef="ExclusiveGateway_2" targetRef="ExclusiveGateway_1">
- <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{(execution.getVariable("DAAIVfMod_deleteVfModuleResponseCode") == 200 || execution.getVariable("DAAIVfMod_deleteVfModuleResponseCode") == 204) && execution.getVariable("DAAIVfMod_isLastModule") == false} ]]></bpmn2:conditionExpression>
- </bpmn2:sequenceFlow>
- <bpmn2:scriptTask id="QueryAAIForGenericVnf1" name="Query AAI for Generif VNF 1" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_3</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_9</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* +dvm.queryAAIForGenericVnf(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_39" name="" sourceRef="QueryAAIForGenericVnf" targetRef="ExclusiveGateway_3"/> + <bpmn2:sequenceFlow id="SequenceFlow_8" name="Vf Module
Does Not Exist or
Base Module is Not
the Last Vf Module" sourceRef="ExclusiveGateway_5" targetRef="DeleteVfModuleFailure"/> + <bpmn2:endEvent id="EndEvent_8"> + <bpmn2:incoming>SequenceFlow_29</bpmn2:incoming> + <bpmn2:errorEventDefinition id="_ErrorEventDefinition_69" errorRef="Error_1"/> + </bpmn2:endEvent> + <bpmn2:sequenceFlow id="SequenceFlow_11" name="" sourceRef="ExclusiveGateway_2" targetRef="ExclusiveGateway_1"> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{(execution.getVariable("DAAIVfMod_deleteVfModuleResponseCode") == 200 || execution.getVariable("DAAIVfMod_deleteVfModuleResponseCode") == 204) && execution.getVariable("DAAIVfMod_isLastModule") == false} ]]></bpmn2:conditionExpression> + </bpmn2:sequenceFlow> + <bpmn2:scriptTask id="QueryAAIForGenericVnf1" name="Query AAI for Generif VNF 1" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_3</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_9</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* def dvm = new DeleteAAIVfModule() -dvm.queryAAIForGenericVnf(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_9" name="" sourceRef="QueryAAIForGenericVnf1" targetRef="ExclusiveGateway_4"/>
- <bpmn2:scriptTask id="DeleteGenericVnfFailure" name="Delete Generic Vnf Failure" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_5</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_2</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* +dvm.queryAAIForGenericVnf(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_9" name="" sourceRef="QueryAAIForGenericVnf1" targetRef="ExclusiveGateway_4"/> + <bpmn2:scriptTask id="DeleteGenericVnfFailure" name="Delete Generic Vnf Failure" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_5</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_2</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* def dvm = new DeleteAAIVfModule() -dvm.handleDeleteGenericVnfFailure(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="DeleteGenericVnfFailure" targetRef="EndEvent_2"/>
- <bpmn2:endEvent id="EndEvent_2">
- <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming>
- <bpmn2:errorEventDefinition id="_ErrorEventDefinition_50" errorRef="Error_1"/>
- </bpmn2:endEvent>
- <bpmn2:exclusiveGateway id="ExclusiveGateway_1" default="SequenceFlow_5">
- <bpmn2:incoming>SequenceFlow_11</bpmn2:incoming>
- <bpmn2:incoming>SequenceFlow_4</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_5</bpmn2:outgoing>
- <bpmn2:outgoing>SequenceFlow_7</bpmn2:outgoing>
- </bpmn2:exclusiveGateway>
- <bpmn2:sequenceFlow id="SequenceFlow_5" name="" sourceRef="ExclusiveGateway_1" targetRef="DeleteGenericVnfFailure"/>
- <bpmn2:sequenceFlow id="SequenceFlow_7" name="" sourceRef="ExclusiveGateway_1" targetRef="EndEvent_1">
- <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{((execution.getVariable("DAAIVfMod_deleteVfModuleResponseCode") == 200 || execution.getVariable("DAAIVfMod_deleteVfModuleResponseCode") == 204) && execution.getVariable("DAAIVfMod_isLastModule") == false) || (execution.getVariable("DAAIVfMod_deleteGenericVnfResponseCode") == 200 || execution.getVariable("DAAIVfMod_deleteGenericVnfResponseCode") == 204)}]]></bpmn2:conditionExpression>
- </bpmn2:sequenceFlow>
- <bpmn2:endEvent id="EndEvent_1">
- <bpmn2:incoming>SequenceFlow_7</bpmn2:incoming>
- <bpmn2:incoming>SequenceFlow_15</bpmn2:incoming>
- </bpmn2:endEvent>
- <bpmn2:scriptTask id="AAIQueryFailure1" name="AAI Query Failure 1" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_10</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_12</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* +dvm.handleDeleteGenericVnfFailure(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="DeleteGenericVnfFailure" targetRef="EndEvent_2"/> + <bpmn2:endEvent id="EndEvent_2"> + <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming> + <bpmn2:errorEventDefinition id="_ErrorEventDefinition_50" errorRef="Error_1"/> + </bpmn2:endEvent> + <bpmn2:exclusiveGateway id="ExclusiveGateway_1" default="SequenceFlow_5"> + <bpmn2:incoming>SequenceFlow_11</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_4</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_5</bpmn2:outgoing> + <bpmn2:outgoing>SequenceFlow_7</bpmn2:outgoing> + </bpmn2:exclusiveGateway> + <bpmn2:sequenceFlow id="SequenceFlow_5" name="" sourceRef="ExclusiveGateway_1" targetRef="DeleteGenericVnfFailure"/> + <bpmn2:sequenceFlow id="SequenceFlow_7" name="" sourceRef="ExclusiveGateway_1" targetRef="EndEvent_1"> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{((execution.getVariable("DAAIVfMod_deleteVfModuleResponseCode") == 200 || execution.getVariable("DAAIVfMod_deleteVfModuleResponseCode") == 204) && execution.getVariable("DAAIVfMod_isLastModule") == false) || (execution.getVariable("DAAIVfMod_deleteGenericVnfResponseCode") == 200 || execution.getVariable("DAAIVfMod_deleteGenericVnfResponseCode") == 204)}]]></bpmn2:conditionExpression> + </bpmn2:sequenceFlow> + <bpmn2:endEvent id="EndEvent_1"> + <bpmn2:incoming>SequenceFlow_7</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_15</bpmn2:incoming> + </bpmn2:endEvent> + <bpmn2:scriptTask id="AAIQueryFailure1" name="AAI Query Failure 1" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_10</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_12</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* def dvm = new DeleteAAIVfModule() -dvm.handleAAIQueryFailure(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_12" name="" sourceRef="AAIQueryFailure1" targetRef="EndEvent_3"/>
- <bpmn2:endEvent id="EndEvent_3">
- <bpmn2:incoming>SequenceFlow_12</bpmn2:incoming>
- <bpmn2:errorEventDefinition id="_ErrorEventDefinition_70" errorRef="Error_1"/>
- </bpmn2:endEvent>
- <bpmn2:scriptTask id="DeleteGenericVnf" name="Delete Generic Vnf" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_14</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_4</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* +dvm.handleAAIQueryFailure(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_12" name="" sourceRef="AAIQueryFailure1" targetRef="EndEvent_3"/> + <bpmn2:endEvent id="EndEvent_3"> + <bpmn2:incoming>SequenceFlow_12</bpmn2:incoming> + <bpmn2:errorEventDefinition id="_ErrorEventDefinition_70" errorRef="Error_1"/> + </bpmn2:endEvent> + <bpmn2:scriptTask id="DeleteGenericVnf" name="Delete Generic Vnf" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_14</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_4</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* def dvm = new DeleteAAIVfModule() -dvm.deleteGenericVnf(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_4" name="" sourceRef="DeleteGenericVnf" targetRef="ExclusiveGateway_1"/>
- <bpmn2:scriptTask id="ParseForGenericVNFResourceVersion" name="Parse for Generic VNF Resource Version" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_13</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_14</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* +dvm.deleteGenericVnf(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_4" name="" sourceRef="DeleteGenericVnf" targetRef="ExclusiveGateway_1"/> + <bpmn2:scriptTask id="ParseForGenericVNFResourceVersion" name="Parse for Generic VNF Resource Version" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_13</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_14</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* def dvm = new DeleteAAIVfModule() -dvm.parseForResourceVersion(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_14" name="" sourceRef="ParseForGenericVNFResourceVersion" targetRef="DeleteGenericVnf"/>
- <bpmn2:exclusiveGateway id="ExclusiveGateway_4" default="SequenceFlow_13">
- <bpmn2:incoming>SequenceFlow_9</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_10</bpmn2:outgoing>
- <bpmn2:outgoing>SequenceFlow_13</bpmn2:outgoing>
- </bpmn2:exclusiveGateway>
- <bpmn2:sequenceFlow id="SequenceFlow_10" name="" sourceRef="ExclusiveGateway_4" targetRef="AAIQueryFailure1">
- <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("DAAIVfMod_queryGenericVnfResponseCode") != 200}]]></bpmn2:conditionExpression>
- </bpmn2:sequenceFlow>
- <bpmn2:sequenceFlow id="SequenceFlow_13" name="" sourceRef="ExclusiveGateway_4" targetRef="ParseForGenericVNFResourceVersion"/>
- <bpmn2:startEvent id="StartEvent_1">
- <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing>
- <bpmn2:messageEventDefinition id="_MessageEventDefinition_6" messageRef="Message_1"/>
- </bpmn2:startEvent>
- <bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="StartEvent_1" targetRef="InitializeVariables"/>
- <bpmn2:scriptTask id="InitializeVariables" name="Initialize Variables" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_38</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* +dvm.parseForResourceVersion(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_14" name="" sourceRef="ParseForGenericVNFResourceVersion" targetRef="DeleteGenericVnf"/> + <bpmn2:exclusiveGateway id="ExclusiveGateway_4" default="SequenceFlow_13"> + <bpmn2:incoming>SequenceFlow_9</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_10</bpmn2:outgoing> + <bpmn2:outgoing>SequenceFlow_13</bpmn2:outgoing> + </bpmn2:exclusiveGateway> + <bpmn2:sequenceFlow id="SequenceFlow_10" name="" sourceRef="ExclusiveGateway_4" targetRef="AAIQueryFailure1"> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("DAAIVfMod_queryGenericVnfResponseCode") != 200}]]></bpmn2:conditionExpression> + </bpmn2:sequenceFlow> + <bpmn2:sequenceFlow id="SequenceFlow_13" name="" sourceRef="ExclusiveGateway_4" targetRef="ParseForGenericVNFResourceVersion"/> + <bpmn2:startEvent id="StartEvent_1"> + <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing> + <bpmn2:messageEventDefinition id="_MessageEventDefinition_6" messageRef="Message_1"/> + </bpmn2:startEvent> + <bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="StartEvent_1" targetRef="InitializeVariables"/> + <bpmn2:scriptTask id="InitializeVariables" name="Initialize Variables" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_38</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* def dvm = new DeleteAAIVfModule() -dvm.preProcessRequest(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_38" name="" sourceRef="InitializeVariables" targetRef="QueryAAIForGenericVnf"/>
- <bpmn2:exclusiveGateway id="ExclusiveGateway_6" name="Is VID Request?" default="SequenceFlow_3">
- <bpmn2:incoming>SequenceFlow_27</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_3</bpmn2:outgoing>
- <bpmn2:outgoing>SequenceFlow_15</bpmn2:outgoing>
- </bpmn2:exclusiveGateway>
- <bpmn2:sequenceFlow id="SequenceFlow_3" name="no" sourceRef="ExclusiveGateway_6" targetRef="QueryAAIForGenericVnf1"/>
- <bpmn2:sequenceFlow id="SequenceFlow_15" name="yes" sourceRef="ExclusiveGateway_6" targetRef="EndEvent_1">
- <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("isVidRequest") =="true"}]]></bpmn2:conditionExpression>
- </bpmn2:sequenceFlow>
- </bpmn2:process>
- <bpmn2:error id="Error_1" errorCode="MSOWorkflowException" name="MSO Workflow Exception"/>
- <bpmn2:message id="Message_1" name="DeleteAAIVfModuleRequest"/>
- <bpmndi:BPMNDiagram id="BPMNDiagram_1">
- <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DeleteAAIVfModule">
- <bpmndi:BPMNShape id="_BPMNShape_StartEvent_37" bpmnElement="StartEvent_1">
- <dc:Bounds height="36.0" width="36.0" x="59.0" y="200.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="77.0" y="241.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_22" bpmnElement="InitializeVariables">
- <dc:Bounds height="80.0" width="100.0" x="192.0" y="178.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_StartEvent_37" targetElement="_BPMNShape_ScriptTask_22">
- <di:waypoint xsi:type="dc:Point" x="95.0" y="218.0"/>
- <di:waypoint xsi:type="dc:Point" x="192.0" y="218.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="117.0" y="218.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_Task_2" bpmnElement="ParseForAddonModule">
- <dc:Bounds height="80.0" width="100.0" x="518.0" y="79.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_50" bpmnElement="ExclusiveGateway_5" isMarkerVisible="true">
- <dc:Bounds height="50.0" width="50.0" x="630.0" y="192.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="655.0" y="247.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_47" bpmnElement="DeleteVfModule">
- <dc:Bounds height="80.0" width="100.0" x="695.0" y="0.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_7" bpmnElement="SequenceFlow_6" sourceElement="_BPMNShape_ExclusiveGateway_50" targetElement="_BPMNShape_ScriptTask_47">
- <di:waypoint xsi:type="dc:Point" x="655.0" y="192.0"/>
- <di:waypoint xsi:type="dc:Point" x="655.0" y="40.0"/>
- <di:waypoint xsi:type="dc:Point" x="695.0" y="40.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="579.0" y="73.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_54" bpmnElement="ExclusiveGateway_1" isMarkerVisible="true">
- <dc:Bounds height="50.0" width="50.0" x="1681.0" y="297.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="1706.0" y="352.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_120" bpmnElement="EndEvent_2">
- <dc:Bounds height="36.0" width="36.0" x="1689.0" y="564.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="1707.0" y="605.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_115" bpmnElement="DeleteGenericVnf">
- <dc:Bounds height="80.0" width="100.0" x="1582.0" y="0.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_86" bpmnElement="ExclusiveGateway_3" isMarkerVisible="true">
- <dc:Bounds height="50.0" width="50.0" x="468.0" y="191.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="493.0" y="246.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_23" bpmnElement="SequenceFlow_22" sourceElement="_BPMNShape_ExclusiveGateway_86" targetElement="_BPMNShape_Task_2">
- <di:waypoint xsi:type="dc:Point" x="493.0" y="191.0"/>
- <di:waypoint xsi:type="dc:Point" x="493.0" y="120.0"/>
- <di:waypoint xsi:type="dc:Point" x="518.0" y="120.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="490.0" y="154.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_155" bpmnElement="AAIQueryFailure">
- <dc:Bounds height="80.0" width="100.0" x="518.0" y="297.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_24" bpmnElement="SequenceFlow_23" sourceElement="_BPMNShape_ExclusiveGateway_86" targetElement="_BPMNShape_ScriptTask_155">
- <di:waypoint xsi:type="dc:Point" x="493.0" y="241.0"/>
- <di:waypoint xsi:type="dc:Point" x="493.0" y="259.0"/>
- <di:waypoint xsi:type="dc:Point" x="568.0" y="259.0"/>
- <di:waypoint xsi:type="dc:Point" x="568.0" y="297.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="547.0" y="259.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_25" bpmnElement="SequenceFlow_24" sourceElement="_BPMNShape_Task_2" targetElement="_BPMNShape_ExclusiveGateway_50">
- <di:waypoint xsi:type="dc:Point" x="568.0" y="159.0"/>
- <di:waypoint xsi:type="dc:Point" x="568.0" y="217.0"/>
- <di:waypoint xsi:type="dc:Point" x="630.0" y="217.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="565.0" y="212.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_160" bpmnElement="EndEvent_7">
- <dc:Bounds height="36.0" width="36.0" x="550.0" y="416.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="568.0" y="457.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_18" bpmnElement="SequenceFlow_18" sourceElement="_BPMNShape_ScriptTask_155" targetElement="_BPMNShape_EndEvent_160">
- <di:waypoint xsi:type="dc:Point" x="568.0" y="377.0"/>
- <di:waypoint xsi:type="dc:Point" x="568.0" y="416.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="565.0" y="388.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_158" bpmnElement="DeleteVfModuleFailure">
- <dc:Bounds height="80.0" width="100.0" x="837.0" y="175.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_99" bpmnElement="ExclusiveGateway_2" isMarkerVisible="true">
- <dc:Bounds height="50.0" width="50.0" x="861.0" y="14.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="886.0" y="69.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_20" bpmnElement="SequenceFlow_20" sourceElement="_BPMNShape_ScriptTask_47" targetElement="_BPMNShape_ExclusiveGateway_99">
- <di:waypoint xsi:type="dc:Point" x="795.0" y="40.0"/>
- <di:waypoint xsi:type="dc:Point" x="861.0" y="39.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="817.0" y="40.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_21" bpmnElement="SequenceFlow_26" sourceElement="_BPMNShape_ExclusiveGateway_99" targetElement="_BPMNShape_ScriptTask_158">
- <di:waypoint xsi:type="dc:Point" x="886.0" y="64.0"/>
- <di:waypoint xsi:type="dc:Point" x="886.0" y="98.0"/>
- <di:waypoint xsi:type="dc:Point" x="887.0" y="98.0"/>
- <di:waypoint xsi:type="dc:Point" x="887.0" y="175.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="38.0" width="126.0" x="887.0" y="100.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_27" bpmnElement="SequenceFlow_27" sourceElement="_BPMNShape_ExclusiveGateway_99" targetElement="_BPMNShape_ExclusiveGateway_226">
- <di:waypoint xsi:type="dc:Point" x="911.0" y="39.0"/>
- <di:waypoint xsi:type="dc:Point" x="1068.0" y="39.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="959.0" y="39.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_161" bpmnElement="EndEvent_8">
- <dc:Bounds height="36.0" width="36.0" x="869.0" y="299.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="887.0" y="340.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_29" bpmnElement="SequenceFlow_29" sourceElement="_BPMNShape_ScriptTask_158" targetElement="_BPMNShape_EndEvent_161">
- <di:waypoint xsi:type="dc:Point" x="887.0" y="255.0"/>
- <di:waypoint xsi:type="dc:Point" x="887.0" y="299.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="884.0" y="280.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_160" bpmnElement="QueryAAIForGenericVnf">
- <dc:Bounds height="80.0" width="100.0" x="336.0" y="178.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_38" bpmnElement="SequenceFlow_38" sourceElement="_BPMNShape_ScriptTask_22" targetElement="_BPMNShape_ScriptTask_160">
- <di:waypoint xsi:type="dc:Point" x="292.0" y="218.0"/>
- <di:waypoint xsi:type="dc:Point" x="336.0" y="218.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="299.0" y="218.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_39" bpmnElement="SequenceFlow_39" sourceElement="_BPMNShape_ScriptTask_160" targetElement="_BPMNShape_ExclusiveGateway_86">
- <di:waypoint xsi:type="dc:Point" x="436.0" y="218.0"/>
- <di:waypoint xsi:type="dc:Point" x="452.0" y="218.0"/>
- <di:waypoint xsi:type="dc:Point" x="452.0" y="216.0"/>
- <di:waypoint xsi:type="dc:Point" x="468.0" y="216.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="449.0" y="217.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_161" bpmnElement="DeleteGenericVnfFailure">
- <dc:Bounds height="80.0" width="100.0" x="1656.0" y="432.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_ScriptTask_161" targetElement="_BPMNShape_EndEvent_120">
- <di:waypoint xsi:type="dc:Point" x="1706.0" y="512.0"/>
- <di:waypoint xsi:type="dc:Point" x="1707.0" y="564.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="1703.0" y="515.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="SequenceFlow_5" sourceElement="_BPMNShape_ExclusiveGateway_54" targetElement="_BPMNShape_ScriptTask_161">
- <di:waypoint xsi:type="dc:Point" x="1706.0" y="347.0"/>
- <di:waypoint xsi:type="dc:Point" x="1706.0" y="432.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="1703.0" y="390.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_6" bpmnElement="SequenceFlow_8" sourceElement="_BPMNShape_ExclusiveGateway_50" targetElement="_BPMNShape_ScriptTask_158">
- <di:waypoint xsi:type="dc:Point" x="680.0" y="217.0"/>
- <di:waypoint xsi:type="dc:Point" x="758.0" y="217.0"/>
- <di:waypoint xsi:type="dc:Point" x="758.0" y="215.0"/>
- <di:waypoint xsi:type="dc:Point" x="837.0" y="215.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="38.0" width="94.0" x="708.0" y="231.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_11" bpmnElement="SequenceFlow_11" sourceElement="_BPMNShape_ExclusiveGateway_99" targetElement="_BPMNShape_ExclusiveGateway_54">
- <di:waypoint xsi:type="dc:Point" x="911.0" y="39.0"/>
- <di:waypoint xsi:type="dc:Point" x="1008.0" y="39.0"/>
- <di:waypoint xsi:type="dc:Point" x="1008.0" y="140.0"/>
- <di:waypoint xsi:type="dc:Point" x="1008.0" y="322.0"/>
- <di:waypoint xsi:type="dc:Point" x="1681.0" y="322.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="1005.0" y="197.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_5" bpmnElement="SequenceFlow_4" sourceElement="_BPMNShape_ScriptTask_115" targetElement="_BPMNShape_ExclusiveGateway_54">
- <di:waypoint xsi:type="dc:Point" x="1632.0" y="80.0"/>
- <di:waypoint xsi:type="dc:Point" x="1632.0" y="322.0"/>
- <di:waypoint xsi:type="dc:Point" x="1681.0" y="322.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="1629.0" y="187.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_162" bpmnElement="EndEvent_1">
- <dc:Bounds height="36.0" width="36.0" x="1806.0" y="305.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="1824.0" y="346.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_8" bpmnElement="SequenceFlow_7" sourceElement="_BPMNShape_ExclusiveGateway_54" targetElement="_BPMNShape_EndEvent_162">
- <di:waypoint xsi:type="dc:Point" x="1731.0" y="322.0"/>
- <di:waypoint xsi:type="dc:Point" x="1806.0" y="323.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="1753.0" y="322.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_242" bpmnElement="QueryAAIForGenericVnf1">
- <dc:Bounds height="80.0" width="100.0" x="1166.0" y="0.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_213" bpmnElement="ExclusiveGateway_4" isMarkerVisible="true">
- <dc:Bounds height="50.0" width="50.0" x="1325.0" y="15.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="1350.0" y="70.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_9" bpmnElement="SequenceFlow_9" sourceElement="_BPMNShape_ScriptTask_242" targetElement="_BPMNShape_ExclusiveGateway_213">
- <di:waypoint xsi:type="dc:Point" x="1266.0" y="40.0"/>
- <di:waypoint xsi:type="dc:Point" x="1325.0" y="40.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="1292.0" y="40.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_243" bpmnElement="AAIQueryFailure1">
- <dc:Bounds height="80.0" width="100.0" x="1300.0" y="117.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_244" bpmnElement="ParseForGenericVNFResourceVersion">
- <dc:Bounds height="80.0" width="100.0" x="1440.0" y="0.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_181" bpmnElement="EndEvent_3">
- <dc:Bounds height="36.0" width="36.0" x="1332.0" y="244.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="1350.0" y="285.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_10" bpmnElement="SequenceFlow_10" sourceElement="_BPMNShape_ExclusiveGateway_213" targetElement="_BPMNShape_ScriptTask_243">
- <di:waypoint xsi:type="dc:Point" x="1350.0" y="65.0"/>
- <di:waypoint xsi:type="dc:Point" x="1349.0" y="90.0"/>
- <di:waypoint xsi:type="dc:Point" x="1350.0" y="90.0"/>
- <di:waypoint xsi:type="dc:Point" x="1350.0" y="117.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="1347.0" y="95.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_12" bpmnElement="SequenceFlow_12" sourceElement="_BPMNShape_ScriptTask_243" targetElement="_BPMNShape_EndEvent_181">
- <di:waypoint xsi:type="dc:Point" x="1350.0" y="197.0"/>
- <di:waypoint xsi:type="dc:Point" x="1350.0" y="244.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="1347.0" y="226.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_13" bpmnElement="SequenceFlow_13" sourceElement="_BPMNShape_ExclusiveGateway_213" targetElement="_BPMNShape_ScriptTask_244">
- <di:waypoint xsi:type="dc:Point" x="1375.0" y="40.0"/>
- <di:waypoint xsi:type="dc:Point" x="1440.0" y="40.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="1394.0" y="40.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_14" bpmnElement="SequenceFlow_14" sourceElement="_BPMNShape_ScriptTask_244" targetElement="_BPMNShape_ScriptTask_115">
- <di:waypoint xsi:type="dc:Point" x="1540.0" y="40.0"/>
- <di:waypoint xsi:type="dc:Point" x="1582.0" y="40.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="1565.0" y="40.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_226" bpmnElement="ExclusiveGateway_6" isMarkerVisible="true">
- <dc:Bounds height="50.0" width="50.0" x="1068.0" y="14.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="22.0" width="100.0" x="1044.0" y="-6.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_4" bpmnElement="SequenceFlow_3" sourceElement="_BPMNShape_ExclusiveGateway_226" targetElement="_BPMNShape_ScriptTask_242">
- <di:waypoint xsi:type="dc:Point" x="1118.0" y="39.0"/>
- <di:waypoint xsi:type="dc:Point" x="1142.0" y="39.0"/>
- <di:waypoint xsi:type="dc:Point" x="1142.0" y="40.0"/>
- <di:waypoint xsi:type="dc:Point" x="1166.0" y="40.0"/>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_15" bpmnElement="SequenceFlow_15" sourceElement="_BPMNShape_ExclusiveGateway_226" targetElement="_BPMNShape_EndEvent_162">
- <di:waypoint xsi:type="dc:Point" x="1093.0" y="64.0"/>
- <di:waypoint xsi:type="dc:Point" x="1093.0" y="289.0"/>
- <di:waypoint xsi:type="dc:Point" x="1823.0" y="289.0"/>
- <di:waypoint xsi:type="dc:Point" x="1823.0" y="305.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="22.0" width="27.0" x="1104.0" y="146.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- </bpmndi:BPMNPlane>
- </bpmndi:BPMNDiagram>
+dvm.preProcessRequest(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_38" name="" sourceRef="InitializeVariables" targetRef="QueryAAIForGenericVnf"/> + <bpmn2:exclusiveGateway id="ExclusiveGateway_6" name="Is VID Request?" default="SequenceFlow_3"> + <bpmn2:incoming>SequenceFlow_27</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_3</bpmn2:outgoing> + <bpmn2:outgoing>SequenceFlow_15</bpmn2:outgoing> + </bpmn2:exclusiveGateway> + <bpmn2:sequenceFlow id="SequenceFlow_3" name="no" sourceRef="ExclusiveGateway_6" targetRef="QueryAAIForGenericVnf1"/> + <bpmn2:sequenceFlow id="SequenceFlow_15" name="yes" sourceRef="ExclusiveGateway_6" targetRef="EndEvent_1"> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("isVidRequest") =="true"}]]></bpmn2:conditionExpression> + </bpmn2:sequenceFlow> + </bpmn2:process> + <bpmn2:error id="Error_1" errorCode="MSOWorkflowException" name="MSO Workflow Exception"/> + <bpmn2:message id="Message_1" name="DeleteAAIVfModuleRequest"/> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DeleteAAIVfModule"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_37" bpmnElement="StartEvent_1"> + <dc:Bounds height="36.0" width="36.0" x="59.0" y="200.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="0.0" width="0.0" x="77.0" y="241.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_22" bpmnElement="InitializeVariables"> + <dc:Bounds height="80.0" width="100.0" x="192.0" y="178.0"/> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_StartEvent_37" targetElement="_BPMNShape_ScriptTask_22"> + <di:waypoint xsi:type="dc:Point" x="95.0" y="218.0"/> + <di:waypoint xsi:type="dc:Point" x="192.0" y="218.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="6.0" width="6.0" x="117.0" y="218.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_Task_2" bpmnElement="ParseForAddonModule"> + <dc:Bounds height="80.0" width="100.0" x="518.0" y="79.0"/> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_50" bpmnElement="ExclusiveGateway_5" isMarkerVisible="true"> + <dc:Bounds height="50.0" width="50.0" x="630.0" y="192.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="0.0" width="0.0" x="655.0" y="247.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_47" bpmnElement="DeleteVfModule"> + <dc:Bounds height="80.0" width="100.0" x="695.0" y="0.0"/> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_7" bpmnElement="SequenceFlow_6" sourceElement="_BPMNShape_ExclusiveGateway_50" targetElement="_BPMNShape_ScriptTask_47"> + <di:waypoint xsi:type="dc:Point" x="655.0" y="192.0"/> + <di:waypoint xsi:type="dc:Point" x="655.0" y="40.0"/> + <di:waypoint xsi:type="dc:Point" x="695.0" y="40.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="6.0" width="6.0" x="579.0" y="73.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_54" bpmnElement="ExclusiveGateway_1" isMarkerVisible="true"> + <dc:Bounds height="50.0" width="50.0" x="1681.0" y="297.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="0.0" width="0.0" x="1706.0" y="352.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_EndEvent_120" bpmnElement="EndEvent_2"> + <dc:Bounds height="36.0" width="36.0" x="1689.0" y="564.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="0.0" width="0.0" x="1707.0" y="605.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_115" bpmnElement="DeleteGenericVnf"> + <dc:Bounds height="80.0" width="100.0" x="1582.0" y="0.0"/> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_86" bpmnElement="ExclusiveGateway_3" isMarkerVisible="true"> + <dc:Bounds height="50.0" width="50.0" x="468.0" y="191.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="0.0" width="0.0" x="493.0" y="246.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_23" bpmnElement="SequenceFlow_22" sourceElement="_BPMNShape_ExclusiveGateway_86" targetElement="_BPMNShape_Task_2"> + <di:waypoint xsi:type="dc:Point" x="493.0" y="191.0"/> + <di:waypoint xsi:type="dc:Point" x="493.0" y="120.0"/> + <di:waypoint xsi:type="dc:Point" x="518.0" y="120.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="6.0" width="6.0" x="490.0" y="154.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_155" bpmnElement="AAIQueryFailure"> + <dc:Bounds height="80.0" width="100.0" x="518.0" y="297.0"/> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_24" bpmnElement="SequenceFlow_23" sourceElement="_BPMNShape_ExclusiveGateway_86" targetElement="_BPMNShape_ScriptTask_155"> + <di:waypoint xsi:type="dc:Point" x="493.0" y="241.0"/> + <di:waypoint xsi:type="dc:Point" x="493.0" y="259.0"/> + <di:waypoint xsi:type="dc:Point" x="568.0" y="259.0"/> + <di:waypoint xsi:type="dc:Point" x="568.0" y="297.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="6.0" width="6.0" x="547.0" y="259.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_25" bpmnElement="SequenceFlow_24" sourceElement="_BPMNShape_Task_2" targetElement="_BPMNShape_ExclusiveGateway_50"> + <di:waypoint xsi:type="dc:Point" x="568.0" y="159.0"/> + <di:waypoint xsi:type="dc:Point" x="568.0" y="217.0"/> + <di:waypoint xsi:type="dc:Point" x="630.0" y="217.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="6.0" width="6.0" x="565.0" y="212.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_EndEvent_160" bpmnElement="EndEvent_7"> + <dc:Bounds height="36.0" width="36.0" x="550.0" y="416.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="0.0" width="0.0" x="568.0" y="457.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_18" bpmnElement="SequenceFlow_18" sourceElement="_BPMNShape_ScriptTask_155" targetElement="_BPMNShape_EndEvent_160"> + <di:waypoint xsi:type="dc:Point" x="568.0" y="377.0"/> + <di:waypoint xsi:type="dc:Point" x="568.0" y="416.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="6.0" width="6.0" x="565.0" y="388.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_158" bpmnElement="DeleteVfModuleFailure"> + <dc:Bounds height="80.0" width="100.0" x="837.0" y="175.0"/> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_99" bpmnElement="ExclusiveGateway_2" isMarkerVisible="true"> + <dc:Bounds height="50.0" width="50.0" x="861.0" y="14.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="0.0" width="0.0" x="886.0" y="69.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_20" bpmnElement="SequenceFlow_20" sourceElement="_BPMNShape_ScriptTask_47" targetElement="_BPMNShape_ExclusiveGateway_99"> + <di:waypoint xsi:type="dc:Point" x="795.0" y="40.0"/> + <di:waypoint xsi:type="dc:Point" x="861.0" y="39.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="6.0" width="6.0" x="817.0" y="40.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_21" bpmnElement="SequenceFlow_26" sourceElement="_BPMNShape_ExclusiveGateway_99" targetElement="_BPMNShape_ScriptTask_158"> + <di:waypoint xsi:type="dc:Point" x="886.0" y="64.0"/> + <di:waypoint xsi:type="dc:Point" x="886.0" y="98.0"/> + <di:waypoint xsi:type="dc:Point" x="887.0" y="98.0"/> + <di:waypoint xsi:type="dc:Point" x="887.0" y="175.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="38.0" width="126.0" x="887.0" y="100.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_27" bpmnElement="SequenceFlow_27" sourceElement="_BPMNShape_ExclusiveGateway_99" targetElement="_BPMNShape_ExclusiveGateway_226"> + <di:waypoint xsi:type="dc:Point" x="911.0" y="39.0"/> + <di:waypoint xsi:type="dc:Point" x="1068.0" y="39.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="6.0" width="6.0" x="959.0" y="39.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_EndEvent_161" bpmnElement="EndEvent_8"> + <dc:Bounds height="36.0" width="36.0" x="869.0" y="299.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="0.0" width="0.0" x="887.0" y="340.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_29" bpmnElement="SequenceFlow_29" sourceElement="_BPMNShape_ScriptTask_158" targetElement="_BPMNShape_EndEvent_161"> + <di:waypoint xsi:type="dc:Point" x="887.0" y="255.0"/> + <di:waypoint xsi:type="dc:Point" x="887.0" y="299.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="6.0" width="6.0" x="884.0" y="280.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_160" bpmnElement="QueryAAIForGenericVnf"> + <dc:Bounds height="80.0" width="100.0" x="336.0" y="178.0"/> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_38" bpmnElement="SequenceFlow_38" sourceElement="_BPMNShape_ScriptTask_22" targetElement="_BPMNShape_ScriptTask_160"> + <di:waypoint xsi:type="dc:Point" x="292.0" y="218.0"/> + <di:waypoint xsi:type="dc:Point" x="336.0" y="218.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="6.0" width="6.0" x="299.0" y="218.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_39" bpmnElement="SequenceFlow_39" sourceElement="_BPMNShape_ScriptTask_160" targetElement="_BPMNShape_ExclusiveGateway_86"> + <di:waypoint xsi:type="dc:Point" x="436.0" y="218.0"/> + <di:waypoint xsi:type="dc:Point" x="452.0" y="218.0"/> + <di:waypoint xsi:type="dc:Point" x="452.0" y="216.0"/> + <di:waypoint xsi:type="dc:Point" x="468.0" y="216.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="6.0" width="6.0" x="449.0" y="217.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_161" bpmnElement="DeleteGenericVnfFailure"> + <dc:Bounds height="80.0" width="100.0" x="1656.0" y="432.0"/> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_ScriptTask_161" targetElement="_BPMNShape_EndEvent_120"> + <di:waypoint xsi:type="dc:Point" x="1706.0" y="512.0"/> + <di:waypoint xsi:type="dc:Point" x="1707.0" y="564.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="6.0" width="6.0" x="1703.0" y="515.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="SequenceFlow_5" sourceElement="_BPMNShape_ExclusiveGateway_54" targetElement="_BPMNShape_ScriptTask_161"> + <di:waypoint xsi:type="dc:Point" x="1706.0" y="347.0"/> + <di:waypoint xsi:type="dc:Point" x="1706.0" y="432.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="6.0" width="6.0" x="1703.0" y="390.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_6" bpmnElement="SequenceFlow_8" sourceElement="_BPMNShape_ExclusiveGateway_50" targetElement="_BPMNShape_ScriptTask_158"> + <di:waypoint xsi:type="dc:Point" x="680.0" y="217.0"/> + <di:waypoint xsi:type="dc:Point" x="758.0" y="217.0"/> + <di:waypoint xsi:type="dc:Point" x="758.0" y="215.0"/> + <di:waypoint xsi:type="dc:Point" x="837.0" y="215.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="38.0" width="94.0" x="708.0" y="231.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_11" bpmnElement="SequenceFlow_11" sourceElement="_BPMNShape_ExclusiveGateway_99" targetElement="_BPMNShape_ExclusiveGateway_54"> + <di:waypoint xsi:type="dc:Point" x="911.0" y="39.0"/> + <di:waypoint xsi:type="dc:Point" x="1008.0" y="39.0"/> + <di:waypoint xsi:type="dc:Point" x="1008.0" y="140.0"/> + <di:waypoint xsi:type="dc:Point" x="1008.0" y="322.0"/> + <di:waypoint xsi:type="dc:Point" x="1681.0" y="322.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="6.0" width="6.0" x="1005.0" y="197.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_5" bpmnElement="SequenceFlow_4" sourceElement="_BPMNShape_ScriptTask_115" targetElement="_BPMNShape_ExclusiveGateway_54"> + <di:waypoint xsi:type="dc:Point" x="1632.0" y="80.0"/> + <di:waypoint xsi:type="dc:Point" x="1632.0" y="322.0"/> + <di:waypoint xsi:type="dc:Point" x="1681.0" y="322.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="6.0" width="6.0" x="1629.0" y="187.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_EndEvent_162" bpmnElement="EndEvent_1"> + <dc:Bounds height="36.0" width="36.0" x="1806.0" y="305.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="0.0" width="0.0" x="1824.0" y="346.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_8" bpmnElement="SequenceFlow_7" sourceElement="_BPMNShape_ExclusiveGateway_54" targetElement="_BPMNShape_EndEvent_162"> + <di:waypoint xsi:type="dc:Point" x="1731.0" y="322.0"/> + <di:waypoint xsi:type="dc:Point" x="1806.0" y="323.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="6.0" width="6.0" x="1753.0" y="322.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_242" bpmnElement="QueryAAIForGenericVnf1"> + <dc:Bounds height="80.0" width="100.0" x="1166.0" y="0.0"/> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_213" bpmnElement="ExclusiveGateway_4" isMarkerVisible="true"> + <dc:Bounds height="50.0" width="50.0" x="1325.0" y="15.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="0.0" width="0.0" x="1350.0" y="70.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_9" bpmnElement="SequenceFlow_9" sourceElement="_BPMNShape_ScriptTask_242" targetElement="_BPMNShape_ExclusiveGateway_213"> + <di:waypoint xsi:type="dc:Point" x="1266.0" y="40.0"/> + <di:waypoint xsi:type="dc:Point" x="1325.0" y="40.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="6.0" width="6.0" x="1292.0" y="40.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_243" bpmnElement="AAIQueryFailure1"> + <dc:Bounds height="80.0" width="100.0" x="1300.0" y="117.0"/> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_244" bpmnElement="ParseForGenericVNFResourceVersion"> + <dc:Bounds height="80.0" width="100.0" x="1440.0" y="0.0"/> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_EndEvent_181" bpmnElement="EndEvent_3"> + <dc:Bounds height="36.0" width="36.0" x="1332.0" y="244.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="0.0" width="0.0" x="1350.0" y="285.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_10" bpmnElement="SequenceFlow_10" sourceElement="_BPMNShape_ExclusiveGateway_213" targetElement="_BPMNShape_ScriptTask_243"> + <di:waypoint xsi:type="dc:Point" x="1350.0" y="65.0"/> + <di:waypoint xsi:type="dc:Point" x="1349.0" y="90.0"/> + <di:waypoint xsi:type="dc:Point" x="1350.0" y="90.0"/> + <di:waypoint xsi:type="dc:Point" x="1350.0" y="117.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="6.0" width="6.0" x="1347.0" y="95.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_12" bpmnElement="SequenceFlow_12" sourceElement="_BPMNShape_ScriptTask_243" targetElement="_BPMNShape_EndEvent_181"> + <di:waypoint xsi:type="dc:Point" x="1350.0" y="197.0"/> + <di:waypoint xsi:type="dc:Point" x="1350.0" y="244.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="6.0" width="6.0" x="1347.0" y="226.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_13" bpmnElement="SequenceFlow_13" sourceElement="_BPMNShape_ExclusiveGateway_213" targetElement="_BPMNShape_ScriptTask_244"> + <di:waypoint xsi:type="dc:Point" x="1375.0" y="40.0"/> + <di:waypoint xsi:type="dc:Point" x="1440.0" y="40.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="6.0" width="6.0" x="1394.0" y="40.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_14" bpmnElement="SequenceFlow_14" sourceElement="_BPMNShape_ScriptTask_244" targetElement="_BPMNShape_ScriptTask_115"> + <di:waypoint xsi:type="dc:Point" x="1540.0" y="40.0"/> + <di:waypoint xsi:type="dc:Point" x="1582.0" y="40.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="6.0" width="6.0" x="1565.0" y="40.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_226" bpmnElement="ExclusiveGateway_6" isMarkerVisible="true"> + <dc:Bounds height="50.0" width="50.0" x="1068.0" y="14.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="22.0" width="100.0" x="1044.0" y="-6.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_4" bpmnElement="SequenceFlow_3" sourceElement="_BPMNShape_ExclusiveGateway_226" targetElement="_BPMNShape_ScriptTask_242"> + <di:waypoint xsi:type="dc:Point" x="1118.0" y="39.0"/> + <di:waypoint xsi:type="dc:Point" x="1142.0" y="39.0"/> + <di:waypoint xsi:type="dc:Point" x="1142.0" y="40.0"/> + <di:waypoint xsi:type="dc:Point" x="1166.0" y="40.0"/> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_15" bpmnElement="SequenceFlow_15" sourceElement="_BPMNShape_ExclusiveGateway_226" targetElement="_BPMNShape_EndEvent_162"> + <di:waypoint xsi:type="dc:Point" x="1093.0" y="64.0"/> + <di:waypoint xsi:type="dc:Point" x="1093.0" y="289.0"/> + <di:waypoint xsi:type="dc:Point" x="1823.0" y="289.0"/> + <di:waypoint xsi:type="dc:Point" x="1823.0" y="305.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="22.0" width="27.0" x="1104.0" y="146.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> </bpmn2:definitions>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/FalloutHandler.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/FalloutHandler.bpmn index 4f27e0026a..c59564b1e3 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/FalloutHandler.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/FalloutHandler.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_3SPHsLr9EeWak-hhutJWuQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.8.2" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_3SPHsLr9EeWak-hhutJWuQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.8.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> <bpmn2:process id="FalloutHandler" name="Fallout Handler" isExecutable="true"> <bpmn2:parallelGateway id="ParallelGateway_1"> <bpmn2:incoming>SequenceFlow_12</bpmn2:incoming> @@ -20,7 +20,7 @@ <bpmn2:scriptTask id="ScriptTask_8" name="Pre-Process Request" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_10</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_12</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* def preProcessRequestData = new FalloutHandler() preProcessRequestData.preProcessRequest(execution) @@ -40,7 +40,7 @@ preProcessRequestData.preProcessRequest(execution) <bpmn2:scriptTask id="ScriptTask_2" name="Post Process Response" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_8</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_9</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* def falloutHandler = new FalloutHandler() falloutHandler.postProcessResponse(execution)]]></bpmn2:script> </bpmn2:scriptTask> @@ -64,7 +64,7 @@ falloutHandler.postProcessResponse(execution)]]></bpmn2:script> <bpmn2:extensionElements> <camunda:connector> <camunda:inputOutput> - <camunda:inputParameter name="url">${URN_mso_adapters_db_endpoint}</camunda:inputParameter> + <camunda:inputParameter name="url"><![CDATA[${UrnPropertiesReader.getVariable("mso.adapters.db.att-endpoint", execution)}]]></camunda:inputParameter> <camunda:inputParameter name="method">POST</camunda:inputParameter> <camunda:inputParameter name="headers"> <camunda:map> @@ -74,7 +74,7 @@ falloutHandler.postProcessResponse(execution)]]></bpmn2:script> </camunda:inputParameter> <camunda:inputParameter name="payload"> <camunda:script scriptFormat="groovy"><![CDATA[//println"INSIDE --> update Request Gamma" -import org.openecomp.mso.bpmn.common.scripts.* +import org.onap.so.bpmn.common.scripts.* def updateRequestGamma= new FalloutHandler() return updateRequestGamma.updateRequestGammaPayload(execution)]]></camunda:script> </camunda:inputParameter> @@ -106,7 +106,7 @@ return updateRequestGamma.updateRequestGammaPayload(execution)]]></camunda:scrip <bpmn2:incoming>SequenceFlow_72</bpmn2:incoming> <bpmn2:incoming>SequenceFlow_31</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_79</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* def falloutHandler = new FalloutHandler() falloutHandler.buildDBWorkflowException(execution, "FH_updateRequestGammaResponseCode")]]></bpmn2:script> </bpmn2:scriptTask> @@ -124,7 +124,7 @@ falloutHandler.buildDBWorkflowException(execution, "FH_updateRequestGammaRespons <bpmn2:incoming>SequenceFlow_32</bpmn2:incoming> <bpmn2:incoming>SequenceFlow_80</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_73</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* def falloutHandler = new FalloutHandler() falloutHandler.buildDBWorkflowException(execution, "FH_updateRequestInfraResponseCode")]]></bpmn2:script> </bpmn2:scriptTask> @@ -133,7 +133,7 @@ falloutHandler.buildDBWorkflowException(execution, "FH_updateRequestInfraRespons <bpmn2:extensionElements> <camunda:connector> <camunda:inputOutput> - <camunda:inputParameter name="url">${URN_mso_adapters_openecomp_db_endpoint}</camunda:inputParameter> + <camunda:inputParameter name="url"><![CDATA[${UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution)}]]></camunda:inputParameter> <camunda:inputParameter name="method">POST</camunda:inputParameter> <camunda:inputParameter name="headers"> <camunda:map> @@ -143,7 +143,7 @@ falloutHandler.buildDBWorkflowException(execution, "FH_updateRequestInfraRespons </camunda:inputParameter> <camunda:inputParameter name="payload"> <camunda:script scriptFormat="groovy"><![CDATA[//println"INSIDE --> update Request Infra" -import org.openecomp.mso.bpmn.common.scripts.* +import org.onap.so.bpmn.common.scripts.* def updateRequestInfra= new FalloutHandler() return updateRequestInfra.updateRequestInfraPayload(execution)]]></camunda:script> </camunda:inputParameter> @@ -175,7 +175,7 @@ return updateRequestInfra.updateRequestInfraPayload(execution)]]></camunda:scrip <bpmn2:scriptTask id="ScriptTask_4" name="Handle Event" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_1ko8ggw</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_1pm9r7h</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* execution.setVariable("FH_success", false) def falloutHandler = new FalloutHandler() @@ -207,7 +207,7 @@ execution.setVariable("FH_WorkflowException", wfe)]]></bpmn2:script> <bpmn2:terminateEventDefinition /> </bpmn2:endEvent> <bpmn2:sequenceFlow id="SequenceFlow_0m7gwor" sourceRef="Task_0ixuwt5" targetRef="ParallelGateway_4" /> - <bpmn2:callActivity id="Task_0ixuwt5" name="Call Notification Service" calledElement="${URN_mso_workflow_notification_name}"> + <bpmn2:callActivity id="Task_0ixuwt5" name="Call Notification Service" calledElement="${UrnPropertiesReader.getVariable("mso.workflow.notification.name", execution)}"> <bpmn2:extensionElements> <camunda:in source="mso-request-id" target="mso-request-id" /> <camunda:in source="mso-service-instance-id" target="mso-service-instance-id" /> diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenerateVfModuleName.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenerateVfModuleName.bpmn index ab4afdad1c..092001b56a 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenerateVfModuleName.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenerateVfModuleName.bpmn @@ -7,14 +7,14 @@ <bpmn:scriptTask id="InitializeVariables" name="Initialize Variables" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_1opqmjl</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0aqc89s</bpmn:outgoing> - <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn:script><![CDATA[import org.onap.so.bpmn.common.scripts.* def generateVfModuleName = new GenerateVfModuleName() generateVfModuleName.preProcessRequest(execution)]]></bpmn:script> </bpmn:scriptTask> <bpmn:scriptTask id="QueryAAIForIndex" name="Query AAI for Index" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_0aqc89s</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1afb896</bpmn:outgoing> - <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn:script><![CDATA[import org.onap.so.bpmn.common.scripts.* def generateVfModuleName = new GenerateVfModuleName() generateVfModuleName.queryAAI(execution)]]></bpmn:script> </bpmn:scriptTask> @@ -29,7 +29,7 @@ generateVfModuleName.queryAAI(execution)]]></bpmn:script> <bpmn:scriptTask id="PostProcessAAIResponse" name="Generate Name Based on Lowest Index" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_1afb896</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0o6nle0</bpmn:outgoing> - <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn:script><![CDATA[import org.onap.so.bpmn.common.scripts.* def generateVfModuleName = new GenerateVfModuleName() generateVfModuleName.generateName(execution)]]></bpmn:script> </bpmn:scriptTask> diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericDeleteService.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericDeleteService.bpmn deleted file mode 100644 index 15929b87eb..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericDeleteService.bpmn +++ /dev/null @@ -1,304 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_wAtdAGrUEeaJwpcpVN5gXw" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
- <bpmn2:process id="GenericDeleteService" name="GenericDeleteService" isExecutable="true">
- <bpmn2:subProcess id="bpmnExceptionHandlingSubProcess" name="Error Handling Sub Process" triggeredByEvent="true">
- <bpmn2:scriptTask id="processError" name="Process Error" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_9</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_10</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* - -ExceptionUtil ex = new ExceptionUtil() -ex.processSubflowsBPMNException(execution) -]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_10" name="" sourceRef="processError" targetRef="EndEvent_3" />
- <bpmn2:startEvent id="StartEvent_2">
- <bpmn2:outgoing>SequenceFlow_9</bpmn2:outgoing>
- <bpmn2:errorEventDefinition id="ErrorEventDefinition_1" />
- </bpmn2:startEvent>
- <bpmn2:sequenceFlow id="SequenceFlow_9" name="" sourceRef="StartEvent_2" targetRef="processError" />
- <bpmn2:endEvent id="EndEvent_3">
- <bpmn2:incoming>SequenceFlow_10</bpmn2:incoming>
- <bpmn2:terminateEventDefinition id="_TerminateEventDefinition_25" />
- </bpmn2:endEvent>
- </bpmn2:subProcess>
- <bpmn2:subProcess id="javaExceptionSubProcess" name="Java Exception Handling Sub Process" triggeredByEvent="true">
- <bpmn2:endEvent id="EndEvent_2">
- <bpmn2:incoming>SequenceFlow_12</bpmn2:incoming>
- </bpmn2:endEvent>
- <bpmn2:scriptTask id="processJavaError" name="Process Error">
- <bpmn2:incoming>SequenceFlow_11</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_12</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-
-ExceptionUtil ex = new ExceptionUtil()
-ex.processJavaException(execution)
-]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:startEvent id="StartEvent_3">
- <bpmn2:outgoing>SequenceFlow_11</bpmn2:outgoing>
- <bpmn2:errorEventDefinition id="ErrorEventDefinition_2" />
- </bpmn2:startEvent>
- <bpmn2:sequenceFlow id="SequenceFlow_11" name="" sourceRef="StartEvent_3" targetRef="processJavaError" />
- <bpmn2:sequenceFlow id="SequenceFlow_12" name="" sourceRef="processJavaError" targetRef="EndEvent_2" />
- </bpmn2:subProcess>
- <bpmn2:startEvent id="StartEvent_1">
- <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing>
- </bpmn2:startEvent>
- <bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="StartEvent_1" targetRef="initialization" />
- <bpmn2:scriptTask id="initialization" name="Initialization" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_3</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-GenericDeleteService deleteService = new GenericDeleteService()
-deleteService.preProcessRequest(execution)
-]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_3" name="" sourceRef="initialization" targetRef="resourceVersionCheck" />
- <bpmn2:exclusiveGateway id="resourceVersionCheck" name="Resource Version Provided?" default="yes">
- <bpmn2:incoming>SequenceFlow_3</bpmn2:incoming>
- <bpmn2:outgoing>no</bpmn2:outgoing>
- <bpmn2:outgoing>yes</bpmn2:outgoing>
- </bpmn2:exclusiveGateway>
- <bpmn2:sequenceFlow id="no" name="No" sourceRef="resourceVersionCheck" targetRef="queryForResourceVersion">
- <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("GENDS_resourceVersionProvidedFlag" ) == false}]]></bpmn2:conditionExpression>
- </bpmn2:sequenceFlow>
- <bpmn2:sequenceFlow id="yes" name="Yes" sourceRef="resourceVersionCheck" targetRef="ExclusiveGateway_2" />
- <bpmn2:scriptTask id="toggleSuccess" name="Toggle Success Indicator" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_7</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_4</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-GenericDeleteService deleteService = new GenericDeleteService()
-deleteService.setSuccessIndicator(execution, true)
-
-execution.setVariable("WorkflowResponse", " ") //for junits
-]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_4" name="" sourceRef="toggleSuccess" targetRef="EndEvent_1" />
- <bpmn2:exclusiveGateway id="ExclusiveGateway_2">
- <bpmn2:incoming>yes</bpmn2:incoming>
- <bpmn2:incoming>siExistYes</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_6</bpmn2:outgoing>
- </bpmn2:exclusiveGateway>
- <bpmn2:sequenceFlow id="SequenceFlow_6" name="" sourceRef="ExclusiveGateway_2" targetRef="deleteServiceInstance" />
- <bpmn2:endEvent id="EndEvent_1">
- <bpmn2:incoming>SequenceFlow_4</bpmn2:incoming>
- <bpmn2:terminateEventDefinition id="_TerminateEventDefinition_24" />
- </bpmn2:endEvent>
- <bpmn2:scriptTask id="deleteServiceInstance" name="DELETE
- Service Instance" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_6</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_7</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-GenericDeleteService deleteService = new GenericDeleteService()
-deleteService.deleteServiceObject(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_7" name="" sourceRef="deleteServiceInstance" targetRef="toggleSuccess" />
- <bpmn2:scriptTask id="queryForResourceVersion" name="Query SI Resource Version" scriptFormat="groovy">
- <bpmn2:incoming>no</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_5</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-GenericDeleteService deleteService = new GenericDeleteService()
-deleteService.getServiceResourceVersion(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_5" name="" sourceRef="queryForResourceVersion" targetRef="siExistCheck" />
- <bpmn2:exclusiveGateway id="siExistCheck" name="Service Exist?">
- <bpmn2:incoming>SequenceFlow_5</bpmn2:incoming>
- <bpmn2:outgoing>siExistYes</bpmn2:outgoing>
- <bpmn2:outgoing>siExistNo</bpmn2:outgoing>
- </bpmn2:exclusiveGateway>
- <bpmn2:sequenceFlow id="siExistYes" name="Yes" sourceRef="siExistCheck" targetRef="ExclusiveGateway_2">
- <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("GENDS_FoundIndicator" ) == true}]]></bpmn2:conditionExpression>
- </bpmn2:sequenceFlow>
- <bpmn2:sequenceFlow id="siExistNo" name="No" sourceRef="siExistCheck" targetRef="EndEvent_4" />
- <bpmn2:endEvent id="EndEvent_4">
- <bpmn2:incoming>siExistNo</bpmn2:incoming>
- <bpmn2:terminateEventDefinition id="_TerminateEventDefinition_38" />
- </bpmn2:endEvent>
- </bpmn2:process>
- <bpmn2:error id="Error_1" name="MSO Workflow Exception" errorCode="MSOWorkflowException" />
- <bpmndi:BPMNDiagram id="BPMNDiagram_1">
- <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="GenericDeleteService">
- <bpmndi:BPMNShape id="_BPMNShape_StartEvent_63" bpmnElement="StartEvent_1">
- <dc:Bounds x="84" y="221" width="36" height="36" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="102" y="262" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_267" bpmnElement="initialization">
- <dc:Bounds x="216" y="199" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_224" bpmnElement="resourceVersionCheck" isMarkerVisible="true">
- <dc:Bounds x="365" y="213" width="50" height="50" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="401" y="243" width="169" height="22" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_268" bpmnElement="queryForResourceVersion">
- <dc:Bounds x="457" y="100" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_225" bpmnElement="ExclusiveGateway_2" isMarkerVisible="true">
- <dc:Bounds x="600" y="213" width="50" height="50" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="625" y="268" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_269" bpmnElement="deleteServiceInstance">
- <dc:Bounds x="684" y="199" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_213" bpmnElement="EndEvent_1">
- <dc:Bounds x="1006" y="221" width="36" height="36" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="1024" y="262" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_SubProcess_20" bpmnElement="bpmnExceptionHandlingSubProcess" isExpanded="true">
- <dc:Bounds x="155" y="384" width="321" height="169" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_StartEvent_63" targetElement="_BPMNShape_ScriptTask_267">
- <di:waypoint xsi:type="dc:Point" x="120" y="239" />
- <di:waypoint xsi:type="dc:Point" x="216" y="239" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="147" y="239" width="6" height="6" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="SequenceFlow_3" sourceElement="_BPMNShape_ScriptTask_267" targetElement="_BPMNShape_ExclusiveGateway_224">
- <di:waypoint xsi:type="dc:Point" x="316" y="239" />
- <di:waypoint xsi:type="dc:Point" x="365" y="238" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="217" y="238" width="6" height="6" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_4" bpmnElement="no" sourceElement="_BPMNShape_ExclusiveGateway_224" targetElement="_BPMNShape_ScriptTask_268">
- <di:waypoint xsi:type="dc:Point" x="390" y="213" />
- <di:waypoint xsi:type="dc:Point" x="390" y="140" />
- <di:waypoint xsi:type="dc:Point" x="457" y="140" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="392" y="179" width="22" height="22" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_5" bpmnElement="SequenceFlow_5" sourceElement="_BPMNShape_ScriptTask_268" targetElement="_BPMNShape_ExclusiveGateway_241">
- <di:waypoint xsi:type="dc:Point" x="557" y="140" />
- <di:waypoint xsi:type="dc:Point" x="600" y="139" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="492" y="140" width="6" height="6" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_6" bpmnElement="SequenceFlow_6" sourceElement="_BPMNShape_ExclusiveGateway_225" targetElement="_BPMNShape_ScriptTask_269">
- <di:waypoint xsi:type="dc:Point" x="650" y="238" />
- <di:waypoint xsi:type="dc:Point" x="684" y="239" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="556" y="239" width="6" height="6" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_7" bpmnElement="SequenceFlow_7" sourceElement="_BPMNShape_ScriptTask_269" targetElement="_BPMNShape_ScriptTask_272">
- <di:waypoint xsi:type="dc:Point" x="784" y="239" />
- <di:waypoint xsi:type="dc:Point" x="826" y="239" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="778" y="239" width="6" height="6" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_8" bpmnElement="yes" sourceElement="_BPMNShape_ExclusiveGateway_224" targetElement="_BPMNShape_ExclusiveGateway_225">
- <di:waypoint xsi:type="dc:Point" x="390" y="263" />
- <di:waypoint xsi:type="dc:Point" x="390" y="310" />
- <di:waypoint xsi:type="dc:Point" x="517" y="310" />
- <di:waypoint xsi:type="dc:Point" x="625" y="310" />
- <di:waypoint xsi:type="dc:Point" x="625" y="263" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="389" y="278" width="29" height="22" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_SubProcess_23" bpmnElement="javaExceptionSubProcess" isExpanded="true">
- <dc:Bounds x="163" y="576" width="306" height="157" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_StartEvent_65" bpmnElement="StartEvent_2">
- <dc:Bounds x="180" y="451" width="36" height="36" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="198" y="492" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_StartEvent_66" bpmnElement="StartEvent_3">
- <dc:Bounds x="192" y="637" width="36" height="36" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="210" y="678" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_216" bpmnElement="EndEvent_2">
- <dc:Bounds x="408" y="637" width="36" height="36" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="426" y="678" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_217" bpmnElement="EndEvent_3">
- <dc:Bounds x="420" y="451" width="36" height="36" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="438" y="492" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_270" bpmnElement="processError">
- <dc:Bounds x="266" y="429" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_271" bpmnElement="processJavaError">
- <dc:Bounds x="267" y="615" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_9" bpmnElement="SequenceFlow_9" sourceElement="_BPMNShape_StartEvent_65" targetElement="_BPMNShape_ScriptTask_270">
- <di:waypoint xsi:type="dc:Point" x="216" y="469" />
- <di:waypoint xsi:type="dc:Point" x="266" y="469" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="232" y="469" width="6" height="6" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_10" bpmnElement="SequenceFlow_10" sourceElement="_BPMNShape_ScriptTask_270" targetElement="_BPMNShape_EndEvent_217">
- <di:waypoint xsi:type="dc:Point" x="366" y="469" />
- <di:waypoint xsi:type="dc:Point" x="420" y="469" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="384" y="469" width="6" height="6" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_11" bpmnElement="SequenceFlow_11" sourceElement="_BPMNShape_StartEvent_66" targetElement="_BPMNShape_ScriptTask_271">
- <di:waypoint xsi:type="dc:Point" x="228" y="655" />
- <di:waypoint xsi:type="dc:Point" x="267" y="655" />
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_12" bpmnElement="SequenceFlow_12" sourceElement="_BPMNShape_ScriptTask_271" targetElement="_BPMNShape_EndEvent_216">
- <di:waypoint xsi:type="dc:Point" x="367" y="655" />
- <di:waypoint xsi:type="dc:Point" x="408" y="655" />
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_272" bpmnElement="toggleSuccess">
- <dc:Bounds x="826" y="199" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_13" bpmnElement="SequenceFlow_4" sourceElement="_BPMNShape_ScriptTask_272" targetElement="_BPMNShape_EndEvent_213">
- <di:waypoint xsi:type="dc:Point" x="926" y="239" />
- <di:waypoint xsi:type="dc:Point" x="1006" y="239" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="828" y="239" width="6" height="6" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_241" bpmnElement="siExistCheck" isMarkerVisible="true">
- <dc:Bounds x="600" y="114" width="50" height="50" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="596" y="94" width="59" height="22" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="siExistYes" sourceElement="_BPMNShape_ExclusiveGateway_241" targetElement="_BPMNShape_ExclusiveGateway_225">
- <di:waypoint xsi:type="dc:Point" x="625" y="164" />
- <di:waypoint xsi:type="dc:Point" x="625" y="213" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="624" y="168" width="29" height="22" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_15" bpmnElement="siExistNo" sourceElement="_BPMNShape_ExclusiveGateway_241" targetElement="_BPMNShape_EndEvent_241">
- <di:waypoint xsi:type="dc:Point" x="650" y="139" />
- <di:waypoint xsi:type="dc:Point" x="733" y="140" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="664" y="140" width="22" height="22" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_241" bpmnElement="EndEvent_4">
- <dc:Bounds x="733" y="122" width="36" height="36" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="751" y="163" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- </bpmndi:BPMNPlane>
- </bpmndi:BPMNDiagram>
-</bpmn2:definitions>
diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericDeleteVnf.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericDeleteVnf.bpmn deleted file mode 100644 index f46f86613f..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericDeleteVnf.bpmn +++ /dev/null @@ -1,251 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_oBLSkHqWEea26OhQB97uCQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
- <bpmn2:process id="GenericDeleteVnf" name="GenericDeleteVnf" isExecutable="true">
- <bpmn2:startEvent id="StartEvent_1">
- <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing>
- </bpmn2:startEvent>
- <bpmn2:scriptTask id="initialization" name="Initialization" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_9</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-GenericDeleteVnf deleteVnf= new GenericDeleteVnf()
-deleteVnf.preProcessRequest(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="StartEvent_1" targetRef="initialization" />
- <bpmn2:sequenceFlow id="SequenceFlow_9" name="" sourceRef="initialization" targetRef="resourceVersionCheck" />
- <bpmn2:exclusiveGateway id="resourceVersionCheck" name="Resource Version Provided?" default="resourceVersionProvided">
- <bpmn2:incoming>SequenceFlow_9</bpmn2:incoming>
- <bpmn2:outgoing>resourceVariableNotProvided</bpmn2:outgoing>
- <bpmn2:outgoing>resourceVersionProvided</bpmn2:outgoing>
- </bpmn2:exclusiveGateway>
- <bpmn2:sequenceFlow id="resourceVariableNotProvided" name="No" sourceRef="resourceVersionCheck" targetRef="queryForResourceVersion">
- <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("GENDV_resourceVersionProvided") == false}]]></bpmn2:conditionExpression>
- </bpmn2:sequenceFlow>
- <bpmn2:sequenceFlow id="resourceVersionProvided" name="Yes" sourceRef="resourceVersionCheck" targetRef="ExclusiveGateway_2" />
- <bpmn2:subProcess id="bpmnExceptionHandlingSubProcess" name="Error Handling Sub Process" triggeredByEvent="true">
- <bpmn2:scriptTask id="processBPMNError" name="Process Error" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_3</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-
-ExceptionUtil ex = new ExceptionUtil()
-ex.processSubflowsBPMNException(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_3" name="" sourceRef="processBPMNError" targetRef="EndEvent_2" />
- <bpmn2:startEvent id="StartEvent_2">
- <bpmn2:outgoing>SequenceFlow_2</bpmn2:outgoing>
- <bpmn2:errorEventDefinition id="ErrorEventDefinition_1" />
- </bpmn2:startEvent>
- <bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="StartEvent_2" targetRef="processBPMNError" />
- <bpmn2:endEvent id="EndEvent_2">
- <bpmn2:incoming>SequenceFlow_3</bpmn2:incoming>
- <bpmn2:terminateEventDefinition id="_TerminateEventDefinition_40" />
- </bpmn2:endEvent>
- </bpmn2:subProcess>
- <bpmn2:scriptTask id="queryForResourceVersion" name="Query SI Resource Version" scriptFormat="groovy">
- <bpmn2:incoming>resourceVariableNotProvided</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_5</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-GenericDeleteVnf deleteVnf= new GenericDeleteVnf()
-deleteVnf.getVnfResourceVersion(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_5" name="" sourceRef="queryForResourceVersion" targetRef="vnfFoundCheck" />
- <bpmn2:scriptTask id="toggleSuccess" name="Toggle Success Indicator" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_7</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_8</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-GenericDeleteVnf deleteVnf= new GenericDeleteVnf()
-deleteVnf.setSuccessIndicator(execution, true)
-
-execution.setVariable("WorkflowResponse", " ") //for junits]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_8" name="" sourceRef="toggleSuccess" targetRef="EndEvent_1" />
- <bpmn2:scriptTask id="deleteVnf" name="DELETE
- Vnf" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_6</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_7</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-GenericDeleteVnf deleteVnf= new GenericDeleteVnf()
-deleteVnf.deleteVnf(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_7" name="" sourceRef="deleteVnf" targetRef="toggleSuccess" />
- <bpmn2:endEvent id="EndEvent_3">
- <bpmn2:incoming>vnfFoundNo</bpmn2:incoming>
- <bpmn2:terminateEventDefinition id="_TerminateEventDefinition_41" />
- </bpmn2:endEvent>
- <bpmn2:exclusiveGateway id="vnfFoundCheck" name="Vnf Found?" default="vnfFoundNo">
- <bpmn2:incoming>SequenceFlow_5</bpmn2:incoming>
- <bpmn2:outgoing>vnfFoundYes</bpmn2:outgoing>
- <bpmn2:outgoing>vnfFoundNo</bpmn2:outgoing>
- </bpmn2:exclusiveGateway>
- <bpmn2:sequenceFlow id="vnfFoundYes" name="Yes" sourceRef="vnfFoundCheck" targetRef="ExclusiveGateway_2">
- <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("GENDV_FoundIndicator") == true}]]></bpmn2:conditionExpression>
- </bpmn2:sequenceFlow>
- <bpmn2:sequenceFlow id="vnfFoundNo" name="No" sourceRef="vnfFoundCheck" targetRef="EndEvent_3" />
- <bpmn2:exclusiveGateway id="ExclusiveGateway_2">
- <bpmn2:incoming>resourceVersionProvided</bpmn2:incoming>
- <bpmn2:incoming>vnfFoundYes</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_6</bpmn2:outgoing>
- </bpmn2:exclusiveGateway>
- <bpmn2:sequenceFlow id="SequenceFlow_6" name="" sourceRef="ExclusiveGateway_2" targetRef="deleteVnf" />
- <bpmn2:endEvent id="EndEvent_1">
- <bpmn2:incoming>SequenceFlow_8</bpmn2:incoming>
- <bpmn2:terminateEventDefinition id="_TerminateEventDefinition_39" />
- </bpmn2:endEvent>
- </bpmn2:process>
- <bpmndi:BPMNDiagram id="BPMNDiagram_1">
- <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="GenericDeleteVnf">
- <bpmndi:BPMNShape id="_BPMNShape_StartEvent_78" bpmnElement="StartEvent_1">
- <dc:Bounds x="74" y="216" width="36" height="36" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="92" y="257" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_310" bpmnElement="initialization">
- <dc:Bounds x="192" y="194" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_StartEvent_78" targetElement="_BPMNShape_ScriptTask_310">
- <di:waypoint xsi:type="dc:Point" x="110" y="234" />
- <di:waypoint xsi:type="dc:Point" x="192" y="234" />
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_239" bpmnElement="resourceVersionCheck" isMarkerVisible="true">
- <dc:Bounds x="326" y="208" width="50" height="50" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="360" y="238" width="169" height="22" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_ScriptTask_310" targetElement="_BPMNShape_ExclusiveGateway_239">
- <di:waypoint xsi:type="dc:Point" x="236" y="476" />
- <di:waypoint xsi:type="dc:Point" x="288" y="476" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="262" y="476" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_320" bpmnElement="queryForResourceVersion">
- <dc:Bounds x="408" y="96" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_321" bpmnElement="deleteVnf">
- <dc:Bounds x="658" y="194" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_240" bpmnElement="ExclusiveGateway_2" isMarkerVisible="true">
- <dc:Bounds x="562" y="208" width="50" height="50" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="587" y="263" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_322" bpmnElement="toggleSuccess">
- <dc:Bounds x="802" y="194" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_240" bpmnElement="EndEvent_1">
- <dc:Bounds x="1001" y="216" width="36" height="36" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="1019" y="257" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="resourceVariableNotProvided" sourceElement="_BPMNShape_ExclusiveGateway_239" targetElement="_BPMNShape_ScriptTask_320">
- <di:waypoint xsi:type="dc:Point" x="351" y="208" />
- <di:waypoint xsi:type="dc:Point" x="351" y="136" />
- <di:waypoint xsi:type="dc:Point" x="408" y="136" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="354" y="165" width="22" height="22" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_4" bpmnElement="resourceVersionProvided" sourceElement="_BPMNShape_ExclusiveGateway_239" targetElement="_BPMNShape_ExclusiveGateway_240">
- <di:waypoint xsi:type="dc:Point" x="351" y="258" />
- <di:waypoint xsi:type="dc:Point" x="351" y="312" />
- <di:waypoint xsi:type="dc:Point" x="459" y="312" />
- <di:waypoint xsi:type="dc:Point" x="587" y="312" />
- <di:waypoint xsi:type="dc:Point" x="587" y="258" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="351" y="276" width="29" height="22" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_5" bpmnElement="SequenceFlow_5" sourceElement="_BPMNShape_ScriptTask_320" targetElement="_BPMNShape_ExclusiveGateway_242">
- <di:waypoint xsi:type="dc:Point" x="508" y="136" />
- <di:waypoint xsi:type="dc:Point" x="562" y="135" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="558" y="135" width="6" height="6" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_6" bpmnElement="SequenceFlow_6" sourceElement="_BPMNShape_ExclusiveGateway_240" targetElement="_BPMNShape_ScriptTask_321">
- <di:waypoint xsi:type="dc:Point" x="612" y="233" />
- <di:waypoint xsi:type="dc:Point" x="658" y="234" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="633" y="234" width="6" height="6" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_7" bpmnElement="SequenceFlow_7" sourceElement="_BPMNShape_ScriptTask_321" targetElement="_BPMNShape_ScriptTask_322">
- <di:waypoint xsi:type="dc:Point" x="758" y="234" />
- <di:waypoint xsi:type="dc:Point" x="802" y="234" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="777" y="234" width="6" height="6" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_8" bpmnElement="SequenceFlow_8" sourceElement="_BPMNShape_ScriptTask_322" targetElement="_BPMNShape_EndEvent_240">
- <di:waypoint xsi:type="dc:Point" x="902" y="234" />
- <di:waypoint xsi:type="dc:Point" x="1001" y="234" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="949" y="234" width="6" height="6" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_9" bpmnElement="SequenceFlow_9" sourceElement="_BPMNShape_ScriptTask_310" targetElement="_BPMNShape_ExclusiveGateway_239">
- <di:waypoint xsi:type="dc:Point" x="292" y="234" />
- <di:waypoint xsi:type="dc:Point" x="326" y="233" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="311" y="233" width="6" height="6" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_SubProcess_36" bpmnElement="bpmnExceptionHandlingSubProcess" isExpanded="true">
- <dc:Bounds x="185" y="397" width="304" height="157" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_StartEvent_82" bpmnElement="StartEvent_2">
- <dc:Bounds x="200" y="458" width="36" height="36" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="218" y="499" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_242" bpmnElement="EndEvent_2">
- <dc:Bounds x="440" y="458" width="36" height="36" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="458" y="499" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_323" bpmnElement="processBPMNError">
- <dc:Bounds x="288" y="436" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_10" bpmnElement="SequenceFlow_3" sourceElement="_BPMNShape_ScriptTask_323" targetElement="_BPMNShape_EndEvent_242">
- <di:waypoint xsi:type="dc:Point" x="388" y="476" />
- <di:waypoint xsi:type="dc:Point" x="440" y="476" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="414" y="476" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_242" bpmnElement="vnfFoundCheck" isMarkerVisible="true">
- <dc:Bounds x="562" y="110" width="50" height="50" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="552" y="90" width="72" height="22" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_243" bpmnElement="EndEvent_3">
- <dc:Bounds x="708" y="118" width="36" height="36" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="726" y="159" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_11" bpmnElement="vnfFoundYes" sourceElement="_BPMNShape_ExclusiveGateway_242" targetElement="_BPMNShape_ExclusiveGateway_240">
- <di:waypoint xsi:type="dc:Point" x="587" y="160" />
- <di:waypoint xsi:type="dc:Point" x="587" y="208" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="587" y="165" width="29" height="22" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_12" bpmnElement="vnfFoundNo" sourceElement="_BPMNShape_ExclusiveGateway_242" targetElement="_BPMNShape_EndEvent_243">
- <di:waypoint xsi:type="dc:Point" x="612" y="135" />
- <di:waypoint xsi:type="dc:Point" x="708" y="136" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="637" y="135" width="22" height="22" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- </bpmndi:BPMNPlane>
- </bpmndi:BPMNDiagram>
-</bpmn2:definitions>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericGetService.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericGetService.bpmn index 6f012bcb88..2015526874 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericGetService.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericGetService.bpmn @@ -4,7 +4,7 @@ <bpmn2:scriptTask id="intialization" name="Initialization" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_2</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* GenericGetService getService = new GenericGetService() getService.preProcessRequest(execution) ]]></bpmn2:script> @@ -23,7 +23,7 @@ getService.preProcessRequest(execution) <bpmn2:scriptTask id="processBPMNException" name="Process Error" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_7</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_8</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* ExceptionUtil ex = new ExceptionUtil() ex.processSubflowsBPMNException(execution)]]></bpmn2:script> @@ -41,7 +41,7 @@ ex.processSubflowsBPMNException(execution)]]></bpmn2:script> <bpmn2:scriptTask id="toggleSuccess" name="Toggle Success Indicator" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_3</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_6</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* GenericGetService getService = new GenericGetService() getService.setSuccessIndicator(execution, true) ]]></bpmn2:script> @@ -50,7 +50,7 @@ getService.setSuccessIndicator(execution, true) <bpmn2:scriptTask id="getServiceInstance" name="GET Object" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_5</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_3</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* GenericGetService getService = new GenericGetService() getService.getServiceObject(execution)]]></bpmn2:script> </bpmn2:scriptTask> @@ -64,7 +64,7 @@ getService.getServiceObject(execution)]]></bpmn2:script> <bpmn2:scriptTask id="obtainServiceUrlById" name="Node Query Using Id " scriptFormat="groovy"> <bpmn2:incoming>obtainById</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_4</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* GenericGetService getService = new GenericGetService() getService.obtainServiceInstanceUrlById(execution)]]></bpmn2:script> </bpmn2:scriptTask> @@ -72,7 +72,7 @@ getService.obtainServiceInstanceUrlById(execution)]]></bpmn2:script> <bpmn2:scriptTask id="obtainServiceUrlByName" name="Node Query Using Name" scriptFormat="groovy"> <bpmn2:incoming>obtainByName</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_13</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* GenericGetService getService = new GenericGetService() getService.obtainServiceInstanceUrlByName(execution)]]></bpmn2:script> </bpmn2:scriptTask> diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericGetVnf.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericGetVnf.bpmn index 3300d86084..5784c10d3e 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericGetVnf.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericGetVnf.bpmn @@ -1,212 +1,212 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd" id="_eb5eEHR6EeaJwpcpVN5gXw" exporter="camunda modeler" exporterVersion="2.7.0" targetNamespace="http://camunda.org/schema/1.0/bpmn">
- <bpmn2:process id="GenericGetVnf" name="GenericGetVnf" isExecutable="true">
- <bpmn2:startEvent id="StartEvent_1">
- <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing>
- </bpmn2:startEvent>
- <bpmn2:scriptTask id="intialization" name="Intialization" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_2</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* +<?xml version="1.0" encoding="UTF-8"?> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd" id="_eb5eEHR6EeaJwpcpVN5gXw" exporter="camunda modeler" exporterVersion="2.7.0" targetNamespace="http://camunda.org/schema/1.0/bpmn"> + <bpmn2:process id="GenericGetVnf" name="GenericGetVnf" isExecutable="true"> + <bpmn2:startEvent id="StartEvent_1"> + <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing> + </bpmn2:startEvent> + <bpmn2:scriptTask id="intialization" name="Intialization" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_2</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* GenericGetVnf genericGetVnf = new GenericGetVnf () genericGetVnf.preProcessRequest(execution) -]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="StartEvent_1" targetRef="intialization"/>
- <bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="intialization" targetRef="vnfIdProvided"/>
- <bpmn2:exclusiveGateway id="vnfIdProvided" name="Vnf Id Provided?" default="noVnfId">
- <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming>
- <bpmn2:outgoing>noVnfId</bpmn2:outgoing>
- <bpmn2:outgoing>haveVnfId</bpmn2:outgoing>
- </bpmn2:exclusiveGateway>
- <bpmn2:sequenceFlow id="noVnfId" name="No" sourceRef="vnfIdProvided" targetRef="getVnfByName"/>
- <bpmn2:sequenceFlow id="haveVnfId" name="Yes" sourceRef="vnfIdProvided" targetRef="getGenericVnf">
- <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("GENGV_getVnfByName") == false}]]></bpmn2:conditionExpression>
- </bpmn2:sequenceFlow>
- <bpmn2:scriptTask id="getVnfByName" name="GET Vnf By Name" scriptFormat="groovy">
- <bpmn2:incoming>noVnfId</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_9</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* +]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="StartEvent_1" targetRef="intialization"/> + <bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="intialization" targetRef="vnfIdProvided"/> + <bpmn2:exclusiveGateway id="vnfIdProvided" name="Vnf Id Provided?" default="noVnfId"> + <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming> + <bpmn2:outgoing>noVnfId</bpmn2:outgoing> + <bpmn2:outgoing>haveVnfId</bpmn2:outgoing> + </bpmn2:exclusiveGateway> + <bpmn2:sequenceFlow id="noVnfId" name="No" sourceRef="vnfIdProvided" targetRef="getVnfByName"/> + <bpmn2:sequenceFlow id="haveVnfId" name="Yes" sourceRef="vnfIdProvided" targetRef="getGenericVnf"> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("GENGV_getVnfByName") == false}]]></bpmn2:conditionExpression> + </bpmn2:sequenceFlow> + <bpmn2:scriptTask id="getVnfByName" name="GET Vnf By Name" scriptFormat="groovy"> + <bpmn2:incoming>noVnfId</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_9</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* GenericGetVnf genericGetVnf = new GenericGetVnf() -genericGetVnf.getVnfByName(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_9" name="" sourceRef="getVnfByName" targetRef="ExclusiveGateway_2"/>
- <bpmn2:exclusiveGateway id="ExclusiveGateway_2">
- <bpmn2:incoming>SequenceFlow_9</bpmn2:incoming>
- <bpmn2:incoming>SequenceFlow_10</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_7</bpmn2:outgoing>
- </bpmn2:exclusiveGateway>
- <bpmn2:sequenceFlow id="SequenceFlow_7" name="" sourceRef="ExclusiveGateway_2" targetRef="toggleSuccess"/>
- <bpmn2:scriptTask id="getGenericVnf" name="GET Vnf By
Id" scriptFormat="groovy">
- <bpmn2:incoming>haveVnfId</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_10</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* +genericGetVnf.getVnfByName(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_9" name="" sourceRef="getVnfByName" targetRef="ExclusiveGateway_2"/> + <bpmn2:exclusiveGateway id="ExclusiveGateway_2"> + <bpmn2:incoming>SequenceFlow_9</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_10</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_7</bpmn2:outgoing> + </bpmn2:exclusiveGateway> + <bpmn2:sequenceFlow id="SequenceFlow_7" name="" sourceRef="ExclusiveGateway_2" targetRef="toggleSuccess"/> + <bpmn2:scriptTask id="getGenericVnf" name="GET Vnf By
Id" scriptFormat="groovy"> + <bpmn2:incoming>haveVnfId</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_10</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* GenericGetVnf genericGetVnf = new GenericGetVnf() -genericGetVnf.getVnfById(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_10" name="" sourceRef="getGenericVnf" targetRef="ExclusiveGateway_2"/>
- <bpmn2:subProcess id="bpmnExceptionHandlingSubProcess" name="Error Handling Sub Process" triggeredByEvent="true">
- <bpmn2:endEvent id="EndEvent_3">
- <bpmn2:incoming>SequenceFlow_12</bpmn2:incoming>
- <bpmn2:terminateEventDefinition id="_TerminateEventDefinition_31"/>
- </bpmn2:endEvent>
- <bpmn2:scriptTask id="proccessBPMNError" name="Process Error" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_11</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_12</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* +genericGetVnf.getVnfById(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_10" name="" sourceRef="getGenericVnf" targetRef="ExclusiveGateway_2"/> + <bpmn2:subProcess id="bpmnExceptionHandlingSubProcess" name="Error Handling Sub Process" triggeredByEvent="true"> + <bpmn2:endEvent id="EndEvent_3"> + <bpmn2:incoming>SequenceFlow_12</bpmn2:incoming> + <bpmn2:terminateEventDefinition id="_TerminateEventDefinition_31"/> + </bpmn2:endEvent> + <bpmn2:scriptTask id="proccessBPMNError" name="Process Error" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_11</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_12</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* ExceptionUtil ex = new ExceptionUtil() -ex.processSubflowsBPMNException(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_12" name="" sourceRef="proccessBPMNError" targetRef="EndEvent_3"/>
- <bpmn2:startEvent id="catchMSOWorkflowException">
- <bpmn2:outgoing>SequenceFlow_11</bpmn2:outgoing>
- <bpmn2:errorEventDefinition id="ErrorEventDefinition_1"/>
- </bpmn2:startEvent>
- <bpmn2:sequenceFlow id="SequenceFlow_11" name="" sourceRef="catchMSOWorkflowException" targetRef="proccessBPMNError"/>
- </bpmn2:subProcess>
- <bpmn2:scriptTask id="toggleSuccess" name="Toggle Success Indicator" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_7</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_8</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* +ex.processSubflowsBPMNException(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_12" name="" sourceRef="proccessBPMNError" targetRef="EndEvent_3"/> + <bpmn2:startEvent id="catchMSOWorkflowException"> + <bpmn2:outgoing>SequenceFlow_11</bpmn2:outgoing> + <bpmn2:errorEventDefinition id="ErrorEventDefinition_1"/> + </bpmn2:startEvent> + <bpmn2:sequenceFlow id="SequenceFlow_11" name="" sourceRef="catchMSOWorkflowException" targetRef="proccessBPMNError"/> + </bpmn2:subProcess> + <bpmn2:scriptTask id="toggleSuccess" name="Toggle Success Indicator" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_7</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_8</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* GenericGetVnf genericGetVnf = new GenericGetVnf() genericGetVnf.setSuccessIndicator(execution, true) -]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_8" name="" sourceRef="toggleSuccess" targetRef="EndEvent_1"/>
- <bpmn2:endEvent id="EndEvent_1">
- <bpmn2:incoming>SequenceFlow_8</bpmn2:incoming>
- <bpmn2:terminateEventDefinition id="_TerminateEventDefinition_28"/>
- </bpmn2:endEvent>
- </bpmn2:process>
- <bpmn2:error id="Error_1" errorCode="MSOWorkflowException" name="MSO Workflow Exception"/>
- <bpmndi:BPMNDiagram id="BPMNDiagram_1">
- <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="GenericGetVnf">
- <bpmndi:BPMNShape id="_BPMNShape_StartEvent_71" bpmnElement="StartEvent_1">
- <dc:Bounds height="36.0" width="36.0" x="110.0" y="271.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="128.0" y="312.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_295" bpmnElement="intialization">
- <dc:Bounds height="80.0" width="100.0" x="228.0" y="249.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_230" bpmnElement="vnfIdProvided" isMarkerVisible="true">
- <dc:Bounds height="50.0" width="50.0" x="372.0" y="263.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="22.0" width="99.0" x="419.0" y="292.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_StartEvent_71" targetElement="_BPMNShape_ScriptTask_295">
- <di:waypoint xsi:type="dc:Point" x="146.0" y="289.0"/>
- <di:waypoint xsi:type="dc:Point" x="228.0" y="289.0"/>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_ScriptTask_295" targetElement="_BPMNShape_ExclusiveGateway_230">
- <di:waypoint xsi:type="dc:Point" x="328.0" y="289.0"/>
- <di:waypoint xsi:type="dc:Point" x="372.0" y="288.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="347.0" y="288.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_296" bpmnElement="getVnfByName">
- <dc:Bounds height="80.0" width="100.0" x="456.0" y="156.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_231" bpmnElement="ExclusiveGateway_2" isMarkerVisible="true">
- <dc:Bounds height="50.0" width="50.0" x="600.0" y="263.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="625.0" y="318.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="noVnfId" sourceElement="_BPMNShape_ExclusiveGateway_230" targetElement="_BPMNShape_ScriptTask_296">
- <di:waypoint xsi:type="dc:Point" x="397.0" y="263.0"/>
- <di:waypoint xsi:type="dc:Point" x="397.0" y="196.0"/>
- <di:waypoint xsi:type="dc:Point" x="456.0" y="196.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="22.0" width="22.0" x="399.0" y="219.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_5" bpmnElement="haveVnfId" sourceElement="_BPMNShape_ExclusiveGateway_230" targetElement="_BPMNShape_ScriptTask_297">
- <di:waypoint xsi:type="dc:Point" x="397.0" y="313.0"/>
- <di:waypoint xsi:type="dc:Point" x="397.0" y="368.0"/>
- <di:waypoint xsi:type="dc:Point" x="456.0" y="368.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="22.0" width="29.0" x="396.0" y="328.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_297" bpmnElement="getGenericVnf">
- <dc:Bounds height="80.0" width="100.0" x="456.0" y="328.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_298" bpmnElement="toggleSuccess">
- <dc:Bounds height="80.0" width="100.0" x="696.0" y="249.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_226" bpmnElement="EndEvent_1">
- <dc:Bounds height="36.0" width="36.0" x="888.0" y="271.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="906.0" y="312.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_7" bpmnElement="SequenceFlow_7" sourceElement="_BPMNShape_ExclusiveGateway_231" targetElement="_BPMNShape_ScriptTask_298">
- <di:waypoint xsi:type="dc:Point" x="650.0" y="288.0"/>
- <di:waypoint xsi:type="dc:Point" x="696.0" y="289.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="673.0" y="289.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_8" bpmnElement="SequenceFlow_8" sourceElement="_BPMNShape_ScriptTask_298" targetElement="_BPMNShape_EndEvent_226">
- <di:waypoint xsi:type="dc:Point" x="796.0" y="289.0"/>
- <di:waypoint xsi:type="dc:Point" x="888.0" y="289.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="829.0" y="289.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_11" bpmnElement="SequenceFlow_9" sourceElement="_BPMNShape_ScriptTask_296" targetElement="_BPMNShape_ExclusiveGateway_231">
- <di:waypoint xsi:type="dc:Point" x="556.0" y="196.0"/>
- <di:waypoint xsi:type="dc:Point" x="625.0" y="196.0"/>
- <di:waypoint xsi:type="dc:Point" x="625.0" y="263.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="622.0" y="205.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_12" bpmnElement="SequenceFlow_10" sourceElement="_BPMNShape_ScriptTask_297" targetElement="_BPMNShape_ExclusiveGateway_231">
- <di:waypoint xsi:type="dc:Point" x="556.0" y="368.0"/>
- <di:waypoint xsi:type="dc:Point" x="625.0" y="368.0"/>
- <di:waypoint xsi:type="dc:Point" x="625.0" y="313.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="621.0" y="368.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_SubProcess_30" bpmnElement="bpmnExceptionHandlingSubProcess" isExpanded="true">
- <dc:Bounds height="169.0" width="313.0" x="168.0" y="468.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_StartEvent_74" bpmnElement="catchMSOWorkflowException">
- <dc:Bounds height="36.0" width="36.0" x="180.0" y="535.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="198.0" y="576.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_302" bpmnElement="proccessBPMNError">
- <dc:Bounds height="80.0" width="100.0" x="275.0" y="513.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_231" bpmnElement="EndEvent_3">
- <dc:Bounds height="36.0" width="36.0" x="432.0" y="535.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="450.0" y="576.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_13" bpmnElement="SequenceFlow_11" sourceElement="_BPMNShape_StartEvent_74" targetElement="_BPMNShape_ScriptTask_302">
- <di:waypoint xsi:type="dc:Point" x="216.0" y="553.0"/>
- <di:waypoint xsi:type="dc:Point" x="275.0" y="553.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="238.0" y="553.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_14" bpmnElement="SequenceFlow_12" sourceElement="_BPMNShape_ScriptTask_302" targetElement="_BPMNShape_EndEvent_231">
- <di:waypoint xsi:type="dc:Point" x="375.0" y="553.0"/>
- <di:waypoint xsi:type="dc:Point" x="432.0" y="553.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="402.0" y="553.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- </bpmndi:BPMNPlane>
- </bpmndi:BPMNDiagram>
+]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_8" name="" sourceRef="toggleSuccess" targetRef="EndEvent_1"/> + <bpmn2:endEvent id="EndEvent_1"> + <bpmn2:incoming>SequenceFlow_8</bpmn2:incoming> + <bpmn2:terminateEventDefinition id="_TerminateEventDefinition_28"/> + </bpmn2:endEvent> + </bpmn2:process> + <bpmn2:error id="Error_1" errorCode="MSOWorkflowException" name="MSO Workflow Exception"/> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="GenericGetVnf"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_71" bpmnElement="StartEvent_1"> + <dc:Bounds height="36.0" width="36.0" x="110.0" y="271.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="0.0" width="0.0" x="128.0" y="312.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_295" bpmnElement="intialization"> + <dc:Bounds height="80.0" width="100.0" x="228.0" y="249.0"/> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_230" bpmnElement="vnfIdProvided" isMarkerVisible="true"> + <dc:Bounds height="50.0" width="50.0" x="372.0" y="263.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="22.0" width="99.0" x="419.0" y="292.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_StartEvent_71" targetElement="_BPMNShape_ScriptTask_295"> + <di:waypoint xsi:type="dc:Point" x="146.0" y="289.0"/> + <di:waypoint xsi:type="dc:Point" x="228.0" y="289.0"/> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_ScriptTask_295" targetElement="_BPMNShape_ExclusiveGateway_230"> + <di:waypoint xsi:type="dc:Point" x="328.0" y="289.0"/> + <di:waypoint xsi:type="dc:Point" x="372.0" y="288.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="6.0" width="6.0" x="347.0" y="288.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_296" bpmnElement="getVnfByName"> + <dc:Bounds height="80.0" width="100.0" x="456.0" y="156.0"/> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_231" bpmnElement="ExclusiveGateway_2" isMarkerVisible="true"> + <dc:Bounds height="50.0" width="50.0" x="600.0" y="263.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="0.0" width="0.0" x="625.0" y="318.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="noVnfId" sourceElement="_BPMNShape_ExclusiveGateway_230" targetElement="_BPMNShape_ScriptTask_296"> + <di:waypoint xsi:type="dc:Point" x="397.0" y="263.0"/> + <di:waypoint xsi:type="dc:Point" x="397.0" y="196.0"/> + <di:waypoint xsi:type="dc:Point" x="456.0" y="196.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="22.0" width="22.0" x="399.0" y="219.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_5" bpmnElement="haveVnfId" sourceElement="_BPMNShape_ExclusiveGateway_230" targetElement="_BPMNShape_ScriptTask_297"> + <di:waypoint xsi:type="dc:Point" x="397.0" y="313.0"/> + <di:waypoint xsi:type="dc:Point" x="397.0" y="368.0"/> + <di:waypoint xsi:type="dc:Point" x="456.0" y="368.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="22.0" width="29.0" x="396.0" y="328.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_297" bpmnElement="getGenericVnf"> + <dc:Bounds height="80.0" width="100.0" x="456.0" y="328.0"/> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_298" bpmnElement="toggleSuccess"> + <dc:Bounds height="80.0" width="100.0" x="696.0" y="249.0"/> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_EndEvent_226" bpmnElement="EndEvent_1"> + <dc:Bounds height="36.0" width="36.0" x="888.0" y="271.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="0.0" width="0.0" x="906.0" y="312.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_7" bpmnElement="SequenceFlow_7" sourceElement="_BPMNShape_ExclusiveGateway_231" targetElement="_BPMNShape_ScriptTask_298"> + <di:waypoint xsi:type="dc:Point" x="650.0" y="288.0"/> + <di:waypoint xsi:type="dc:Point" x="696.0" y="289.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="6.0" width="6.0" x="673.0" y="289.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_8" bpmnElement="SequenceFlow_8" sourceElement="_BPMNShape_ScriptTask_298" targetElement="_BPMNShape_EndEvent_226"> + <di:waypoint xsi:type="dc:Point" x="796.0" y="289.0"/> + <di:waypoint xsi:type="dc:Point" x="888.0" y="289.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="6.0" width="6.0" x="829.0" y="289.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_11" bpmnElement="SequenceFlow_9" sourceElement="_BPMNShape_ScriptTask_296" targetElement="_BPMNShape_ExclusiveGateway_231"> + <di:waypoint xsi:type="dc:Point" x="556.0" y="196.0"/> + <di:waypoint xsi:type="dc:Point" x="625.0" y="196.0"/> + <di:waypoint xsi:type="dc:Point" x="625.0" y="263.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="6.0" width="6.0" x="622.0" y="205.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_12" bpmnElement="SequenceFlow_10" sourceElement="_BPMNShape_ScriptTask_297" targetElement="_BPMNShape_ExclusiveGateway_231"> + <di:waypoint xsi:type="dc:Point" x="556.0" y="368.0"/> + <di:waypoint xsi:type="dc:Point" x="625.0" y="368.0"/> + <di:waypoint xsi:type="dc:Point" x="625.0" y="313.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="6.0" width="6.0" x="621.0" y="368.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_SubProcess_30" bpmnElement="bpmnExceptionHandlingSubProcess" isExpanded="true"> + <dc:Bounds height="169.0" width="313.0" x="168.0" y="468.0"/> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_74" bpmnElement="catchMSOWorkflowException"> + <dc:Bounds height="36.0" width="36.0" x="180.0" y="535.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="0.0" width="0.0" x="198.0" y="576.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_302" bpmnElement="proccessBPMNError"> + <dc:Bounds height="80.0" width="100.0" x="275.0" y="513.0"/> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_EndEvent_231" bpmnElement="EndEvent_3"> + <dc:Bounds height="36.0" width="36.0" x="432.0" y="535.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="0.0" width="0.0" x="450.0" y="576.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_13" bpmnElement="SequenceFlow_11" sourceElement="_BPMNShape_StartEvent_74" targetElement="_BPMNShape_ScriptTask_302"> + <di:waypoint xsi:type="dc:Point" x="216.0" y="553.0"/> + <di:waypoint xsi:type="dc:Point" x="275.0" y="553.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="6.0" width="6.0" x="238.0" y="553.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_14" bpmnElement="SequenceFlow_12" sourceElement="_BPMNShape_ScriptTask_302" targetElement="_BPMNShape_EndEvent_231"> + <di:waypoint xsi:type="dc:Point" x="375.0" y="553.0"/> + <di:waypoint xsi:type="dc:Point" x="432.0" y="553.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="6.0" width="6.0" x="402.0" y="553.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> </bpmn2:definitions>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericPutService.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericPutService.bpmn index ca03a9560c..2d18f38c16 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericPutService.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericPutService.bpmn @@ -1,201 +1,201 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_FatVcHn0EeaH6vX1RRdc_w" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
- <bpmn2:process id="GenericPutService" name="GenericPutService" isExecutable="true">
- <bpmn2:startEvent id="StartEvent_1">
- <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing>
- </bpmn2:startEvent>
- <bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="StartEvent_1" targetRef="Initialization" />
- <bpmn2:endEvent id="EndEvent_1">
- <bpmn2:incoming>SequenceFlow_5</bpmn2:incoming>
- <bpmn2:terminateEventDefinition id="TerminateEventDefinition_1" />
- </bpmn2:endEvent>
- <bpmn2:scriptTask id="toggleSuccess" name="Toggle Success Indicator" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_4</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_5</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-
-def serviceInstance= new GenericPutService()
-serviceInstance.setSuccessIndicator(execution, true)
-
-execution.setVariable("WorkflowResponse", " ") //for junits]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_5" name="" sourceRef="toggleSuccess" targetRef="EndEvent_1" />
- <bpmn2:scriptTask id="putServiceInstance" name="Put Service Instance" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_3</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_4</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-
-def serviceInstance= new GenericPutService()
-serviceInstance.putServiceInstance(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_4" name="" sourceRef="putServiceInstance" targetRef="toggleSuccess" />
- <bpmn2:scriptTask id="Initialization" name="Initialization" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_3</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-
-def serviceInstance= new GenericPutService()
-serviceInstance.preProcessRequest(execution)
-]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_3" name="" sourceRef="Initialization" targetRef="putServiceInstance" />
- <bpmn2:subProcess id="bpmnExceptionHandlingSubProcess" name="Error Handling Sub Process" triggeredByEvent="true">
- <bpmn2:startEvent id="StartEvent_2">
- <bpmn2:outgoing>SequenceFlow_6</bpmn2:outgoing>
- <bpmn2:errorEventDefinition id="ErrorEventDefinition_1" />
- </bpmn2:startEvent>
- <bpmn2:sequenceFlow id="SequenceFlow_6" name="" sourceRef="StartEvent_2" targetRef="processError" />
- <bpmn2:endEvent id="EndEvent_2">
- <bpmn2:incoming>SequenceFlow_7</bpmn2:incoming>
- </bpmn2:endEvent>
- <bpmn2:scriptTask id="processError" name="Process Error" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_6</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_7</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-
-ExceptionUtil ex = new ExceptionUtil()
-ex.processSubflowsBPMNException(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_7" name="" sourceRef="processError" targetRef="EndEvent_2" />
- </bpmn2:subProcess>
- <bpmn2:subProcess id="javaExceptionSubProcess" name="Java Exception Handling Sub Process" triggeredByEvent="true">
- <bpmn2:startEvent id="catchJavaExcep">
- <bpmn2:outgoing>SequenceFlow_9</bpmn2:outgoing>
- <bpmn2:errorEventDefinition id="ErrorEventDefinition_2" errorRef="Error_2" />
- </bpmn2:startEvent>
- <bpmn2:sequenceFlow id="SequenceFlow_9" name="" sourceRef="catchJavaExcep" targetRef="processJavaError" />
- <bpmn2:scriptTask id="processJavaError" name="Process Java Error" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_9</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_10</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-
-ExceptionUtil ex = new ExceptionUtil()
-ex.processJavaException(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:endEvent id="EndEvent_3">
- <bpmn2:incoming>SequenceFlow_10</bpmn2:incoming>
- <bpmn2:terminateEventDefinition id="TerminateEventDefinition_2" />
- </bpmn2:endEvent>
- <bpmn2:sequenceFlow id="SequenceFlow_10" name="" sourceRef="processJavaError" targetRef="EndEvent_3" />
- </bpmn2:subProcess>
- </bpmn2:process>
- <bpmn2:error id="Error_1" name="MSO Workflow Exception" errorCode="MSOWorkflowException" />
- <bpmn2:error id="Error_2" name="Java Lang Exception" errorCode="java.lang.Exception" />
- <bpmndi:BPMNDiagram id="BPMNDiagram_1">
- <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="GenericPutService">
- <bpmndi:BPMNShape id="_BPMNShape_StartEvent_71" bpmnElement="StartEvent_1">
- <dc:Bounds x="182" y="180" width="36" height="36" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="200" y="221" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_302" bpmnElement="Initialization">
- <dc:Bounds x="324" y="158" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_StartEvent_71" targetElement="_BPMNShape_ScriptTask_302">
- <di:waypoint xsi:type="dc:Point" x="218" y="198" />
- <di:waypoint xsi:type="dc:Point" x="324" y="198" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="250" y="198" width="6" height="6" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_304" bpmnElement="putServiceInstance">
- <dc:Bounds x="528" y="158" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="SequenceFlow_3" sourceElement="_BPMNShape_ScriptTask_302" targetElement="_BPMNShape_ScriptTask_304">
- <di:waypoint xsi:type="dc:Point" x="424" y="198" />
- <di:waypoint xsi:type="dc:Point" x="528" y="198" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="446" y="198" width="6" height="6" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_305" bpmnElement="toggleSuccess">
- <dc:Bounds x="732" y="158" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_4" bpmnElement="SequenceFlow_4" sourceElement="_BPMNShape_ScriptTask_304" targetElement="_BPMNShape_ScriptTask_305">
- <di:waypoint xsi:type="dc:Point" x="628" y="198" />
- <di:waypoint xsi:type="dc:Point" x="732" y="198" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="650" y="198" width="6" height="6" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_230" bpmnElement="EndEvent_1">
- <dc:Bounds x="908" y="180" width="36" height="36" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="926" y="221" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_5" bpmnElement="SequenceFlow_5" sourceElement="_BPMNShape_ScriptTask_305" targetElement="_BPMNShape_EndEvent_230">
- <di:waypoint xsi:type="dc:Point" x="832" y="198" />
- <di:waypoint xsi:type="dc:Point" x="908" y="198" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="854" y="198" width="6" height="6" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_SubProcess_27" bpmnElement="bpmnExceptionHandlingSubProcess" isExpanded="true">
- <dc:Bounds x="324" y="312" width="418" height="150" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_StartEvent_72" bpmnElement="StartEvent_2">
- <dc:Bounds x="357" y="370" width="36" height="36" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="375" y="411" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_306" bpmnElement="processError">
- <dc:Bounds x="466" y="348" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_6" bpmnElement="SequenceFlow_6" sourceElement="_BPMNShape_StartEvent_72" targetElement="_BPMNShape_ScriptTask_306">
- <di:waypoint xsi:type="dc:Point" x="393" y="388" />
- <di:waypoint xsi:type="dc:Point" x="466" y="388" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="415" y="388" width="6" height="6" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_231" bpmnElement="EndEvent_2">
- <dc:Bounds x="615" y="370" width="36" height="36" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="633" y="411" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_7" bpmnElement="SequenceFlow_7" sourceElement="_BPMNShape_ScriptTask_306" targetElement="_BPMNShape_EndEvent_231">
- <di:waypoint xsi:type="dc:Point" x="566" y="388" />
- <di:waypoint xsi:type="dc:Point" x="615" y="388" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="588" y="388" width="6" height="6" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_SubProcess_28" bpmnElement="javaExceptionSubProcess" isExpanded="true">
- <dc:Bounds x="323" y="486" width="419" height="150" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_StartEvent_73" bpmnElement="catchJavaExcep">
- <dc:Bounds x="357" y="538" width="36" height="36" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="375" y="579" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_308" bpmnElement="processJavaError">
- <dc:Bounds x="465" y="516" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_9" bpmnElement="SequenceFlow_9" sourceElement="_BPMNShape_StartEvent_73" targetElement="_BPMNShape_ScriptTask_308">
- <di:waypoint xsi:type="dc:Point" x="393" y="556" />
- <di:waypoint xsi:type="dc:Point" x="465" y="556" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="415" y="556" width="6" height="6" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_232" bpmnElement="EndEvent_3">
- <dc:Bounds x="615" y="538" width="36" height="36" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="633" y="579" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_10" bpmnElement="SequenceFlow_10" sourceElement="_BPMNShape_ScriptTask_308" targetElement="_BPMNShape_EndEvent_232">
- <di:waypoint xsi:type="dc:Point" x="565" y="556" />
- <di:waypoint xsi:type="dc:Point" x="615" y="556" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="587" y="556" width="6" height="6" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- </bpmndi:BPMNPlane>
- </bpmndi:BPMNDiagram>
-</bpmn2:definitions>
+<?xml version="1.0" encoding="UTF-8"?> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_FatVcHn0EeaH6vX1RRdc_w" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> + <bpmn2:process id="GenericPutService" name="GenericPutService" isExecutable="true"> + <bpmn2:startEvent id="StartEvent_1"> + <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing> + </bpmn2:startEvent> + <bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="StartEvent_1" targetRef="Initialization" /> + <bpmn2:endEvent id="EndEvent_1"> + <bpmn2:incoming>SequenceFlow_5</bpmn2:incoming> + <bpmn2:terminateEventDefinition id="TerminateEventDefinition_1" /> + </bpmn2:endEvent> + <bpmn2:scriptTask id="toggleSuccess" name="Toggle Success Indicator" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_4</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_5</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* + +def serviceInstance= new GenericPutService() +serviceInstance.setSuccessIndicator(execution, true) + +execution.setVariable("WorkflowResponse", " ") //for junits]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_5" name="" sourceRef="toggleSuccess" targetRef="EndEvent_1" /> + <bpmn2:scriptTask id="putServiceInstance" name="Put Service Instance" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_3</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_4</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* + +def serviceInstance= new GenericPutService() +serviceInstance.putServiceInstance(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_4" name="" sourceRef="putServiceInstance" targetRef="toggleSuccess" /> + <bpmn2:scriptTask id="Initialization" name="Initialization" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_3</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* + +def serviceInstance= new GenericPutService() +serviceInstance.preProcessRequest(execution) +]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_3" name="" sourceRef="Initialization" targetRef="putServiceInstance" /> + <bpmn2:subProcess id="bpmnExceptionHandlingSubProcess" name="Error Handling Sub Process" triggeredByEvent="true"> + <bpmn2:startEvent id="StartEvent_2"> + <bpmn2:outgoing>SequenceFlow_6</bpmn2:outgoing> + <bpmn2:errorEventDefinition id="ErrorEventDefinition_1" /> + </bpmn2:startEvent> + <bpmn2:sequenceFlow id="SequenceFlow_6" name="" sourceRef="StartEvent_2" targetRef="processError" /> + <bpmn2:endEvent id="EndEvent_2"> + <bpmn2:incoming>SequenceFlow_7</bpmn2:incoming> + </bpmn2:endEvent> + <bpmn2:scriptTask id="processError" name="Process Error" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_6</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_7</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* + +ExceptionUtil ex = new ExceptionUtil() +ex.processSubflowsBPMNException(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_7" name="" sourceRef="processError" targetRef="EndEvent_2" /> + </bpmn2:subProcess> + <bpmn2:subProcess id="javaExceptionSubProcess" name="Java Exception Handling Sub Process" triggeredByEvent="true"> + <bpmn2:startEvent id="catchJavaExcep"> + <bpmn2:outgoing>SequenceFlow_9</bpmn2:outgoing> + <bpmn2:errorEventDefinition id="ErrorEventDefinition_2" errorRef="Error_2" /> + </bpmn2:startEvent> + <bpmn2:sequenceFlow id="SequenceFlow_9" name="" sourceRef="catchJavaExcep" targetRef="processJavaError" /> + <bpmn2:scriptTask id="processJavaError" name="Process Java Error" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_9</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_10</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* + +ExceptionUtil ex = new ExceptionUtil() +ex.processJavaException(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:endEvent id="EndEvent_3"> + <bpmn2:incoming>SequenceFlow_10</bpmn2:incoming> + <bpmn2:terminateEventDefinition id="TerminateEventDefinition_2" /> + </bpmn2:endEvent> + <bpmn2:sequenceFlow id="SequenceFlow_10" name="" sourceRef="processJavaError" targetRef="EndEvent_3" /> + </bpmn2:subProcess> + </bpmn2:process> + <bpmn2:error id="Error_1" name="MSO Workflow Exception" errorCode="MSOWorkflowException" /> + <bpmn2:error id="Error_2" name="Java Lang Exception" errorCode="java.lang.Exception" /> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="GenericPutService"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_71" bpmnElement="StartEvent_1"> + <dc:Bounds x="182" y="180" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="200" y="221" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_302" bpmnElement="Initialization"> + <dc:Bounds x="324" y="158" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_StartEvent_71" targetElement="_BPMNShape_ScriptTask_302"> + <di:waypoint xsi:type="dc:Point" x="218" y="198" /> + <di:waypoint xsi:type="dc:Point" x="324" y="198" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="250" y="198" width="6" height="6" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_304" bpmnElement="putServiceInstance"> + <dc:Bounds x="528" y="158" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="SequenceFlow_3" sourceElement="_BPMNShape_ScriptTask_302" targetElement="_BPMNShape_ScriptTask_304"> + <di:waypoint xsi:type="dc:Point" x="424" y="198" /> + <di:waypoint xsi:type="dc:Point" x="528" y="198" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="446" y="198" width="6" height="6" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_305" bpmnElement="toggleSuccess"> + <dc:Bounds x="732" y="158" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_4" bpmnElement="SequenceFlow_4" sourceElement="_BPMNShape_ScriptTask_304" targetElement="_BPMNShape_ScriptTask_305"> + <di:waypoint xsi:type="dc:Point" x="628" y="198" /> + <di:waypoint xsi:type="dc:Point" x="732" y="198" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="650" y="198" width="6" height="6" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_EndEvent_230" bpmnElement="EndEvent_1"> + <dc:Bounds x="908" y="180" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="926" y="221" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_5" bpmnElement="SequenceFlow_5" sourceElement="_BPMNShape_ScriptTask_305" targetElement="_BPMNShape_EndEvent_230"> + <di:waypoint xsi:type="dc:Point" x="832" y="198" /> + <di:waypoint xsi:type="dc:Point" x="908" y="198" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="854" y="198" width="6" height="6" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_SubProcess_27" bpmnElement="bpmnExceptionHandlingSubProcess" isExpanded="true"> + <dc:Bounds x="324" y="312" width="418" height="150" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_72" bpmnElement="StartEvent_2"> + <dc:Bounds x="357" y="370" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="375" y="411" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_306" bpmnElement="processError"> + <dc:Bounds x="466" y="348" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_6" bpmnElement="SequenceFlow_6" sourceElement="_BPMNShape_StartEvent_72" targetElement="_BPMNShape_ScriptTask_306"> + <di:waypoint xsi:type="dc:Point" x="393" y="388" /> + <di:waypoint xsi:type="dc:Point" x="466" y="388" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="415" y="388" width="6" height="6" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_EndEvent_231" bpmnElement="EndEvent_2"> + <dc:Bounds x="615" y="370" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="633" y="411" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_7" bpmnElement="SequenceFlow_7" sourceElement="_BPMNShape_ScriptTask_306" targetElement="_BPMNShape_EndEvent_231"> + <di:waypoint xsi:type="dc:Point" x="566" y="388" /> + <di:waypoint xsi:type="dc:Point" x="615" y="388" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="588" y="388" width="6" height="6" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_SubProcess_28" bpmnElement="javaExceptionSubProcess" isExpanded="true"> + <dc:Bounds x="323" y="486" width="419" height="150" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_73" bpmnElement="catchJavaExcep"> + <dc:Bounds x="357" y="538" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="375" y="579" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_308" bpmnElement="processJavaError"> + <dc:Bounds x="465" y="516" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_9" bpmnElement="SequenceFlow_9" sourceElement="_BPMNShape_StartEvent_73" targetElement="_BPMNShape_ScriptTask_308"> + <di:waypoint xsi:type="dc:Point" x="393" y="556" /> + <di:waypoint xsi:type="dc:Point" x="465" y="556" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="415" y="556" width="6" height="6" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_EndEvent_232" bpmnElement="EndEvent_3"> + <dc:Bounds x="615" y="538" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="633" y="579" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_10" bpmnElement="SequenceFlow_10" sourceElement="_BPMNShape_ScriptTask_308" targetElement="_BPMNShape_EndEvent_232"> + <di:waypoint xsi:type="dc:Point" x="565" y="556" /> + <di:waypoint xsi:type="dc:Point" x="615" y="556" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="587" y="556" width="6" height="6" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn2:definitions> diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericPutVnf.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericPutVnf.bpmn deleted file mode 100644 index f155783e3a..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericPutVnf.bpmn +++ /dev/null @@ -1,135 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd" id="_ZkRI4HntEea26OhQB97uCQ" exporter="camunda modeler" exporterVersion="2.7.0" targetNamespace="http://camunda.org/schema/1.0/bpmn">
- <bpmn2:process id="GenericPutVnf" name="GenericPutVnf" isExecutable="true">
- <bpmn2:startEvent id="StartEvent_1">
- <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing>
- </bpmn2:startEvent>
- <bpmn2:scriptTask id="intialization" name="Intialization" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_2</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* -GenericPutVnf genericPutVnf = new GenericPutVnf() -genericPutVnf.preProcessRequest(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="StartEvent_1" targetRef="intialization"/>
- <bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="intialization" targetRef="putVnf"/>
- <bpmn2:subProcess id="processBPMNExceptionSubProcess" name="Error Handling Sub Process" triggeredByEvent="true">
- <bpmn2:endEvent id="EndEvent_2">
- <bpmn2:incoming>SequenceFlow_6</bpmn2:incoming>
- <bpmn2:terminateEventDefinition id="_TerminateEventDefinition_43"/>
- </bpmn2:endEvent>
- <bpmn2:startEvent id="StartEvent_2">
- <bpmn2:outgoing>SequenceFlow_5</bpmn2:outgoing>
- <bpmn2:errorEventDefinition id="_ErrorEventDefinition_96"/>
- </bpmn2:startEvent>
- <bpmn2:scriptTask id="processBPMNException" name="Process Error" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_5</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_6</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-
-ExceptionUtil ex = new ExceptionUtil()
-ex.processSubflowsBPMNException(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_5" name="" sourceRef="StartEvent_2" targetRef="processBPMNException"/>
- <bpmn2:sequenceFlow id="SequenceFlow_6" name="" sourceRef="processBPMNException" targetRef="EndEvent_2"/>
- </bpmn2:subProcess>
- <bpmn2:scriptTask id="putVnf" name="PUT Vnf" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_3</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* -GenericPutVnf genericPutVnf = new GenericPutVnf() -genericPutVnf.putVnf(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_3" name="" sourceRef="putVnf" targetRef="toggleSuccess"/>
- <bpmn2:scriptTask id="toggleSuccess" name="Toggle Success Indicator" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_3</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_4</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* -GenericPutVnf genericPutVnf = new GenericPutVnf() -genericPutVnf.setSuccessIndicator(execution, true) - -execution.setVariable("WorkflowResponse", " ") //for junits]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_4" name="" sourceRef="toggleSuccess" targetRef="EndEvent_1"/>
- <bpmn2:endEvent id="EndEvent_1">
- <bpmn2:incoming>SequenceFlow_4</bpmn2:incoming>
- <bpmn2:terminateEventDefinition id="_TerminateEventDefinition_42"/>
- </bpmn2:endEvent>
- </bpmn2:process>
- <bpmndi:BPMNDiagram id="BPMNDiagram_1">
- <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="GenericPutVnf">
- <bpmndi:BPMNShape id="_BPMNShape_StartEvent_75" bpmnElement="StartEvent_1">
- <dc:Bounds height="36.0" width="36.0" x="116.0" y="233.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="134.0" y="274.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_305" bpmnElement="intialization">
- <dc:Bounds height="80.0" width="100.0" x="240.0" y="211.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_306" bpmnElement="putVnf">
- <dc:Bounds height="80.0" width="100.0" x="384.0" y="211.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_307" bpmnElement="toggleSuccess">
- <dc:Bounds height="80.0" width="100.0" x="528.0" y="211.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_233" bpmnElement="EndEvent_1">
- <dc:Bounds height="36.0" width="36.0" x="732.0" y="233.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="750.0" y="274.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_StartEvent_75" targetElement="_BPMNShape_ScriptTask_305">
- <di:waypoint xsi:type="dc:Point" x="152.0" y="251.0"/>
- <di:waypoint xsi:type="dc:Point" x="240.0" y="251.0"/>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_ScriptTask_305" targetElement="_BPMNShape_ScriptTask_306">
- <di:waypoint xsi:type="dc:Point" x="340.0" y="251.0"/>
- <di:waypoint xsi:type="dc:Point" x="384.0" y="251.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="365.0" y="251.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="SequenceFlow_3" sourceElement="_BPMNShape_ScriptTask_306" targetElement="_BPMNShape_ScriptTask_307">
- <di:waypoint xsi:type="dc:Point" x="484.0" y="251.0"/>
- <di:waypoint xsi:type="dc:Point" x="528.0" y="251.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="513.0" y="251.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_4" bpmnElement="SequenceFlow_4" sourceElement="_BPMNShape_ScriptTask_307" targetElement="_BPMNShape_EndEvent_233">
- <di:waypoint xsi:type="dc:Point" x="628.0" y="251.0"/>
- <di:waypoint xsi:type="dc:Point" x="732.0" y="251.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="678.0" y="251.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_SubProcess_31" bpmnElement="processBPMNExceptionSubProcess" isExpanded="true">
- <dc:Bounds height="169.0" width="322.0" x="174.0" y="396.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_StartEvent_83" bpmnElement="StartEvent_2">
- <dc:Bounds height="36.0" width="36.0" x="204.0" y="463.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="222.0" y="504.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_244" bpmnElement="EndEvent_2">
- <dc:Bounds height="36.0" width="36.0" x="432.0" y="463.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="450.0" y="504.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_324" bpmnElement="processBPMNException">
- <dc:Bounds height="80.0" width="100.0" x="286.0" y="441.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_5" bpmnElement="SequenceFlow_5" sourceElement="_BPMNShape_StartEvent_83" targetElement="_BPMNShape_ScriptTask_324">
- <di:waypoint xsi:type="dc:Point" x="240.0" y="481.0"/>
- <di:waypoint xsi:type="dc:Point" x="286.0" y="481.0"/>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_6" bpmnElement="SequenceFlow_6" sourceElement="_BPMNShape_ScriptTask_324" targetElement="_BPMNShape_EndEvent_244">
- <di:waypoint xsi:type="dc:Point" x="386.0" y="481.0"/>
- <di:waypoint xsi:type="dc:Point" x="432.0" y="481.0"/>
- </bpmndi:BPMNEdge>
- </bpmndi:BPMNPlane>
- </bpmndi:BPMNDiagram>
-</bpmn2:definitions>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/PrepareUpdateAAIVfModule.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/PrepareUpdateAAIVfModule.bpmn index 956192c5af..de9adc59c7 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/PrepareUpdateAAIVfModule.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/PrepareUpdateAAIVfModule.bpmn @@ -6,7 +6,7 @@ and the updated VF Module (type=VfModule) is placed in the variable 'PUAAIVfMod_ <bpmn2:scriptTask id="QueryAAIForGenericVnf" name="Query AAI for Generic Vnf" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_38</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_39</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* def puvm = new PrepareUpdateAAIVfModule() puvm.getGenericVnf(execution)]]></bpmn2:script> </bpmn2:scriptTask> @@ -23,14 +23,14 @@ puvm.getGenericVnf(execution)]]></bpmn2:script> <bpmn2:scriptTask id="ScriptTask_1" name="Validate VF Module" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_22</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_10</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* def puvm= new PrepareUpdateAAIVfModule() puvm.validateVfModule(execution)]]></bpmn2:script> </bpmn2:scriptTask> <bpmn2:scriptTask id="VnfNotFound" name="Handle Generic Vnf Not found" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_23</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_18</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* def puvm= new PrepareUpdateAAIVfModule() puvm.handleVnfNotFound(execution)]]></bpmn2:script> </bpmn2:scriptTask> @@ -48,7 +48,7 @@ puvm.handleVnfNotFound(execution)]]></bpmn2:script> <bpmn2:scriptTask id="ScriptTask_2" name="Handle VF Module Validation Error" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_12</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_15</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* def puvm= new PrepareUpdateAAIVfModule() puvm.handleVfModuleValidationError(execution)]]></bpmn2:script> </bpmn2:scriptTask> @@ -75,7 +75,7 @@ puvm.handleVfModuleValidationError(execution)]]></bpmn2:script> <bpmn2:extensionElements> <camunda:connector> <camunda:inputOutput> - <camunda:outputParameter name="CreateCustomerV1Response"><![CDATA[<aetgt:CreateCustomerResponse xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1" xmlns:ns="http://org.openecomp/mso/workflow/schema/v1"> + <camunda:outputParameter name="CreateCustomerV1Response"><![CDATA[<aetgt:CreateCustomerResponse xmlns:aetgt="http://org.onap/so/workflow/schema/v1" xmlns:ns="http://org.onap/so/workflow/schema/v1"> <ns:GlobalCustomerId>${CCV1_subscriberglobalid}</ns:GlobalCustomerId> </aetgt:CreateCustomerResponse>]]></camunda:outputParameter> </camunda:inputOutput> @@ -86,7 +86,7 @@ puvm.handleVfModuleValidationError(execution)]]></bpmn2:script> <bpmn2:scriptTask id="HandleUpdateVfModuleFailure" name="Handle Update VF Module Failure" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_4</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_8</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* def puvm= new PrepareUpdateAAIVfModule() puvm.handleUpdateVfModuleFailure(execution)]]></bpmn2:script> </bpmn2:scriptTask> @@ -94,7 +94,7 @@ puvm.handleUpdateVfModuleFailure(execution)]]></bpmn2:script> <bpmn2:scriptTask id="UpdateVfModule" name="Update VF Module" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_16</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_14</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* def puvm= new PrepareUpdateAAIVfModule() puvm.updateVfModule(execution)]]></bpmn2:script> </bpmn2:scriptTask> @@ -109,7 +109,7 @@ puvm.updateVfModule(execution)]]></bpmn2:script> <bpmn2:scriptTask id="ProcessReceivedRequest" name="Process Received Request" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_38</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* def puvm= new PrepareUpdateAAIVfModule() puvm.preProcessRequest(execution)]]></bpmn2:script> </bpmn2:scriptTask> diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/ReceiveWorkflowMessage.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/ReceiveWorkflowMessage.bpmn index abae950134..f19e3fc10f 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/ReceiveWorkflowMessage.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/ReceiveWorkflowMessage.bpmn @@ -4,7 +4,7 @@ <bpmn2:scriptTask id="ScriptTask_1" name="Pre-Process Request" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_9</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_1ps0nzi</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* def receiveWorkflowMessage = new ReceiveWorkflowMessage() receiveWorkflowMessage .preProcessRequest(execution) ]]></bpmn2:script> @@ -16,7 +16,7 @@ receiveWorkflowMessage .preProcessRequest(execution) <bpmn2:scriptTask id="ScriptTask_5" name="Workflow Exception (timeout)" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_27</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_34</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* def exceptionUtil = new ExceptionUtil() exceptionUtil.buildWorkflowException(execution, 7010, "Receive Workflow Message Timeout Error")]]></bpmn2:script> </bpmn2:scriptTask> @@ -28,7 +28,7 @@ exceptionUtil.buildWorkflowException(execution, 7010, "Receive Workflow Message <bpmn2:scriptTask id="ScriptTask_setSuccess" name="Process Message and Set WorkflowResult" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_44</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* def receiveWorkflowMessage = new ReceiveWorkflowMessage() receiveWorkflowMessage.processReceivedMessage(execution)]]></bpmn2:script> </bpmn2:scriptTask> diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/SDNCAdapterRestV1.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/SDNCAdapterRestV1.bpmn index c52612bb95..7a9a7f8308 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/SDNCAdapterRestV1.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/SDNCAdapterRestV1.bpmn @@ -1,34 +1,34 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_GraPIIyxEeWmdMDkx6Uftw" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="_GraPIIyxEeWmdMDkx6Uftw" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.13.1" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> <bpmn2:process id="SDNCAdapterRestV1" name="SDNCAdapterRestV1" isExecutable="true"> <bpmn2:scriptTask id="ScriptTask_2" name="Log Response" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_3</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_14</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script>import org.onap.so.bpmn.common.scripts.* def sdncAdapterRestV1 = new SDNCAdapterRestV1() def statusCode = execution.getVariable('SDNCREST_sdncAdapterStatusCode') String response = String.valueOf(execution.getVariable('SDNCREST_sdncAdapterResponse')) def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') def processKey = sdncAdapterRestV1.getProcessKey(execution) sdncAdapterRestV1.logDebug(processKey + " received response from SDNCAdapter: statusCode=" + statusCode + - " response=" + (response.isEmpty() ? "" : "\n") + response, isDebugLogEnabled)]]></bpmn2:script> + " response=" + (response.isEmpty() ? "" : "\n") + response, isDebugLogEnabled)</bpmn2:script> </bpmn2:scriptTask> <bpmn2:scriptTask id="ScriptTask_3" name="Workflow Exception (no connection)" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_17</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_35</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script>import org.onap.so.bpmn.common.scripts.* def exceptionUtil = new ExceptionUtil() -exceptionUtil.buildWorkflowException(execution, 5300, "Failed to communicate with SDNCAdapter")]]></bpmn2:script> +exceptionUtil.buildWorkflowException(execution, 5300, "Failed to communicate with SDNCAdapter")</bpmn2:script> </bpmn2:scriptTask> <bpmn2:scriptTask id="ScriptTask_4" name="Workflow Exception (bad response)" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_23</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_36</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script>import org.onap.so.bpmn.common.scripts.* String res = execution.getVariable('SDNCREST_sdncAdapterResponse') def sdncAdapterRestV1 = new SDNCAdapterRestV1() -sdncAdapterRestV1.sdncAdapterBuildWorkflowException(execution, res)]]></bpmn2:script> +sdncAdapterRestV1.sdncAdapterBuildWorkflowException(execution, res)</bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_14" name="" sourceRef="ScriptTask_2" targetRef="ExclusiveGateway_1" /> <bpmn2:exclusiveGateway id="ExclusiveGateway_1" default="SequenceFlow_23"> @@ -38,11 +38,11 @@ sdncAdapterRestV1.sdncAdapterBuildWorkflowException(execution, res)]]></bpmn2:sc <bpmn2:outgoing>SequenceFlow_24</bpmn2:outgoing> </bpmn2:exclusiveGateway> <bpmn2:sequenceFlow id="SequenceFlow_17" name="404" sourceRef="ExclusiveGateway_1" targetRef="ScriptTask_3"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("SDNCREST_sdncAdapterStatusCode") == '404'}]]></bpmn2:conditionExpression> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression">#{execution.getVariable("SDNCREST_sdncAdapterStatusCode") == '404'}</bpmn2:conditionExpression> </bpmn2:sequenceFlow> <bpmn2:sequenceFlow id="SequenceFlow_23" name="other" sourceRef="ExclusiveGateway_1" targetRef="ScriptTask_4" /> <bpmn2:sequenceFlow id="SequenceFlow_24" name="2xx" sourceRef="ExclusiveGateway_1" targetRef="SubProcess_2"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("SDNCREST_sdncAdapterStatusCode") == '200' || execution.getVariable("SDNCREST_sdncAdapterStatusCode") == '202'}]]></bpmn2:conditionExpression> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression">#{execution.getVariable("SDNCREST_sdncAdapterStatusCode") == '200' || execution.getVariable("SDNCREST_sdncAdapterStatusCode") == '202'}</bpmn2:conditionExpression> </bpmn2:sequenceFlow> <bpmn2:sequenceFlow id="SequenceFlow_35" name="" sourceRef="ScriptTask_3" targetRef="EndEvent_9" /> <bpmn2:endEvent id="EndEvent_9"> @@ -57,18 +57,18 @@ sdncAdapterRestV1.sdncAdapterBuildWorkflowException(execution, res)]]></bpmn2:sc <bpmn2:scriptTask id="ScriptTask_7" name="Send Request to SDNC Adapter" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_3</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script>import org.onap.so.bpmn.common.scripts.* def sdncAdapterRestV1 = new SDNCAdapterRestV1() -sdncAdapterRestV1.sendRequestToSDNCAdapter(execution)]]></bpmn2:script> +sdncAdapterRestV1.sendRequestToSDNCAdapter(execution)</bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_3" name="" sourceRef="ScriptTask_7" targetRef="ScriptTask_2" /> <bpmn2:scriptTask id="ScriptTask_1" name="Pre-Process Request" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_9</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_2</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script>import org.onap.so.bpmn.common.scripts.* def sdncAdapterRestV1 = new SDNCAdapterRestV1() sdncAdapterRestV1.preProcessRequest(execution) -]]></bpmn2:script> +</bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="ScriptTask_1" targetRef="ScriptTask_7" /> <bpmn2:startEvent id="StartEvent_1" name="Start"> @@ -78,9 +78,9 @@ sdncAdapterRestV1.preProcessRequest(execution) <bpmn2:scriptTask id="ScriptTask_5" name="Workflow Exception (timeout)" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_27</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_34</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script>import org.onap.so.bpmn.common.scripts.* def exceptionUtil = new ExceptionUtil() -exceptionUtil.buildWorkflowException(execution, 5320, "SDNCAdapter Callback Timeout Error")]]></bpmn2:script> +exceptionUtil.buildWorkflowException(execution, 5320, "SDNCAdapter Callback Timeout Error")</bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_34" name="" sourceRef="ScriptTask_5" targetRef="EndEvent_8" /> <bpmn2:endEvent id="EndEvent_8"> @@ -90,10 +90,10 @@ exceptionUtil.buildWorkflowException(execution, 5320, "SDNCAdapter Callback Time <bpmn2:scriptTask id="ScriptTask_setSuccess" name="Set Success Indicator and WorkflowResponse" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_44</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script>import org.onap.so.bpmn.common.scripts.* def sdncAdapterRestV1 = new SDNCAdapterRestV1() sdncAdapterRestV1.setSuccessIndicator(execution, true) -execution.setVariable('WorkflowResponse', sdncAdapterRestV1.getLastCallback(execution))]]></bpmn2:script> +execution.setVariable('WorkflowResponse', sdncAdapterRestV1.getLastCallback(execution))</bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="ScriptTask_setSuccess" targetRef="EndEvent_6" /> <bpmn2:endEvent id="EndEvent_6" name="End"> @@ -106,15 +106,15 @@ execution.setVariable('WorkflowResponse', sdncAdapterRestV1.getLastCallback(exec </bpmn2:timerEventDefinition> </bpmn2:boundaryEvent> <bpmn2:sequenceFlow id="SequenceFlow_27" name="" sourceRef="BoundaryEvent_1" targetRef="ScriptTask_5" /> - <bpmn2:subProcess id="SubProcess_2" name="Wait for Callbacks"> + <bpmn2:subProcess id="SubProcess_2" name="Wait for Callbacks" camunda:asyncAfter="true"> <bpmn2:incoming>SequenceFlow_24</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_44</bpmn2:outgoing> <bpmn2:scriptTask id="ScriptTask_6" name="Process Callback" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_41</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_42</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script>import org.onap.so.bpmn.common.scripts.* def sdncAdapterRestV1 = new SDNCAdapterRestV1() -sdncAdapterRestV1.processCallback(execution)]]></bpmn2:script> +sdncAdapterRestV1.processCallback(execution)</bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_42" name="" sourceRef="ScriptTask_6" targetRef="ExclusiveGateway_3" /> <bpmn2:startEvent id="StartEvent_3"> @@ -127,7 +127,7 @@ sdncAdapterRestV1.processCallback(execution)]]></bpmn2:script> <bpmn2:outgoing>SequenceFlow_43</bpmn2:outgoing> </bpmn2:exclusiveGateway> <bpmn2:sequenceFlow id="SequenceFlow_39" name="Y" sourceRef="ExclusiveGateway_7" targetRef="EndEvent_12"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable('SDNCREST_ackFinalIndicator')=="Y"}]]></bpmn2:conditionExpression> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression">#{execution.getVariable('SDNCREST_ackFinalIndicator')=="Y"}</bpmn2:conditionExpression> </bpmn2:sequenceFlow> <bpmn2:sequenceFlow id="SequenceFlow_43" name="N" sourceRef="ExclusiveGateway_7" targetRef="IntermediateCatchEvent_1" /> <bpmn2:exclusiveGateway id="ExclusiveGateway_3" name="Callback
Exception?" default="SequenceFlow_30"> @@ -136,7 +136,7 @@ sdncAdapterRestV1.processCallback(execution)]]></bpmn2:script> <bpmn2:outgoing>SequenceFlow_30</bpmn2:outgoing> </bpmn2:exclusiveGateway> <bpmn2:sequenceFlow id="SequenceFlow_8" name="yes" sourceRef="ExclusiveGateway_3" targetRef="EndEvent_3"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("WorkflowException") != null}]]></bpmn2:conditionExpression> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression">#{execution.getVariable("WorkflowException") != null}</bpmn2:conditionExpression> </bpmn2:sequenceFlow> <bpmn2:sequenceFlow id="SequenceFlow_30" name="no" sourceRef="ExclusiveGateway_3" targetRef="ExclusiveGateway_7" /> <bpmn2:intermediateCatchEvent id="IntermediateCatchEvent_1" name="Catch Event"> @@ -164,10 +164,10 @@ sdncAdapterRestV1.processCallback(execution)]]></bpmn2:script> <bpmn2:scriptTask id="ScriptTask_8" name="Process Error" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_4</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_11</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script>import org.onap.so.bpmn.common.scripts.* def exUtil = new ExceptionUtil() exUtil.processSubflowsBPMNException(execution) -]]></bpmn2:script> +</bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_11" name="" sourceRef="ScriptTask_8" targetRef="EndEvent_2" /> <bpmn2:endEvent id="EndEvent_2"> @@ -219,8 +219,8 @@ exUtil.processSubflowsBPMNException(execution) <dc:Bounds x="744" y="24" width="97" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="SequenceFlow_9" sourceElement="_BPMNShape_StartEvent_54" targetElement="_BPMNShape_ScriptTask_56"> - <di:waypoint xsi:type="dc:Point" x="166" y="188" /> - <di:waypoint xsi:type="dc:Point" x="204" y="188" /> + <di:waypoint x="166" y="188" /> + <di:waypoint x="204" y="188" /> <bpmndi:BPMNLabel> <dc:Bounds x="176" y="188" width="6" height="6" /> </bpmndi:BPMNLabel> @@ -232,33 +232,33 @@ exUtil.processSubflowsBPMNException(execution) </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_18" bpmnElement="SequenceFlow_14" sourceElement="_BPMNShape_ScriptTask_79" targetElement="_BPMNShape_ExclusiveGateway_105"> - <di:waypoint xsi:type="dc:Point" x="592" y="188" /> - <di:waypoint xsi:type="dc:Point" x="624" y="187" /> + <di:waypoint x="592" y="188" /> + <di:waypoint x="624" y="187" /> <bpmndi:BPMNLabel> <dc:Bounds x="611" y="187" width="6" height="6" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_19" bpmnElement="SequenceFlow_17" sourceElement="_BPMNShape_ExclusiveGateway_105" targetElement="_BPMNShape_ScriptTask_168"> - <di:waypoint xsi:type="dc:Point" x="649" y="162" /> - <di:waypoint xsi:type="dc:Point" x="649" y="64" /> - <di:waypoint xsi:type="dc:Point" x="744" y="64" /> + <di:waypoint x="649" y="162" /> + <di:waypoint x="649" y="64" /> + <di:waypoint x="744" y="64" /> <bpmndi:BPMNLabel> <dc:Bounds x="688" y="64" width="27" height="22" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_20" bpmnElement="SequenceFlow_23" sourceElement="_BPMNShape_ExclusiveGateway_105" targetElement="_BPMNShape_ScriptTask_78"> - <di:waypoint xsi:type="dc:Point" x="674" y="187" /> - <di:waypoint xsi:type="dc:Point" x="709" y="187" /> - <di:waypoint xsi:type="dc:Point" x="709" y="188" /> - <di:waypoint xsi:type="dc:Point" x="744" y="188" /> + <di:waypoint x="674" y="187" /> + <di:waypoint x="709" y="187" /> + <di:waypoint x="709" y="188" /> + <di:waypoint x="744" y="188" /> <bpmndi:BPMNLabel> <dc:Bounds x="684" y="188" width="35" height="22" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_25" bpmnElement="SequenceFlow_24" sourceElement="_BPMNShape_ExclusiveGateway_105" targetElement="_BPMNShape_SubProcess_14"> - <di:waypoint xsi:type="dc:Point" x="649" y="212" /> - <di:waypoint xsi:type="dc:Point" x="649" y="443" /> - <di:waypoint xsi:type="dc:Point" x="744" y="443" /> + <di:waypoint x="649" y="212" /> + <di:waypoint x="649" y="443" /> + <di:waypoint x="744" y="443" /> <bpmndi:BPMNLabel> <dc:Bounds x="689" y="443" width="18" height="12" /> </bpmndi:BPMNLabel> @@ -270,16 +270,16 @@ exUtil.processSubflowsBPMNException(execution) </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_27" bpmnElement="SequenceFlow_25" sourceElement="_BPMNShape_StartEvent_55" targetElement="_BPMNShape_IntermediateCatchEvent_20"> - <di:waypoint xsi:type="dc:Point" x="812" y="444" /> - <di:waypoint xsi:type="dc:Point" x="871" y="444" /> + <di:waypoint x="812" y="444" /> + <di:waypoint x="871" y="444" /> <bpmndi:BPMNLabel> <dc:Bounds x="1074" y="442" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_29" bpmnElement="SequenceFlow_27" sourceElement="_BPMNShape_BoundaryEvent_24" targetElement="_BPMNShape_ScriptTask_59"> - <di:waypoint xsi:type="dc:Point" x="1318" y="601" /> - <di:waypoint xsi:type="dc:Point" x="1318" y="664" /> - <di:waypoint xsi:type="dc:Point" x="1418" y="664" /> + <di:waypoint x="1318" y="601" /> + <di:waypoint x="1318" y="664" /> + <di:waypoint x="1418" y="664" /> <bpmndi:BPMNLabel> <dc:Bounds x="1153" y="655" width="0" height="0" /> </bpmndi:BPMNLabel> @@ -297,8 +297,8 @@ exUtil.processSubflowsBPMNException(execution) </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_36" bpmnElement="SequenceFlow_34" sourceElement="_BPMNShape_ScriptTask_59" targetElement="_BPMNShape_EndEvent_160"> - <di:waypoint xsi:type="dc:Point" x="1518" y="664" /> - <di:waypoint xsi:type="dc:Point" x="1562" y="664" /> + <di:waypoint x="1518" y="664" /> + <di:waypoint x="1562" y="664" /> <bpmndi:BPMNLabel> <dc:Bounds x="1542" y="664" width="6" height="6" /> </bpmndi:BPMNLabel> @@ -310,8 +310,8 @@ exUtil.processSubflowsBPMNException(execution) </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_37" bpmnElement="SequenceFlow_35" sourceElement="_BPMNShape_ScriptTask_168" targetElement="_BPMNShape_EndEvent_161"> - <di:waypoint xsi:type="dc:Point" x="840" y="64" /> - <di:waypoint xsi:type="dc:Point" x="891" y="64" /> + <di:waypoint x="840" y="64" /> + <di:waypoint x="891" y="64" /> <bpmndi:BPMNLabel> <dc:Bounds x="865" y="64" width="6" height="6" /> </bpmndi:BPMNLabel> @@ -323,15 +323,15 @@ exUtil.processSubflowsBPMNException(execution) </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_38" bpmnElement="SequenceFlow_36" sourceElement="_BPMNShape_ScriptTask_78" targetElement="_BPMNShape_EndEvent_162"> - <di:waypoint xsi:type="dc:Point" x="840" y="188" /> - <di:waypoint xsi:type="dc:Point" x="892" y="188" /> + <di:waypoint x="840" y="188" /> + <di:waypoint x="892" y="188" /> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_236" bpmnElement="ScriptTask_setSuccess"> <dc:Bounds x="1419" y="401" width="97" height="83" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_ScriptTask_236" targetElement="_BPMNShape_EndEvent_158"> - <di:waypoint xsi:type="dc:Point" x="1515" y="442" /> - <di:waypoint xsi:type="dc:Point" x="1562" y="443" /> + <di:waypoint x="1515" y="442" /> + <di:waypoint x="1562" y="443" /> <bpmndi:BPMNLabel> <dc:Bounds x="1548" y="443" width="6" height="6" /> </bpmndi:BPMNLabel> @@ -340,19 +340,19 @@ exUtil.processSubflowsBPMNException(execution) <dc:Bounds x="360" y="146" width="97" height="83" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_ScriptTask_56" targetElement="_BPMNShape_ScriptTask_237"> - <di:waypoint xsi:type="dc:Point" x="304" y="188" /> - <di:waypoint xsi:type="dc:Point" x="344" y="188" /> - <di:waypoint xsi:type="dc:Point" x="344" y="187" /> - <di:waypoint xsi:type="dc:Point" x="360" y="187" /> + <di:waypoint x="304" y="188" /> + <di:waypoint x="344" y="188" /> + <di:waypoint x="344" y="187" /> + <di:waypoint x="360" y="187" /> <bpmndi:BPMNLabel> <dc:Bounds x="317" y="188" width="6" height="6" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_4" bpmnElement="SequenceFlow_3" sourceElement="_BPMNShape_ScriptTask_237" targetElement="_BPMNShape_ScriptTask_79"> - <di:waypoint xsi:type="dc:Point" x="456" y="187" /> - <di:waypoint xsi:type="dc:Point" x="474" y="187" /> - <di:waypoint xsi:type="dc:Point" x="474" y="188" /> - <di:waypoint xsi:type="dc:Point" x="492" y="188" /> + <di:waypoint x="456" y="187" /> + <di:waypoint x="474" y="187" /> + <di:waypoint x="474" y="188" /> + <di:waypoint x="492" y="188" /> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="_BPMNShape_SubProcess_24" bpmnElement="SubProcess_1" isExpanded="true"> <dc:Bounds x="156" y="516" width="382" height="181" /> @@ -367,8 +367,8 @@ exUtil.processSubflowsBPMNException(execution) <dc:Bounds x="302" y="565" width="97" height="83" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_5" bpmnElement="SequenceFlow_4" sourceElement="_BPMNShape_StartEvent_66" targetElement="_BPMNShape_ScriptTask_266"> - <di:waypoint xsi:type="dc:Point" x="240" y="607" /> - <di:waypoint xsi:type="dc:Point" x="302" y="606" /> + <di:waypoint x="240" y="607" /> + <di:waypoint x="302" y="606" /> <bpmndi:BPMNLabel> <dc:Bounds x="280" y="630" width="6" height="6" /> </bpmndi:BPMNLabel> @@ -386,8 +386,8 @@ exUtil.processSubflowsBPMNException(execution) </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_9" bpmnElement="SequenceFlow_8" sourceElement="_BPMNShape_ExclusiveGateway_107" targetElement="_BPMNShape_EndEvent_215"> - <di:waypoint xsi:type="dc:Point" x="1117" y="468" /> - <di:waypoint xsi:type="dc:Point" x="1118" y="516" /> + <di:waypoint x="1117" y="468" /> + <di:waypoint x="1118" y="516" /> <bpmndi:BPMNLabel> <dc:Bounds x="1122" y="468" width="18" height="12" /> </bpmndi:BPMNLabel> @@ -399,22 +399,22 @@ exUtil.processSubflowsBPMNException(execution) </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_26" bpmnElement="SequenceFlow_30" sourceElement="_BPMNShape_ExclusiveGateway_107" targetElement="_BPMNShape_ExclusiveGateway_111"> - <di:waypoint xsi:type="dc:Point" x="1142" y="443" /> - <di:waypoint xsi:type="dc:Point" x="1204" y="443" /> + <di:waypoint x="1142" y="443" /> + <di:waypoint x="1204" y="443" /> <bpmndi:BPMNLabel> <dc:Bounds x="1156" y="443" width="12" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_39" bpmnElement="SequenceFlow_39" sourceElement="_BPMNShape_ExclusiveGateway_111" targetElement="_BPMNShape_EndEvent_219"> - <di:waypoint xsi:type="dc:Point" x="1254" y="443" /> - <di:waypoint xsi:type="dc:Point" x="1308" y="444" /> + <di:waypoint x="1254" y="443" /> + <di:waypoint x="1308" y="444" /> <bpmndi:BPMNLabel> <dc:Bounds x="1276" y="418" width="7" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_41" bpmnElement="SequenceFlow_41" sourceElement="_BPMNShape_IntermediateCatchEvent_20" targetElement="_BPMNShape_ScriptTask_58"> - <di:waypoint xsi:type="dc:Point" x="907" y="444" /> - <di:waypoint xsi:type="dc:Point" x="948" y="444" /> + <di:waypoint x="907" y="444" /> + <di:waypoint x="948" y="444" /> <bpmndi:BPMNLabel> <dc:Bounds x="763" y="475" width="0" height="0" /> </bpmndi:BPMNLabel> @@ -426,28 +426,28 @@ exUtil.processSubflowsBPMNException(execution) </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_42" bpmnElement="SequenceFlow_42" sourceElement="_BPMNShape_ScriptTask_58" targetElement="_BPMNShape_ExclusiveGateway_107"> - <di:waypoint xsi:type="dc:Point" x="1048" y="444" /> - <di:waypoint xsi:type="dc:Point" x="1070" y="444" /> - <di:waypoint xsi:type="dc:Point" x="1070" y="443" /> - <di:waypoint xsi:type="dc:Point" x="1092" y="443" /> + <di:waypoint x="1048" y="444" /> + <di:waypoint x="1070" y="444" /> + <di:waypoint x="1070" y="443" /> + <di:waypoint x="1092" y="443" /> <bpmndi:BPMNLabel> <dc:Bounds x="905" y="462" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_43" bpmnElement="SequenceFlow_43" sourceElement="_BPMNShape_ExclusiveGateway_111" targetElement="_BPMNShape_IntermediateCatchEvent_20"> - <di:waypoint xsi:type="dc:Point" x="1229" y="418" /> - <di:waypoint xsi:type="dc:Point" x="1229" y="351" /> - <di:waypoint xsi:type="dc:Point" x="889" y="351" /> - <di:waypoint xsi:type="dc:Point" x="889" y="426" /> + <di:waypoint x="1229" y="418" /> + <di:waypoint x="1229" y="351" /> + <di:waypoint x="889" y="351" /> + <di:waypoint x="889" y="426" /> <bpmndi:BPMNLabel> <dc:Bounds x="1240" y="360" width="8" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_44" bpmnElement="SequenceFlow_44" sourceElement="_BPMNShape_SubProcess_14" targetElement="_BPMNShape_ScriptTask_236"> - <di:waypoint xsi:type="dc:Point" x="1372" y="443" /> - <di:waypoint xsi:type="dc:Point" x="1395" y="443" /> - <di:waypoint xsi:type="dc:Point" x="1395" y="442" /> - <di:waypoint xsi:type="dc:Point" x="1419" y="442" /> + <di:waypoint x="1372" y="443" /> + <di:waypoint x="1395" y="443" /> + <di:waypoint x="1395" y="442" /> + <di:waypoint x="1419" y="442" /> <bpmndi:BPMNLabel> <dc:Bounds x="1404" y="462" width="0" height="0" /> </bpmndi:BPMNLabel> @@ -459,8 +459,8 @@ exUtil.processSubflowsBPMNException(execution) </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_11" bpmnElement="SequenceFlow_11" sourceElement="_BPMNShape_ScriptTask_266" targetElement="_BPMNShape_EndEvent_220"> - <di:waypoint xsi:type="dc:Point" x="398" y="606" /> - <di:waypoint xsi:type="dc:Point" x="444" y="607" /> + <di:waypoint x="398" y="606" /> + <di:waypoint x="444" y="607" /> <bpmndi:BPMNLabel> <dc:Bounds x="412" y="606" width="6" height="6" /> </bpmndi:BPMNLabel> diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/SDNCAdapterRestV2.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/SDNCAdapterRestV2.bpmn index 68afc9ae5a..cee6e43f93 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/SDNCAdapterRestV2.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/SDNCAdapterRestV2.bpmn @@ -1,35 +1,35 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="_GraPIIyxEeWmdMDkx6Uftw" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="_GraPIIyxEeWmdMDkx6Uftw" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.13.1" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> <bpmn2:process id="SDNCAdapterRestV2" name="SDNCAdapterRestV2" isExecutable="true"> <bpmn2:documentation>This version of SDNCAdapterRest allows for interim notifications to be sent for any non-final response received from SDNC.</bpmn2:documentation> <bpmn2:scriptTask id="ScriptTask_2" name="Log Response" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_3</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_14</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script>import org.onap.so.bpmn.common.scripts.* def sdncAdapterRestV2 = new SDNCAdapterRestV2() def statusCode = execution.getVariable('SDNCREST_sdncAdapterStatusCode') String response = String.valueOf(execution.getVariable('SDNCREST_sdncAdapterResponse')) def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') def processKey = sdncAdapterRestV2.getProcessKey(execution) sdncAdapterRestV2.logDebug(processKey + " received response from SDNCAdapter: statusCode=" + statusCode + - " response=" + (response.isEmpty() ? "" : "\n") + response, isDebugLogEnabled)]]></bpmn2:script> + " response=" + (response.isEmpty() ? "" : "\n") + response, isDebugLogEnabled)</bpmn2:script> </bpmn2:scriptTask> <bpmn2:scriptTask id="ScriptTask_3" name="Workflow Exception (no connection)" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_17</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_35</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script>import org.onap.so.bpmn.common.scripts.* def exceptionUtil = new ExceptionUtil() -exceptionUtil.buildWorkflowException(execution, 5300, "Failed to communicate with SDNCAdapter")]]></bpmn2:script> +exceptionUtil.buildWorkflowException(execution, 5300, "Failed to communicate with SDNCAdapter")</bpmn2:script> </bpmn2:scriptTask> <bpmn2:scriptTask id="ScriptTask_4" name="Workflow Exception (bad response)" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_23</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_36</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script>import org.onap.so.bpmn.common.scripts.* String res = execution.getVariable('SDNCREST_sdncAdapterResponse') def sdncAdapterRestV2 = new SDNCAdapterRestV2() -sdncAdapterRestV2.sdncAdapterBuildWorkflowException(execution, res)]]></bpmn2:script> +sdncAdapterRestV2.sdncAdapterBuildWorkflowException(execution, res)</bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_14" name="" sourceRef="ScriptTask_2" targetRef="ExclusiveGateway_1" /> <bpmn2:exclusiveGateway id="ExclusiveGateway_1" default="SequenceFlow_23"> @@ -39,11 +39,11 @@ sdncAdapterRestV2.sdncAdapterBuildWorkflowException(execution, res)]]></bpmn2:sc <bpmn2:outgoing>SequenceFlow_24</bpmn2:outgoing> </bpmn2:exclusiveGateway> <bpmn2:sequenceFlow id="SequenceFlow_17" name="404" sourceRef="ExclusiveGateway_1" targetRef="ScriptTask_3"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("SDNCREST_sdncAdapterStatusCode") == '404'}]]></bpmn2:conditionExpression> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression">#{execution.getVariable("SDNCREST_sdncAdapterStatusCode") == '404'}</bpmn2:conditionExpression> </bpmn2:sequenceFlow> <bpmn2:sequenceFlow id="SequenceFlow_23" name="other" sourceRef="ExclusiveGateway_1" targetRef="ScriptTask_4" /> <bpmn2:sequenceFlow id="SequenceFlow_24" name="2xx" sourceRef="ExclusiveGateway_1" targetRef="SubProcess_2"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("SDNCREST_sdncAdapterStatusCode") == '200' || execution.getVariable("SDNCREST_sdncAdapterStatusCode") == '202'}]]></bpmn2:conditionExpression> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression">#{execution.getVariable("SDNCREST_sdncAdapterStatusCode") == '200' || execution.getVariable("SDNCREST_sdncAdapterStatusCode") == '202'}</bpmn2:conditionExpression> </bpmn2:sequenceFlow> <bpmn2:sequenceFlow id="SequenceFlow_35" name="" sourceRef="ScriptTask_3" targetRef="EndEvent_9" /> <bpmn2:endEvent id="EndEvent_9"> @@ -58,18 +58,18 @@ sdncAdapterRestV2.sdncAdapterBuildWorkflowException(execution, res)]]></bpmn2:sc <bpmn2:scriptTask id="ScriptTask_7" name="Send Request to SDNC Adapter" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_3</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script>import org.onap.so.bpmn.common.scripts.* def sdncAdapterRestV2 = new SDNCAdapterRestV2() -sdncAdapterRestV2.sendRequestToSDNCAdapter(execution)]]></bpmn2:script> +sdncAdapterRestV2.sendRequestToSDNCAdapter(execution)</bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_3" name="" sourceRef="ScriptTask_7" targetRef="ScriptTask_2" /> <bpmn2:scriptTask id="ScriptTask_1" name="Pre-Process Request" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_9</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_2</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script>import org.onap.so.bpmn.common.scripts.* def sdncAdapterRestV2 = new SDNCAdapterRestV2() sdncAdapterRestV2.preProcessRequest(execution) -]]></bpmn2:script> +</bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="ScriptTask_1" targetRef="ScriptTask_7" /> <bpmn2:startEvent id="StartEvent_1" name="Start"> @@ -79,9 +79,9 @@ sdncAdapterRestV2.preProcessRequest(execution) <bpmn2:scriptTask id="ScriptTask_5" name="Workflow Exception (timeout)" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_27</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_34</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script>import org.onap.so.bpmn.common.scripts.* def exceptionUtil = new ExceptionUtil() -exceptionUtil.buildWorkflowException(execution, 5320, "SDNCAdapter Callback Timeout Error")]]></bpmn2:script> +exceptionUtil.buildWorkflowException(execution, 5320, "SDNCAdapter Callback Timeout Error")</bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_34" name="" sourceRef="ScriptTask_5" targetRef="EndEvent_8" /> <bpmn2:endEvent id="EndEvent_8"> @@ -91,10 +91,10 @@ exceptionUtil.buildWorkflowException(execution, 5320, "SDNCAdapter Callback Time <bpmn2:scriptTask id="ScriptTask_setSuccess" name="Set Success Indicator and WorkflowResponse" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_44</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script>import org.onap.so.bpmn.common.scripts.* def sdncAdapterRestV2 = new SDNCAdapterRestV2() sdncAdapterRestV2.setSuccessIndicator(execution, true) -execution.setVariable('WorkflowResponse', sdncAdapterRestV2.getLastCallback(execution))]]></bpmn2:script> +execution.setVariable('WorkflowResponse', sdncAdapterRestV2.getLastCallback(execution))</bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="ScriptTask_setSuccess" targetRef="EndEvent_6" /> <bpmn2:endEvent id="EndEvent_6" name="End"> @@ -107,15 +107,15 @@ execution.setVariable('WorkflowResponse', sdncAdapterRestV2.getLastCallback(exec </bpmn2:timerEventDefinition> </bpmn2:boundaryEvent> <bpmn2:sequenceFlow id="SequenceFlow_27" name="" sourceRef="BoundaryEvent_1" targetRef="ScriptTask_5" /> - <bpmn2:subProcess id="SubProcess_2" name="Wait for Callbacks"> + <bpmn2:subProcess id="SubProcess_2" name="Wait for Callbacks" camunda:asyncAfter="true"> <bpmn2:incoming>SequenceFlow_24</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_44</bpmn2:outgoing> <bpmn2:scriptTask id="ScriptTask_6" name="Process Callback" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_41</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_42</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script>import org.onap.so.bpmn.common.scripts.* def sdncAdapterRestV2 = new SDNCAdapterRestV2() -sdncAdapterRestV2.processCallback(execution)]]></bpmn2:script> +sdncAdapterRestV2.processCallback(execution)</bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_42" name="" sourceRef="ScriptTask_6" targetRef="ExclusiveGateway_3" /> <bpmn2:startEvent id="StartEvent_3"> @@ -128,7 +128,7 @@ sdncAdapterRestV2.processCallback(execution)]]></bpmn2:script> <bpmn2:outgoing>SequenceFlow_43</bpmn2:outgoing> </bpmn2:exclusiveGateway> <bpmn2:sequenceFlow id="SequenceFlow_39" name="Y" sourceRef="ExclusiveGateway_7" targetRef="EndEvent_12"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable('SDNCREST_ackFinalIndicator')=="Y"}]]></bpmn2:conditionExpression> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression">#{execution.getVariable('SDNCREST_ackFinalIndicator')=="Y"}</bpmn2:conditionExpression> </bpmn2:sequenceFlow> <bpmn2:sequenceFlow id="SequenceFlow_43" name="N" sourceRef="ExclusiveGateway_7" targetRef="ExclusiveGateway_1611bnb" /> <bpmn2:exclusiveGateway id="ExclusiveGateway_3" name="Callback Exception?" default="SequenceFlow_30"> @@ -137,7 +137,7 @@ sdncAdapterRestV2.processCallback(execution)]]></bpmn2:script> <bpmn2:outgoing>SequenceFlow_30</bpmn2:outgoing> </bpmn2:exclusiveGateway> <bpmn2:sequenceFlow id="SequenceFlow_8" name="yes" sourceRef="ExclusiveGateway_3" targetRef="EndEvent_3"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("WorkflowException") != null}]]></bpmn2:conditionExpression> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression">#{execution.getVariable("WorkflowException") != null}</bpmn2:conditionExpression> </bpmn2:sequenceFlow> <bpmn2:sequenceFlow id="SequenceFlow_30" name="no" sourceRef="ExclusiveGateway_3" targetRef="ExclusiveGateway_7" /> <bpmn2:intermediateCatchEvent id="IntermediateCatchEvent_1" name="Catch Event"> @@ -163,17 +163,17 @@ sdncAdapterRestV2.processCallback(execution)]]></bpmn2:script> <bpmn2:scriptTask id="Task_0pe8nq9" name="Prepare Interim Notification" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_1g8pswz</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0my3p6y</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script>import org.onap.so.bpmn.common.scripts.* def sdncAdapterRestV2 = new SDNCAdapterRestV2() -sdncAdapterRestV2.prepareInterimNotification(execution)]]></bpmn2:script> +sdncAdapterRestV2.prepareInterimNotification(execution)</bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_0u48ihb" name="N" sourceRef="ExclusiveGateway_1611bnb" targetRef="IntermediateCatchEvent_1" /> <bpmn2:sequenceFlow id="SequenceFlow_1g8pswz" name="Y" sourceRef="ExclusiveGateway_1611bnb" targetRef="Task_0pe8nq9"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("SDNCREST_doInterimNotification") != null && execution.getVariable("SDNCREST_doInterimNotification") == true}]]></bpmn2:conditionExpression> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression">#{execution.getVariable("SDNCREST_doInterimNotification") != null && execution.getVariable("SDNCREST_doInterimNotification") == true}</bpmn2:conditionExpression> </bpmn2:sequenceFlow> <bpmn2:sequenceFlow id="SequenceFlow_0my3p6y" sourceRef="Task_0pe8nq9" targetRef="Task_1ashvem" /> <bpmn2:sequenceFlow id="SequenceFlow_0vluoaq" sourceRef="Task_1ashvem" targetRef="IntermediateCatchEvent_1" /> - <bpmn2:callActivity id="Task_1ashvem" name="Call Notification Service" calledElement="${URN_mso_workflow_notification_name}"> + <bpmn2:callActivity id="Task_1ashvem" name="Call Notification Service" calledElement="${UrnPropertiesReader.getVariable("mso.workflow.notification.name", execution)}"> <bpmn2:extensionElements> <camunda:in target="all" variables="all" /> <camunda:out variables="all" /> @@ -192,10 +192,10 @@ sdncAdapterRestV2.prepareInterimNotification(execution)]]></bpmn2:script> <bpmn2:scriptTask id="ScriptTask_8" name="Process Error" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_4</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_11</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script>import org.onap.so.bpmn.common.scripts.* def exUtil = new ExceptionUtil() exUtil.processSubflowsBPMNException(execution) -]]></bpmn2:script> +</bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_11" name="" sourceRef="ScriptTask_8" targetRef="EndEvent_2" /> <bpmn2:endEvent id="EndEvent_2"> @@ -247,8 +247,8 @@ exUtil.processSubflowsBPMNException(execution) <dc:Bounds x="744" y="24" width="97" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="SequenceFlow_9" sourceElement="_BPMNShape_StartEvent_54" targetElement="_BPMNShape_ScriptTask_56"> - <di:waypoint xsi:type="dc:Point" x="166" y="188" /> - <di:waypoint xsi:type="dc:Point" x="204" y="188" /> + <di:waypoint x="166" y="188" /> + <di:waypoint x="204" y="188" /> <bpmndi:BPMNLabel> <dc:Bounds x="176" y="188" width="6" height="6" /> </bpmndi:BPMNLabel> @@ -260,33 +260,33 @@ exUtil.processSubflowsBPMNException(execution) </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_18" bpmnElement="SequenceFlow_14" sourceElement="_BPMNShape_ScriptTask_79" targetElement="_BPMNShape_ExclusiveGateway_105"> - <di:waypoint xsi:type="dc:Point" x="592" y="188" /> - <di:waypoint xsi:type="dc:Point" x="624" y="187" /> + <di:waypoint x="592" y="188" /> + <di:waypoint x="624" y="187" /> <bpmndi:BPMNLabel> <dc:Bounds x="611" y="187" width="6" height="6" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_19" bpmnElement="SequenceFlow_17" sourceElement="_BPMNShape_ExclusiveGateway_105" targetElement="_BPMNShape_ScriptTask_168"> - <di:waypoint xsi:type="dc:Point" x="649" y="162" /> - <di:waypoint xsi:type="dc:Point" x="649" y="64" /> - <di:waypoint xsi:type="dc:Point" x="744" y="64" /> + <di:waypoint x="649" y="162" /> + <di:waypoint x="649" y="64" /> + <di:waypoint x="744" y="64" /> <bpmndi:BPMNLabel> <dc:Bounds x="688" y="64" width="27" height="22" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_20" bpmnElement="SequenceFlow_23" sourceElement="_BPMNShape_ExclusiveGateway_105" targetElement="_BPMNShape_ScriptTask_78"> - <di:waypoint xsi:type="dc:Point" x="674" y="187" /> - <di:waypoint xsi:type="dc:Point" x="709" y="187" /> - <di:waypoint xsi:type="dc:Point" x="709" y="188" /> - <di:waypoint xsi:type="dc:Point" x="744" y="188" /> + <di:waypoint x="674" y="187" /> + <di:waypoint x="709" y="187" /> + <di:waypoint x="709" y="188" /> + <di:waypoint x="744" y="188" /> <bpmndi:BPMNLabel> <dc:Bounds x="684" y="188" width="35" height="22" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_25" bpmnElement="SequenceFlow_24" sourceElement="_BPMNShape_ExclusiveGateway_105" targetElement="_BPMNShape_SubProcess_14"> - <di:waypoint xsi:type="dc:Point" x="649" y="212" /> - <di:waypoint xsi:type="dc:Point" x="649" y="457" /> - <di:waypoint xsi:type="dc:Point" x="745" y="457" /> + <di:waypoint x="649" y="212" /> + <di:waypoint x="649" y="457" /> + <di:waypoint x="745" y="457" /> <bpmndi:BPMNLabel> <dc:Bounds x="691" y="457" width="18" height="12" /> </bpmndi:BPMNLabel> @@ -298,18 +298,18 @@ exUtil.processSubflowsBPMNException(execution) </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_27" bpmnElement="SequenceFlow_25" sourceElement="_BPMNShape_StartEvent_55" targetElement="_BPMNShape_IntermediateCatchEvent_20"> - <di:waypoint xsi:type="dc:Point" x="813" y="534" /> - <di:waypoint xsi:type="dc:Point" x="842" y="534" /> - <di:waypoint xsi:type="dc:Point" x="842" y="534" /> - <di:waypoint xsi:type="dc:Point" x="874" y="534" /> + <di:waypoint x="813" y="534" /> + <di:waypoint x="842" y="534" /> + <di:waypoint x="842" y="534" /> + <di:waypoint x="874" y="534" /> <bpmndi:BPMNLabel> <dc:Bounds x="857" y="534" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_29" bpmnElement="SequenceFlow_27" sourceElement="_BPMNShape_BoundaryEvent_24" targetElement="_BPMNShape_ScriptTask_59"> - <di:waypoint xsi:type="dc:Point" x="1323" y="694" /> - <di:waypoint xsi:type="dc:Point" x="1323" y="766" /> - <di:waypoint xsi:type="dc:Point" x="1418" y="766" /> + <di:waypoint x="1323" y="694" /> + <di:waypoint x="1323" y="766" /> + <di:waypoint x="1418" y="766" /> <bpmndi:BPMNLabel> <dc:Bounds x="1338" y="730" width="0" height="0" /> </bpmndi:BPMNLabel> @@ -327,10 +327,10 @@ exUtil.processSubflowsBPMNException(execution) </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_36" bpmnElement="SequenceFlow_34" sourceElement="_BPMNShape_ScriptTask_59" targetElement="_BPMNShape_EndEvent_160"> - <di:waypoint xsi:type="dc:Point" x="1518" y="766" /> - <di:waypoint xsi:type="dc:Point" x="1540" y="766" /> - <di:waypoint xsi:type="dc:Point" x="1540" y="766" /> - <di:waypoint xsi:type="dc:Point" x="1573" y="766" /> + <di:waypoint x="1518" y="766" /> + <di:waypoint x="1540" y="766" /> + <di:waypoint x="1540" y="766" /> + <di:waypoint x="1573" y="766" /> <bpmndi:BPMNLabel> <dc:Bounds x="1555" y="766" width="0" height="0" /> </bpmndi:BPMNLabel> @@ -342,8 +342,8 @@ exUtil.processSubflowsBPMNException(execution) </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_37" bpmnElement="SequenceFlow_35" sourceElement="_BPMNShape_ScriptTask_168" targetElement="_BPMNShape_EndEvent_161"> - <di:waypoint xsi:type="dc:Point" x="840" y="64" /> - <di:waypoint xsi:type="dc:Point" x="891" y="64" /> + <di:waypoint x="840" y="64" /> + <di:waypoint x="891" y="64" /> <bpmndi:BPMNLabel> <dc:Bounds x="865" y="64" width="6" height="6" /> </bpmndi:BPMNLabel> @@ -355,15 +355,15 @@ exUtil.processSubflowsBPMNException(execution) </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_38" bpmnElement="SequenceFlow_36" sourceElement="_BPMNShape_ScriptTask_78" targetElement="_BPMNShape_EndEvent_162"> - <di:waypoint xsi:type="dc:Point" x="840" y="188" /> - <di:waypoint xsi:type="dc:Point" x="892" y="188" /> + <di:waypoint x="840" y="188" /> + <di:waypoint x="892" y="188" /> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_236" bpmnElement="ScriptTask_setSuccess"> <dc:Bounds x="1455" y="416" width="97" height="83" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_ScriptTask_236" targetElement="_BPMNShape_EndEvent_158"> - <di:waypoint xsi:type="dc:Point" x="1552" y="457" /> - <di:waypoint xsi:type="dc:Point" x="1603" y="458" /> + <di:waypoint x="1552" y="457" /> + <di:waypoint x="1603" y="458" /> <bpmndi:BPMNLabel> <dc:Bounds x="1578" y="442.5" width="0" height="0" /> </bpmndi:BPMNLabel> @@ -372,19 +372,19 @@ exUtil.processSubflowsBPMNException(execution) <dc:Bounds x="360" y="146" width="97" height="83" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_ScriptTask_56" targetElement="_BPMNShape_ScriptTask_237"> - <di:waypoint xsi:type="dc:Point" x="304" y="188" /> - <di:waypoint xsi:type="dc:Point" x="344" y="188" /> - <di:waypoint xsi:type="dc:Point" x="344" y="187" /> - <di:waypoint xsi:type="dc:Point" x="360" y="187" /> + <di:waypoint x="304" y="188" /> + <di:waypoint x="344" y="188" /> + <di:waypoint x="344" y="187" /> + <di:waypoint x="360" y="187" /> <bpmndi:BPMNLabel> <dc:Bounds x="317" y="188" width="6" height="6" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_4" bpmnElement="SequenceFlow_3" sourceElement="_BPMNShape_ScriptTask_237" targetElement="_BPMNShape_ScriptTask_79"> - <di:waypoint xsi:type="dc:Point" x="456" y="187" /> - <di:waypoint xsi:type="dc:Point" x="474" y="187" /> - <di:waypoint xsi:type="dc:Point" x="474" y="188" /> - <di:waypoint xsi:type="dc:Point" x="492" y="188" /> + <di:waypoint x="456" y="187" /> + <di:waypoint x="474" y="187" /> + <di:waypoint x="474" y="188" /> + <di:waypoint x="492" y="188" /> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="_BPMNShape_SubProcess_24" bpmnElement="SubProcess_1" isExpanded="true"> <dc:Bounds x="156" y="516" width="382" height="181" /> @@ -399,8 +399,8 @@ exUtil.processSubflowsBPMNException(execution) <dc:Bounds x="302" y="565" width="97" height="83" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_5" bpmnElement="SequenceFlow_4" sourceElement="_BPMNShape_StartEvent_66" targetElement="_BPMNShape_ScriptTask_266"> - <di:waypoint xsi:type="dc:Point" x="240" y="607" /> - <di:waypoint xsi:type="dc:Point" x="302" y="606" /> + <di:waypoint x="240" y="607" /> + <di:waypoint x="302" y="606" /> <bpmndi:BPMNLabel> <dc:Bounds x="280" y="630" width="6" height="6" /> </bpmndi:BPMNLabel> @@ -418,8 +418,8 @@ exUtil.processSubflowsBPMNException(execution) </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_9" bpmnElement="SequenceFlow_8" sourceElement="_BPMNShape_ExclusiveGateway_107" targetElement="_BPMNShape_EndEvent_215"> - <di:waypoint xsi:type="dc:Point" x="1129" y="558" /> - <di:waypoint xsi:type="dc:Point" x="1130" y="619" /> + <di:waypoint x="1129" y="558" /> + <di:waypoint x="1130" y="619" /> <bpmndi:BPMNLabel> <dc:Bounds x="1135" y="575.0654163104991" width="18" height="12" /> </bpmndi:BPMNLabel> @@ -431,22 +431,22 @@ exUtil.processSubflowsBPMNException(execution) </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_26" bpmnElement="SequenceFlow_30" sourceElement="_BPMNShape_ExclusiveGateway_107" targetElement="_BPMNShape_ExclusiveGateway_111"> - <di:waypoint xsi:type="dc:Point" x="1155" y="534" /> - <di:waypoint xsi:type="dc:Point" x="1205" y="533" /> + <di:waypoint x="1155" y="534" /> + <di:waypoint x="1205" y="533" /> <bpmndi:BPMNLabel> <dc:Bounds x="1166" y="533.6762115651724" width="12" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_39" bpmnElement="SequenceFlow_39" sourceElement="_BPMNShape_ExclusiveGateway_111" targetElement="_BPMNShape_EndEvent_219"> - <di:waypoint xsi:type="dc:Point" x="1255" y="533" /> - <di:waypoint xsi:type="dc:Point" x="1309" y="534" /> + <di:waypoint x="1255" y="533" /> + <di:waypoint x="1309" y="534" /> <bpmndi:BPMNLabel> <dc:Bounds x="1277" y="508" width="7" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_41" bpmnElement="SequenceFlow_41" sourceElement="_BPMNShape_IntermediateCatchEvent_20" targetElement="_BPMNShape_ScriptTask_58"> - <di:waypoint xsi:type="dc:Point" x="910" y="534" /> - <di:waypoint xsi:type="dc:Point" x="949" y="534" /> + <di:waypoint x="910" y="534" /> + <di:waypoint x="949" y="534" /> <bpmndi:BPMNLabel> <dc:Bounds x="930" y="519" width="0" height="0" /> </bpmndi:BPMNLabel> @@ -458,22 +458,22 @@ exUtil.processSubflowsBPMNException(execution) </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_42" bpmnElement="SequenceFlow_42" sourceElement="_BPMNShape_ScriptTask_58" targetElement="_BPMNShape_ExclusiveGateway_107"> - <di:waypoint xsi:type="dc:Point" x="1049" y="534" /> - <di:waypoint xsi:type="dc:Point" x="1105" y="534" /> + <di:waypoint x="1049" y="534" /> + <di:waypoint x="1105" y="534" /> <bpmndi:BPMNLabel> <dc:Bounds x="1077" y="519" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_43" bpmnElement="SequenceFlow_43" sourceElement="_BPMNShape_ExclusiveGateway_111" targetElement="_BPMNShape_IntermediateCatchEvent_20"> - <di:waypoint xsi:type="dc:Point" x="1230" y="508" /> - <di:waypoint xsi:type="dc:Point" x="1230" y="444" /> + <di:waypoint x="1230" y="508" /> + <di:waypoint x="1230" y="444" /> <bpmndi:BPMNLabel> <dc:Bounds x="1236" y="478.9261883440748" width="8" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_44" bpmnElement="SequenceFlow_44" sourceElement="_BPMNShape_SubProcess_14" targetElement="_BPMNShape_ScriptTask_236"> - <di:waypoint xsi:type="dc:Point" x="1378" y="457" /> - <di:waypoint xsi:type="dc:Point" x="1455" y="457" /> + <di:waypoint x="1378" y="457" /> + <di:waypoint x="1455" y="457" /> <bpmndi:BPMNLabel> <dc:Bounds x="1417" y="442" width="0" height="0" /> </bpmndi:BPMNLabel> @@ -485,8 +485,8 @@ exUtil.processSubflowsBPMNException(execution) </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_11" bpmnElement="SequenceFlow_11" sourceElement="_BPMNShape_ScriptTask_266" targetElement="_BPMNShape_EndEvent_220"> - <di:waypoint xsi:type="dc:Point" x="398" y="606" /> - <di:waypoint xsi:type="dc:Point" x="444" y="607" /> + <di:waypoint x="398" y="606" /> + <di:waypoint x="444" y="607" /> <bpmndi:BPMNLabel> <dc:Bounds x="412" y="606" width="6" height="6" /> </bpmndi:BPMNLabel> @@ -501,32 +501,32 @@ exUtil.processSubflowsBPMNException(execution) <dc:Bounds x="1092" y="293" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0u48ihb_di" bpmnElement="SequenceFlow_0u48ihb"> - <di:waypoint xsi:type="dc:Point" x="1205" y="419" /> - <di:waypoint xsi:type="dc:Point" x="892" y="419" /> - <di:waypoint xsi:type="dc:Point" x="892" y="516" /> + <di:waypoint x="1205" y="419" /> + <di:waypoint x="892" y="419" /> + <di:waypoint x="892" y="516" /> <bpmndi:BPMNLabel> <dc:Bounds x="1174" y="402" width="8" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1g8pswz_di" bpmnElement="SequenceFlow_1g8pswz"> - <di:waypoint xsi:type="dc:Point" x="1230" y="394" /> - <di:waypoint xsi:type="dc:Point" x="1230" y="333" /> - <di:waypoint xsi:type="dc:Point" x="1192" y="333" /> + <di:waypoint x="1230" y="394" /> + <di:waypoint x="1230" y="333" /> + <di:waypoint x="1192" y="333" /> <bpmndi:BPMNLabel> <dc:Bounds x="1239" y="364.76190476190476" width="7" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0my3p6y_di" bpmnElement="SequenceFlow_0my3p6y"> - <di:waypoint xsi:type="dc:Point" x="1092" y="333" /> - <di:waypoint xsi:type="dc:Point" x="1039" y="333" /> + <di:waypoint x="1092" y="333" /> + <di:waypoint x="1039" y="333" /> <bpmndi:BPMNLabel> <dc:Bounds x="1066" y="318" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0vluoaq_di" bpmnElement="SequenceFlow_0vluoaq"> - <di:waypoint xsi:type="dc:Point" x="939" y="333" /> - <di:waypoint xsi:type="dc:Point" x="892" y="333" /> - <di:waypoint xsi:type="dc:Point" x="892" y="516" /> + <di:waypoint x="939" y="333" /> + <di:waypoint x="892" y="333" /> + <di:waypoint x="892" y="516" /> <bpmndi:BPMNLabel> <dc:Bounds x="916" y="318" width="0" height="0" /> </bpmndi:BPMNLabel> diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/SDNCAdapterV1.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/SDNCAdapterV1.bpmn index 6a4223d2ad..2ae2ff7f8b 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/SDNCAdapterV1.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/SDNCAdapterV1.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_l2hJ8CccEeW3d--PaFJMbg" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_l2hJ8CccEeW3d--PaFJMbg" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.13.1" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> <bpmn2:process id="sdncAdapter" name="SDNC Adapter" isExecutable="true"> <bpmn2:exclusiveGateway id="isResponseOK" name="is Response Ok?" default="badSynchronousResponse"> <bpmn2:incoming>SequenceFlow_15</bpmn2:incoming> @@ -8,23 +8,23 @@ </bpmn2:exclusiveGateway> <bpmn2:sequenceFlow id="badSynchronousResponse" name="Bad synchronous response" sourceRef="isResponseOK" targetRef="setBadResponse" /> <bpmn2:sequenceFlow id="goodSynchronousResponse" name="Good synchronous response" sourceRef="isResponseOK" targetRef="resetCallbackRequest"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("SDNCA_ResponseCode")=='200'}]]></bpmn2:conditionExpression> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression">#{execution.getVariable("SDNCA_ResponseCode")=='200'}</bpmn2:conditionExpression> </bpmn2:sequenceFlow> <bpmn2:scriptTask id="setBadResponse" name="Set Bad Response Exception" scriptFormat="groovy"> <bpmn2:incoming>badSynchronousResponse</bpmn2:incoming> <bpmn2:outgoing>Exception</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script>import org.onap.so.bpmn.common.scripts.* int responseCode = execution.getVariable("SDNCA_ResponseCode") ExceptionUtil exceptionUtil = new ExceptionUtil() -exceptionUtil.buildWorkflowException(execution, 7000, "Could not communicate with the SDNC Adapter" )]]></bpmn2:script> +exceptionUtil.buildWorkflowException(execution, 7000, "Could not communicate with the SDNC Adapter" )</bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="Exception" name="Exception" sourceRef="setBadResponse" targetRef="badResponseEndFlow" /> <bpmn2:serviceTask id="invokeSDNCAdapter" name="Invoke SDNC Adapter" camunda:asyncAfter="true" camunda:class=""> <bpmn2:extensionElements> <camunda:connector> <camunda:inputOutput> - <camunda:inputParameter name="url">${URN_mso_adapters_sdnc_endpoint}</camunda:inputParameter> + <camunda:inputParameter name="url">${execution.getVariable("mso.adapters.sdnc.endpoint")}</camunda:inputParameter> <camunda:inputParameter name="method">POST</camunda:inputParameter> <camunda:inputParameter name="headers"> <camunda:map> @@ -65,20 +65,20 @@ exceptionUtil.buildWorkflowException(execution, 7000, "Could not communicate wit </bpmn2:extensionElements> <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_8</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script>import org.onap.so.bpmn.common.scripts.* def sdnc= new SDNCAdapter() sdnc.preProcessRequest(execution) -]]></bpmn2:script> +</bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_8" sourceRef="processMessage" targetRef="invokeSDNCAdapter" /> <bpmn2:scriptTask id="returnWorkflowResult" name="Return workflow result" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_9</bpmn2:incoming> <bpmn2:incoming>SequenceFlow_11ah5pw</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_14</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script>import org.onap.so.bpmn.common.scripts.* def sdnc= new SDNCAdapter() sdnc.postProcessResponse(execution) -]]></bpmn2:script> +</bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_14" sourceRef="returnWorkflowResult" targetRef="timeoutError" /> <bpmn2:exclusiveGateway id="timeoutError" name="Did Timeout occur?" default="noTimeoutError"> @@ -88,9 +88,9 @@ sdnc.postProcessResponse(execution) </bpmn2:exclusiveGateway> <bpmn2:sequenceFlow id="noTimeoutError" name="No Timeout" sourceRef="timeoutError" targetRef="ExclusiveGateway_1" /> <bpmn2:sequenceFlow id="SequenceFlow_19" name="Timeout" sourceRef="timeoutError" targetRef="endEventException"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("asynchronousResponseTimeout")==true}]]></bpmn2:conditionExpression> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression">#{execution.getVariable("asynchronousResponseTimeout")==true}</bpmn2:conditionExpression> </bpmn2:sequenceFlow> - <bpmn2:subProcess id="SubProcess" name="Wait for asynchronous message"> + <bpmn2:subProcess id="SubProcess" name="Wait for asynchronous message" camunda:asyncAfter="true"> <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_9</bpmn2:outgoing> <bpmn2:startEvent id="StartEvent" name="Start Event"> @@ -111,17 +111,17 @@ sdnc.postProcessResponse(execution) <bpmn2:scriptTask id="setTimeoutEx" name="Set Timeout and Stop Listening for Callback" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_0mzs1ze</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_11ah5pw</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script>import org.onap.so.bpmn.common.scripts.* def sdnc= new SDNCAdapter() -sdnc.setTimeout(execution)]]></bpmn2:script> +sdnc.setTimeout(execution)</bpmn2:script> </bpmn2:scriptTask> <bpmn2:scriptTask id="resetCallbackRequest" name="Reset callback request and set timer value" scriptFormat="groovy"> <bpmn2:incoming>goodSynchronousResponse</bpmn2:incoming> <bpmn2:incoming>SequenceFlow_26</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_2</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script>import org.onap.so.bpmn.common.scripts.* def sdnc= new SDNCAdapter() -sdnc.resetCallbackRequest(execution)]]></bpmn2:script> +sdnc.resetCallbackRequest(execution)</bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="resetCallbackRequest" targetRef="SubProcess" /> <bpmn2:exclusiveGateway id="ExclusiveGateway_1" name="Check final indicator" default="Done"> @@ -131,14 +131,14 @@ sdnc.resetCallbackRequest(execution)]]></bpmn2:script> </bpmn2:exclusiveGateway> <bpmn2:sequenceFlow id="Done" name="Done" sourceRef="ExclusiveGateway_1" targetRef="ResetInterimNotificationFlag" /> <bpmn2:sequenceFlow id="SequenceFlow_30" name="Not Done" sourceRef="ExclusiveGateway_1" targetRef="ParallelGateway_3"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("continueListening")==true}]]></bpmn2:conditionExpression> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression">#{execution.getVariable("continueListening")==true}</bpmn2:conditionExpression> </bpmn2:sequenceFlow> <bpmn2:scriptTask id="toggleSuccessIndicator" name="Toggle Success Indicator" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_1w1za5m</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_17</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script>import org.onap.so.bpmn.common.scripts.* def sdnc= new SDNCAdapter() -sdnc.toggleSuccessIndicator(execution)]]></bpmn2:script> +sdnc.toggleSuccessIndicator(execution)</bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_17" name="" sourceRef="toggleSuccessIndicator" targetRef="endEventFlow" /> <bpmn2:endEvent id="endEventFlow" name="End Event Flow"> @@ -168,9 +168,9 @@ sdnc.toggleSuccessIndicator(execution)]]></bpmn2:script> <bpmn2:scriptTask id="assignError" name="Assign Error" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_22</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_27</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script>import org.onap.so.bpmn.common.scripts.* def sdnc= new SDNCAdapter() -sdnc.assignError(execution)]]></bpmn2:script> +sdnc.assignError(execution)</bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_27" name="" sourceRef="assignError" targetRef="EndEvent_5" /> <bpmn2:endEvent id="EndEvent_5"> @@ -183,7 +183,7 @@ sdnc.assignError(execution)]]></bpmn2:script> <bpmn2:outgoing>SequenceFlow_23</bpmn2:outgoing> </bpmn2:exclusiveGateway> <bpmn2:sequenceFlow id="SequenceFlow_4" name="Yes" sourceRef="ExclusiveGateway_2" targetRef="SetInterimNotificationFlag"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("serviceConfigActivate")==true}]]></bpmn2:conditionExpression> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression">#{execution.getVariable("serviceConfigActivate")==true}</bpmn2:conditionExpression> </bpmn2:sequenceFlow> <bpmn2:sequenceFlow id="SequenceFlow_23" name="No" sourceRef="ExclusiveGateway_2" targetRef="EndEvent_1" /> <bpmn2:endEvent id="EndEvent_1"> @@ -202,7 +202,7 @@ sdnc.assignError(execution)]]></bpmn2:script> </bpmn2:endEvent> <bpmn2:sequenceFlow id="SequenceFlow_0mzs1ze" sourceRef="BoundaryEvent_1" targetRef="setTimeoutEx" /> <bpmn2:sequenceFlow id="SequenceFlow_11ah5pw" sourceRef="setTimeoutEx" targetRef="returnWorkflowResult" /> - <bpmn2:callActivity id="CallActivity_11xgv33" name="Call Notification Service" calledElement="${URN_mso_workflow_notification_name}"> + <bpmn2:callActivity id="CallActivity_11xgv33" name="Call Notification Service" calledElement="${UrnPropertiesReader.getVariable("mso.workflow.notification.name", execution)}"> <bpmn2:extensionElements> <camunda:in source="mso-request-id" target="mso-request-id" /> <camunda:in source="mso-service-instance-id" target="mso-service-instance-id" /> @@ -215,7 +215,7 @@ sdnc.assignError(execution)]]></bpmn2:script> <bpmn2:scriptTask id="SetInterimNotificationFlag" name="Set Interim Notification Flag" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_4</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_193cb6p</bpmn2:outgoing> - <bpmn2:script><![CDATA[execution.setVariable("SDNCA_InterimNotify", true)]]></bpmn2:script> + <bpmn2:script>execution.setVariable("SDNCA_InterimNotify", true)</bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_193cb6p" sourceRef="SetInterimNotificationFlag" targetRef="CallActivity_11xgv33" /> <bpmn2:endEvent id="EndEvent_18rq0b6"> @@ -225,7 +225,7 @@ sdnc.assignError(execution)]]></bpmn2:script> <bpmn2:scriptTask id="ResetInterimNotificationFlag" name="Reset Interim Notification Flag" scriptFormat="groovy"> <bpmn2:incoming>Done</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_1w1za5m</bpmn2:outgoing> - <bpmn2:script><![CDATA[execution.setVariable("SDNCA_InterimNotify", false)]]></bpmn2:script> + <bpmn2:script>execution.setVariable("SDNCA_InterimNotify", false)</bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_1w1za5m" sourceRef="ResetInterimNotificationFlag" targetRef="toggleSuccessIndicator" /> </bpmn2:process> @@ -264,23 +264,23 @@ sdnc.assignError(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_5" bpmnElement="badSynchronousResponse" sourceElement="_BPMNShape_ExclusiveGateway_29" targetElement="_BPMNShape_ScriptTask_24"> - <di:waypoint xsi:type="dc:Point" x="544" y="153" /> - <di:waypoint xsi:type="dc:Point" x="544" y="122" /> - <di:waypoint xsi:type="dc:Point" x="600" y="122" /> + <di:waypoint x="544" y="153" /> + <di:waypoint x="544" y="122" /> + <di:waypoint x="600" y="122" /> <bpmndi:BPMNLabel> <dc:Bounds x="441" y="99" width="164" height="22" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_StartEvent_33" targetElement="_BPMNShape_ScriptTask_3"> - <di:waypoint xsi:type="dc:Point" x="147" y="179" /> - <di:waypoint xsi:type="dc:Point" x="194" y="179" /> + <di:waypoint x="147" y="179" /> + <di:waypoint x="194" y="179" /> <bpmndi:BPMNLabel> <dc:Bounds x="171" y="179" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_4" bpmnElement="goodSynchronousResponse" sourceElement="_BPMNShape_ExclusiveGateway_29" targetElement="_BPMNShape_ScriptTask_27"> - <di:waypoint xsi:type="dc:Point" x="544" y="203" /> - <di:waypoint xsi:type="dc:Point" x="544" y="246" /> + <di:waypoint x="544" y="203" /> + <di:waypoint x="544" y="246" /> <bpmndi:BPMNLabel> <dc:Bounds x="459" y="208" width="172" height="22" /> </bpmndi:BPMNLabel> @@ -292,24 +292,24 @@ sdnc.assignError(execution)]]></bpmn2:script> <dc:Bounds x="194" y="139" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_8" bpmnElement="SequenceFlow_8" sourceElement="_BPMNShape_ScriptTask_3" targetElement="_BPMNShape_ServiceTask_62"> - <di:waypoint xsi:type="dc:Point" x="294" y="179" /> - <di:waypoint xsi:type="dc:Point" x="342" y="179" /> + <di:waypoint x="294" y="179" /> + <di:waypoint x="342" y="179" /> <bpmndi:BPMNLabel> <dc:Bounds x="300" y="153" width="30" height="22" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_14" bpmnElement="SequenceFlow_14" sourceElement="_BPMNShape_ServiceTask_68" targetElement="_BPMNShape_ExclusiveGateway_53"> - <di:waypoint xsi:type="dc:Point" x="1204" y="277" /> - <di:waypoint xsi:type="dc:Point" x="1248" y="276" /> + <di:waypoint x="1204" y="277" /> + <di:waypoint x="1248" y="276" /> <bpmndi:BPMNLabel> <dc:Bounds x="1211" y="251" width="37" height="22" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_15" bpmnElement="SequenceFlow_15" sourceElement="_BPMNShape_ServiceTask_62" targetElement="_BPMNShape_ExclusiveGateway_29"> - <di:waypoint xsi:type="dc:Point" x="442" y="179" /> - <di:waypoint xsi:type="dc:Point" x="480" y="179" /> - <di:waypoint xsi:type="dc:Point" x="480" y="178" /> - <di:waypoint xsi:type="dc:Point" x="519" y="178" /> + <di:waypoint x="442" y="179" /> + <di:waypoint x="480" y="179" /> + <di:waypoint x="480" y="178" /> + <di:waypoint x="519" y="178" /> <bpmndi:BPMNLabel> <dc:Bounds x="468" y="153" width="37" height="22" /> </bpmndi:BPMNLabel> @@ -330,8 +330,8 @@ sdnc.assignError(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_9" bpmnElement="SequenceFlow_9" sourceElement="_BPMNShape_SubProcess_11"> - <di:waypoint xsi:type="dc:Point" x="998" y="278" /> - <di:waypoint xsi:type="dc:Point" x="1104" y="277" /> + <di:waypoint x="998" y="278" /> + <di:waypoint x="1104" y="277" /> <bpmndi:BPMNLabel> <dc:Bounds x="1051" y="262.5" width="0" height="0" /> </bpmndi:BPMNLabel> @@ -340,8 +340,8 @@ sdnc.assignError(execution)]]></bpmn2:script> <dc:Bounds x="600" y="82" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="Exception" sourceElement="_BPMNShape_ScriptTask_24" targetElement="_BPMNShape_EndEvent_65"> - <di:waypoint xsi:type="dc:Point" x="700" y="122" /> - <di:waypoint xsi:type="dc:Point" x="762" y="122" /> + <di:waypoint x="700" y="122" /> + <di:waypoint x="762" y="122" /> <bpmndi:BPMNLabel> <dc:Bounds x="699" y="99" width="64" height="22" /> </bpmndi:BPMNLabel> @@ -350,8 +350,8 @@ sdnc.assignError(execution)]]></bpmn2:script> <dc:Bounds x="941" y="372" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_16" bpmnElement="SequenceFlow_16" sourceElement="_BPMNShape_IntermediateCatchEvent_16"> - <di:waypoint xsi:type="dc:Point" x="817" y="275" /> - <di:waypoint xsi:type="dc:Point" x="926" y="275" /> + <di:waypoint x="817" y="275" /> + <di:waypoint x="926" y="275" /> <bpmndi:BPMNLabel> <dc:Bounds x="872" y="260" width="0" height="0" /> </bpmndi:BPMNLabel> @@ -363,16 +363,16 @@ sdnc.assignError(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_17" bpmnElement="noTimeoutError" sourceElement="_BPMNShape_ExclusiveGateway_53" targetElement="_BPMNShape_ExclusiveGateway_54"> - <di:waypoint xsi:type="dc:Point" x="1273" y="301" /> - <di:waypoint xsi:type="dc:Point" x="1273" y="359" /> + <di:waypoint x="1273" y="301" /> + <di:waypoint x="1273" y="359" /> <bpmndi:BPMNLabel> <dc:Bounds x="1280" y="324" width="72" height="22" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_19" bpmnElement="SequenceFlow_19" sourceElement="_BPMNShape_ExclusiveGateway_53" targetElement="_BPMNShape_ScriptTask_25"> - <di:waypoint xsi:type="dc:Point" x="1273" y="251" /> - <di:waypoint xsi:type="dc:Point" x="1273" y="95" /> - <di:waypoint xsi:type="dc:Point" x="1560" y="95" /> + <di:waypoint x="1273" y="251" /> + <di:waypoint x="1273" y="95" /> + <di:waypoint x="1560" y="95" /> <bpmndi:BPMNLabel> <dc:Bounds x="1301" y="169.45283018867923" width="39" height="12" /> </bpmndi:BPMNLabel> @@ -384,8 +384,8 @@ sdnc.assignError(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_7" bpmnElement="Done" sourceElement="_BPMNShape_ExclusiveGateway_54" targetElement="_BPMNShape_ScriptTask_247"> - <di:waypoint xsi:type="dc:Point" x="1298" y="384" /> - <di:waypoint xsi:type="dc:Point" x="1386" y="385" /> + <di:waypoint x="1298" y="384" /> + <di:waypoint x="1386" y="385" /> <bpmndi:BPMNLabel> <dc:Bounds x="1322" y="384.219838851959" width="27" height="13" /> </bpmndi:BPMNLabel> @@ -394,17 +394,17 @@ sdnc.assignError(execution)]]></bpmn2:script> <dc:Bounds x="494" y="246" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_12" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_ScriptTask_27" targetElement="_BPMNShape_SubProcess_11"> - <di:waypoint xsi:type="dc:Point" x="594" y="286" /> - <di:waypoint xsi:type="dc:Point" x="607" y="286" /> - <di:waypoint xsi:type="dc:Point" x="607" y="275" /> - <di:waypoint xsi:type="dc:Point" x="619" y="275" /> + <di:waypoint x="594" y="286" /> + <di:waypoint x="607" y="286" /> + <di:waypoint x="607" y="275" /> + <di:waypoint x="619" y="275" /> <bpmndi:BPMNLabel> <dc:Bounds x="622" y="280.5" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_38" bpmnElement="SequenceFlow_30" sourceElement="_BPMNShape_ExclusiveGateway_54" targetElement="_BPMNShape_ParallelGateway_14"> - <di:waypoint xsi:type="dc:Point" x="1273" y="409" /> - <di:waypoint xsi:type="dc:Point" x="1273" y="467" /> + <di:waypoint x="1273" y="409" /> + <di:waypoint x="1273" y="467" /> <bpmndi:BPMNLabel> <dc:Bounds x="1273" y="423" width="60" height="22" /> </bpmndi:BPMNLabel> @@ -416,8 +416,8 @@ sdnc.assignError(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_13" bpmnElement="SequenceFlow_4" sourceElement="_BPMNShape_ExclusiveGateway_55" targetElement="CallActivity_11xgv33_di"> - <di:waypoint xsi:type="dc:Point" x="1273" y="602" /> - <di:waypoint xsi:type="dc:Point" x="1273" y="664" /> + <di:waypoint x="1273" y="602" /> + <di:waypoint x="1273" y="664" /> <bpmndi:BPMNLabel> <dc:Bounds x="1237" y="635.9906427957554" width="18" height="13" /> </bpmndi:BPMNLabel> @@ -428,9 +428,9 @@ sdnc.assignError(execution)]]></bpmn2:script> <dc:Bounds x="1273" y="522" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_28" bpmnElement="SequenceFlow_21" sourceElement="_BPMNShape_ParallelGateway_14" targetElement="_BPMNShape_ScriptTask_255"> - <di:waypoint xsi:type="dc:Point" x="1272" y="516" /> - <di:waypoint xsi:type="dc:Point" x="1273" y="552" /> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_28" bpmnElement="SequenceFlow_21" sourceElement="_BPMNShape_ParallelGateway_14"> + <di:waypoint x="1272" y="516" /> + <di:waypoint x="1273" y="552" /> <bpmndi:BPMNLabel> <dc:Bounds x="1273" y="519" width="0" height="0" /> </bpmndi:BPMNLabel> @@ -442,17 +442,17 @@ sdnc.assignError(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_30" bpmnElement="SequenceFlow_23" sourceElement="_BPMNShape_ExclusiveGateway_55" targetElement="_BPMNShape_EndEvent_96"> - <di:waypoint xsi:type="dc:Point" x="1298" y="577" /> - <di:waypoint xsi:type="dc:Point" x="1330" y="577" /> - <di:waypoint xsi:type="dc:Point" x="1440" y="577" /> + <di:waypoint x="1298" y="577" /> + <di:waypoint x="1330" y="577" /> + <di:waypoint x="1440" y="577" /> <bpmndi:BPMNLabel> <dc:Bounds x="1309" y="590.5" width="14" height="13" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_33" bpmnElement="SequenceFlow_26" sourceElement="_BPMNShape_ParallelGateway_14" targetElement="_BPMNShape_ScriptTask_27"> - <di:waypoint xsi:type="dc:Point" x="1248" y="492" /> - <di:waypoint xsi:type="dc:Point" x="544" y="492" /> - <di:waypoint xsi:type="dc:Point" x="544" y="326" /> + <di:waypoint x="1248" y="492" /> + <di:waypoint x="544" y="492" /> + <di:waypoint x="544" y="326" /> <bpmndi:BPMNLabel> <dc:Bounds x="782" y="467" width="73" height="48" /> </bpmndi:BPMNLabel> @@ -461,47 +461,47 @@ sdnc.assignError(execution)]]></bpmn2:script> <dc:Bounds x="1540" y="344" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_26" bpmnElement="SequenceFlow_17" sourceElement="_BPMNShape_ScriptTask_247" targetElement="_BPMNShape_EndEvent_64"> - <di:waypoint xsi:type="dc:Point" x="1640" y="384" /> - <di:waypoint xsi:type="dc:Point" x="1699" y="384" /> + <di:waypoint x="1640" y="384" /> + <di:waypoint x="1699" y="384" /> <bpmndi:BPMNLabel> <dc:Bounds x="1670" y="369" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="_BPMNShape_SubProcess_19" bpmnElement="errorHandlingSubProcess" isExpanded="true"> - <dc:Bounds x="378" y="797" width="353" height="193" /> + <dc:Bounds x="207" y="692" width="353" height="193" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="_BPMNShape_StartEvent_63" bpmnElement="catchErrors"> - <dc:Bounds x="413" y="876" width="36" height="36" /> + <dc:Bounds x="242" y="771" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="416" y="917" width="29" height="12" /> + <dc:Bounds x="245" y="812" width="29" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="_BPMNShape_EndEvent_213" bpmnElement="EndEvent_5"> - <dc:Bounds x="653" y="876" width="36" height="36" /> + <dc:Bounds x="482" y="771" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="671" y="917" width="0" height="0" /> + <dc:Bounds x="455" y="812" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_249" bpmnElement="assignError"> - <dc:Bounds x="497" y="854" width="100" height="80" /> + <dc:Bounds x="326" y="749" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_29" bpmnElement="SequenceFlow_22" sourceElement="_BPMNShape_StartEvent_63" targetElement="_BPMNShape_ScriptTask_249"> - <di:waypoint xsi:type="dc:Point" x="449" y="894" /> - <di:waypoint xsi:type="dc:Point" x="497" y="894" /> + <di:waypoint x="278" y="789" /> + <di:waypoint x="326" y="789" /> <bpmndi:BPMNLabel> - <dc:Bounds x="479" y="894" width="0" height="0" /> + <dc:Bounds x="263" y="789" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_34" bpmnElement="SequenceFlow_27" sourceElement="_BPMNShape_ScriptTask_249" targetElement="_BPMNShape_EndEvent_213"> - <di:waypoint xsi:type="dc:Point" x="597" y="894" /> - <di:waypoint xsi:type="dc:Point" x="653" y="894" /> + <di:waypoint x="426" y="789" /> + <di:waypoint x="482" y="789" /> <bpmndi:BPMNLabel> - <dc:Bounds x="625" y="894" width="0" height="0" /> + <dc:Bounds x="409" y="789" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1eciucn_di" bpmnElement="SequenceFlow_1eciucn"> - <di:waypoint xsi:type="dc:Point" x="691" y="275" /> - <di:waypoint xsi:type="dc:Point" x="781" y="275" /> + <di:waypoint x="691" y="275" /> + <di:waypoint x="781" y="275" /> <bpmndi:BPMNLabel> <dc:Bounds x="736" y="260" width="0" height="0" /> </bpmndi:BPMNLabel> @@ -519,17 +519,17 @@ sdnc.assignError(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0mzs1ze_di" bpmnElement="SequenceFlow_0mzs1ze"> - <di:waypoint xsi:type="dc:Point" x="800" y="364" /> - <di:waypoint xsi:type="dc:Point" x="800" y="412" /> - <di:waypoint xsi:type="dc:Point" x="941" y="412" /> + <di:waypoint x="800" y="364" /> + <di:waypoint x="800" y="412" /> + <di:waypoint x="941" y="412" /> <bpmndi:BPMNLabel> <dc:Bounds x="815" y="388" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_11ah5pw_di" bpmnElement="SequenceFlow_11ah5pw"> - <di:waypoint xsi:type="dc:Point" x="1041" y="412" /> - <di:waypoint xsi:type="dc:Point" x="1154" y="412" /> - <di:waypoint xsi:type="dc:Point" x="1154" y="317" /> + <di:waypoint x="1041" y="412" /> + <di:waypoint x="1154" y="412" /> + <di:waypoint x="1154" y="317" /> <bpmndi:BPMNLabel> <dc:Bounds x="1098" y="397" width="0" height="0" /> </bpmndi:BPMNLabel> @@ -547,8 +547,8 @@ sdnc.assignError(execution)]]></bpmn2:script> <dc:Bounds x="1223" y="666" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_193cb6p_di" bpmnElement="SequenceFlow_193cb6p"> - <di:waypoint xsi:type="dc:Point" x="1273" y="746" /> - <di:waypoint xsi:type="dc:Point" x="1273" y="795" /> + <di:waypoint x="1273" y="746" /> + <di:waypoint x="1273" y="795" /> <bpmndi:BPMNLabel> <dc:Bounds x="1288" y="770.5" width="0" height="0" /> </bpmndi:BPMNLabel> @@ -560,8 +560,8 @@ sdnc.assignError(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1em7gys_di" bpmnElement="SequenceFlow_1em7gys"> - <di:waypoint xsi:type="dc:Point" x="1273" y="875" /> - <di:waypoint xsi:type="dc:Point" x="1273" y="920" /> + <di:waypoint x="1273" y="875" /> + <di:waypoint x="1273" y="920" /> <bpmndi:BPMNLabel> <dc:Bounds x="1288" y="897.5" width="0" height="0" /> </bpmndi:BPMNLabel> @@ -570,8 +570,8 @@ sdnc.assignError(execution)]]></bpmn2:script> <dc:Bounds x="1386" y="345" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1w1za5m_di" bpmnElement="SequenceFlow_1w1za5m"> - <di:waypoint xsi:type="dc:Point" x="1486" y="385" /> - <di:waypoint xsi:type="dc:Point" x="1540" y="384" /> + <di:waypoint x="1486" y="385" /> + <di:waypoint x="1540" y="384" /> <bpmndi:BPMNLabel> <dc:Bounds x="1513" y="369.5" width="0" height="0" /> </bpmndi:BPMNLabel> diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/UpdateAAIGenericVnf.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/UpdateAAIGenericVnf.bpmn index 0932221944..42ffb762e7 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/UpdateAAIGenericVnf.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/UpdateAAIGenericVnf.bpmn @@ -5,7 +5,7 @@ <bpmn2:scriptTask id="QueryAAIForGenericVNF" name="Query AAI for Generic VNF" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_38</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_39</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* def ugv = new UpdateAAIGenericVnf() ugv.getGenericVnf(execution)]]></bpmn2:script> </bpmn2:scriptTask> @@ -26,7 +26,7 @@ ugv.getGenericVnf(execution)]]></bpmn2:script> <bpmn2:scriptTask id="HandleUpdateGenericVNFFailure" name="Handle Update Generic VNF Failure" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_4</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_8</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* def ugv = new UpdateAAIGenericVnf() ugv.handleUpdateGenericVnfFailure(execution)]]></bpmn2:script> </bpmn2:scriptTask> @@ -35,7 +35,7 @@ ugv.handleUpdateGenericVnfFailure(execution)]]></bpmn2:script> <bpmn2:extensionElements> <camunda:connector> <camunda:inputOutput> - <camunda:outputParameter name="CreateCustomerV1Response"><![CDATA[<aetgt:CreateCustomerResponse xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1" xmlns:ns="http://org.openecomp/mso/workflow/schema/v1"> + <camunda:outputParameter name="CreateCustomerV1Response"><![CDATA[<aetgt:CreateCustomerResponse xmlns:aetgt="http://org.onap/so/workflow/schema/v1" xmlns:ns="http://org.onap/so/workflow/schema/v1"> <ns:GlobalCustomerId>${CCV1_subscriberglobalid}</ns:GlobalCustomerId> </aetgt:CreateCustomerResponse>]]></camunda:outputParameter> </camunda:inputOutput> @@ -46,7 +46,7 @@ ugv.handleUpdateGenericVnfFailure(execution)]]></bpmn2:script> <bpmn2:scriptTask id="UpdateGenericVNF" name="Update Generic VNF" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_22</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_14</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* def ugv = new UpdateAAIGenericVnf() ugv.updateGenericVnf(execution)]]></bpmn2:script> </bpmn2:scriptTask> @@ -63,7 +63,7 @@ ugv.updateGenericVnf(execution)]]></bpmn2:script> <bpmn2:scriptTask id="AAIQueryFailure" name="Handle AAI Query Failure" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_23</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_18</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* def ugv = new UpdateAAIGenericVnf() ugv.handleAAIQueryFailure(execution)]]></bpmn2:script> </bpmn2:scriptTask> @@ -79,7 +79,7 @@ ugv.handleAAIQueryFailure(execution)]]></bpmn2:script> <bpmn2:scriptTask id="ProcessReceivedRequest" name="Process Received Request" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_38</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* def ugv = new UpdateAAIGenericVnf() ugv.preProcessRequest(execution)]]></bpmn2:script> </bpmn2:scriptTask> diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/UpdateAAIVfModule.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/UpdateAAIVfModule.bpmn index 6eacaee530..f0b1d8d027 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/UpdateAAIVfModule.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/UpdateAAIVfModule.bpmn @@ -5,7 +5,7 @@ <bpmn2:scriptTask id="QueryAAIForVfModule" name="Query AAI for VF Module" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_38</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_39</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* def uvm = new UpdateAAIVfModule() uvm.getVfModule(execution)]]></bpmn2:script> </bpmn2:scriptTask> @@ -17,7 +17,7 @@ uvm.getVfModule(execution)]]></bpmn2:script> <bpmn2:scriptTask id="AAIQueryFailure" name="Handle AAI Query Failure" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_23</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_18</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* def uvm= new UpdateAAIVfModule() uvm.handleAAIQueryFailure(execution)]]></bpmn2:script> </bpmn2:scriptTask> @@ -30,7 +30,7 @@ uvm.handleAAIQueryFailure(execution)]]></bpmn2:script> <bpmn2:extensionElements> <camunda:connector> <camunda:inputOutput> - <camunda:outputParameter name="CreateCustomerV1Response"><![CDATA[<aetgt:CreateCustomerResponse xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1" xmlns:ns="http://org.openecomp/mso/workflow/schema/v1"> + <camunda:outputParameter name="CreateCustomerV1Response"><![CDATA[<aetgt:CreateCustomerResponse xmlns:aetgt="http://org.onap/so/workflow/schema/v1" xmlns:ns="http://org.onap/so/workflow/schema/v1"> <ns:GlobalCustomerId>${CCV1_subscriberglobalid}</ns:GlobalCustomerId> </aetgt:CreateCustomerResponse>]]></camunda:outputParameter> </camunda:inputOutput> @@ -50,7 +50,7 @@ uvm.handleAAIQueryFailure(execution)]]></bpmn2:script> <bpmn2:scriptTask id="HandleUpdateVfModuleFailure" name="Handle Update VF Module Failure" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_4</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_8</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* def uvm= new UpdateAAIVfModule() uvm.handleUpdateVfModuleFailure(execution)]]></bpmn2:script> </bpmn2:scriptTask> @@ -67,7 +67,7 @@ uvm.handleUpdateVfModuleFailure(execution)]]></bpmn2:script> <bpmn2:scriptTask id="UpdateVfModule" name="Update VF Module" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_22</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_14</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* def uvm= new UpdateAAIVfModule() uvm.updateVfModule(execution)]]></bpmn2:script> </bpmn2:scriptTask> @@ -79,7 +79,7 @@ uvm.updateVfModule(execution)]]></bpmn2:script> <bpmn2:scriptTask id="ProcessReceivedRequest" name="Process Received Request" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_38</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* def uvm= new UpdateAAIVfModule() uvm.preProcessRequest(execution)]]></bpmn2:script> </bpmn2:scriptTask> diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/VnfAdapterRestV1.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/VnfAdapterRestV1.bpmn index 82d89b0c64..cdd710d102 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/VnfAdapterRestV1.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/VnfAdapterRestV1.bpmn @@ -1,442 +1,442 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd" id="_GraPIIyxEeWmdMDkx6Uftw" exporter="camunda modeler" exporterVersion="2.7.0" targetNamespace="http://camunda.org/schema/1.0/bpmn">
- <bpmn2:process id="vnfAdapterRestV1" name="vnfAdapterRestV1" isExecutable="true">
- <bpmn2:scriptTask id="ScriptTask_2" name="Log Response" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_3</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_14</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-def vnfAdapterRestV1 = new VnfAdapterRestV1()
-def statusCode = execution.getVariable('VNFREST_vnfAdapterStatusCode')
-String response = String.valueOf(execution.getVariable('VNFREST_vnfAdapterResponse'))
-def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
-def processKey = vnfAdapterRestV1.getProcessKey(execution)
-vnfAdapterRestV1.logDebug(processKey + " received response from VnfAdapter: statusCode=" + statusCode +
- " response=" + (response.isEmpty() ? "" : "\n") + response, isDebugLogEnabled)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:scriptTask id="ScriptTask_3" name="Workflow Exception (no connection)">
- <bpmn2:incoming>SequenceFlow_17</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_35</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-def exceptionUtil = new ExceptionUtil()
-exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Failed to communicate with VnfAdapter")]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:scriptTask id="ScriptTask_4" name="Workflow Exception (bad response)" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_23</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_36</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-
-String res = execution.getVariable(VNFREST_vnfAdapterResponse)
-
-def vnfAdapterRestV1 = new VnfAdapterRestV1()
-vnfAdapterRestV1.vnfAdapterWorkflowException(execution, res)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_14" name="" sourceRef="ScriptTask_2" targetRef="ExclusiveGateway_1"/>
- <bpmn2:exclusiveGateway id="ExclusiveGateway_1" default="SequenceFlow_23">
- <bpmn2:incoming>SequenceFlow_14</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_17</bpmn2:outgoing>
- <bpmn2:outgoing>SequenceFlow_23</bpmn2:outgoing>
- <bpmn2:outgoing>SequenceFlow_24</bpmn2:outgoing>
- </bpmn2:exclusiveGateway>
- <bpmn2:sequenceFlow id="SequenceFlow_17" name="404" sourceRef="ExclusiveGateway_1" targetRef="ScriptTask_3">
- <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("VNFREST_vnfAdapterStatusCode") == '404'}]]></bpmn2:conditionExpression>
- </bpmn2:sequenceFlow>
- <bpmn2:sequenceFlow id="SequenceFlow_23" name="other" sourceRef="ExclusiveGateway_1" targetRef="ScriptTask_4"/>
- <bpmn2:sequenceFlow id="SequenceFlow_24" name="2xx" sourceRef="ExclusiveGateway_1" targetRef="waitForAsyncMessage">
- <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("VNFREST_vnfAdapterStatusCode") == '200' || execution.getVariable("VNFREST_vnfAdapterStatusCode") == '202'}]]></bpmn2:conditionExpression>
- </bpmn2:sequenceFlow>
- <bpmn2:boundaryEvent id="BoundaryEvent_1" name="Timeout" attachedToRef="waitForAsyncMessage">
- <bpmn2:outgoing>SequenceFlow_27</bpmn2:outgoing>
- <bpmn2:timerEventDefinition id="TimerEventDefinition_1">
- <bpmn2:timeDuration xsi:type="bpmn2:tFormalExpression">${URN_mso_po_timeout}</bpmn2:timeDuration>
- </bpmn2:timerEventDefinition>
- </bpmn2:boundaryEvent>
- <bpmn2:subProcess id="waitForAsyncMessage" name="Wait for Callback">
- <bpmn2:incoming>SequenceFlow_24</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_28</bpmn2:outgoing>
- <bpmn2:intermediateCatchEvent id="IntermediateCatchEvent_1" name="Catch Event">
- <bpmn2:incoming>SequenceFlow_25</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_26</bpmn2:outgoing>
- <bpmn2:messageEventDefinition id="MessageEventDefinition_1" messageRef="Message_1"/>
- </bpmn2:intermediateCatchEvent>
- <bpmn2:sequenceFlow id="SequenceFlow_26" name="" sourceRef="IntermediateCatchEvent_1" targetRef="EndEvent_2"/>
- <bpmn2:startEvent id="StartEvent_3">
- <bpmn2:outgoing>SequenceFlow_25</bpmn2:outgoing>
- </bpmn2:startEvent>
- <bpmn2:sequenceFlow id="SequenceFlow_25" name="" sourceRef="StartEvent_3" targetRef="IntermediateCatchEvent_1"/>
- <bpmn2:endEvent id="EndEvent_2">
- <bpmn2:incoming>SequenceFlow_26</bpmn2:incoming>
- </bpmn2:endEvent>
- </bpmn2:subProcess>
- <bpmn2:sequenceFlow id="SequenceFlow_27" name="" sourceRef="BoundaryEvent_1" targetRef="ScriptTask_5"/>
- <bpmn2:scriptTask id="ScriptTask_5" name="Workflow Exception (timeout)" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_27</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_34</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-def exceptionUtil = new ExceptionUtil()
-exceptionUtil.buildAndThrowWorkflowException(execution, 7010, "VnfAdapter Callback Timeout Error")]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_28" name="" sourceRef="waitForAsyncMessage" targetRef="ScriptTask_6"/>
- <bpmn2:scriptTask id="ScriptTask_6" name="Process Callback" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_28</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_33</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-def vnfAdapterRestV1 = new VnfAdapterRestV1()
-vnfAdapterRestV1.processCallback(execution)
-]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_33" name="" sourceRef="ScriptTask_6" targetRef="ExclusiveGateway_2"/>
- <bpmn2:sequenceFlow id="SequenceFlow_34" name="" sourceRef="ScriptTask_5" targetRef="EndEvent_8"/>
- <bpmn2:endEvent id="EndEvent_8">
- <bpmn2:incoming>SequenceFlow_34</bpmn2:incoming>
- <bpmn2:errorEventDefinition id="_ErrorEventDefinition_21" errorRef="Error_1"/>
- </bpmn2:endEvent>
- <bpmn2:sequenceFlow id="SequenceFlow_35" name="" sourceRef="ScriptTask_3" targetRef="EndEvent_9"/>
- <bpmn2:endEvent id="EndEvent_9">
- <bpmn2:incoming>SequenceFlow_35</bpmn2:incoming>
- <bpmn2:errorEventDefinition id="_ErrorEventDefinition_22" errorRef="Error_1"/>
- </bpmn2:endEvent>
- <bpmn2:endEvent id="EndEvent_10">
- <bpmn2:incoming>SequenceFlow_36</bpmn2:incoming>
- <bpmn2:errorEventDefinition id="_ErrorEventDefinition_23" errorRef="Error_1"/>
- </bpmn2:endEvent>
- <bpmn2:sequenceFlow id="SequenceFlow_36" name="" sourceRef="ScriptTask_4" targetRef="EndEvent_10"/>
- <bpmn2:endEvent id="EndEvent_7">
- <bpmn2:incoming>SequenceFlow_32</bpmn2:incoming>
- <bpmn2:errorEventDefinition id="_ErrorEventDefinition_20" errorRef="Error_1"/>
- </bpmn2:endEvent>
- <bpmn2:exclusiveGateway id="ExclusiveGateway_2" name="Callback
Exception?" default="SequenceFlow_31">
- <bpmn2:incoming>SequenceFlow_33</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_31</bpmn2:outgoing>
- <bpmn2:outgoing>SequenceFlow_32</bpmn2:outgoing>
- </bpmn2:exclusiveGateway>
- <bpmn2:sequenceFlow id="SequenceFlow_31" name="no" sourceRef="ExclusiveGateway_2" targetRef="ScriptTask_setSuccess"/>
- <bpmn2:sequenceFlow id="SequenceFlow_32" name="yes" sourceRef="ExclusiveGateway_2" targetRef="EndEvent_7">
- <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("WorkflowException") != null}]]></bpmn2:conditionExpression>
- </bpmn2:sequenceFlow>
- <bpmn2:scriptTask id="ScriptTask_setSuccess" name="Set Success Indicator" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_31</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-def vnfAdapterRestV1 = new VnfAdapterRestV1()
-vnfAdapterRestV1.setSuccessIndicator(execution, true)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="ScriptTask_setSuccess" targetRef="EndEvent_6"/>
- <bpmn2:endEvent id="EndEvent_6" name="End Flow">
- <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming>
- </bpmn2:endEvent>
- <bpmn2:scriptTask id="ScriptTask_7" name="Send Request to Vnf Adapter" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_3</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-def vnfAdapterRestV1 = new VnfAdapterRestV1()
-vnfAdapterRestV1.sendRequestToVnfAdapter(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_3" name="" sourceRef="ScriptTask_7" targetRef="ScriptTask_2"/>
- <bpmn2:subProcess id="SubProcess_1" name="Error Handling Sub Process" triggeredByEvent="true">
- <bpmn2:scriptTask id="ScriptTask_8" name="Process Error" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_4</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_5</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-def exUtil = new ExceptionUtil()
-exUtil.processSubflowsBPMNException(execution)
-]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_5" name="" sourceRef="ScriptTask_8" targetRef="EndEvent_1"/>
- <bpmn2:endEvent id="EndEvent_1">
- <bpmn2:incoming>SequenceFlow_5</bpmn2:incoming>
- </bpmn2:endEvent>
- <bpmn2:startEvent id="StartEvent_2">
- <bpmn2:outgoing>SequenceFlow_4</bpmn2:outgoing>
- <bpmn2:errorEventDefinition id="_ErrorEventDefinition_89"/>
- </bpmn2:startEvent>
- <bpmn2:sequenceFlow id="SequenceFlow_4" name="" sourceRef="StartEvent_2" targetRef="ScriptTask_8"/>
- </bpmn2:subProcess>
- <bpmn2:scriptTask id="ScriptTask_1" name="Pre-Process Request" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_9</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_2</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-def vnfAdapterRestV1 = new VnfAdapterRestV1()
-vnfAdapterRestV1.preProcessRequest(execution)
-]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="ScriptTask_1" targetRef="ScriptTask_7"/>
- <bpmn2:startEvent id="StartEvent_1" name="Start">
- <bpmn2:outgoing>SequenceFlow_9</bpmn2:outgoing>
- </bpmn2:startEvent>
- <bpmn2:sequenceFlow id="SequenceFlow_9" name="" sourceRef="StartEvent_1" targetRef="ScriptTask_1"/>
- </bpmn2:process>
- <bpmn2:error id="Error_1" errorCode="MSOWorkflowException" name="MSO Workflow Exception"/>
- <bpmn2:message id="Message_1" name="WorkflowMessage"/>
- <bpmndi:BPMNDiagram id="BPMNDiagram_1">
- <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="vnfAdapterRestV1">
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_56" bpmnElement="ScriptTask_1">
- <dc:Bounds height="80.0" width="100.0" x="204.0" y="148.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_SubProcess_14" bpmnElement="waitForAsyncMessage" isExpanded="true">
- <dc:Bounds height="154.0" width="265.0" x="744.0" y="275.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_58" bpmnElement="ScriptTask_6">
- <dc:Bounds height="80.0" width="100.0" x="1046.0" y="311.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_59" bpmnElement="ScriptTask_5">
- <dc:Bounds height="80.0" width="100.0" x="827.0" y="492.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_BoundaryEvent_24" bpmnElement="BoundaryEvent_1">
- <dc:Bounds height="36.0" width="36.0" x="859.0" y="411.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="22.0" width="52.0" x="894.0" y="441.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_IntermediateCatchEvent_20" bpmnElement="IntermediateCatchEvent_1">
- <dc:Bounds height="36.0" width="36.0" x="863.0" y="330.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="22.0" width="76.0" x="843.0" y="371.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_78" bpmnElement="ScriptTask_4">
- <dc:Bounds height="80.0" width="97.0" x="744.0" y="148.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_79" bpmnElement="ScriptTask_2">
- <dc:Bounds height="80.0" width="100.0" x="492.0" y="148.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_StartEvent_54" bpmnElement="StartEvent_1">
- <dc:Bounds height="36.0" width="36.0" x="84.0" y="170.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="22.0" width="34.0" x="85.0" y="211.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_168" bpmnElement="ScriptTask_3">
- <dc:Bounds height="80.0" width="97.0" x="744.0" y="24.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="SequenceFlow_9" sourceElement="_BPMNShape_StartEvent_54" targetElement="_BPMNShape_ScriptTask_56">
- <di:waypoint xsi:type="dc:Point" x="120.0" y="188.0"/>
- <di:waypoint xsi:type="dc:Point" x="204.0" y="188.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="130.0" y="188.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_105" bpmnElement="ExclusiveGateway_1" isMarkerVisible="true">
- <dc:Bounds height="50.0" width="50.0" x="624.0" y="162.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="649.0" y="217.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_18" bpmnElement="SequenceFlow_14" sourceElement="_BPMNShape_ScriptTask_79" targetElement="_BPMNShape_ExclusiveGateway_105">
- <di:waypoint xsi:type="dc:Point" x="592.0" y="188.0"/>
- <di:waypoint xsi:type="dc:Point" x="624.0" y="187.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="611.0" y="187.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_19" bpmnElement="SequenceFlow_17" sourceElement="_BPMNShape_ExclusiveGateway_105" targetElement="_BPMNShape_ScriptTask_168">
- <di:waypoint xsi:type="dc:Point" x="649.0" y="162.0"/>
- <di:waypoint xsi:type="dc:Point" x="649.0" y="64.0"/>
- <di:waypoint xsi:type="dc:Point" x="744.0" y="64.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="22.0" width="27.0" x="688.0" y="64.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_20" bpmnElement="SequenceFlow_23" sourceElement="_BPMNShape_ExclusiveGateway_105" targetElement="_BPMNShape_ScriptTask_78">
- <di:waypoint xsi:type="dc:Point" x="674.0" y="187.0"/>
- <di:waypoint xsi:type="dc:Point" x="709.0" y="187.0"/>
- <di:waypoint xsi:type="dc:Point" x="709.0" y="188.0"/>
- <di:waypoint xsi:type="dc:Point" x="744.0" y="188.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="22.0" width="35.0" x="684.0" y="188.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_25" bpmnElement="SequenceFlow_24" sourceElement="_BPMNShape_ExclusiveGateway_105" targetElement="_BPMNShape_SubProcess_14">
- <di:waypoint xsi:type="dc:Point" x="649.0" y="212.0"/>
- <di:waypoint xsi:type="dc:Point" x="649.0" y="353.0"/>
- <di:waypoint xsi:type="dc:Point" x="708.0" y="353.0"/>
- <di:waypoint xsi:type="dc:Point" x="744.0" y="353.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="22.0" width="27.0" x="688.0" y="328.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_StartEvent_55" bpmnElement="StartEvent_3">
- <dc:Bounds height="36.0" width="36.0" x="768.0" y="330.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="786.0" y="371.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_27" bpmnElement="SequenceFlow_25" sourceElement="_BPMNShape_StartEvent_55" targetElement="_BPMNShape_IntermediateCatchEvent_20">
- <di:waypoint xsi:type="dc:Point" x="804.0" y="348.0"/>
- <di:waypoint xsi:type="dc:Point" x="863.0" y="348.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="833.0" y="348.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_156" bpmnElement="EndEvent_2">
- <dc:Bounds height="36.0" width="36.0" x="948.0" y="330.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="966.0" y="371.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_28" bpmnElement="SequenceFlow_26" sourceElement="_BPMNShape_IntermediateCatchEvent_20" targetElement="_BPMNShape_EndEvent_156">
- <di:waypoint xsi:type="dc:Point" x="899.0" y="348.0"/>
- <di:waypoint xsi:type="dc:Point" x="929.0" y="348.0"/>
- <di:waypoint xsi:type="dc:Point" x="929.0" y="347.0"/>
- <di:waypoint xsi:type="dc:Point" x="948.0" y="348.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="926.0" y="348.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_29" bpmnElement="SequenceFlow_27" sourceElement="_BPMNShape_BoundaryEvent_24" targetElement="_BPMNShape_ScriptTask_59">
- <di:waypoint xsi:type="dc:Point" x="877.0" y="447.0"/>
- <di:waypoint xsi:type="dc:Point" x="877.0" y="492.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="874.0" y="472.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_30" bpmnElement="SequenceFlow_28" sourceElement="_BPMNShape_SubProcess_14" targetElement="_BPMNShape_ScriptTask_58">
- <di:waypoint xsi:type="dc:Point" x="1008.0" y="351.0"/>
- <di:waypoint xsi:type="dc:Point" x="1046.0" y="351.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="1023.0" y="351.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_106" bpmnElement="ExclusiveGateway_2" isMarkerVisible="true">
- <dc:Bounds height="50.0" width="50.0" x="1188.0" y="325.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="38.0" width="71.0" x="1179.0" y="288.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_158" bpmnElement="EndEvent_6">
- <dc:Bounds height="36.0" width="36.0" x="1463.0" y="333.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="22.0" width="60.0" x="1451.0" y="374.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_33" bpmnElement="SequenceFlow_31" sourceElement="_BPMNShape_ExclusiveGateway_106" targetElement="_BPMNShape_ScriptTask_236">
- <di:waypoint xsi:type="dc:Point" x="1238.0" y="350.0"/>
- <di:waypoint xsi:type="dc:Point" x="1308.0" y="350.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="22.0" width="20.0" x="1248.0" y="350.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_159" bpmnElement="EndEvent_7">
- <dc:Bounds height="36.0" width="36.0" x="1196.0" y="426.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="1214.0" y="467.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_34" bpmnElement="SequenceFlow_32" sourceElement="_BPMNShape_ExclusiveGateway_106" targetElement="_BPMNShape_EndEvent_159">
- <di:waypoint xsi:type="dc:Point" x="1213.0" y="375.0"/>
- <di:waypoint xsi:type="dc:Point" x="1213.0" y="392.0"/>
- <di:waypoint xsi:type="dc:Point" x="1214.0" y="392.0"/>
- <di:waypoint xsi:type="dc:Point" x="1214.0" y="426.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="22.0" width="27.0" x="1223.0" y="390.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_35" bpmnElement="SequenceFlow_33" sourceElement="_BPMNShape_ScriptTask_58" targetElement="_BPMNShape_ExclusiveGateway_106">
- <di:waypoint xsi:type="dc:Point" x="1146.0" y="351.0"/>
- <di:waypoint xsi:type="dc:Point" x="1173.0" y="351.0"/>
- <di:waypoint xsi:type="dc:Point" x="1173.0" y="350.0"/>
- <di:waypoint xsi:type="dc:Point" x="1188.0" y="350.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="1170.0" y="350.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_160" bpmnElement="EndEvent_8">
- <dc:Bounds height="36.0" width="36.0" x="974.0" y="514.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="992.0" y="555.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_36" bpmnElement="SequenceFlow_34" sourceElement="_BPMNShape_ScriptTask_59" targetElement="_BPMNShape_EndEvent_160">
- <di:waypoint xsi:type="dc:Point" x="927.0" y="532.0"/>
- <di:waypoint xsi:type="dc:Point" x="974.0" y="532.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="951.0" y="532.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_161" bpmnElement="EndEvent_9">
- <dc:Bounds height="36.0" width="36.0" x="891.0" y="46.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="909.0" y="87.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_37" bpmnElement="SequenceFlow_35" sourceElement="_BPMNShape_ScriptTask_168" targetElement="_BPMNShape_EndEvent_161">
- <di:waypoint xsi:type="dc:Point" x="840.0" y="64.0"/>
- <di:waypoint xsi:type="dc:Point" x="891.0" y="64.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="865.0" y="64.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_162" bpmnElement="EndEvent_10">
- <dc:Bounds height="36.0" width="36.0" x="892.0" y="170.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="910.0" y="211.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_38" bpmnElement="SequenceFlow_36" sourceElement="_BPMNShape_ScriptTask_78" targetElement="_BPMNShape_EndEvent_162">
- <di:waypoint xsi:type="dc:Point" x="840.0" y="188.0"/>
- <di:waypoint xsi:type="dc:Point" x="892.0" y="188.0"/>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_236" bpmnElement="ScriptTask_setSuccess">
- <dc:Bounds height="83.0" width="97.0" x="1308.0" y="309.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_ScriptTask_236" targetElement="_BPMNShape_EndEvent_158">
- <di:waypoint xsi:type="dc:Point" x="1404.0" y="350.0"/>
- <di:waypoint xsi:type="dc:Point" x="1422.0" y="350.0"/>
- <di:waypoint xsi:type="dc:Point" x="1422.0" y="351.0"/>
- <di:waypoint xsi:type="dc:Point" x="1463.0" y="351.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="1419.0" y="351.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_237" bpmnElement="ScriptTask_7">
- <dc:Bounds height="83.0" width="97.0" x="360.0" y="146.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_ScriptTask_56" targetElement="_BPMNShape_ScriptTask_237">
- <di:waypoint xsi:type="dc:Point" x="304.0" y="188.0"/>
- <di:waypoint xsi:type="dc:Point" x="344.0" y="188.0"/>
- <di:waypoint xsi:type="dc:Point" x="344.0" y="187.0"/>
- <di:waypoint xsi:type="dc:Point" x="360.0" y="187.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="317.0" y="188.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_4" bpmnElement="SequenceFlow_3" sourceElement="_BPMNShape_ScriptTask_237" targetElement="_BPMNShape_ScriptTask_79">
- <di:waypoint xsi:type="dc:Point" x="456.0" y="187.0"/>
- <di:waypoint xsi:type="dc:Point" x="474.0" y="187.0"/>
- <di:waypoint xsi:type="dc:Point" x="474.0" y="188.0"/>
- <di:waypoint xsi:type="dc:Point" x="492.0" y="188.0"/>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_SubProcess_24" bpmnElement="SubProcess_1" isExpanded="true">
- <dc:Bounds height="181.0" width="382.0" x="180.0" y="532.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_StartEvent_66" bpmnElement="StartEvent_2">
- <dc:Bounds height="36.0" width="36.0" x="225.0" y="605.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="243.0" y="646.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_207" bpmnElement="EndEvent_1">
- <dc:Bounds height="36.0" width="36.0" x="477.0" y="605.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="495.0" y="646.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_266" bpmnElement="ScriptTask_8">
- <dc:Bounds height="83.0" width="97.0" x="323.0" y="581.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_5" bpmnElement="SequenceFlow_4" sourceElement="_BPMNShape_StartEvent_66" targetElement="_BPMNShape_ScriptTask_266">
- <di:waypoint xsi:type="dc:Point" x="261.0" y="623.0"/>
- <di:waypoint xsi:type="dc:Point" x="323.0" y="622.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="273.0" y="623.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_6" bpmnElement="SequenceFlow_5" sourceElement="_BPMNShape_ScriptTask_266" targetElement="_BPMNShape_EndEvent_207">
- <di:waypoint xsi:type="dc:Point" x="419.0" y="622.0"/>
- <di:waypoint xsi:type="dc:Point" x="477.0" y="623.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="445.0" y="623.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- </bpmndi:BPMNPlane>
- </bpmndi:BPMNDiagram>
+<?xml version="1.0" encoding="UTF-8"?> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd" id="_GraPIIyxEeWmdMDkx6Uftw" exporter="camunda modeler" exporterVersion="2.7.0" targetNamespace="http://camunda.org/schema/1.0/bpmn"> + <bpmn2:process id="vnfAdapterRestV1" name="vnfAdapterRestV1" isExecutable="true"> + <bpmn2:scriptTask id="ScriptTask_2" name="Log Response" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_3</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_14</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* +def vnfAdapterRestV1 = new VnfAdapterRestV1() +def statusCode = execution.getVariable('VNFREST_vnfAdapterStatusCode') +String response = String.valueOf(execution.getVariable('VNFREST_vnfAdapterResponse')) +def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') +def processKey = vnfAdapterRestV1.getProcessKey(execution) +vnfAdapterRestV1.logDebug(processKey + " received response from VnfAdapter: statusCode=" + statusCode + + " response=" + (response.isEmpty() ? "" : "\n") + response, isDebugLogEnabled)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:scriptTask id="ScriptTask_3" name="Workflow Exception (no connection)"> + <bpmn2:incoming>SequenceFlow_17</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_35</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* +def exceptionUtil = new ExceptionUtil() +exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Failed to communicate with VnfAdapter")]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:scriptTask id="ScriptTask_4" name="Workflow Exception (bad response)" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_23</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_36</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* + +String res = execution.getVariable(VNFREST_vnfAdapterResponse) + +def vnfAdapterRestV1 = new VnfAdapterRestV1() +vnfAdapterRestV1.vnfAdapterWorkflowException(execution, res)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_14" name="" sourceRef="ScriptTask_2" targetRef="ExclusiveGateway_1"/> + <bpmn2:exclusiveGateway id="ExclusiveGateway_1" default="SequenceFlow_23"> + <bpmn2:incoming>SequenceFlow_14</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_17</bpmn2:outgoing> + <bpmn2:outgoing>SequenceFlow_23</bpmn2:outgoing> + <bpmn2:outgoing>SequenceFlow_24</bpmn2:outgoing> + </bpmn2:exclusiveGateway> + <bpmn2:sequenceFlow id="SequenceFlow_17" name="404" sourceRef="ExclusiveGateway_1" targetRef="ScriptTask_3"> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("VNFREST_vnfAdapterStatusCode") == '404'}]]></bpmn2:conditionExpression> + </bpmn2:sequenceFlow> + <bpmn2:sequenceFlow id="SequenceFlow_23" name="other" sourceRef="ExclusiveGateway_1" targetRef="ScriptTask_4"/> + <bpmn2:sequenceFlow id="SequenceFlow_24" name="2xx" sourceRef="ExclusiveGateway_1" targetRef="waitForAsyncMessage"> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("VNFREST_vnfAdapterStatusCode") == '200' || execution.getVariable("VNFREST_vnfAdapterStatusCode") == '202'}]]></bpmn2:conditionExpression> + </bpmn2:sequenceFlow> + <bpmn2:boundaryEvent id="BoundaryEvent_1" name="Timeout" attachedToRef="waitForAsyncMessage"> + <bpmn2:outgoing>SequenceFlow_27</bpmn2:outgoing> + <bpmn2:timerEventDefinition id="TimerEventDefinition_1"> + <bpmn2:timeDuration xsi:type="bpmn2:tFormalExpression"><![CDATA[${UrnPropertiesReader.getVariable("mso.po.timeout", execution)}]]></bpmn2:timeDuration> + </bpmn2:timerEventDefinition> + </bpmn2:boundaryEvent> + <bpmn2:subProcess id="waitForAsyncMessage" name="Wait for Callback"> + <bpmn2:incoming>SequenceFlow_24</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_28</bpmn2:outgoing> + <bpmn2:intermediateCatchEvent id="IntermediateCatchEvent_1" name="Catch Event"> + <bpmn2:incoming>SequenceFlow_25</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_26</bpmn2:outgoing> + <bpmn2:messageEventDefinition id="MessageEventDefinition_1" messageRef="Message_1"/> + </bpmn2:intermediateCatchEvent> + <bpmn2:sequenceFlow id="SequenceFlow_26" name="" sourceRef="IntermediateCatchEvent_1" targetRef="EndEvent_2"/> + <bpmn2:startEvent id="StartEvent_3"> + <bpmn2:outgoing>SequenceFlow_25</bpmn2:outgoing> + </bpmn2:startEvent> + <bpmn2:sequenceFlow id="SequenceFlow_25" name="" sourceRef="StartEvent_3" targetRef="IntermediateCatchEvent_1"/> + <bpmn2:endEvent id="EndEvent_2"> + <bpmn2:incoming>SequenceFlow_26</bpmn2:incoming> + </bpmn2:endEvent> + </bpmn2:subProcess> + <bpmn2:sequenceFlow id="SequenceFlow_27" name="" sourceRef="BoundaryEvent_1" targetRef="ScriptTask_5"/> + <bpmn2:scriptTask id="ScriptTask_5" name="Workflow Exception (timeout)" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_27</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_34</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* +def exceptionUtil = new ExceptionUtil() +exceptionUtil.buildAndThrowWorkflowException(execution, 7010, "VnfAdapter Callback Timeout Error")]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_28" name="" sourceRef="waitForAsyncMessage" targetRef="ScriptTask_6"/> + <bpmn2:scriptTask id="ScriptTask_6" name="Process Callback" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_28</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_33</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* +def vnfAdapterRestV1 = new VnfAdapterRestV1() +vnfAdapterRestV1.processCallback(execution) +]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_33" name="" sourceRef="ScriptTask_6" targetRef="ExclusiveGateway_2"/> + <bpmn2:sequenceFlow id="SequenceFlow_34" name="" sourceRef="ScriptTask_5" targetRef="EndEvent_8"/> + <bpmn2:endEvent id="EndEvent_8"> + <bpmn2:incoming>SequenceFlow_34</bpmn2:incoming> + <bpmn2:errorEventDefinition id="_ErrorEventDefinition_21" errorRef="Error_1"/> + </bpmn2:endEvent> + <bpmn2:sequenceFlow id="SequenceFlow_35" name="" sourceRef="ScriptTask_3" targetRef="EndEvent_9"/> + <bpmn2:endEvent id="EndEvent_9"> + <bpmn2:incoming>SequenceFlow_35</bpmn2:incoming> + <bpmn2:errorEventDefinition id="_ErrorEventDefinition_22" errorRef="Error_1"/> + </bpmn2:endEvent> + <bpmn2:endEvent id="EndEvent_10"> + <bpmn2:incoming>SequenceFlow_36</bpmn2:incoming> + <bpmn2:errorEventDefinition id="_ErrorEventDefinition_23" errorRef="Error_1"/> + </bpmn2:endEvent> + <bpmn2:sequenceFlow id="SequenceFlow_36" name="" sourceRef="ScriptTask_4" targetRef="EndEvent_10"/> + <bpmn2:endEvent id="EndEvent_7"> + <bpmn2:incoming>SequenceFlow_32</bpmn2:incoming> + <bpmn2:errorEventDefinition id="_ErrorEventDefinition_20" errorRef="Error_1"/> + </bpmn2:endEvent> + <bpmn2:exclusiveGateway id="ExclusiveGateway_2" name="Callback
Exception?" default="SequenceFlow_31"> + <bpmn2:incoming>SequenceFlow_33</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_31</bpmn2:outgoing> + <bpmn2:outgoing>SequenceFlow_32</bpmn2:outgoing> + </bpmn2:exclusiveGateway> + <bpmn2:sequenceFlow id="SequenceFlow_31" name="no" sourceRef="ExclusiveGateway_2" targetRef="ScriptTask_setSuccess"/> + <bpmn2:sequenceFlow id="SequenceFlow_32" name="yes" sourceRef="ExclusiveGateway_2" targetRef="EndEvent_7"> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("WorkflowException") != null}]]></bpmn2:conditionExpression> + </bpmn2:sequenceFlow> + <bpmn2:scriptTask id="ScriptTask_setSuccess" name="Set Success Indicator" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_31</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* +def vnfAdapterRestV1 = new VnfAdapterRestV1() +vnfAdapterRestV1.setSuccessIndicator(execution, true)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="ScriptTask_setSuccess" targetRef="EndEvent_6"/> + <bpmn2:endEvent id="EndEvent_6" name="End Flow"> + <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming> + </bpmn2:endEvent> + <bpmn2:scriptTask id="ScriptTask_7" name="Send Request to Vnf Adapter" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_3</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* +def vnfAdapterRestV1 = new VnfAdapterRestV1() +vnfAdapterRestV1.sendRequestToVnfAdapter(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_3" name="" sourceRef="ScriptTask_7" targetRef="ScriptTask_2"/> + <bpmn2:subProcess id="SubProcess_1" name="Error Handling Sub Process" triggeredByEvent="true"> + <bpmn2:scriptTask id="ScriptTask_8" name="Process Error" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_4</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_5</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* +def exUtil = new ExceptionUtil() +exUtil.processSubflowsBPMNException(execution) +]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_5" name="" sourceRef="ScriptTask_8" targetRef="EndEvent_1"/> + <bpmn2:endEvent id="EndEvent_1"> + <bpmn2:incoming>SequenceFlow_5</bpmn2:incoming> + </bpmn2:endEvent> + <bpmn2:startEvent id="StartEvent_2"> + <bpmn2:outgoing>SequenceFlow_4</bpmn2:outgoing> + <bpmn2:errorEventDefinition id="_ErrorEventDefinition_89"/> + </bpmn2:startEvent> + <bpmn2:sequenceFlow id="SequenceFlow_4" name="" sourceRef="StartEvent_2" targetRef="ScriptTask_8"/> + </bpmn2:subProcess> + <bpmn2:scriptTask id="ScriptTask_1" name="Pre-Process Request" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_9</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_2</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* +def vnfAdapterRestV1 = new VnfAdapterRestV1() +vnfAdapterRestV1.preProcessRequest(execution) +]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="ScriptTask_1" targetRef="ScriptTask_7"/> + <bpmn2:startEvent id="StartEvent_1" name="Start"> + <bpmn2:outgoing>SequenceFlow_9</bpmn2:outgoing> + </bpmn2:startEvent> + <bpmn2:sequenceFlow id="SequenceFlow_9" name="" sourceRef="StartEvent_1" targetRef="ScriptTask_1"/> + </bpmn2:process> + <bpmn2:error id="Error_1" errorCode="MSOWorkflowException" name="MSO Workflow Exception"/> + <bpmn2:message id="Message_1" name="WorkflowMessage"/> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="vnfAdapterRestV1"> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_56" bpmnElement="ScriptTask_1"> + <dc:Bounds height="80.0" width="100.0" x="204.0" y="148.0"/> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_SubProcess_14" bpmnElement="waitForAsyncMessage" isExpanded="true"> + <dc:Bounds height="154.0" width="265.0" x="744.0" y="275.0"/> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_58" bpmnElement="ScriptTask_6"> + <dc:Bounds height="80.0" width="100.0" x="1046.0" y="311.0"/> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_59" bpmnElement="ScriptTask_5"> + <dc:Bounds height="80.0" width="100.0" x="827.0" y="492.0"/> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_BoundaryEvent_24" bpmnElement="BoundaryEvent_1"> + <dc:Bounds height="36.0" width="36.0" x="859.0" y="411.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="22.0" width="52.0" x="894.0" y="441.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_IntermediateCatchEvent_20" bpmnElement="IntermediateCatchEvent_1"> + <dc:Bounds height="36.0" width="36.0" x="863.0" y="330.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="22.0" width="76.0" x="843.0" y="371.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_78" bpmnElement="ScriptTask_4"> + <dc:Bounds height="80.0" width="97.0" x="744.0" y="148.0"/> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_79" bpmnElement="ScriptTask_2"> + <dc:Bounds height="80.0" width="100.0" x="492.0" y="148.0"/> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_54" bpmnElement="StartEvent_1"> + <dc:Bounds height="36.0" width="36.0" x="84.0" y="170.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="22.0" width="34.0" x="85.0" y="211.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_168" bpmnElement="ScriptTask_3"> + <dc:Bounds height="80.0" width="97.0" x="744.0" y="24.0"/> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="SequenceFlow_9" sourceElement="_BPMNShape_StartEvent_54" targetElement="_BPMNShape_ScriptTask_56"> + <di:waypoint xsi:type="dc:Point" x="120.0" y="188.0"/> + <di:waypoint xsi:type="dc:Point" x="204.0" y="188.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="6.0" width="6.0" x="130.0" y="188.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_105" bpmnElement="ExclusiveGateway_1" isMarkerVisible="true"> + <dc:Bounds height="50.0" width="50.0" x="624.0" y="162.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="0.0" width="0.0" x="649.0" y="217.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_18" bpmnElement="SequenceFlow_14" sourceElement="_BPMNShape_ScriptTask_79" targetElement="_BPMNShape_ExclusiveGateway_105"> + <di:waypoint xsi:type="dc:Point" x="592.0" y="188.0"/> + <di:waypoint xsi:type="dc:Point" x="624.0" y="187.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="6.0" width="6.0" x="611.0" y="187.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_19" bpmnElement="SequenceFlow_17" sourceElement="_BPMNShape_ExclusiveGateway_105" targetElement="_BPMNShape_ScriptTask_168"> + <di:waypoint xsi:type="dc:Point" x="649.0" y="162.0"/> + <di:waypoint xsi:type="dc:Point" x="649.0" y="64.0"/> + <di:waypoint xsi:type="dc:Point" x="744.0" y="64.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="22.0" width="27.0" x="688.0" y="64.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_20" bpmnElement="SequenceFlow_23" sourceElement="_BPMNShape_ExclusiveGateway_105" targetElement="_BPMNShape_ScriptTask_78"> + <di:waypoint xsi:type="dc:Point" x="674.0" y="187.0"/> + <di:waypoint xsi:type="dc:Point" x="709.0" y="187.0"/> + <di:waypoint xsi:type="dc:Point" x="709.0" y="188.0"/> + <di:waypoint xsi:type="dc:Point" x="744.0" y="188.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="22.0" width="35.0" x="684.0" y="188.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_25" bpmnElement="SequenceFlow_24" sourceElement="_BPMNShape_ExclusiveGateway_105" targetElement="_BPMNShape_SubProcess_14"> + <di:waypoint xsi:type="dc:Point" x="649.0" y="212.0"/> + <di:waypoint xsi:type="dc:Point" x="649.0" y="353.0"/> + <di:waypoint xsi:type="dc:Point" x="708.0" y="353.0"/> + <di:waypoint xsi:type="dc:Point" x="744.0" y="353.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="22.0" width="27.0" x="688.0" y="328.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_55" bpmnElement="StartEvent_3"> + <dc:Bounds height="36.0" width="36.0" x="768.0" y="330.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="0.0" width="0.0" x="786.0" y="371.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_27" bpmnElement="SequenceFlow_25" sourceElement="_BPMNShape_StartEvent_55" targetElement="_BPMNShape_IntermediateCatchEvent_20"> + <di:waypoint xsi:type="dc:Point" x="804.0" y="348.0"/> + <di:waypoint xsi:type="dc:Point" x="863.0" y="348.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="6.0" width="6.0" x="833.0" y="348.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_EndEvent_156" bpmnElement="EndEvent_2"> + <dc:Bounds height="36.0" width="36.0" x="948.0" y="330.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="0.0" width="0.0" x="966.0" y="371.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_28" bpmnElement="SequenceFlow_26" sourceElement="_BPMNShape_IntermediateCatchEvent_20" targetElement="_BPMNShape_EndEvent_156"> + <di:waypoint xsi:type="dc:Point" x="899.0" y="348.0"/> + <di:waypoint xsi:type="dc:Point" x="929.0" y="348.0"/> + <di:waypoint xsi:type="dc:Point" x="929.0" y="347.0"/> + <di:waypoint xsi:type="dc:Point" x="948.0" y="348.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="6.0" width="6.0" x="926.0" y="348.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_29" bpmnElement="SequenceFlow_27" sourceElement="_BPMNShape_BoundaryEvent_24" targetElement="_BPMNShape_ScriptTask_59"> + <di:waypoint xsi:type="dc:Point" x="877.0" y="447.0"/> + <di:waypoint xsi:type="dc:Point" x="877.0" y="492.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="6.0" width="6.0" x="874.0" y="472.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_30" bpmnElement="SequenceFlow_28" sourceElement="_BPMNShape_SubProcess_14" targetElement="_BPMNShape_ScriptTask_58"> + <di:waypoint xsi:type="dc:Point" x="1008.0" y="351.0"/> + <di:waypoint xsi:type="dc:Point" x="1046.0" y="351.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="6.0" width="6.0" x="1023.0" y="351.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_106" bpmnElement="ExclusiveGateway_2" isMarkerVisible="true"> + <dc:Bounds height="50.0" width="50.0" x="1188.0" y="325.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="38.0" width="71.0" x="1179.0" y="288.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_EndEvent_158" bpmnElement="EndEvent_6"> + <dc:Bounds height="36.0" width="36.0" x="1463.0" y="333.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="22.0" width="60.0" x="1451.0" y="374.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_33" bpmnElement="SequenceFlow_31" sourceElement="_BPMNShape_ExclusiveGateway_106" targetElement="_BPMNShape_ScriptTask_236"> + <di:waypoint xsi:type="dc:Point" x="1238.0" y="350.0"/> + <di:waypoint xsi:type="dc:Point" x="1308.0" y="350.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="22.0" width="20.0" x="1248.0" y="350.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_EndEvent_159" bpmnElement="EndEvent_7"> + <dc:Bounds height="36.0" width="36.0" x="1196.0" y="426.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="0.0" width="0.0" x="1214.0" y="467.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_34" bpmnElement="SequenceFlow_32" sourceElement="_BPMNShape_ExclusiveGateway_106" targetElement="_BPMNShape_EndEvent_159"> + <di:waypoint xsi:type="dc:Point" x="1213.0" y="375.0"/> + <di:waypoint xsi:type="dc:Point" x="1213.0" y="392.0"/> + <di:waypoint xsi:type="dc:Point" x="1214.0" y="392.0"/> + <di:waypoint xsi:type="dc:Point" x="1214.0" y="426.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="22.0" width="27.0" x="1223.0" y="390.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_35" bpmnElement="SequenceFlow_33" sourceElement="_BPMNShape_ScriptTask_58" targetElement="_BPMNShape_ExclusiveGateway_106"> + <di:waypoint xsi:type="dc:Point" x="1146.0" y="351.0"/> + <di:waypoint xsi:type="dc:Point" x="1173.0" y="351.0"/> + <di:waypoint xsi:type="dc:Point" x="1173.0" y="350.0"/> + <di:waypoint xsi:type="dc:Point" x="1188.0" y="350.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="6.0" width="6.0" x="1170.0" y="350.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_EndEvent_160" bpmnElement="EndEvent_8"> + <dc:Bounds height="36.0" width="36.0" x="974.0" y="514.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="0.0" width="0.0" x="992.0" y="555.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_36" bpmnElement="SequenceFlow_34" sourceElement="_BPMNShape_ScriptTask_59" targetElement="_BPMNShape_EndEvent_160"> + <di:waypoint xsi:type="dc:Point" x="927.0" y="532.0"/> + <di:waypoint xsi:type="dc:Point" x="974.0" y="532.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="6.0" width="6.0" x="951.0" y="532.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_EndEvent_161" bpmnElement="EndEvent_9"> + <dc:Bounds height="36.0" width="36.0" x="891.0" y="46.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="0.0" width="0.0" x="909.0" y="87.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_37" bpmnElement="SequenceFlow_35" sourceElement="_BPMNShape_ScriptTask_168" targetElement="_BPMNShape_EndEvent_161"> + <di:waypoint xsi:type="dc:Point" x="840.0" y="64.0"/> + <di:waypoint xsi:type="dc:Point" x="891.0" y="64.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="6.0" width="6.0" x="865.0" y="64.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_EndEvent_162" bpmnElement="EndEvent_10"> + <dc:Bounds height="36.0" width="36.0" x="892.0" y="170.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="0.0" width="0.0" x="910.0" y="211.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_38" bpmnElement="SequenceFlow_36" sourceElement="_BPMNShape_ScriptTask_78" targetElement="_BPMNShape_EndEvent_162"> + <di:waypoint xsi:type="dc:Point" x="840.0" y="188.0"/> + <di:waypoint xsi:type="dc:Point" x="892.0" y="188.0"/> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_236" bpmnElement="ScriptTask_setSuccess"> + <dc:Bounds height="83.0" width="97.0" x="1308.0" y="309.0"/> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_ScriptTask_236" targetElement="_BPMNShape_EndEvent_158"> + <di:waypoint xsi:type="dc:Point" x="1404.0" y="350.0"/> + <di:waypoint xsi:type="dc:Point" x="1422.0" y="350.0"/> + <di:waypoint xsi:type="dc:Point" x="1422.0" y="351.0"/> + <di:waypoint xsi:type="dc:Point" x="1463.0" y="351.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="6.0" width="6.0" x="1419.0" y="351.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_237" bpmnElement="ScriptTask_7"> + <dc:Bounds height="83.0" width="97.0" x="360.0" y="146.0"/> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_ScriptTask_56" targetElement="_BPMNShape_ScriptTask_237"> + <di:waypoint xsi:type="dc:Point" x="304.0" y="188.0"/> + <di:waypoint xsi:type="dc:Point" x="344.0" y="188.0"/> + <di:waypoint xsi:type="dc:Point" x="344.0" y="187.0"/> + <di:waypoint xsi:type="dc:Point" x="360.0" y="187.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="6.0" width="6.0" x="317.0" y="188.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_4" bpmnElement="SequenceFlow_3" sourceElement="_BPMNShape_ScriptTask_237" targetElement="_BPMNShape_ScriptTask_79"> + <di:waypoint xsi:type="dc:Point" x="456.0" y="187.0"/> + <di:waypoint xsi:type="dc:Point" x="474.0" y="187.0"/> + <di:waypoint xsi:type="dc:Point" x="474.0" y="188.0"/> + <di:waypoint xsi:type="dc:Point" x="492.0" y="188.0"/> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_SubProcess_24" bpmnElement="SubProcess_1" isExpanded="true"> + <dc:Bounds height="181.0" width="382.0" x="180.0" y="532.0"/> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_66" bpmnElement="StartEvent_2"> + <dc:Bounds height="36.0" width="36.0" x="225.0" y="605.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="0.0" width="0.0" x="243.0" y="646.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_EndEvent_207" bpmnElement="EndEvent_1"> + <dc:Bounds height="36.0" width="36.0" x="477.0" y="605.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="0.0" width="0.0" x="495.0" y="646.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_266" bpmnElement="ScriptTask_8"> + <dc:Bounds height="83.0" width="97.0" x="323.0" y="581.0"/> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_5" bpmnElement="SequenceFlow_4" sourceElement="_BPMNShape_StartEvent_66" targetElement="_BPMNShape_ScriptTask_266"> + <di:waypoint xsi:type="dc:Point" x="261.0" y="623.0"/> + <di:waypoint xsi:type="dc:Point" x="323.0" y="622.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="6.0" width="6.0" x="273.0" y="623.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_6" bpmnElement="SequenceFlow_5" sourceElement="_BPMNShape_ScriptTask_266" targetElement="_BPMNShape_EndEvent_207"> + <di:waypoint xsi:type="dc:Point" x="419.0" y="622.0"/> + <di:waypoint xsi:type="dc:Point" x="477.0" y="623.0"/> + <bpmndi:BPMNLabel> + <dc:Bounds height="6.0" width="6.0" x="445.0" y="623.0"/> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> </bpmn2:definitions>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/resources/urn.properties b/bpmn/MSOCommonBPMN/src/main/resources/urn.properties deleted file mode 100644 index 12253aa9d2..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/resources/urn.properties +++ /dev/null @@ -1,30 +0,0 @@ -### -# ============LICENSE_START======================================================= -# ECOMP MSO -# ================================================================================ -# 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========================================================= -### - -# URN mappings for this project. - -# TODO: Remove all the non-URN stuff that's in here. -# TODO: Implement a real URN mapping capability. - -#AAIEndPoint= http://localhost:28080/SoapUIMocks -AAIEndPoint= http://localhost:28090/ -SDNCEndPoint=http://localhost:28090/SDNCAdapter/ -msoRollback = true -mso.AaiEncrypted.Pwd = C1FC4A39E16419DD41DFC1212843F440 diff --git a/bpmn/MSOCommonBPMN/src/main/resources/wsdl/VnfAdapterNotify.wsdl b/bpmn/MSOCommonBPMN/src/main/resources/wsdl/VnfAdapterNotify.wsdl index a4f194045a..b2c9a34c9b 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/wsdl/VnfAdapterNotify.wsdl +++ b/bpmn/MSOCommonBPMN/src/main/resources/wsdl/VnfAdapterNotify.wsdl @@ -1,17 +1,17 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> <definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:wsp="http://www.w3.org/ns/ws-policy" - xmlns:tns="http://org.openecomp.mso/vnfNotify" + xmlns:tns="http://org.onap.so/vnfNotify" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" name="vnfAdapterNotify" - targetNamespace="http://org.openecomp.mso/vnfNotify"> + targetNamespace="http://org.onap.so/vnfNotify"> <types> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" - targetNamespace="http://org.openecomp.mso/vnfNotify" + targetNamespace="http://org.onap.so/vnfNotify" version="1.0"> <xs:element name="createVnfNotification" type="tns:createVnfNotification"/> @@ -36,7 +36,7 @@ <xs:element minOccurs="0" name="outputs"> <xs:complexType> <xs:sequence> - <xs:element maxOccurs="unbounded" minOccurs="0" name="entry"> + <xs:element maxOccurs="255" minOccurs="0" name="entry"> <xs:complexType> <xs:sequence> <xs:element minOccurs="0" name="key" type="xs:string"/> @@ -78,7 +78,7 @@ <xs:element minOccurs="0" name="outputs"> <xs:complexType> <xs:sequence> - <xs:element maxOccurs="unbounded" minOccurs="0" name="entry"> + <xs:element maxOccurs="255" minOccurs="0" name="entry"> <xs:complexType> <xs:sequence> <xs:element minOccurs="0" name="key" type="xs:string"/> @@ -102,7 +102,7 @@ <xs:element minOccurs="0" name="outputs"> <xs:complexType> <xs:sequence> - <xs:element maxOccurs="unbounded" minOccurs="0" name="entry"> + <xs:element maxOccurs="255" minOccurs="0" name="entry"> <xs:complexType> <xs:sequence> <xs:element minOccurs="0" name="key" type="xs:string"/> @@ -172,23 +172,23 @@ <portType name="vnfAdapterNotify"> <operation name="rollbackVnfNotification"> <input message="tns:rollbackVnfNotification" - wsam:Action="http://org.openecomp.mso/notify/adapterNotify/rollbackVnfNotificationRequest"/> + wsam:Action="http://org.onap.so/notify/adapterNotify/rollbackVnfNotificationRequest"/> </operation> <operation name="queryVnfNotification"> <input message="tns:queryVnfNotification" - wsam:Action="http://org.openecomp.mso/notify/adapterNotify/queryVnfNotificationRequest"/> + wsam:Action="http://org.onap.so/notify/adapterNotify/queryVnfNotificationRequest"/> </operation> <operation name="createVnfNotification"> <input message="tns:createVnfNotification" - wsam:Action="http://org.openecomp.mso/notify/adapterNotify/createVnfNotificationRequest"/> + wsam:Action="http://org.onap.so/notify/adapterNotify/createVnfNotificationRequest"/> </operation> <operation name="updateVnfNotification"> <input message="tns:updateVnfNotification" - wsam:Action="http://org.openecomp.mso/notify/adapterNotify/updateVnfNotificationRequest"/> + wsam:Action="http://org.onap.so/notify/adapterNotify/updateVnfNotificationRequest"/> </operation> <operation name="deleteVnfNotification"> <input message="tns:deleteVnfNotification" - wsam:Action="http://org.openecomp.mso/notify/adapterNotify/deleteVnfNotificationRequest"/> + wsam:Action="http://org.onap.so/notify/adapterNotify/deleteVnfNotificationRequest"/> </operation> </portType> <binding name="MsoVnfAdapterAsyncImplPortBinding" type="tns:vnfAdapterNotify"> diff --git a/bpmn/MSOCommonBPMN/src/main/resources/xjb/AAI.xjb b/bpmn/MSOCommonBPMN/src/main/resources/xjb/AAI.xjb deleted file mode 100644 index ca8ac4766d..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/resources/xjb/AAI.xjb +++ /dev/null @@ -1,14 +0,0 @@ -<?xml version="1.0"?> -<jxb:bindings version="1.0" - xmlns:jxb="http://java.sun.com/xml/ns/jaxb" - xmlns:xs="http://www.w3.org/2001/XMLSchema" - xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc" - xmlns:inheritance="http://jaxb2-commons.dev.java.net/basic/inheritance" - jxb:extensionBindingPrefixes="xjc"> - - <jxb:bindings schemaLocation="../xsd/aai_schema_v10.xsd"> - <jxb:globalBindings> - <xjc:superClass name="org.openecomp.mso.client.aai.entities.AAIEntity" /> - </jxb:globalBindings> -</jxb:bindings> -</jxb:bindings>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/resources/xsd/MSOWorkflowSchemaV1.xsd b/bpmn/MSOCommonBPMN/src/main/resources/xsd/MSOWorkflowSchemaV1.xsd deleted file mode 100644 index 0472e54693..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/resources/xsd/MSOWorkflowSchemaV1.xsd +++ /dev/null @@ -1,129 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - <!-- - ================================================================ - Description: This is the schema for LPP Configuration Component - - ================================================================ - Change Log: Version Author Comments - =========== ======= ====== ======== - 0.10 ss835w 2011-4-13. First draft - - - ================================================================ - --> - -<schema targetNamespace="http://ecomp.att.com/mso/workflow/schema/v1" -xmlns="http://www.w3.org/2001/XMLSchema" - xmlns:tns="http://ecomp.att.com/mso/workflow/schema/v1" - xmlns:sdncadapterworkflow="http://ecomp.att.com/mso/workflow/schema/v1" - xmlns:msoservtypes="http://ecomp.att.com/mso/request/types/v1" - xmlns:msolayer3="http://ecomp.att.com/mso/request/layer3/schema/v1" - xmlns:sdncadapter="http://domain2.att.com/workflow/sdnc/adapter/schema/v1" - xmlns:aai="http://com.att.aai.inventory" - elementFormDefault="qualified"> - - <import namespace="http://ecomp.att.com/mso/request/types/v1" schemaLocation="MsoServiceRequestTypesV1.xsd"/> - - - <!-- ========================= --> - <!-- Simple Types - enum --> - <!-- ========================= --> - - <simpleType name="PortGroupNameType"> - <restriction base="string"> - <enumeration value="IPAG-VCE" /> - <enumeration value="VCE-VPE" /> - </restriction> - </simpleType> - - <simpleType name="SDNCActionType"> - <restriction base="string"> - <enumeration value="AssignVNFNetworkResources" /> - <enumeration value="ConfigureService" /> - <enumeration value="DeprovisionService" /> - <enumeration value="ReleaseVNFNetworkResources" /> - <enumeration value="UpdateService" /> - <enumeration value="TestService" /> - <enumeration value="ReserveService" /> - <enumeration value="ActivateService" /> - <enumeration value="GetServiceDetails" /> - </restriction> - </simpleType> - - <!-- ========================= --> - <!-- Complex Types --> - <!-- ========================= --> - - - <!-- ========================= --> - <!-- Elements --> - <!-- ========================= --> - - - - <!-- ========================= --> - <!-- Requests/Responses --> - <!-- ========================= --> - - - - - - - <element name="WorkflowException"> - <complexType> - <sequence> - <element name="ErrorMessage" type="string" minOccurs="1" maxOccurs="1" /> - <element name="ErrorCode" type="string" minOccurs="1" maxOccurs="1" /> - <element name="SourceSystemErrorCode" type="string" minOccurs="0" maxOccurs="1" /> - </sequence> - </complexType> - </element> - - - <!-- Error handler --> - <element name="FalloutHandlerRequest"> - <complexType> - <sequence> - <element ref="msoservtypes:request-information" minOccurs="1" maxOccurs="1" /> - <element ref="sdncadapterworkflow:WorkflowException" minOccurs="1" maxOccurs="1" /> - <element name="is-srv-inst-req" type="boolean" minOccurs="0" maxOccurs="1" /> - <element name="resp-content-type" type="string" minOccurs="0" maxOccurs="1" /> - <element name="service-instance-id" type="string" minOccurs="0" maxOccurs="1"/> - <element name="start-time" type="string" minOccurs="0" maxOccurs="1"/> - </sequence> - </complexType> - </element> - - <element name="FalloutHandlerResponse"> - <complexType> - <sequence> - <element name="out" type="string"></element> - </sequence> - </complexType> - </element> - - <!-- Completion handler --> - <element name="MsoCompletionRequest"> - <complexType> - <sequence> - <element ref="msoservtypes:request-information" minOccurs="1" maxOccurs="1" /> - <element name="mso-bpel-name" type="string" minOccurs="1" maxOccurs="1" /> - <element name="is-srv-inst-req" type="boolean" minOccurs="0" maxOccurs="1" /> - <element name="resp-content-type" type="string" minOccurs="0" maxOccurs="1" /> - <element name="service-instance-id" type="string" minOccurs="0" maxOccurs="1"/> - <element name="start-time" type="string" minOccurs="0" maxOccurs="1"/> - </sequence> - </complexType> - </element> - - <element name="MsoCompletionResponse"> - <complexType> - <sequence> - <element name="out" type="string"></element> - </sequence> - </complexType> - </element> - - -</schema> diff --git a/bpmn/MSOCommonBPMN/src/main/resources/xsd/ManualTasks.xsd b/bpmn/MSOCommonBPMN/src/main/resources/xsd/ManualTasks.xsd deleted file mode 100644 index f1754b6ba7..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/resources/xsd/ManualTasks.xsd +++ /dev/null @@ -1,49 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<xs:schema targetNamespace="http://www.example.org/mso" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.example.org/mso">
- <xs:element name="taskList">
- <xs:complexType>
- <xs:sequence>
- <xs:element type="xs:string" name="taskId"/>
- <xs:element type="xs:string" name="type"/>
- <xs:element type="xs:string" name="nfRole"/>
- <xs:element type="xs:string" name="subscriptionServiceType"/>
- <xs:element type="xs:string" name="originalRequestId"/>
- <xs:element type="xs:string" name="originalRequestorId"/>
- <xs:element type="xs:string" name="errorSource"/>
- <xs:element type="xs:string" name="errorCode"/>
- <xs:element type="xs:string" name="errorMessage"/>
- <xs:element type="xs:string" name="buildingBlockName"/>
- <xs:element type="xs:string" name="buildingBlockStep"/>
- <xs:element name="validResponses">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="0" maxOccurs="unbounded" name="action" type="xs:string"/>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="requestDetails">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="requestInfo">
- <xs:complexType>
- <xs:sequence>
- <xs:element type="xs:string" name="source"/>
- <xs:element type="xs:string" name="responseValue"/>
- <xs:element type="xs:string" name="requestorId"/>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name ="taskRequestReference">
- <xs:complexType>
- <xs:sequence>
- <xs:element type="xs:string" name="taskId"/>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
-</xs:schema>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/resources/xsd/MsoServiceRequestTypesV1.xsd b/bpmn/MSOCommonBPMN/src/main/resources/xsd/MsoServiceRequestTypesV1.xsd deleted file mode 100644 index c5fa26c998..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/resources/xsd/MsoServiceRequestTypesV1.xsd +++ /dev/null @@ -1,99 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<!-- - ================================================================ - Description: This is the schema for MSO Request data - - ================================================================ - Change Log: Version Author Comments - =========== ======= ====== ======== - 0.10 ss835w 2014-12-22. First draft - 0.20 dr695h 2014-01-09. Second draft - - ================================ ================================ - --> -<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://ecomp.att.com/mso/request/types/v1" targetNamespace="http://ecomp.att.com/mso/request/types/v1" elementFormDefault="qualified"> - <complexType name="response-type"> - <sequence> - <element name="request-id" type="string" minOccurs="1" maxOccurs="1"/> - <element name="request-action" type="tns:request-action-type" minOccurs="1" maxOccurs="1"/> - <element name="source" type="string" minOccurs="1" maxOccurs="1"/> - <element name="request-id-in-progress" type="string" minOccurs="0" maxOccurs="1"/> - <element name="error-code" type="int" minOccurs="0" maxOccurs="1"/> - <element name="error-message" type="string" minOccurs="0" maxOccurs="1"/> - <element name="ack-final-indicator" type="tns:y-or-n-type" minOccurs="1" maxOccurs="1"/> - </sequence> - </complexType> - <annotation> - <documentation xml:lang="en">order-number is required if service-type equals SDN-ETHERNET-INTERNET. order-version is required if service-type equals - SDN-ETHERNET-INTERNET, source=OMX, and request-action=Layer3ServiceActivateRequest or ChangeLayer3ServiceProvRequest</documentation> - </annotation> - <element name="request-information"> - <complexType> - <sequence> - <element name="request-id" type="string" minOccurs="1" maxOccurs="1"/> - <element name="request-action" type="tns:request-action-type" minOccurs="1" maxOccurs="1"/> - <element name="request-sub-action" type="tns:request-sub-action-type" minOccurs="0" maxOccurs="1"/> - <element name="source" type="string" minOccurs="1" maxOccurs="1"/> - <element name="notification-url" type="string" minOccurs="0" maxOccurs="1"/> - <element name="order-number" type="string" minOccurs="0" maxOccurs="1"/> - <element name="order-version" type="string" minOccurs="0" maxOccurs="1"/> - </sequence> - </complexType> - </element> - <annotation> - <documentation xml:lang="en">subscriber-name required if request-action=Layer3ServiceActivateRequest</documentation> - </annotation> - <element name="service-information"> - <complexType> - <sequence> - <element name="service-type" type="tns:service-type" minOccurs="1" maxOccurs="1"/> - <element name="service-instance-id" type="string" minOccurs="1" maxOccurs="1"/> - <element name="subscriber-name" type="string" minOccurs="0" maxOccurs="1"/> - </sequence> - </complexType> - </element> - <element name="feature-information"> - <complexType> - <sequence> - <element name="feature-type" type="tns:feature-type"/> - <element name="feature-instance-id" type="string"/> - <element name="feature-yang-model" type="string"/> - <element name="feature-yang-model-version" type="string"/> - </sequence> - </complexType> - </element> - <simpleType name="request-action-type"> - <restriction base="string"> - <enumeration value="Layer3ServiceActivateRequest"/> - <enumeration value="Layer3ServiceTestAndTurnupRequest"/> - <enumeration value="ChangeLayer3ServiceActivateRequest"/> - <enumeration value="ChangeLayer3ServiceProvRequest"/> - <enumeration value="DisconnectLayer3ServiceRequest"/> - <enumeration value="GetLayer3ServiceDetailsRequest"/> - <enumeration value="ChangeFeatureActivateRequest"/> - </restriction> - </simpleType> - <simpleType name="request-sub-action-type"> - <restriction base="string"> - <enumeration value="CANCEL"/> - <enumeration value="SUPP"/> - </restriction> - </simpleType> - <simpleType name="service-type"> - <restriction base="string"> - <enumeration value="SDN-ETHERNET-INTERNET"/> - </restriction> - </simpleType> - <simpleType name="y-or-n-type"> - <restriction base="string"> - <enumeration value="Y"/> - <enumeration value="N"/> - </restriction> - </simpleType> - <simpleType name="feature-type"> - <restriction base="string"> - <enumeration value="FIREWALL-LITE"/> - </restriction> - </simpleType> -</schema> diff --git a/bpmn/MSOCommonBPMN/src/main/resources/xsd/aai_schema_v10.xsd b/bpmn/MSOCommonBPMN/src/main/resources/xsd/aai_schema_v10.xsd deleted file mode 100644 index 0972056432..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/resources/xsd/aai_schema_v10.xsd +++ /dev/null @@ -1,6547 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="yes"?> -<xs:schema elementFormDefault="qualified" version="1.0" targetNamespace="http://com.att.aai.inventory/v10" xmlns:tns="http://com.att.aai.inventory/v10" xmlns:xs="http://www.w3.org/2001/XMLSchema" -xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" - jaxb:version="2.1" - xmlns:annox="http://annox.dev.java.net" - jaxb:extensionBindingPrefixes="annox"> - - <xs:element name="inventory-item-data"> - <xs:complexType> - <xs:sequence> - <xs:element name="property-name" type="xs:string" minOccurs="0"/> - <xs:element name="property-value" type="xs:string" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="inventory-item"> - <xs:complexType> - <xs:sequence> - <xs:element name="inventory-item-type" type="xs:string" minOccurs="0"/> - <xs:element name="inventory-item-link" type="xs:string" minOccurs="0"/> - <xs:element ref="tns:inventory-item-data" minOccurs="0" maxOccurs="unbounded"/> - <xs:element ref="tns:tagged-inventory-item-list" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="tagged-inventory-item-list"> - <xs:complexType> - <xs:sequence> - <xs:element ref="tns:inventory-item" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="edge-tag-query-result"> - <xs:complexType> - <xs:sequence> - <xs:element ref="tns:tagged-inventory-item-list" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="start-node-filter"> - <xs:complexType> - <xs:sequence> - <xs:element name="property-name" type="xs:string" minOccurs="0"/> - <xs:element name="property-value" type="xs:string" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="include-node-filter"> - <xs:complexType> - <xs:sequence> - <xs:element name="include-node-type" type="xs:string" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="secondary-filter"> - <xs:complexType> - <xs:sequence> - <xs:element name="property-name" type="xs:string" minOccurs="0"/> - <xs:element name="filter-type" type="xs:string" minOccurs="0"/> - <xs:element name="property-value" type="xs:string" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="edge-tag-query-request"> - <xs:complexType> - <xs:sequence> - <xs:element name="edge-tag" type="xs:string" minOccurs="0"/> - <xs:element name="result-detail" type="xs:string" minOccurs="0"/> - <xs:element name="start-node-type" type="xs:string" minOccurs="0"/> - <xs:element ref="tns:start-node-filter" minOccurs="0" maxOccurs="unbounded"/> - <xs:element ref="tns:include-node-filter" minOccurs="0" maxOccurs="unbounded"/> - <xs:element ref="tns:secondary-filter" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="result-data"> - <xs:complexType> - <xs:sequence> - <xs:element name="resource-type" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="The specific type of node in the A&AI graph")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-link" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="The URL to the specific resource")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="search-results"> - <xs:complexType> - <xs:sequence> - <xs:element ref="tns:result-data" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="relationship-data"> - <xs:complexType> - <xs:sequence> - <xs:element name="relationship-key" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="A keyword provided by A&AI to indicate an attribute.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="relationship-value" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Value of the attribute.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="related-to-property"> - <xs:complexType> - <xs:sequence> - <xs:element name="property-key" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Key part of a key/value pair")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="property-value" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Value part of a key/value pair")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="relationship"> - <xs:complexType> - <xs:sequence> - <xs:element name="related-to" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="A keyword provided by A&AI to indicate type of node.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="related-link" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="URL to the object in A&AI.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:relationship-data" minOccurs="0" maxOccurs="unbounded"/> - <xs:element ref="tns:related-to-property" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="relationship-list"> - <xs:complexType> - <xs:sequence> - <xs:element ref="tns:relationship" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="oam-network"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="OAM network, to be deprecated shortly. Do not use for new purposes. ",nameProps="network-name",indexedProps="cvlan-tag,network-uuid,network-name",dependentOn="cloud-region",container="oam-networks")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="network-uuid" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="UUID of the network. Unique across a cloud-region")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="network-name" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Name of the network.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="cvlan-tag" type="xs:unsignedInt"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="cvlan-id")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="ipv4-oam-gateway-address" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Used for VNF firewall rule so customer cannot send customer traffic over this oam network")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="ipv4-oam-gateway-address-prefix-length" type="xs:int" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Used for VNF firewall rule so customer cannot send customer traffic over this oam network")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="oam-networks"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Collection of OAM networks, to be deprecated shortly. Do not use for new purposes. ")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element ref="tns:oam-network" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="dvs-switch"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Digital virtual switch metadata, used by SDN-C to configure VCEs. A&AI needs to receive this data from the PO deployment team and administer it using the provisioningTool.sh into A&AI. ",indexedProps="vcenter-url,switch-name",dependentOn="cloud-region",container="dvs-switches")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="switch-name" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="DVS switch name")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="vcenter-url" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="URL used to reach the vcenter")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="dvs-switches"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Collection of digital virtual switch metadata used for vmWare VCEs and VPEs.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element ref="tns:dvs-switch" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="availability-zone"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Availability zone, a collection of compute hosts/pservers",indexedProps="availability-zone-name",dependentOn="cloud-region",container="availability-zones")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="availability-zone-name" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="Name of the availability zone. Unique across a cloud region")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="hypervisor-type" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Type of hypervisor. Source of truth should define valid values.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="operational-status" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Status that indicates whether the asset is in or out of the service path. Valid values are null, in-service-path, out-of-service-path.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="az-and-dvs-switches"> - <xs:complexType> - <xs:sequence> - <xs:element ref="tns:dvs-switches" minOccurs="0"/> - <xs:element ref="tns:availability-zone" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="sdn-zone-response"> - <xs:complexType> - <xs:sequence> - <xs:element ref="tns:oam-networks" minOccurs="0"/> - <xs:element ref="tns:az-and-dvs-switches" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="search"> - <xs:complexType> - <xs:sequence> - <xs:element ref="tns:edge-tag-query-result" minOccurs="0"/> - <xs:element ref="tns:edge-tag-query-request" minOccurs="0"/> - <xs:element ref="tns:search-results" minOccurs="0"/> - <xs:element ref="tns:sdn-zone-response" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="update-node-key"> - <xs:complexType> - <xs:sequence> - <xs:element name="key-name" type="xs:string" minOccurs="0"/> - <xs:element name="key-value" type="xs:string" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="action-data"> - <xs:complexType> - <xs:sequence> - <xs:element name="property-name" type="xs:string" minOccurs="0"/> - <xs:element name="property-value" type="xs:string" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="action"> - <xs:complexType> - <xs:sequence> - <xs:element name="action-type" type="xs:string" minOccurs="0"/> - <xs:element ref="tns:action-data" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="update"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Serves a PATCH like function. Does not enforce concurrency control. Clear each usage with AAI team.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="update-node-type" type="xs:string"/> - <xs:element ref="tns:update-node-key" minOccurs="0" maxOccurs="unbounded"/> - <xs:element name="update-node-uri" type="xs:string" minOccurs="0"/> - <xs:element ref="tns:action" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="key-data"> - <xs:complexType> - <xs:sequence> - <xs:element name="key-name" type="xs:string" minOccurs="0"/> - <xs:element name="key-value" type="xs:string" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="notify"> - <xs:complexType> - <xs:sequence> - <xs:element name="event-id" type="xs:string"/> - <xs:element name="node-type" type="xs:string" minOccurs="0"/> - <xs:element name="event-trigger" type="xs:string" minOccurs="0"/> - <xs:element ref="tns:key-data" minOccurs="0" maxOccurs="unbounded"/> - <xs:element name="selflink" type="xs:string" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="actions"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="APIs that are more action related than REST (e.g., notify, update).")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element ref="tns:update" minOccurs="0"/> - <xs:element ref="tns:notify" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="ctag-pool"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="A collection of C tags (vlan tags) grouped for a specific purpose.",indexedProps="availability-zone-name",dependentOn="complex",container="ctag-pools")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="target-pe" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="The Target provider edge router")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="availability-zone-name" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="Name of the availability zone")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="ctag-pool-purpose" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Describes what the intended purpose of this pool is.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="ctag-values" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Comma separated list of ctags")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="ctag-pools"> - <xs:complexType> - <xs:sequence> - <xs:element ref="tns:ctag-pool" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="complex"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Collection of physical locations that can house cloud-regions.",indexedProps="identity-url,data-center-code,complex-name,physical-location-id",searchable="physical-location-id,data-center-code,complex-name,street1,street2,postal-code",uniqueProps="physical-location-id",container="complexes",namespace="cloud-infrastructure")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="physical-location-id" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="Unique identifier for physical location, e.g., CLLI")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="data-center-code" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Data center code which can be an alternate way to identify a complex")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="complex-name" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Gamma complex name for LCP instance.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="identity-url" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="URL of the keystone identity service")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="physical-location-type" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Type, e.g., central office, data center.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="street1" type="xs:string"/> - <xs:element name="street2" type="xs:string" minOccurs="0"/> - <xs:element name="city" type="xs:string"/> - <xs:element name="state" type="xs:string" minOccurs="0"/> - <xs:element name="postal-code" type="xs:string"/> - <xs:element name="country" type="xs:string"/> - <xs:element name="region" type="xs:string"/> - <xs:element name="latitude" type="xs:string" minOccurs="0"/> - <xs:element name="longitude" type="xs:string" minOccurs="0"/> - <xs:element name="elevation" type="xs:string" minOccurs="0"/> - <xs:element name="lata" type="xs:string" minOccurs="0"/> - <xs:element ref="tns:ctag-pools" minOccurs="0"/> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="complexes"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Collection of physical locations that can house cloud-regions.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element ref="tns:complex" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="volume-group"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Persistent block-level storage.",indexedProps="volume-group-name,vnf-type,heat-stack-id,volume-group-id",searchable="volume-group-id,volume-group-name",dependentOn="cloud-region",container="volume-groups")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="volume-group-id" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="Unique ID of volume-group.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="volume-group-name" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Name of the volume group.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="heat-stack-id" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Heat stack id corresponding to this volume-group")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="vnf-type" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="String capturing type of vnf, that was intended to identify the ASDC resource. This field has been overloaded in service-specific ways and clients should expect changes to occur in the future to this field as ECOMP matures.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="orchestration-status" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Orchestration status of this volume-group")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="model-customization-id" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="captures the id of all the configuration used to customize the resource for the service.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="vf-module-model-customization-id" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="helps relate the volume group to the vf-module whose components will require the volume group")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="volume-groups"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Collection of persistent block-level storage.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element ref="tns:volume-group" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="volume"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Ephemeral Block storage volume.",indexedProps="volume-id",dependentOn="vserver",container="volumes")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="volume-id" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="Unique ID of block storage volume relative to the vserver.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="volume-selflink" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="URL to endpoint where AAI can get more details")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="volumes"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Collection of ephemeral Block storage volumes.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element ref="tns:volume" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="l3-interface-ipv4-address-list"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="IPv4 Address Range",indexedProps="l3-interface-ipv4-address,vlan-id-inner,neutron-network-id,neutron-subnet-id",dependentOn="vlan,l-interface")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="l3-interface-ipv4-address" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="IP address")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="l3-interface-ipv4-prefix-length" type="xs:unsignedInt" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Prefix length, 32 for single address")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="vlan-id-inner" type="xs:unsignedInt" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Inner VLAN tag")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="vlan-id-outer" type="xs:unsignedInt" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Outer VLAN tag")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="is-floating" type="xs:boolean" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Indicator of fixed or floating address")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="neutron-network-id" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Neutron network id of the interface that address belongs to")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="neutron-subnet-id" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Neutron id of subnet that address belongs to")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="l3-interface-ipv6-address-list"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="IPv6 Address Range",indexedProps="l3-interface-ipv6-address,vlan-id-inner,neutron-network-id,neutron-subnet-id",dependentOn="vlan,l-interface")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="l3-interface-ipv6-address" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="IP address")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="l3-interface-ipv6-prefix-length" type="xs:unsignedInt" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Prefix length, 128 for single address")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="vlan-id-inner" type="xs:unsignedInt" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Inner VLAN tag")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="vlan-id-outer" type="xs:unsignedInt" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Outer VLAN tag")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="is-floating" type="xs:boolean" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Indicator of fixed or floating address")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="neutron-network-id" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Neutron network id of the interface that address belongs to")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="neutron-subnet-id" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Neutron id of subnet that address belongs to")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="vlan"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Definition of vlan",indexedProps="vlan-interface,vlan-id-inner,vpn-id",uniqueProps="vpn-id",dependentOn="l-interface",container="vlans")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="vlan-interface" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="String that identifies the interface")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="vlan-id-inner" type="xs:unsignedInt" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Inner VLAN tag")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="vlan-id-outer" type="xs:unsignedInt" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Outer VLAN tag")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="speed-value" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Captures the numeric part of the speed")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="speed-units" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Captures the units corresponding to the speed")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="vlan-description" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Used to describe (the service associated with) the vlan")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="backdoor-connection" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Whether customer is going to use this VLAN for backdoor connection to another customer premise device.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="vpn-id" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="This indicates the customers VPN ID associated with this vlan")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="orchestration-status" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Status of a vnf's vlan interface, on which the customer circuit resides, mastered by SDN-C.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - <xs:element ref="tns:l3-interface-ipv4-address-list" minOccurs="0" maxOccurs="unbounded"/> - <xs:element ref="tns:l3-interface-ipv6-address-list" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="vlans"> - <xs:complexType> - <xs:sequence> - <xs:element ref="tns:vlan" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="sriov-vf"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="SR-IOV Virtual Function (not to be confused with virtual network function)",indexedProps="pci-id,vf-vlan-filter,vf-mac-filter,vf-vlan-strip,neutron-network-id",dependentOn="l-interface",container="sriov-vfs")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="pci-id" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="PCI ID used to identify the sriov-vf")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="vf-vlan-filter" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="This metadata provides option to specify list of VLAN filters applied on VF to pass the traffic to VM.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="vf-mac-filter" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="When MAC filters are specified, VF-agent service configures VFs to do MAC level filtering before the traffic is passed to VM.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="vf-vlan-strip" type="xs:boolean" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="When this field is set to true, VF will configured to strip the outer TAG before the traffic is passed to VM.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="vf-vlan-anti-spoof-check" type="xs:boolean" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="This option ensures anti VLAN spoof checks are done at the VF level to comply with security. The disable check will also be honored per the VNF needs for trusted VMs.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="vf-mac-anti-spoof-check" type="xs:boolean" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="This option ensures anti MAC spoof checks are done at the VF level to comply with security. The disable check will also be honored per the VNF needs for trusted VMs.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="vf-mirrors" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="This option defines the set of Mirror objects which essentially mirrors the traffic from source to set of collector VNF Ports.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="vf-broadcast-allow" type="xs:boolean" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="This option, if set to true, sets the VF in promiscuous mode and allows all broadcast traffic to reach the VM")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="vf-unknown-multicast-allow" type="xs:boolean" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="This option, if set to true, sets the VF in promiscuous mode and allows unknown multicast traffic to reach the VM")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="vf-unknown-unicast-allow" type="xs:boolean" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="This option, if set to true, sets the VF in promiscuous mode and allows unknown unicast traffic to reach the VM")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="vf-insert-stag" type="xs:boolean" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="This option, if set to true, instructs to insert outer tag after traffic comes out of VM.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="vf-link-status" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="This option is used to set the link status. Valid values as of 1607 are on, off, and auto.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="neutron-network-id" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Neutron network id of the interface")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="sriov-vfs"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Collection of SR-IOV Virtual Functions.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element ref="tns:sriov-vf" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="l-interface"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Logical interfaces, e.g., a vnic.",indexedProps="macaddr,interface-id,interface-name,network-name",dependentOn="generic-vnf,newvce,vpe,p-interface,vserver,lag-interface",container="l-interfaces")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="interface-name" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="Name given to the interface")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="interface-role" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="E.g., CUSTOMER, UPLINK, etc.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="v6-wan-link-ip" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Questionably placed - v6 ip addr of this interface (is in vr-lan-interface from Mary B.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="selflink" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="URL to endpoint where AAI can get more details")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="interface-id" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="ID of interface")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="macaddr" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="MAC address for the interface")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="network-name" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Name of the network")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="management-option" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Whether A&AI should be managing this interface of not. Could have value like CUSTOMER")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="interface-description" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Human friendly text regarding this interface.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="is-port-mirrored" type="xs:boolean"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(defaultValue="false",description="used to indicate whether or not this port is mirrored.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:l-interfaces" minOccurs="0"/> - <xs:element ref="tns:vlans" minOccurs="0"/> - <xs:element ref="tns:sriov-vfs" minOccurs="0"/> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - <xs:element ref="tns:l3-interface-ipv4-address-list" minOccurs="0" maxOccurs="unbounded"/> - <xs:element ref="tns:l3-interface-ipv6-address-list" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="l-interfaces"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Collection of logical interfaces.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element ref="tns:l-interface" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="vserver"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Virtual Servers, aka virtual machine or VM.",nameProps="vserver-name",indexedProps="is-closed-loop-disabled,prov-status,vserver-name,vserver-id,in-maint,vserver-name2",searchable="vserver-id,vserver-name,vserver-name2",dependentOn="tenant",container="vservers")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="vserver-id" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="Unique identifier for this vserver relative to its tenant")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="vserver-name" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Name of vserver")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="vserver-name2" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Alternative name of vserver")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="prov-status" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Trigger for operational monitoring of this resource by Service Assurance systems.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="vserver-selflink" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="URL to endpoint where AAI can get more details")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="in-maint" type="xs:boolean"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(defaultValue="false",description="Used to indicate whether or not this object is in maintenance mode (maintenance mode = true). This field (in conjunction with prov-status) is used to suppress alarms and vSCL on VNFs/VMs.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="is-closed-loop-disabled" type="xs:boolean"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(defaultValue="false",description="Used to indicate whether closed loop function is enabled on this node")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:volumes" minOccurs="0"/> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - <xs:element ref="tns:l-interfaces" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="vservers"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Collection of virtual Servers, aka virtual machines or VMs.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element ref="tns:vserver" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="tenant"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Openstack tenant",nameProps="tenant-name",indexedProps="tenant-name,tenant-id",searchable="tenant-id,tenant-name",dependentOn="cloud-region",container="tenants")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="tenant-id" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="Unique id relative to the cloud-region.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="tenant-name" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Readable name of tenant")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:vservers" minOccurs="0"/> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="tenants"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Collection of openstack tenants.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element ref="tns:tenant" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="flavor"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Openstack flavor.",nameProps="flavor-name",indexedProps="flavor-name,flavor-id",dependentOn="cloud-region",container="flavors")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="flavor-id" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="Flavor id, expected to be unique across cloud-region.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="flavor-name" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Flavor name")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="flavor-vcpus" type="xs:int" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Number of CPUs")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="flavor-ram" type="xs:int" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Amount of memory")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="flavor-disk" type="xs:int" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Disk space")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="flavor-ephemeral" type="xs:int" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Amount of ephemeral disk space")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="flavor-swap" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="amount of swap space allocation")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="flavor-is-public" type="xs:boolean" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="whether flavor is available to all users or private to the tenant it was created in.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="flavor-selflink" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="URL to endpoint where AAI can get more details")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="flavor-disabled" type="xs:boolean" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Boolean as to whether this flavor is no longer enabled")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="flavors"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Collection of openstack flavors.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element ref="tns:flavor" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="group-assignment"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Openstack group-assignment used to store exclusivity groups (EG).",nameProps="group-name",indexedProps="group-id,group-type,group-name",dependentOn="cloud-region",container="group-assignments")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="group-id" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="Group id, expected to be unique across cloud-region.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="group-type" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Group type - the type of group this instance refers to")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="group-name" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Group name - name assigned to the group")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="group-description" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Group description - description of the group")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="group-assignments"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Collection of openstack group assignments")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element ref="tns:group-assignment" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="snapshot"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Openstack snapshot",nameProps="snapshot-name",uniqueProps="snapshot-id",indexedProps="application,snapshot-name,application-vendor,snapshot-id,application-version,prev-snapshot-id",dependentOn="cloud-region",container="snapshots")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="snapshot-id" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="Snapshot id, this is the key UUID assoc associated in glance with the snapshots.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="snapshot-name" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Snapshot name")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="snapshot-architecture" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Operating system architecture")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="snapshot-os-distro" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="The common name of the operating system distribution in lowercase")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="snapshot-os-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="The operating system version as specified by the distributor.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="application" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="The application that the image instantiates.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="application-vendor" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="The vendor of the application.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="application-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="The version of the application.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="snapshot-selflink" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="URL to endpoint where AAI can get more details")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="prev-snapshot-id" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="This field contains the UUID of the previous snapshot (if any).")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="snapshots"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Collection of openstack snapshots")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element ref="tns:snapshot" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="metadatum"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Key/value pairs",indexedProps="metaname",dependentOn="tenant,image,service-instance,connector,model",container="metadata")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="metaname" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true)</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="metaval" type="xs:string"/> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="metadata"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Collection of metadatum (key/value pairs)")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element ref="tns:metadatum" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="image"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Openstack image.",nameProps="image-name",indexedProps="application,image-name,application-vendor,image-id,application-version",dependentOn="cloud-region",container="images")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="image-id" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="Image id, expected to be unique across cloud region")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="image-name" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Image name")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="image-architecture" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Operating system architecture.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="image-os-distro" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="The common name of the operating system distribution in lowercase")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="image-os-version" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="The operating system version as specified by the distributor.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="application" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="The application that the image instantiates.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="application-vendor" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="The vendor of the application.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="application-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="The version of the application.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="image-selflink" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="URL to endpoint where AAI can get more details")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - <xs:element ref="tns:metadata" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="images"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Collectio of Openstack images.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element ref="tns:image" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="availability-zones"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Collection of availability zones")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element ref="tns:availability-zone" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="cloud-region"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="cloud-region designates an installation of a cloud cluster or region or instantiation. In AT&Ts AIC cloud, this could be an LCP or DCP. Cloud regions are uniquely identified by a composite key, cloud-owner + cloud-region-id. The format of the cloud-owner is vendor-cloudname and we will use att-aic for AT&T's AIC. It's important to note that the cloud-region data is not updated once created, so there is a potential for the data to become stale.",indexedProps="cloud-owner,cloud-region-id,cloud-type,owner-defined-type",nameProps="owner-defined-type",container="cloud-regions",namespace="cloud-infrastructure")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="cloud-owner" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="Identifies the vendor and cloud name, e.g., att-aic. First part of composite key should be formatted as vendor-cloudname")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="cloud-region-id" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="Identifier used by the vendor for the region. Second part of composite key")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="cloud-type" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Type of the cloud (e.g., openstack)")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="owner-defined-type" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Cloud-owner defined type indicator (e.g., dcp, lcp)")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="cloud-region-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Software version employed at the site. NOTE - THIS FIELD IS NOT KEPT UP TO DATE.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="identity-url" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="URL of the keystone identity service")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="cloud-zone" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Zone where the cloud is homed. NOTE - THIS FIELD IS NOT CORRECTLY POPULATED.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="complex-name" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="complex name for cloud-region instance. NOTE - THIS FIELD IS NOT CORRECTLY POPULATED.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:volume-groups" minOccurs="0"/> - <xs:element ref="tns:tenants" minOccurs="0"/> - <xs:element ref="tns:flavors" minOccurs="0"/> - <xs:element ref="tns:group-assignments" minOccurs="0"/> - <xs:element ref="tns:snapshots" minOccurs="0"/> - <xs:element ref="tns:images" minOccurs="0"/> - <xs:element ref="tns:dvs-switches" minOccurs="0"/> - <xs:element ref="tns:oam-networks" minOccurs="0"/> - <xs:element ref="tns:availability-zones" minOccurs="0"/> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="cloud-regions"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(maximumDepth="0")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element ref="tns:cloud-region" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="network-profile"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Network profile populated by SDN-GP for SNMP",indexedProps="nm-profile-name",container="network-profiles",namespace="cloud-infrastructure")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="nm-profile-name" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="Unique name of network profile.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="community-string" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Encrypted SNMP community string")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="network-profiles"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Collection of network profiles")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element ref="tns:network-profile" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="p-interface"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Physical interface (e.g., nic)",indexedProps="interface-name,prov-status",nameProps="prov-status",dependentOn="vpls-pe,pserver,pnf",container="p-interfaces")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="interface-name" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="Name that identifies the physical interface")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="speed-value" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Captures the numeric part of the speed")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="speed-units" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Captures the units corresponding to the speed")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="port-description" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Nature of the services and connectivity on this port.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="equipment-identifier" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="CLEI or other specification for p-interface hardware.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="interface-role" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Role specification for p-interface hardware.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="interface-type" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Indicates the physical properties of the interface.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="prov-status" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Trigger for operational monitoring of this resource by Service Assurance systems.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - <xs:element ref="tns:l-interfaces" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="p-interfaces"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Collection of physical interfaces.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element ref="tns:p-interface" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="lag-interface"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Link aggregate interface",indexedProps="interface-name,interface-id,interface-role",dependentOn="generic-vnf,pserver,vpe,vpls-pe,pnf",container="lag-interfaces")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="interface-name" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="Name that identifies the link aggregate interface")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="interface-description" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Human friendly text regarding this interface.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="speed-value" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Captures the numeric part of the speed")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="speed-units" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Captures the units corresponding to the speed")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="interface-id" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="ID of interface")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="interface-role" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Role assigned to this Interface, should use values as defined in ECOMP Yang models.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="prov-status" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Trigger for operational monitoring of this resource by Service Assurance systems.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - <xs:element ref="tns:l-interfaces" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="lag-interfaces"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Collection of link aggregate interfaces.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element ref="tns:lag-interface" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="pserver"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Compute host whose hostname must be unique and must exactly match what is sent as a relationship to a vserver.",nameProps="pserver-name2",indexedProps="hostname,in-maint,pserver-id,pserver-name2,inv-status",searchable="hostname,pserver-name2,pserver-id,ipv4-oam-address",container="pservers",namespace="cloud-infrastructure")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="hostname" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="Value from executing hostname on the compute node.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="ptnii-equip-name" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="PTNII name")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="number-of-cpus" type="xs:int" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Number of cpus")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="disk-in-gigabytes" type="xs:int" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Disk size, in GBs")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="ram-in-megabytes" type="xs:int" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="RAM size, in MBs")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="equip-type" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Equipment type. Source of truth should define valid values.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="equip-vendor" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Equipment vendor. Source of truth should define valid values.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="equip-model" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Equipment model. Source of truth should define valid values.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="fqdn" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Fully-qualified domain name")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="pserver-selflink" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="URL to endpoint where AAI can get more details")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="ipv4-oam-address" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Used to configure device, also used for troubleshooting and is IP used for traps generated by device.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="serial-number" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Serial number, may be queried")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="ipaddress-v4-loopback-0" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="IPV4 Loopback 0 address")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="ipaddress-v6-loopback-0" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="IPV6 Loopback 0 address")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="ipaddress-v4-aim" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="IPV4 AIM address")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="ipaddress-v6-aim" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="IPV6 AIM address")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="ipaddress-v6-oam" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="IPV6 OAM address")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="inv-status" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="CANOPI's inventory status. Only set with values exactly as defined by CANOPI.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="pserver-id" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="ID of Pserver")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="internet-topology" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="internet topology of Pserver")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="in-maint" type="xs:boolean"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(defaultValue="false",description="used to indicate whether or not this object is in maintenance mode (maintenance mode = true). This field (in conjunction with prov-status) is used to suppress alarms and vSCL on VNFs/VMs.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="pserver-name2" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="alternative pserver name")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="purpose" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="purpose of pserver")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="prov-status" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Prov Status of this device (not under canopi control) Valid values [PREPROV/NVTPROV/PROV]")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - <xs:element ref="tns:p-interfaces" minOccurs="0"/> - <xs:element ref="tns:lag-interfaces" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="pservers"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Collection of compute hosts.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element ref="tns:pserver" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="virtual-data-center"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Virtual organization of cloud infrastructure elements in a data center context",nameProps="vdc-name",indexedProps="vdc-name,vdc-id",container="virtual-data-centers",namespace="cloud-infrastructure")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="vdc-id" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="Unique ID of the vdc")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="vdc-name" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Name of the virtual data center")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="virtual-data-centers"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Virtual organization of cloud infrastructure elements in a data center context")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element ref="tns:virtual-data-center" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="cloud-infrastructure"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Namespace for cloud infrastructure.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element ref="tns:complexes" minOccurs="0"/> - <xs:element ref="tns:cloud-regions" minOccurs="0"/> - <xs:element ref="tns:network-profiles" minOccurs="0"/> - <xs:element ref="tns:pservers" minOccurs="0"/> - <xs:element ref="tns:virtual-data-centers" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="connector"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Collection of resource instances used to connect a variety of disparate inventory widgets",indexedProps="resource-instance-id,model-invariant-id,model-version-id,widget-model-id,widget-model-version",container="connectors",namespace="business")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="resource-instance-id" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="Unique id of resource instance.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="model-invariant-id" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="the ASDC model id for this resource or service model.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="model-version-id" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="the ASDC model version uuid for this resource or service model.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="widget-model-id" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="the ASDC data dictionary widget model. This maps directly to the A&AI widget.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="widget-model-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="the ASDC data dictionary version of the widget model.This maps directly to the A&AI version of the widget.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - <xs:element ref="tns:metadata" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="connectors"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Collection of resource instances used to connect a variety of disparate inventory widgets")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element ref="tns:connector" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="tunnel-xconnect"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Represents the specifics of a tunnel cross connect piece of a resource that gets separately allotted",uniqueProps="id",indexedProps="id",dependentOn="allotted-resource",container="tunnel-xconnects")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="id" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="Allotted Resource id UUID assigned to this instance.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="bandwidth-up-wan1" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="The WAN uplink bandwidth for WAN1")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="bandwidth-down-wan1" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="The WAN downlink bandwidth for WAN1")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="bandwidth-up-wan2" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="The WAN uplink bandwidth for WAN2")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="bandwidth-down-wan2" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="The WAN downlink bandwidth for WAN2")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Concurrency value")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="tunnel-xconnects"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="This object is used to store the specific tunnel cross connect aspects of an allotted resource")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element ref="tns:tunnel-xconnect" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="allotted-resource"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Represents a slice or partial piece of a resource that gets separately allotted",nameProps="description",uniqueProps="id",indexedProps="id,model-invariant-id,model-version-id,type,role",dependentOn="service-instance",container="allotted-resources")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="id" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="Allotted Resource id UUID assigned to this instance.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="description" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="The descriptive information assigned to this allotted resource instance")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="selflink" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Link back to more information in the controller")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="model-invariant-id" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="the ASDC model id for this resource or service model.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="model-version-id" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="the ASDC model version uuid for this resource or service model.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="model-customization-id" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="captures the id of all the configuration used to customize the resource for the service.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="orchestration-status" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Orchestration status of this resource, mastered by MSO")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="operational-status" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Status that indicates whether the asset is in or out of the service path. Valid values are null, in-service-path, out-of-service-path.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Concurrency value")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="type" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Generic description of the type of the resource")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="role" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Role that this asset will be playing in its context.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:tunnel-xconnects" minOccurs="0"/> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="allotted-resources"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="This object is used to store slices of services being offered")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element ref="tns:allotted-resource" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="service-instance"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Instance of a service",indexedProps="service-instance-id,model-invariant-id,model-version-id,widget-model-id,widget-model-version,service-instance-name,service-instance-location-id,orchestration-status",nameProps="service-instance-name",searchable="service-instance-id,service-instance-name",uniqueProps="service-instance-id",dependentOn="service-subscription",container="service-instances")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="service-instance-id" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="Uniquely identifies this instance of a service")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="service-instance-name" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="This field will store a name assigned to the service-instance.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="model-invariant-id" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="the ASDC model id for this resource or service model.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="model-version-id" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="the ASDC model version uuid for this resource or service model.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="widget-model-id" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="the ASDC data dictionary widget model. This maps directly to the A&AI widget.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="widget-model-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="the ASDC data dictionary version of the widget model.This maps directly to the A&AI version of the widget.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="bandwidth-total" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Indicates the total bandwidth to be used for this service.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="bandwidth-up-wan1" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="indicates the upstream bandwidth this service will use on the WAN1 port of the physical device.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="bandwidth-down-wan1" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="indicates the downstream bandwidth this service will use on the WAN1 port of the physical device.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="bandwidth-up-wan2" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="indicates the upstream bandwidth this service will use on the WAN2 port of the physical device.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="bandwidth-down-wan2" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="indicates the downstream bandwidth this service will use on the WAN2 port of the physical device.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="vhn-portal-url" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="URL customers will use to access the vHN Portal.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="service-instance-location-id" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="An identifier that customers assign to the location where this service is being used.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="selflink" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Path to the controller object.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="orchestration-status" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Orchestration status of this service.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - <xs:element ref="tns:metadata" minOccurs="0"/> - <xs:element ref="tns:allotted-resources" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="service-instances"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Collection of service instances")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element ref="tns:service-instance" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="service-subscription"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Object that group service instances.",indexedProps="service-type",dependentOn="customer",container="service-subscriptions",crossEntityReference="service-instance,service-type")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="service-type" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="Value defined by orchestration to identify this service across ECOMP.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="temp-ub-sub-account-id" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="This property will be deleted from A&AI in the near future. Only stop gap solution.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:service-instances" minOccurs="0"/> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="service-subscriptions"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Collection of objects that group service instances.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element ref="tns:service-subscription" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="customer"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="customer identifiers to provide linkage back to BSS information.",nameProps="subscriber-name",indexedProps="subscriber-name,global-customer-id,subscriber-type",searchable="global-customer-id,subscriber-name",uniqueProps="global-customer-id",container="customers",namespace="business")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="global-customer-id" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="Global customer id used across ECOMP to uniquely identify customer.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="subscriber-name" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Subscriber name, an alternate way to retrieve a customer.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="subscriber-type" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Subscriber type, a way to provide VID with only the INFRA customers.",defaultValue="CUST")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:service-subscriptions" minOccurs="0"/> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="customers"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Collection of customer identifiers to provide linkage back to BSS information.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element ref="tns:customer" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="business"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Namespace for business related constructs")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element ref="tns:connectors" minOccurs="0"/> - <xs:element ref="tns:customers" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="vnf-image"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Image object that pertain to a VNF that doesn't have associated vservers. This is a kludge.",indexedProps="application,att-uuid,application-vendor,application-version",uniqueProps="att-uuid",container="vnf-images",namespace="service-design-and-creation")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="att-uuid" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="Unique ID of this asset")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="application" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="The application that the image instantiates.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="application-vendor" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="The vendor of the application.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="application-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="The version of the application.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="selflink" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="URL to endpoint where AAI can get more details")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="vnf-images"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Collection of image objects that pertain to a VNF that doesn't have associated vservers. This is a kludge.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element ref="tns:vnf-image" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="service"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Stand-in for service model definitions. Likely to be deprecated in favor of models from ASDC. Does not strictly map to ASDC services.",indexedProps="service-description,service-id",container="services",namespace="service-design-and-creation")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="service-id" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="This gets defined by others to provide a unique ID for the service, we accept what is sent.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="service-description" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Description of the service")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="service-selflink" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="URL to endpoint where AAI can get more details")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="service-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="service version")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="services"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Collection of service model definitions. Likely to be deprecated in favor of models from ASDC.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element ref="tns:service" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="service-capability"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Early definition of server/resource pairings, likely to be replaced by models. No new use should be made of this.",indexedProps="service-type,vnf-type",container="service-capabilities",namespace="service-design-and-creation")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="service-type" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="This gets defined by others to provide a unique ID for the service, we accept what is sent.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="vnf-type" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="String capturing type of vnf, that was intended to identify the ASDC resource. This field has been overloaded in service-specific ways and clients should expect changes to occur in the future to this field as ECOMP matures.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="service-capabilities"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Collection of service capabilities.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element ref="tns:service-capability" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="element-choice-set"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="This is how we would capture constraints defining allowed sets of elements.",uniqueProps="element-choice-set-uuid",indexedProps="element-choice-set-uuid",allowDirectRead="true",allowDirectWrite="false",container="element-choice-sets")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="element-choice-set-uuid" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,autoGenerateUuid="true")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="element-choice-set-name" type="xs:string"/> - <xs:element name="cardinality" type="xs:string" minOccurs="0"/> - <xs:element name="resource-version" type="xs:string" minOccurs="0"/> - <xs:element ref="tns:model-elements" minOccurs="0"/> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="element-choice-sets"> - <xs:complexType> - <xs:sequence> - <xs:element ref="tns:element-choice-set" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="constrained-element-set"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="This is how we would capture constraints defining allowed sets of elements.",uniqueProps="constrained-element-set-uuid",indexedProps="constrained-element-set-uuid",allowDirectRead="true",allowDirectWrite="false",container="constrained-element-sets")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="constrained-element-set-uuid" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,autoGenerateUuid="true")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="constraint-type" type="xs:string"/> - <xs:element name="check-type" type="xs:string"/> - <xs:element name="resource-version" type="xs:string" minOccurs="0"/> - <xs:element ref="tns:element-choice-sets" minOccurs="0"/> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="constrained-element-sets"> - <xs:complexType> - <xs:sequence> - <xs:element ref="tns:constrained-element-set" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="model-constraint"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="This is how we would capture constraints defining allowed sets of elements.",uniqueProps="model-constraint-uuid",indexedProps="model-constraint-uuid",allowDirectRead="true",allowDirectWrite="false",container="model-constraints")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="model-constraint-uuid" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,autoGenerateUuid="true")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="constrained-element-set-uuid-to-replace" type="xs:string"/> - <xs:element ref="tns:constrained-element-sets" minOccurs="0"/> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="model-constraints"> - <xs:complexType> - <xs:sequence> - <xs:element ref="tns:model-constraint" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="model-element"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Defines how other models combine to make up a higher-level model.",uniqueProps="model-element-uuid",indexedProps="model-element-uuid",allowDirectRead="true",allowDirectWrite="false",container="model-elements")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="model-element-uuid" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,autoGenerateUuid="true")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="new-data-del-flag" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Indicates whether this element was created as part of instantiation from this model")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="cardinality" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="How many of this type of element are required/allowed")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="linkage-points" minOccurs="0"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Defines how other models combine to make up a higher-level model.",uniqueProps="model-element-uuid",indexedProps="model-element-uuid",allowDirectRead="true",allowDirectWrite="false",container="model-elements")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="linkage-point" type="xs:string" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:model-elements" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Defines how other models combine to make up a higher-level model")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:model-constraints" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Describes new constraints on this model element that are not part of that model's definition")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="model-elements"> - <xs:complexType> - <xs:sequence> - <xs:element ref="tns:model-element" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="model-ver"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Subgraph definition provided by ASDC to describe a specific version of an inventory asset and its connections related to ASDC models",nameProps="model-name",indexedProps="model-version-id,model-name,model-version",uniqueProps="model-version-id",container="model-vers")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="model-version-id" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="Unique identifier corresponding to one version of a model in ASDC")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="model-name" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Name of the model, which can change from version to version.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="model-version" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Version")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="model-description" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Description")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:model-elements" minOccurs="0"/> - <xs:element ref="tns:metadata" minOccurs="0"/> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="model-vers"> - <xs:complexType> - <xs:sequence> - <xs:element ref="tns:model-ver" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="model"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Subgraph definition provided by ASDC to describe an inventory asset and its connections related to ASDC models, independent of version",nameProps="model-type",indexedProps="model-invariant-id,model-type",uniqueProps="model-invariant-id",container="models",namespace="service-design-and-creation")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="model-invariant-id" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="Unique identifier corresponding to the main definition of a model in ASDC")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="model-type" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Type of the model, e.g., service, resource, widget, etc.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:model-vers" minOccurs="0"/> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="models"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Collection of subgraph definitions provided by ASDC to describe the inventory assets and their connections related to ASDC models")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element ref="tns:model" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="related-lookup"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="TBD",uniqueProps="related-lookup-uuid",indexedProps="related-lookup-uuid",allowDirectRead="true",allowDirectWrite="false",container="related-lookups")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="related-lookup-uuid" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,autoGenerateUuid="true")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="source-node-type" type="xs:string"/> - <xs:element name="source-node-property" type="xs:string"/> - <xs:element name="target-node-type" type="xs:string"/> - <xs:element name="target-node-property" type="xs:string"/> - <xs:element name="property-collect-list" type="xs:string" minOccurs="0" maxOccurs="unbounded"/> - <xs:element name="resource-version" type="xs:string" minOccurs="0"/> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="related-lookups"> - <xs:complexType> - <xs:sequence> - <xs:element ref="tns:related-lookup" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="property-constraint"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="TBD",uniqueProps="property-constraint-uuid",indexedProps="property-constraint-uuid",allowDirectRead="true",allowDirectWrite="false",container="property-constraints")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="property-constraint-uuid" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,autoGenerateUuid="true")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="constraint-type" type="xs:string"/> - <xs:element name="property-name" type="xs:string"/> - <xs:element name="property-value" type="xs:string"/> - <xs:element name="resource-version" type="xs:string" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="property-constraints"> - <xs:complexType> - <xs:sequence> - <xs:element ref="tns:property-constraint" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="named-query-element"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="TBD",uniqueProps="named-query-element-uuid",indexedProps="named-query-element-uuid",allowDirectRead="true",allowDirectWrite="false",container="named-query-elements")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="named-query-element-uuid" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,autoGenerateUuid="true")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="property-collect-list" type="xs:string" minOccurs="0" maxOccurs="unbounded"/> - <xs:element name="resource-version" type="xs:string" minOccurs="0"/> - <xs:element name="property-limit-desc" type="xs:string" minOccurs="0"/> - <xs:element name="do-not-output" type="xs:string" minOccurs="0"/> - <xs:element ref="tns:named-query-elements" minOccurs="0"/> - <xs:element ref="tns:related-lookups" minOccurs="0"/> - <xs:element ref="tns:property-constraints" minOccurs="0"/> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="named-query-elements"> - <xs:complexType> - <xs:sequence> - <xs:element ref="tns:named-query-element" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="named-query"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="TBD",nameProps="named-query-name",uniqueProps="named-query-uuid",indexedProps="named-query-uuid,named-query-name",container="named-queries",namespace="service-design-and-creation")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="named-query-uuid" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true)</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="named-query-name" type="xs:string"/> - <xs:element name="named-query-version" type="xs:string"/> - <xs:element name="required-input-params" minOccurs="0"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="TBD",nameProps="named-query-name",uniqueProps="named-query-uuid",indexedProps="named-query-uuid,named-query-name",container="named-queries",namespace="service-design-and-creation")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="required-input-param" type="xs:string" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="description" type="xs:string" minOccurs="0"/> - <xs:element name="resource-version" type="xs:string" minOccurs="0"/> - <xs:element ref="tns:named-query-elements" minOccurs="0"/> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="named-queries"> - <xs:complexType> - <xs:sequence> - <xs:element ref="tns:named-query" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="service-design-and-creation"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Namespace for objects managed by ASDC")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element ref="tns:vnf-images" minOccurs="0"/> - <xs:element ref="tns:services" minOccurs="0"/> - <xs:element ref="tns:service-capabilities" minOccurs="0"/> - <xs:element ref="tns:models" minOccurs="0"/> - <xs:element ref="tns:named-queries" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="logical-link"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Logical links generally connect l-interfaces but are used to express logical connectivity between two points",indexedProps="link-name,model-invariant-id,model-version-id,widget-model-id,widget-model-version,link-id,prov-status,circuit-id,purpose",uniqueProps="link-id",container="logical-links",namespace="network",searchable="link-name")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="link-name" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="e.g., evc-name, or vnf-nameA_interface-nameA_vnf-nameZ_interface-nameZ")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="link-type" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Type of logical link, e.g., evc")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="speed-value" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Captures the numeric part of the speed")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="speed-units" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Captures the units corresponding to the speed")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="ip-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="v4, v6, or ds for dual stack (should be att-ip-version)")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="routing-protocol" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="For example, static or BGP")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="model-invariant-id" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="the ASDC model id for this resource or service model.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="model-version-id" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="the ASDC model version uuid for this resource or service model.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="widget-model-id" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="the ASDC data dictionary widget model. This maps directly to the A&AI widget.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="widget-model-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="the ASDC data dictionary version of the widget model.This maps directly to the A&AI version of the widget.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="operational-status" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Status that indicates whether the asset is in or out of the service path. Valid values are null, in-service-path, out-of-service-path.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="prov-status" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Trigger for operational monitoring of this VNF by BAU Service Assurance systems.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="link-role" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Indication of the network use of the logical link.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="link-name2" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Alias or alternate name (CLCI or D1 name).")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="link-id" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="UUID of the logical-link, SDNC generates this.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="circuit-id" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Circuit id")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="purpose" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Reason for this entity, role it is playing")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="logical-links"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Collection of logical connections")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element ref="tns:logical-link" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="class-of-service"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(indexedProps="cos",dependentOn="site-pair",container="classes-of-service")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="cos" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="unique identifier of probe")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="probe-id" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="identifier of probe")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="probe-type" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="type of probe")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="classes-of-service"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="class-of-service of probe")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element ref="tns:class-of-service" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="site-pair"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(indexedProps="site-pair-id",uniqueProps="site-pair-id",dependentOn="routing-instance",container="site-pairs")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="site-pair-id" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="unique identifier of probe")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="source-ip" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Prefix address")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="destination-ip" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Prefix address")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="ip-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="ip version, v4, v6")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="destination-hostname" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Hostname of the destination equipment to which SLAs are measured against.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="destination-equip-type" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="The type of destinatination equipment. Could be Router, UCPE, etc.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:classes-of-service" minOccurs="0"/> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="site-pairs"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="probe within a set")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element ref="tns:site-pair" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="routing-instance"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(indexedProps="routing-instance-id",uniqueProps="routing-instance-id",dependentOn="site-pair-set",container="routing-instances")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="routing-instance-id" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="Unique id of routing instance")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="rpm-owner" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="rpm owner")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:site-pairs" minOccurs="0"/> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="routing-instances"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="set of probes related to generic-vnf routing instance")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element ref="tns:routing-instance" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="site-pair-set"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Set of instances for probes used to measure service level agreements",indexedProps="site-pair-set-id",uniqueProps="site-pair-set-id",container="site-pair-sets",namespace="network")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="site-pair-set-id" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="Unique id of site pair set.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:routing-instances" minOccurs="0"/> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="site-pair-sets"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Collection of sets of instances for probes related to generic-vnf")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element ref="tns:site-pair-set" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="route-target"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="stores the global route targets associated with a VPN",indexedProps="global-route-target,route-target-role",searchable="global-route-target",container="route-targets",namespace="network")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="global-route-target" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="Number used to identify an RT, globally unique in the network")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="route-target-role" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="Role assigned to this route target, valid values EXPORT/IMPORT/BOTH")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Relationship to other objects")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="route-targets"> - <xs:complexType> - <xs:sequence> - <xs:element ref="tns:route-target" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="vpn-binding"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="VPN binding",nameProps="vpn-name,vpn-type",indexedProps="vpn-name,vpn-id,global-route-target,vpn-type",searchable="vpn-id,vpn-name",uniqueProps="vpn-id",container="vpn-bindings",namespace="network")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="vpn-id" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="VPN ID, globally unique within A&AI")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="vpn-name" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="VPN Name")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="global-route-target" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Number used to identify a VPN, globally unique in the network. NOTE - WILL BE RETIRED IN 1802, see child object")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="vpn-platform" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="the platform associated with the VPN example AVPN, Mobility")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="vpn-type" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Type of the vpn, should be taken from enumerated/valid values")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="route-distinguisher" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Used to distinguish the distinct VPN routes of separate customers who connect to the provider in an MPLS network.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="route-target-role" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Role assigned to this route target. NOTE - WILL BE RETIRED IN 1802, see child object")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:route-targets" minOccurs="0"/> - <xs:element ref="tns:relationship-list" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="l3-networks relate to vpn-bindings")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="vpn-bindings"> - <xs:complexType> - <xs:sequence> - <xs:element ref="tns:vpn-binding" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="vpls-pe"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="VPLS Provider Edge routers.",indexedProps="prov-status,equipment-name",container="vpls-pes",namespace="network")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="equipment-name" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true)</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="prov-status" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Trigger for operational monitoring of this VNF by BAU Service Assurance systems.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="ipv4-oam-address" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Address tail-f uses to configure vpe, also used for troubleshooting and is IP used for traps generated by VPE (v4-loopback0-ip-address).")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="equipment-role" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Client should send valid enumerated value, e.g., VPLS-PE.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="vlan-id-outer" type="xs:unsignedInt" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Temporary location for stag to get to VCE")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - <xs:element ref="tns:p-interfaces" minOccurs="0"/> - <xs:element ref="tns:lag-interfaces" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="vpls-pes"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Collection of VPLS Provider Edge routers")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element ref="tns:vpls-pe" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="multicast-configuration"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(indexedProps="multicast-configuration-id",uniqueProps="multicast-configuration-id",container="multicast-configurations",namespace="network")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="multicast-configuration-id" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="Unique id of multicast configuration.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="multicast-protocol" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="protocol of multicast configuration")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="rp-type" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="rp type of multicast configuration")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="multicast-configurations"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="multicast configuration of generic-vnf ip-address")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element ref="tns:multicast-configuration" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="cvlan-tag-entry"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(dependentOn="port-group",indexedProps="cvlan-tag",container="cvlan-tags")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="cvlan-tag" type="xs:unsignedInt"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="See mis-na-virtualization-platform.yang")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="cvlan-tags"> - <xs:complexType> - <xs:sequence> - <xs:element ref="tns:cvlan-tag-entry" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="port-group"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Used to capture the network interfaces of this VCE",nameProps="port-group-name",indexedProps="port-group-id,heat-stack-id,interface-id,interface-name,switch-name",dependentOn="vce",container="port-groups")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="interface-id" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="Unique ID of the interface")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="neutron-network-id" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Neutron network id of this Interface")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="neutron-network-name" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Neutron network name of this Interface")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="interface-role" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Role assigned to this Interface, should use values as defined in ECOMP Yang models.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="port-group-id" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Unique ID for port group in vmware")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="port-group-name" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Likely to duplicate value of neutron network name")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="switch-name" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="DVS or standard switch name (should be non-null for port groups associated with DVS)")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="orchestration-status" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Orchestration status of this VNF, mastered by MSO")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="heat-stack-id" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Heat stack id corresponding to this instance, managed by MSO")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="mso-catalog-key" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Corresponds to the SDN-C catalog id used to configure this VCE")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:cvlan-tags" minOccurs="0"/> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="port-groups"> - <xs:complexType> - <xs:sequence> - <xs:element ref="tns:port-group" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="license"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Metadata for license group.",indexedProps="group-uuid,resource-uuid",dependentOn="generic-vnf,vce,vpe",container="licenses")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="group-uuid" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="Unique ID for the license group the resource belongs to, should be uuid.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-uuid" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="Unique ID of a license resource. ")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Concurrency value")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="licenses"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Licenses to be allocated across resources, keyed by group-uuid and resource-uuid, related to license management")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element ref="tns:license" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="entitlement"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Metadata for entitlement group.",indexedProps="group-uuid,resource-uuid",dependentOn="generic-vnf,vce,vpe",container="entitlements")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="group-uuid" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="Unique ID for the entitlement group the resource comes from, should be uuid.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-uuid" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="Unique ID of an entitlement resource. ")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Concurrency value")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="entitlements"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Entitlements, keyed by group-uuid and resource-uuid, related to license management")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element ref="tns:entitlement" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="vce"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Virtual Customer Edge Router, used specifically for Gamma. This object is deprecated.",nameProps="vnf-name",indexedProps="vnf-name,vnf-name2,vnf-type,heat-stack-id,vnf-id,interface-name,regional-resource-zone,vpe-id,prov-status,service-id",searchable="vnf-id,vnf-name,vnf-name2",uniqueProps="vnf-id",container="vces",namespace="network",extendsFrom="vnf")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="vnf-id" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="Unique id of VNF. This is unique across the graph.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="vnf-name" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Name of VNF.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="vnf-name2" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Alternate name of VNF.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="vnf-type" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="String capturing type of vnf, that was intended to identify the ASDC resource. This field has been overloaded in service-specific ways and clients should expect changes to occur in the future to this field as ECOMP matures.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="service-id" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Unique identifier of service, does not strictly map to ASDC services, SOON TO BE DEPRECATED.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="regional-resource-zone" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Regional way of organizing pservers, source of truth should define values")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="prov-status" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Trigger for operational monitoring of this resource by Service Assurance systems.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="operational-status" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Status that indicates whether the asset is in or out of the service path. Valid values are null, in-service-path, out-of-service-path.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="equipment-role" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Network role being played by this VNF")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="orchestration-status" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Orchestration status of this VNF, mastered by MSO")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="heat-stack-id" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Heat stack id corresponding to this instance, managed by MSO")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="mso-catalog-key" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Corresponds to the SDN-C catalog id used to configure this VCE")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="vpe-id" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Unique ID of VPE connected to this VCE.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="v6-vce-wan-address" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Valid v6 IP address for the WAN Link on this router. Implied length of /64.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="ipv4-oam-address" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Address tail-f uses to configure vce, also used for troubleshooting and is IP used for traps generated by VCE.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="ipv4-loopback0-address" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Loopback0 address")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:port-groups" minOccurs="0"/> - <xs:element ref="tns:licenses" minOccurs="0"/> - <xs:element ref="tns:entitlements" minOccurs="0"/> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="vces"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Collection of Virtual Customer Edge Routers, used specifically for Gamma. This object is deprecated.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element ref="tns:vce" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="vpe"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Relationship-list must include related to info for complex.",nameProps="vnf-name",indexedProps="vnf-name,vnf-name2,vnf-type,heat-stack-id,vnf-id,regional-resource-zone,prov-status,service-id",searchable="vnf-id,vnf-name,vnf-name2",uniqueProps="vnf-id",container="vpes",namespace="network",extendsFrom="vnf")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="vnf-id" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="Unique id of VNF. This is unique across the graph.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="vnf-name" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Name of VNF.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="vnf-name2" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Alternate name of VNF.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="vnf-type" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="String capturing type of vnf, that was intended to identify the ASDC resource. This field has been overloaded in service-specific ways and clients should expect changes to occur in the future to this field as ECOMP matures.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="service-id" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Unique identifier of service. Does not map strictly to ASDC services. SOON TO BE DEPRECATED")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="regional-resource-zone" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Regional way of organizing pservers, source of truth should define values")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="prov-status" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Trigger for operational monitoring of this resource by Service Assurance systems.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="operational-status" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Status that indicates whether the asset is in or out of the service path. Valid values are null, in-service-path, out-of-service-path.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="equipment-role" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Client should send valid enumerated value")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="orchestration-status" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Orchestration status of this VNF, mastered by MSO")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="heat-stack-id" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Heat stack id corresponding to this instance, managed by MSO")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="mso-catalog-key" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Corresponds to the SDN-C catalog id used to configure this VCE")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="ipv4-oam-address" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Address tail-f uses to configure vpe, also used for troubleshooting and is IP used for traps generated by VPE (v4-loopback0-ip-address).")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="ipv4-oam-gateway-address-prefix-length" type="xs:int" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Prefix length for oam-address")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="ipv4-oam-gateway-address" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Gateway address")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="v4-loopback0-ip-address" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Loopback0 address")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="vlan-id-outer" type="xs:unsignedInt" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Temporary location for stag to get to VCE")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="as-number" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="as-number of the VPE")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="summary-status" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="details regarding the vpe operation, PLEASE DISCONTINUE USE OF THIS FIELD.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="encrypted-access-flag" type="xs:boolean" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="indicates whether vpe access uses SSH")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - <xs:element ref="tns:l-interfaces" minOccurs="0"/> - <xs:element ref="tns:lag-interfaces" minOccurs="0"/> - <xs:element ref="tns:licenses" minOccurs="0"/> - <xs:element ref="tns:entitlements" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="vpes"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Virtual provider edge router. In 1504, A&AI will populate this object through an M&P and tool provided to operations.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element ref="tns:vpe" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="vnfc"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(indexedProps="vnfc-name,prov-status,vnfc-type,vnfc-function-code,ipaddress-v4-oam-vip,in-maint,is-closed-loop-disabled,group-notation",searchable="vnfc-name",container="vnfcs",namespace="network")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="vnfc-name" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="Unique ID of vnfc.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="vnfc-function-code" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="function code")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="vnfc-type" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="type")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="prov-status" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="prov status of this vnfc")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="orchestration-status" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Orchestration status of this VNF, mastered by APP-C")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="ipaddress-v4-oam-vip" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Oam V4 vip address of this vnfc")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="in-maint" type="xs:boolean"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(defaultValue="false",description="used to indicate whether or not this object is in maintenance mode (maintenance mode = true)")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="is-closed-loop-disabled" type="xs:boolean"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(defaultValue="false",description="used to indicate whether closed loop function is enabled on this node")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="group-notation" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Group notation of VNFC")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="vnfcs"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="virtual network components associated with a vserver from application controller.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element ref="tns:vnfc" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="subnet"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(indexedProps="subnet-id,subnet-name",nameProps="subnet-name",uniqueProps="subnet-id",dependentOn="l3-network",container="subnets")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="subnet-id" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="Subnet ID, should be UUID.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="subnet-name" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Name associated with the subnet.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="neutron-subnet-id" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Neutron id of this subnet")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="gateway-address" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="gateway ip address")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="network-start-address" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="network start address")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="cidr-mask" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="cidr mask")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="ip-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="ip version")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="orchestration-status" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Orchestration status of this VNF, mastered by MSO")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="dhcp-enabled" type="xs:boolean"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(defaultValue="false",description="dhcp enabled")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="dhcp-start" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="the start address reserved for use by dhcp")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="dhcp-end" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="the last address reserved for use by dhcp")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="subnets"> - <xs:complexType> - <xs:sequence> - <xs:element ref="tns:subnet" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="ctag-assignment"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(indexedProps="vlan-id-inner",dependentOn="l3-network",container="ctag-assignments")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="vlan-id-inner" type="xs:unsignedInt"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="id.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="ctag-assignments"> - <xs:complexType> - <xs:sequence> - <xs:element ref="tns:ctag-assignment" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="segmentation-assignment"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Openstack segmentation assignment.",indexedProps="segmentation-id",dependentOn="l3-network",container="segmentation-assignments")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="segmentation-id" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="Route Table Reference id, UUID assigned to this instance.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Concurrency value")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="segmentation-assignments"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Collection of openstack segmentation assignments")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element ref="tns:segmentation-assignment" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="l3-network"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Generic network definition",nameProps="network-name",indexedProps="heat-stack-id,network-uuid,service-id,network-id,network-name,model-invariant-id,model-version-id,widget-model-id,widget-model-version,contrail-network-fqdn,network-role",searchable="network-id,network-name",uniqueProps="network-id",container="l3-networks",namespace="network")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="network-id" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="Network ID, should be uuid. Unique across A&AI.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="network-name" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Name of the network, governed by some naming convention..")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="network-type" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Type of the network - who defines these values?")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="network-role" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Role the network plans - who defines these values?")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="network-technology" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Network technology - who defines these values?")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="neutron-network-id" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Neutron network id of this Interface")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="is-bound-to-vpn" type="xs:boolean"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(defaultValue="false",description="Set to true if bound to VPN")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="service-id" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Unique identifier of service from ASDC. Does not strictly map to ASDC services. SOON TO BE DEPRECATED")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="network-role-instance" type="xs:unsignedInt" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="network role instance")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="orchestration-status" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Orchestration status of this VNF, mastered by MSO")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="heat-stack-id" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Heat stack id corresponding to this instance, managed by MSO")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="mso-catalog-key" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Corresponds to the SDN-C catalog id used to configure this VCE")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="contrail-network-fqdn" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Contrail FQDN for the network")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="model-invariant-id" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="the ASDC model id for this resource or service model.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="model-version-id" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="the ASDC model version uuid for this resource or service model.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="model-customization-id" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="captures the id of all the configuration used to customize the resource for the service.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="widget-model-id" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="the ASDC data dictionary widget model. This maps directly to the A&AI widget.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="widget-model-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="the ASDC data dictionary version of the widget model.This maps directly to the A&AI version of the widget.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="physical-network-name" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Name associated with the physical network.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="is-provider-network" type="xs:boolean"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(defaultValue="false",description="boolean indicatating whether or not network is a provider network.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="is-shared-network" type="xs:boolean"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(defaultValue="false",description="boolean indicatating whether or not network is a shared network.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="is-external-network" type="xs:boolean"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(defaultValue="false",description="boolean indicatating whether or not network is an external network.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="operational-status" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Status that indicates whether the asset is in or out of the service path. Valid values are null, in-service-path, out-of-service-path.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="selflink" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Path to the controller object.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:subnets" minOccurs="0"/> - <xs:element ref="tns:ctag-assignments" minOccurs="0"/> - <xs:element ref="tns:segmentation-assignments" minOccurs="0"/> - <xs:element ref="tns:relationship-list" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Relates to tenant (or is it a child of tenant), complex, service, vpn-binding")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="l3-networks"> - <xs:complexType> - <xs:sequence> - <xs:element ref="tns:l3-network" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="network-policy"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(nameProps="network-policy-fqdn",indexedProps="network-policy-id,network-policy-fqdn",searchable="network-policy-id,network-policy-fqdn",uniqueProps="network-policy-id",container="network-policies",namespace="network")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="network-policy-id" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="UUID representing unique key to this instance")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="network-policy-fqdn" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Contrail FQDN for the policy")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="heat-stack-id" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="ID for the openStack Heat instance")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="network-policies"> - <xs:complexType> - <xs:sequence> - <xs:element ref="tns:network-policy" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="vf-module"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="a deployment unit of VNFCs",indexedProps="vf-module-id,vf-module-name,heat-stack-id,model-invariant-id,model-version-id,widget-model-id,widget-model-version,contrail-service-instance-fqdn",searchable="vf-module-id,vf-module-name",dependentOn="generic-vnf",container="vf-modules")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="vf-module-id" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="Unique ID of vf-module.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="vf-module-name" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Name of vf-module")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="heat-stack-id" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Heat stack id corresponding to this instance.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="orchestration-status" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="orchestration status of this vf-module, mastered by MSO")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="is-base-vf-module" type="xs:boolean"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(defaultValue="false",description="used to indicate whether or not this object is base vf module")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="model-invariant-id" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="the ASDC model id for this resource or service model.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="model-version-id" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="the ASDC model version uuid for this resource or service model.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="model-customization-id" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="captures the id of all the configuration used to customize the resource for the service.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="widget-model-id" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="the ASDC data dictionary widget model. This maps directly to the A&AI widget.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="widget-model-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="the ASDC data dictionary version of the widget model.This maps directly to the A&AI version of the widget.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="contrail-service-instance-fqdn" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="the Contrail unique ID for a service-instance")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="module-index" type="xs:int" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="the index will track the number of modules of a given type that have been deployed in a VNF, starting with 0, and always choosing the lowest available digit")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="selflink" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Path to the controller object.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="vf-modules"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Collection of vf-modules, a deployment unit of VNFCs")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element ref="tns:vf-module" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="generic-vnf"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="General purpose VNF",nameProps="vnf-name",indexedProps="is-closed-loop-disabled,vnf-name2,vnf-type,heat-stack-id,in-maint,vnf-name,vnf-id,regional-resource-zone,prov-status,service-id,model-invariant-id,model-version-id,widget-model-id,widget-model-version,nf-type,nf-role,nf-function,nf-naming-code",searchable="vnf-id,vnf-name,vnf-name2",uniqueProps="vnf-id",container="generic-vnfs",namespace="network",extendsFrom="vnf")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="vnf-id" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="Unique id of VNF. This is unique across the graph.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="vnf-name" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Name of VNF.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="vnf-name2" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Alternate name of VNF.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="vnf-type" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="String capturing type of vnf, that was intended to identify the ASDC resource. This field has been overloaded in service-specific ways and clients should expect changes to occur in the future to this field as ECOMP matures.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="service-id" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Unique identifier of service, does not necessarily map to ASDC service models. SOON TO BE DEPRECATED")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="regional-resource-zone" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Regional way of organizing pservers, source of truth should define values")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="prov-status" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Trigger for operational monitoring of this resource by Service Assurance systems.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="operational-status" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Status that indicates whether the asset is in or out of the service path. Valid values are null, in-service-path, out-of-service-path.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="equipment-role" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Client should send valid enumerated value")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="orchestration-status" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Orchestration status of this VNF, used by MSO.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="heat-stack-id" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Heat stack id corresponding to this instance, managed by MSO")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="mso-catalog-key" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Corresponds to the SDN-C catalog id used to configure this VCE")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="management-option" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="identifier of managed by ATT or customer")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="ipv4-oam-address" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Address tail-f uses to configure generic-vnf, also used for troubleshooting and is IP used for traps generated by generic-vnf.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="ipv4-loopback0-address" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="v4 Loopback0 address")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="nm-lan-v6-address" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="v6 Loopback address")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="management-v6-address" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="v6 management address")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="vcpu" type="xs:unsignedInt" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="number of vcpus ordered for this instance of VNF, used for VNFs with no vservers/flavors, to be used only by uCPE")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="vcpu-units" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="units associated with vcpu, used for VNFs with no vservers/flavors, to be used only by uCPE")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="vmemory" type="xs:unsignedInt" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="number of GB of memory ordered for this instance of VNF, used for VNFs with no vservers/flavors, to be used only by uCPE")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="vmemory-units" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="units associated with vmemory, used for VNFs with no vservers/flavors, to be used only by uCPE")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="vdisk" type="xs:unsignedInt" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="number of vdisks ordered for this instance of VNF, used for VNFs with no vservers/flavors, to be used only uCPE")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="vdisk-units" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="units associated with vdisk, used for VNFs with no vservers/flavors, to be used only by uCPE")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="in-maint" type="xs:boolean"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(defaultValue="false",description="used to indicate whether or not this object is in maintenance mode (maintenance mode = true). This field (in conjunction with prov-status) is used to suppress alarms and vSCL on VNFs/VMs.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="is-closed-loop-disabled" type="xs:boolean"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(defaultValue="false",description="used to indicate whether closed loop function is enabled on this node")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="summary-status" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="details regarding the generic-vnf operation, PLEASE DISCONTINUE USE OF THIS FIELD.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="encrypted-access-flag" type="xs:boolean" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="indicates whether generic-vnf access uses SSH")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="model-invariant-id" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="the ASDC model id for this resource or service model.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="model-version-id" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="the ASDC model version uuid for this resource or service model.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="model-customization-id" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="captures the id of all the configuration used to customize the resource for the service.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="widget-model-id" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="the ASDC data dictionary widget model. This maps directly to the A&AI widget.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="widget-model-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="the ASDC data dictionary version of the widget model.This maps directly to the A&AI version of the widget.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="as-number" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="as-number of the VNF")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="regional-resource-subzone" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="represents sub zone of the rr plane")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="nf-type" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Generic description of the type of the resource")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="nf-role" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Role that this asset will be playing in its context.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="nf-function" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="English description of function that the specific resource deployment is providing. Assigned as part of the customization of a resource in a service")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="nf-naming-code" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Short code that is used in naming instances of the item being modelled")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="selflink" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Path to the controller object.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - <xs:element ref="tns:l-interfaces" minOccurs="0"/> - <xs:element ref="tns:lag-interfaces" minOccurs="0"/> - <xs:element ref="tns:vf-modules" minOccurs="0"/> - <xs:element ref="tns:licenses" minOccurs="0"/> - <xs:element ref="tns:entitlements" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="generic-vnfs"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Collection of VNFs")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element ref="tns:generic-vnf" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="lag-link"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="LAG links can connect lag-interfaces",indexedProps="link-name",container="lag-links",namespace="network")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="link-name" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="Alphabetical concatenation of lag-interface names")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="lag-links"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Collection of link aggregation connections")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element ref="tns:lag-link" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="newvce"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="This object fills in the gaps from vce that were incorporated into generic-vnf. This object will be retired with vce.",nameProps="vnf-name",indexedProps="vnf-name,vnf-name2,vnf-type,heat-stack-id,prov-status,vnf-id2",searchable="vnf-id2,vnf-name,vnf-name2",uniqueProps="vnf-id2",container="newvces",namespace="network")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="vnf-id2" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="Unique id of VNF, can't use same attribute name right now until we promote this new object")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="vnf-name" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Name of VNF.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="vnf-name2" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Alternate name of VNF.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="vnf-type" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="String capturing type of vnf, that was intended to identify the ASDC resource. This field has been overloaded in service-specific ways and clients should expect changes to occur in the future to this field as ECOMP matures.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="prov-status" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Trigger for operational monitoring of this VNF by BAU Service Assurance systems.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="operational-status" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Status that indicates whether the asset is in or out of the service path. Valid values are null, in-service-path, out-of-service-path.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="ipv4-oam-address" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Address tail-f uses to configure vpe, also used for troubleshooting and is IP used for traps generated by VPE (v4-loopback0-ip-address).")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="equipment-role" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Client should send valid enumerated value, e.g., VPE.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="ipv4-loopback0-address" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="v4 Loopback0 address")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="orchestration-status" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Orchestration status of this VNF, mastered by MSO.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="heat-stack-id" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Heat stack id corresponding to this instance, managed by MSO")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="mso-catalog-key" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Corresponds to the SDN-C catalog id used to configure this VCE")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - <xs:element ref="tns:l-interfaces" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="newvces"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="This object fills in the gaps from vce that were incorporated into generic-vnf. This object will be retired with vce.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element ref="tns:newvce" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="pnf"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="PNF represents a physical network function. typically equipment used in the D1 world. in 1607, this will be populated by SDN-C to represent a premises router that a uCPE connects to. But this can be used to represent any physical device that is not an AIC node or uCPE.",indexedProps="pnf-name,orchestration-status,inv-status",searchable="pnf-name",uniqueProps="pnf-name",container="pnfs",namespace="network")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="pnf-name" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="unique name of Physical Network Function.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="pnf-name2" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="name of Physical Network Function.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="pnf-name2-source" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="source of name2")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="pnf-id" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="id of pnf")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="equip-type" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Equipment type. Source of truth should define valid values.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="equip-vendor" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Equipment vendor. Source of truth should define valid values.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="equip-model" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Equipment model. Source of truth should define valid values.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="management-option" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="identifier of managed by ATT or customer")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="ipaddress-v4-oam" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="ipv4-oam-address with new naming convention for IP addresses")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="sw-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="sw-version is the version of SW for the hosted application on the PNF.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="in-maint" type="xs:boolean"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(defaultValue="false",description="Used to indicate whether or not this object is in maintenance mode (maintenance mode = true). This field (in conjunction with prov-status) is used to suppress alarms and vSCL on VNFs/VMs.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="frame-id" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="ID of the physical frame (relay rack) where pnf is installed.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="serial-number" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Serial number of the device")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="ipaddress-v4-loopback-0" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="IPV4 Loopback 0 address")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="ipaddress-v6-loopback-0" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="IPV6 Loopback 0 address")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="ipaddress-v4-aim" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="IPV4 AIM address")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="ipaddress-v6-aim" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="IPV6 AIM address")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="ipaddress-v6-oam" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="IPV6 OAM address")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="inv-status" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="CANOPI's inventory status. Only set with values exactly as defined by CANOPI.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="prov-status" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Prov Status of this device (not under canopi control) Valid values [PREPROV/NVTPROV/PROV]")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="nf-role" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Nf Role is the role performed by this instance in the network.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - <xs:element ref="tns:p-interfaces" minOccurs="0"/> - <xs:element ref="tns:lag-interfaces" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="pnfs"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Collection of Physical Network Functions.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element ref="tns:pnf" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="physical-link"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Collection of physical connections, typically between p-interfaces",indexedProps="circuit-id,link-name",alternateKeys1="circuit-id",container="physical-links",namespace="network",searchable="link-name,circuit-id")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="link-name" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="e.g., hostnameA_p-connection_nameA_hostnameZ+p_connection-nameZ")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="speed-value" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Captures the numeric part of the speed")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="speed-units" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Captures the units corresponding to the speed")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="circuit-id" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Circuit it")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="dual-mode" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Dual access mode (e.g., primary, secondary")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="management-option" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="To provide information on who manages this circuit. A&AI or 3rd party transport provider")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="service-provider-name" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Name of the service Provider on this link.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="physical-links"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Collection of physical connections, typically between p-interfaces")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element ref="tns:physical-link" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="vig-server"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="vig-server contains information about a vig server used for IPSec-configuration. Populated by SDN-C from 1607",indexedProps="vig-address-type",dependentOn="ipsec-configuration",container="vig-servers")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="vig-address-type" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="indicates whether the VIG is for AVPN or INTERNET")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="ipaddress-v4-vig" type="xs:string" minOccurs="0" maxOccurs="unbounded"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="v4 IP of the vig server")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="ipaddress-v6-vig" type="xs:string" minOccurs="0" maxOccurs="unbounded"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="v6 IP of the vig server")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="vig-servers"> - <xs:complexType> - <xs:sequence> - <xs:element ref="tns:vig-server" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="ipsec-configuration"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="IPSec configuration node will contain various configuration data for the NMTE VNF. This node will have an edge to the generic-vnf (vnf type = TE). Starting 1607, this data will be populated by SDN-C",indexedProps="ipsec-configuration-id",uniqueProps="ipsec-configuration-id",container="ipsec-configurations",namespace="network")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="ipsec-configuration-id" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="UUID of this configuration")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="requested-vig-address-type" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Indicate the type of VIG server like AVPN, INTERNET, BOTH")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="requested-encryption-strength" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Encryption values like 3des-cbc, des-cbc, aes-128-cbc, aes-192-cbc, aes-265-cbc")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="requested-dmz-type" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="ATT can offer a shared DMZ or a DMZ specific to a customer")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="shared-dmz-network-address" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Network address of shared DMZ")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="requested-customer-name" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="If the DMZ is a custom DMZ, this field will indicate the customer information")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="ike-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="can be 1 or 2")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="ikev1-authentication" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Contains values like md5, sha1, sha256, sha384")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="ikev1-encryption" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Encyption values like 3des-cbc, des-cbc, aes-128-cbc, aes-192-cbc, aes-265-cbc")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="ikev1-dh-group" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Diffie-Hellman group like DH-GROUP2, DH-GROUP5, DH-GROUP14")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="ikev1-am-group-id" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Group name defined in VIG for clients using aggressive mode")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="ikev1-am-password" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="pre-shared key for the above group name ")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="ikev1-sa-lifetime" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Lifetime for IKEv1 SA")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="ipsec-authentication" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="md5, sha1, sha256, sha384")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="ipsec-encryption" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="3des-cbc, des-cbc, aes-128-cbc, aes-192-cbc, aes-265-cbc")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="ipsec-sa-lifetime" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Life time for IPSec SA")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="ipsec-pfs" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="enable PFS or not")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="xauth-userid" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="user ID for xAuth, sm-user,ucpeHostName,nmteHostName")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="xauth-user-password" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Encrypted using the Juniper $9$ algorithm")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="dpd-interval" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="The time between DPD probe")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="dpd-frequency" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Maximum number of DPD before claiming the tunnel is down")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - <xs:element ref="tns:vig-servers" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="ipsec-configurations"> - <xs:complexType> - <xs:sequence> - <xs:element ref="tns:ipsec-configuration" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="route-table-reference"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Openstack route table reference.",nameProps="route-table-reference-fqdn",uniqueProps="route-table-reference-id",indexedProps="route-table-reference-id,route-table-reference-fqdn",container="route-table-references",namespace="network")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="route-table-reference-id" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="Route Table Reference id, UUID assigned to this instance.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="route-table-reference-fqdn" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="FQDN entry in the route table.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Concurrency value")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="route-table-references"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Collection of openstack route table references")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element ref="tns:route-table-reference" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="instance-group"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="General mechanism for grouping instances",nameProps="description",uniqueProps="id",indexedProps="id,description,type,sub-type",container="instance-groups",namespace="network")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="id" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="Instance Group ID, UUID assigned to this instance.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="description" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Descriptive text to help identify the usage of this instance-group")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="type" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Only valid value today is lower case ha for high availability")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="sub-type" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Valid values for ha type are [geo-activeactive, geo-activestandby, local-activeactive, local-activestandby]")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Concurrency value")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="instance-groups"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Collection of openstack route table references")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element ref="tns:instance-group" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="zone"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="A zone is a grouping of assets in a location homing to the same connections into the CBB",nameProps="zone-name",indexedProps="zone-id,design-type,zone-context",uniqueProps="zone-id",container="zones",namespace="network")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="zone-id" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="Code assigned by AIC to the zone")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="zone-name" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="English name associated with the zone")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="design-type" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Design of zone [Medium/Large…]")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="zone-context" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Context of zone [production/test]")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="status" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Status of a zone.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Concurrency value")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="zones"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Collection of zones")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element ref="tns:zone" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="network"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Namespace for network inventory resources.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element ref="tns:logical-links" minOccurs="0"/> - <xs:element ref="tns:site-pair-sets" minOccurs="0"/> - <xs:element ref="tns:vpn-bindings" minOccurs="0"/> - <xs:element ref="tns:vpls-pes" minOccurs="0"/> - <xs:element ref="tns:multicast-configurations" minOccurs="0"/> - <xs:element ref="tns:vces" minOccurs="0"/> - <xs:element ref="tns:vpes" minOccurs="0"/> - <xs:element ref="tns:vnfcs" minOccurs="0"/> - <xs:element ref="tns:l3-networks" minOccurs="0"/> - <xs:element ref="tns:network-policies" minOccurs="0"/> - <xs:element ref="tns:generic-vnfs" minOccurs="0"/> - <xs:element ref="tns:lag-links" minOccurs="0"/> - <xs:element ref="tns:newvces" minOccurs="0"/> - <xs:element ref="tns:pnfs" minOccurs="0"/> - <xs:element ref="tns:physical-links" minOccurs="0"/> - <xs:element ref="tns:ipsec-configurations" minOccurs="0"/> - <xs:element ref="tns:route-table-references" minOccurs="0"/> - <xs:element ref="tns:instance-groups" minOccurs="0"/> - <xs:element ref="tns:zones" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="reserved-prop-names"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Internal map to define some reserved properties of a vertex",uniqueProps="aai-unique-key",indexedProps="aai-unique-key,source-of-truth,aai-node-type,aai-uri")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="last-mod-source-of-truth" type="xs:string" minOccurs="0"/> - <xs:element name="aai-node-type" type="xs:string" minOccurs="0"/> - <xs:element name="aai-created-ts" type="xs:unsignedInt" minOccurs="0"/> - <xs:element name="aai-unique-key" type="xs:string" minOccurs="0"/> - <xs:element name="aai-last-mod-ts" type="xs:unsignedInt" minOccurs="0"/> - <xs:element name="source-of-truth" type="xs:string" minOccurs="0"/> - <xs:element name="aai-uri" type="xs:string" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="edge-prop-names"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Internal map to define the properties of an edge and interpret the map EdgeRules",edgeInfo="edgeLabel,direction,multiplicityRule,isParent,usesResource,hasDelTarget,SVC-INFRA,SVC-INFRA-REV")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="edgeLabel" type="xs:string" minOccurs="0"/> - <xs:element name="direction" type="xs:string" minOccurs="0"/> - <xs:element name="multiplicityRule" type="xs:string" minOccurs="0"/> - <xs:element name="isParent" type="xs:boolean" minOccurs="0"/> - <xs:element name="usesResource" type="xs:boolean" minOccurs="0"/> - <xs:element name="hasDelTarget" type="xs:boolean" minOccurs="0"/> - <xs:element name="SVC-INFRA" type="xs:string" minOccurs="0"/> - <xs:element name="SVC-INFRA-REV" type="xs:string" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="aai-internal"> - <xs:complexType> - <xs:sequence> - <xs:element ref="tns:reserved-prop-names" minOccurs="0" maxOccurs="unbounded"/> - <xs:element ref="tns:edge-prop-names" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="inventory"> - <xs:complexType> - <xs:sequence> - <xs:element ref="tns:search" minOccurs="0"/> - <xs:element ref="tns:actions" minOccurs="0"/> - <xs:element ref="tns:cloud-infrastructure" minOccurs="0"/> - <xs:element ref="tns:business" minOccurs="0"/> - <xs:element ref="tns:service-design-and-creation" minOccurs="0"/> - <xs:element ref="tns:network" minOccurs="0"/> - <xs:element ref="tns:aai-internal" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="notification-event-header"> - <xs:complexType> - <xs:sequence> - <xs:element name="id" type="xs:string" minOccurs="0"/> - <xs:element name="timestamp" type="xs:string" minOccurs="0"/> - <xs:element name="source-name" type="xs:string" minOccurs="0"/> - <xs:element name="domain" type="xs:string" minOccurs="0"/> - <xs:element name="sequence-number" type="xs:string" minOccurs="0"/> - <xs:element name="severity" type="xs:string" minOccurs="0"/> - <xs:element name="event-type" type="xs:string" minOccurs="0"/> - <xs:element name="version" type="xs:string" minOccurs="0"/> - <xs:element name="action" type="xs:string" minOccurs="0"/> - <xs:element name="entity-type" type="xs:string" minOccurs="0"/> - <xs:element name="top-entity-type" type="xs:string" minOccurs="0"/> - <xs:element name="entity-link" type="xs:string" minOccurs="0"/> - <xs:element name="status" type="xs:string" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="notification-event"> - <xs:complexType> - <xs:sequence> - <xs:element name="cambria.partition" type="xs:string" minOccurs="0"/> - <xs:element ref="tns:notification-event-header" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="overloaded-model"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Allows for legacy POST of old-style and new-style models")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="model-invariant-id" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="Unique identifier corresponding to the main definition of a model in ASDC")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="model-name-version-id" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="Unique identifier corresponding to one version of a model in ASDC")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="model-type" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Type of the model, e.g., service, resource, widget, etc.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="model-name" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Name of the model, which can change from version to version.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="model-id" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Invariant unique ID which does not change from version to version")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="model-version" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Version")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="model-description" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Description")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - <xs:element ref="tns:model-vers" minOccurs="0"/> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="query-parameters"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="QueryParameters for performing a named-query or model query")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element ref="tns:named-query" minOccurs="0"/> - <xs:element ref="tns:overloaded-model" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="instance-filter"> - <xs:complexType> - <xs:sequence/> - </xs:complexType> - </xs:element> - <xs:element name="instance-filters"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="InstanceFilters for performing a named-query or model query")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element ref="tns:instance-filter" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="secondary-filt"> - <xs:complexType> - <xs:sequence/> - </xs:complexType> - </xs:element> - <xs:element name="secondary-filts"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="SecondaryFilts for performing a named-query or model query")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element ref="tns:secondary-filt" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="model-and-named-query-search"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="ModelAndNamedQuerySearch holds query-parameters and instance-properties for performing a named-query or model query")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element ref="tns:query-parameters" minOccurs="0"/> - <xs:element ref="tns:instance-filters" minOccurs="0"/> - <xs:element ref="tns:secondary-filts" minOccurs="0"/> - <xs:element name="top-node-type" type="xs:string" minOccurs="0"/> - <xs:element name="secondary-filter-cut-point" type="xs:string" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="properties"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Property holder for query properties or instance properties")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="property-name" type="xs:string" minOccurs="0"/> - <xs:element name="property-value" type="xs:string" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="extra-properties"> - <xs:complexType> - <xs:sequence/> - </xs:complexType> - </xs:element> - <xs:element name="inventory-response-item"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Inventory item for response list",container="inventory-response-items")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="model-name" type="xs:string" minOccurs="0"/> - <xs:element ref="tns:extra-properties" minOccurs="0"/> - <xs:element ref="tns:inventory-response-items" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="inventory-response-items"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Container for inventory items in response list",container="response-list")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element ref="tns:inventory-response-item" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="response-list"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Response container for the results of a named-query or model query")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element ref="tns:inventory-response-items" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="extra-property"> - <xs:complexType> - <xs:sequence> - <xs:element name="property-name" type="xs:string" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="vnf"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="class">@com.att.aai.annotations.Metadata(description="Abstract vnf class",indexedProps="vnf-id",uniqueProps="vnf-id",inheritors="vce,vpe,generic-vnf",isAbstract="true")</annox:annotate> - </xs:appinfo> - </xs:annotation> - <xs:sequence> - <xs:element name="vnf-id" type="xs:string"> - <xs:annotation> - <xs:appinfo> - <annox:annotate target="field">@com.att.aai.annotations.Metadata(isKey=true,description="Unique id of VNF. This is unique across the graph.")</annox:annotate> - </xs:appinfo> - </xs:annotation> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> -</xs:schema> diff --git a/bpmn/MSOCommonBPMN/src/main/resources/xsd/aai_schema_v11.xsd b/bpmn/MSOCommonBPMN/src/main/resources/xsd/aai_schema_v11.xsd deleted file mode 100644 index 47385168cc..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/resources/xsd/aai_schema_v11.xsd +++ /dev/null @@ -1,6934 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="yes"?> -<xs:schema elementFormDefault="qualified" version="1.0" targetNamespace="http://org.onap.aai.inventory/v11" xmlns:tns="http://org.onap.aai.inventory/v11" xmlns:xs="http://www.w3.org/2001/XMLSchema" -xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
- jaxb:version="2.1"
- xmlns:annox="http://annox.dev.java.net"
- jaxb:extensionBindingPrefixes="annox"> - - <xs:element name="inventory-item-data"> - <xs:complexType> - <xs:sequence> - <xs:element name="property-name" type="xs:string" minOccurs="0"/> - <xs:element name="property-value" type="xs:string" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="inventory-item"> - <xs:complexType> - <xs:sequence> - <xs:element name="inventory-item-type" type="xs:string" minOccurs="0"/> - <xs:element name="inventory-item-link" type="xs:string" minOccurs="0"/> - <xs:element ref="tns:inventory-item-data" minOccurs="0" maxOccurs="unbounded"/> - <xs:element ref="tns:tagged-inventory-item-list" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="tagged-inventory-item-list"> - <xs:complexType> - <xs:sequence> - <xs:element ref="tns:inventory-item" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="edge-tag-query-result"> - <xs:complexType> - <xs:sequence> - <xs:element ref="tns:tagged-inventory-item-list" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="start-node-filter"> - <xs:complexType> - <xs:sequence> - <xs:element name="property-name" type="xs:string" minOccurs="0"/> - <xs:element name="property-value" type="xs:string" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="include-node-filter"> - <xs:complexType> - <xs:sequence> - <xs:element name="include-node-type" type="xs:string" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="secondary-filter"> - <xs:complexType> - <xs:sequence> - <xs:element name="property-name" type="xs:string" minOccurs="0"/> - <xs:element name="filter-type" type="xs:string" minOccurs="0"/> - <xs:element name="property-value" type="xs:string" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="edge-tag-query-request"> - <xs:complexType> - <xs:sequence> - <xs:element name="edge-tag" type="xs:string" minOccurs="0"/> - <xs:element name="result-detail" type="xs:string" minOccurs="0"/> - <xs:element name="start-node-type" type="xs:string" minOccurs="0"/> - <xs:element ref="tns:start-node-filter" minOccurs="0" maxOccurs="unbounded"/> - <xs:element ref="tns:include-node-filter" minOccurs="0" maxOccurs="unbounded"/> - <xs:element ref="tns:secondary-filter" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="result-data"> - <xs:complexType> - <xs:sequence> - <xs:element name="resource-type" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="The specific type of node in the A&AI graph")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-link" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="The URL to the specific resource")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="search-results"> - <xs:complexType> - <xs:sequence> - <xs:element ref="tns:result-data" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="relationship-data"> - <xs:complexType> - <xs:sequence> - <xs:element name="relationship-key" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="A keyword provided by A&AI to indicate an attribute.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="relationship-value" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Value of the attribute.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="related-to-property"> - <xs:complexType> - <xs:sequence> - <xs:element name="property-key" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Key part of a key/value pair")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="property-value" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Value part of a key/value pair")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="relationship"> - <xs:complexType> - <xs:sequence> - <xs:element name="related-to" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="A keyword provided by A&AI to indicate type of node.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="related-link" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="URL to the object in A&AI.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:relationship-data" minOccurs="0" maxOccurs="unbounded"/> - <xs:element ref="tns:related-to-property" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="relationship-list"> - <xs:complexType> - <xs:sequence> - <xs:element ref="tns:relationship" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="oam-network"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="OAM network, to be deprecated shortly. Do not use for new purposes. ",nameProps="network-name",indexedProps="cvlan-tag,network-uuid,network-name",dependentOn="cloud-region",container="oam-networks")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="network-uuid" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="UUID of the network. Unique across a cloud-region")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="network-name" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Name of the network.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="cvlan-tag" type="xs:unsignedInt"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="cvlan-id")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="ipv4-oam-gateway-address" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used for VNF firewall rule so customer cannot send customer traffic over this oam network")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="ipv4-oam-gateway-address-prefix-length" type="xs:int" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used for VNF firewall rule so customer cannot send customer traffic over this oam network")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="oam-networks"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Collection of OAM networks, to be deprecated shortly. Do not use for new purposes. ")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element ref="tns:oam-network" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="dvs-switch"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Digital virtual switch metadata, used by SDN-C to configure VCEs. A&AI needs to receive this data from the PO deployment team and administer it using the provisioningTool.sh into A&AI. ",indexedProps="vcenter-url,switch-name",dependentOn="cloud-region",container="dvs-switches")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="switch-name" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="DVS switch name")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="vcenter-url" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="URL used to reach the vcenter")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="dvs-switches"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Collection of digital virtual switch metadata used for vmWare VCEs and VPEs.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element ref="tns:dvs-switch" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="availability-zone"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Availability zone, a collection of compute hosts/pservers",indexedProps="availability-zone-name",dependentOn="cloud-region",container="availability-zones")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="availability-zone-name" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="Name of the availability zone. Unique across a cloud region")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="hypervisor-type" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Type of hypervisor. Source of truth should define valid values.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="operational-status" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="State that indicates whether the availability zone should be used, etc. Source of truth should define valid values.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="az-and-dvs-switches"> - <xs:complexType> - <xs:sequence> - <xs:element ref="tns:dvs-switches" minOccurs="0"/> - <xs:element ref="tns:availability-zone" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="sdn-zone-response"> - <xs:complexType> - <xs:sequence> - <xs:element ref="tns:oam-networks" minOccurs="0"/> - <xs:element ref="tns:az-and-dvs-switches" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="search"> - <xs:complexType> - <xs:sequence> - <xs:element ref="tns:edge-tag-query-result" minOccurs="0"/> - <xs:element ref="tns:edge-tag-query-request" minOccurs="0"/> - <xs:element ref="tns:search-results" minOccurs="0"/> - <xs:element ref="tns:sdn-zone-response" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="update-node-key"> - <xs:complexType> - <xs:sequence> - <xs:element name="key-name" type="xs:string" minOccurs="0"/> - <xs:element name="key-value" type="xs:string" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="action-data"> - <xs:complexType> - <xs:sequence> - <xs:element name="property-name" type="xs:string" minOccurs="0"/> - <xs:element name="property-value" type="xs:string" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="action"> - <xs:complexType> - <xs:sequence> - <xs:element name="action-type" type="xs:string" minOccurs="0"/> - <xs:element ref="tns:action-data" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="update"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Serves a PATCH like function. Does not enforce concurrency control. Clear each usage with AAI team.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="update-node-type" type="xs:string"/> - <xs:element ref="tns:update-node-key" minOccurs="0" maxOccurs="unbounded"/> - <xs:element name="update-node-uri" type="xs:string" minOccurs="0"/> - <xs:element ref="tns:action" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="key-data"> - <xs:complexType> - <xs:sequence> - <xs:element name="key-name" type="xs:string" minOccurs="0"/> - <xs:element name="key-value" type="xs:string" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="notify"> - <xs:complexType> - <xs:sequence> - <xs:element name="event-id" type="xs:string"/> - <xs:element name="node-type" type="xs:string" minOccurs="0"/> - <xs:element name="event-trigger" type="xs:string" minOccurs="0"/> - <xs:element ref="tns:key-data" minOccurs="0" maxOccurs="unbounded"/> - <xs:element name="selflink" type="xs:string" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="actions"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="APIs that are more action related than REST (e.g., notify, update).")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element ref="tns:update" minOccurs="0"/> - <xs:element ref="tns:notify" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="ctag-pool"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="A collection of C tags (vlan tags) grouped for a specific purpose.",indexedProps="availability-zone-name",dependentOn="complex",container="ctag-pools")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="target-pe" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="The Target provider edge router")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="availability-zone-name" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="Name of the availability zone")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="ctag-pool-purpose" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Describes what the intended purpose of this pool is.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="ctag-values" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Comma separated list of ctags")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="ctag-pools"> - <xs:complexType> - <xs:sequence> - <xs:element ref="tns:ctag-pool" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="complex"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Collection of physical locations that can house cloud-regions.",indexedProps="identity-url,data-center-code,complex-name,physical-location-id",searchable="physical-location-id,data-center-code,complex-name,street1,street2,postal-code",uniqueProps="physical-location-id",container="complexes",namespace="cloud-infrastructure")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="physical-location-id" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="Unique identifier for physical location, e.g., CLLI")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="data-center-code" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Data center code which can be an alternate way to identify a complex")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="complex-name" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Gamma complex name for LCP instance.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="identity-url" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="URL of the keystone identity service")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="physical-location-type" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Type, e.g., central office, data center.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="street1" type="xs:string"/> - <xs:element name="street2" type="xs:string" minOccurs="0"/> - <xs:element name="city" type="xs:string"/> - <xs:element name="state" type="xs:string" minOccurs="0"/> - <xs:element name="postal-code" type="xs:string"/> - <xs:element name="country" type="xs:string"/> - <xs:element name="region" type="xs:string"/> - <xs:element name="latitude" type="xs:string" minOccurs="0"/> - <xs:element name="longitude" type="xs:string" minOccurs="0"/> - <xs:element name="elevation" type="xs:string" minOccurs="0"/> - <xs:element name="lata" type="xs:string" minOccurs="0"/> - <xs:element ref="tns:ctag-pools" minOccurs="0"/> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="complexes"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Collection of physical locations that can house cloud-regions.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element ref="tns:complex" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="volume-group"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Persistent block-level storage.",indexedProps="volume-group-name,vnf-type,heat-stack-id,volume-group-id",searchable="volume-group-id,volume-group-name",dependentOn="cloud-region",container="volume-groups")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="volume-group-id" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="Unique ID of volume-group.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="volume-group-name" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Name of the volume group.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="heat-stack-id" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Heat stack id corresponding to this volume-group")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="vnf-type" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="String capturing type of vnf, that was intended to identify the ASDC resource. This field has been overloaded in service-specific ways and clients should expect changes to occur in the future to this field as ECOMP matures.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="orchestration-status" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Orchestration status of this volume-group")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="model-customization-id" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="captures the id of all the configuration used to customize the resource for the service.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="vf-module-model-customization-id" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="helps relate the volume group to the vf-module whose components will require the volume group")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="volume-groups"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Collection of persistent block-level storage.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element ref="tns:volume-group" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="volume"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Ephemeral Block storage volume.",indexedProps="volume-id",dependentOn="vserver",container="volumes")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="volume-id" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="Unique ID of block storage volume relative to the vserver.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="volume-selflink" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="URL to endpoint where AAI can get more details")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="volumes"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Collection of ephemeral Block storage volumes.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element ref="tns:volume" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="l3-interface-ipv4-address-list"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="IPv4 Address Range",indexedProps="l3-interface-ipv4-address,vlan-id-inner,neutron-network-id,neutron-subnet-id",dependentOn="vlan,l-interface")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="l3-interface-ipv4-address" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="IP address")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="l3-interface-ipv4-prefix-length" type="xs:unsignedInt" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Prefix length, 32 for single address")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="vlan-id-inner" type="xs:unsignedInt" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Inner VLAN tag")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="vlan-id-outer" type="xs:unsignedInt" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Outer VLAN tag")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="is-floating" type="xs:boolean" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Indicator of fixed or floating address")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="neutron-network-id" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Neutron network id of the interface that address belongs to")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="neutron-subnet-id" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Neutron id of subnet that address belongs to")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="l3-interface-ipv6-address-list"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="IPv6 Address Range",indexedProps="l3-interface-ipv6-address,vlan-id-inner,neutron-network-id,neutron-subnet-id",dependentOn="vlan,l-interface")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="l3-interface-ipv6-address" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="IP address")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="l3-interface-ipv6-prefix-length" type="xs:unsignedInt" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Prefix length, 128 for single address")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="vlan-id-inner" type="xs:unsignedInt" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Inner VLAN tag")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="vlan-id-outer" type="xs:unsignedInt" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Outer VLAN tag")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="is-floating" type="xs:boolean" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Indicator of fixed or floating address")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="neutron-network-id" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Neutron network id of the interface that address belongs to")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="neutron-subnet-id" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Neutron id of subnet that address belongs to")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="vlan"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Definition of vlan",indexedProps="vlan-interface,vlan-id-inner,vpn-key",dependentOn="l-interface",container="vlans")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="vlan-interface" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="String that identifies the interface")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="vlan-id-inner" type="xs:unsignedInt" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Inner VLAN tag")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="vlan-id-outer" type="xs:unsignedInt" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Outer VLAN tag")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="speed-value" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Captures the numeric part of the speed")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="speed-units" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Captures the units corresponding to the speed")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="vlan-description" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used to describe (the service associated with) the vlan")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="backdoor-connection" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Whether customer is going to use this VLAN for backdoor connection to another customer premise device.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="vpn-key" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="This indicates the customers VPN ID associated with this vlan")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="orchestration-status" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Status of a vnf's vlan interface, on which the customer circuit resides, mastered by SDN-C.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="in-maint" type="xs:boolean"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(defaultValue="false",description="used to indicate whether or not this object is in maintenance mode (maintenance mode = true)")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="prov-status" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Prov Status of the VLAN configuration related to a logical interface. Valid values [PREPROV/NVTPROV/PROV].")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="is-ip-unnumbered" type="xs:boolean"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(defaultValue="false",description="Flag indicating the interface uses the IP Unnumbered configuration.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - <xs:element ref="tns:l3-interface-ipv4-address-list" minOccurs="0" maxOccurs="unbounded"/> - <xs:element ref="tns:l3-interface-ipv6-address-list" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="vlans"> - <xs:complexType> - <xs:sequence> - <xs:element ref="tns:vlan" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="sriov-vf"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="SR-IOV Virtual Function (not to be confused with virtual network function)",indexedProps="pci-id,vf-vlan-filter,vf-mac-filter,vf-vlan-strip,neutron-network-id",dependentOn="l-interface",container="sriov-vfs")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="pci-id" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="PCI ID used to identify the sriov-vf")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="vf-vlan-filter" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="This metadata provides option to specify list of VLAN filters applied on VF to pass the traffic to VM.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="vf-mac-filter" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="When MAC filters are specified, VF-agent service configures VFs to do MAC level filtering before the traffic is passed to VM.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="vf-vlan-strip" type="xs:boolean" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="When this field is set to true, VF will configured to strip the outer TAG before the traffic is passed to VM.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="vf-vlan-anti-spoof-check" type="xs:boolean" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="This option ensures anti VLAN spoof checks are done at the VF level to comply with security. The disable check will also be honored per the VNF needs for trusted VMs.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="vf-mac-anti-spoof-check" type="xs:boolean" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="This option ensures anti MAC spoof checks are done at the VF level to comply with security. The disable check will also be honored per the VNF needs for trusted VMs.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="vf-mirrors" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="This option defines the set of Mirror objects which essentially mirrors the traffic from source to set of collector VNF Ports.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="vf-broadcast-allow" type="xs:boolean" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="This option, if set to true, sets the VF in promiscuous mode and allows all broadcast traffic to reach the VM")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="vf-unknown-multicast-allow" type="xs:boolean" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="This option, if set to true, sets the VF in promiscuous mode and allows unknown multicast traffic to reach the VM")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="vf-unknown-unicast-allow" type="xs:boolean" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="This option, if set to true, sets the VF in promiscuous mode and allows unknown unicast traffic to reach the VM")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="vf-insert-stag" type="xs:boolean" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="This option, if set to true, instructs to insert outer tag after traffic comes out of VM.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="vf-link-status" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="This option is used to set the link status. Valid values as of 1607 are on, off, and auto.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="neutron-network-id" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Neutron network id of the interface")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="sriov-vfs"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Collection of SR-IOV Virtual Functions.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element ref="tns:sriov-vf" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="l-interface"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Logical interfaces, e.g., a vnic.",indexedProps="macaddr,interface-id,interface-name,network-name",dependentOn="generic-vnf,newvce,vpe,p-interface,vserver,lag-interface",container="l-interfaces")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="interface-name" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="Name given to the interface")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="interface-role" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="E.g., CUSTOMER, UPLINK, etc.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="v6-wan-link-ip" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Questionably placed - v6 ip addr of this interface (is in vr-lan-interface from Mary B.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="selflink" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="URL to endpoint where AAI can get more details")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="interface-id" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="ID of interface")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="macaddr" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="MAC address for the interface")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="network-name" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Name of the network")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="management-option" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Whether A&AI should be managing this interface of not. Could have value like CUSTOMER")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="interface-description" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Human friendly text regarding this interface.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="is-port-mirrored" type="xs:boolean"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(defaultValue="false",description="boolean indicatating whether or not port is a mirrored.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="in-maint" type="xs:boolean"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(defaultValue="false",description="used to indicate whether or not this object is in maintenance mode (maintenance mode = true)")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="prov-status" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Prov Status of the logical interface. Valid values [PREPROV/NVTPROV/PROV].")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="is-ip-unnumbered" type="xs:boolean"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(defaultValue="false",description="Flag indicating the interface uses the IP Unnumbered configuration.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:vlans" minOccurs="0"/> - <xs:element ref="tns:sriov-vfs" minOccurs="0"/> - <xs:element ref="tns:l-interfaces" minOccurs="0"/> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - <xs:element ref="tns:l3-interface-ipv4-address-list" minOccurs="0" maxOccurs="unbounded"/> - <xs:element ref="tns:l3-interface-ipv6-address-list" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="l-interfaces"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Collection of logical interfaces.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element ref="tns:l-interface" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="vserver"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Virtual Servers, aka virtual machine or VM.",nameProps="vserver-name",indexedProps="is-closed-loop-disabled,prov-status,vserver-name,vserver-id,in-maint,vserver-name2",searchable="vserver-id,vserver-name,vserver-name2",dependentOn="tenant",container="vservers")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="vserver-id" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="Unique identifier for this vserver relative to its tenant")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="vserver-name" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Name of vserver")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="vserver-name2" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Alternative name of vserver")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="prov-status" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Trigger for operational monitoring of this resource by Service Assurance systems.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="vserver-selflink" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="URL to endpoint where AAI can get more details")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="in-maint" type="xs:boolean"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(defaultValue="false",description="Used to indicate whether or not this object is in maintenance mode (maintenance mode = true). This field (in conjunction with prov-status) is used to suppress alarms and vSCL on VNFs/VMs.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="is-closed-loop-disabled" type="xs:boolean"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(defaultValue="false",description="Used to indicate whether closed loop function is enabled on this node")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:volumes" minOccurs="0"/> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - <xs:element ref="tns:l-interfaces" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="vservers"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Collection of virtual Servers, aka virtual machines or VMs.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element ref="tns:vserver" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="tenant"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Openstack tenant",nameProps="tenant-name",indexedProps="tenant-name,tenant-id,tenant-context",searchable="tenant-id,tenant-name",dependentOn="cloud-region",container="tenants")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="tenant-id" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="Unique id relative to the cloud-region.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="tenant-name" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Readable name of tenant")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="tenant-context" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="This field will store the tenant context.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:vservers" minOccurs="0"/> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="tenants"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Collection of openstack tenants.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element ref="tns:tenant" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="flavor"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Openstack flavor.",nameProps="flavor-name",indexedProps="flavor-name,flavor-id",dependentOn="cloud-region",container="flavors")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="flavor-id" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="Flavor id, expected to be unique across cloud-region.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="flavor-name" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Flavor name")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="flavor-vcpus" type="xs:int" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Number of CPUs")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="flavor-ram" type="xs:int" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Amount of memory")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="flavor-disk" type="xs:int" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Disk space")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="flavor-ephemeral" type="xs:int" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Amount of ephemeral disk space")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="flavor-swap" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="amount of swap space allocation")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="flavor-is-public" type="xs:boolean" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="whether flavor is available to all users or private to the tenant it was created in.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="flavor-selflink" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="URL to endpoint where AAI can get more details")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="flavor-disabled" type="xs:boolean" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Boolean as to whether this flavor is no longer enabled")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="flavors"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Collection of openstack flavors.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element ref="tns:flavor" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="group-assignment"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Openstack group-assignment used to store exclusivity groups (EG).",nameProps="group-name",indexedProps="group-id,group-type,group-name",searchable="group-id,group-name",dependentOn="cloud-region",container="group-assignments")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="group-id" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="Group id, expected to be unique across cloud-region.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="group-type" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Group type - the type of group this instance refers to")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="group-name" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Group name - name assigned to the group")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="group-description" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Group description - description of the group")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="group-assignments"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Collection of openstack group assignments")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element ref="tns:group-assignment" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="snapshot"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Openstack snapshot",nameProps="snapshot-name",uniqueProps="snapshot-id",indexedProps="application,snapshot-name,application-vendor,snapshot-id,application-version,prev-snapshot-id",dependentOn="cloud-region",container="snapshots")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="snapshot-id" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="Snapshot id, this is the key UUID assoc associated in glance with the snapshots.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="snapshot-name" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Snapshot name")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="snapshot-architecture" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Operating system architecture")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="snapshot-os-distro" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="The common name of the operating system distribution in lowercase")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="snapshot-os-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="The operating system version as specified by the distributor.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="application" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="The application that the image instantiates.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="application-vendor" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="The vendor of the application.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="application-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="The version of the application.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="snapshot-selflink" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="URL to endpoint where AAI can get more details")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="prev-snapshot-id" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="This field contains the UUID of the previous snapshot (if any).")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="snapshots"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Collection of openstack snapshots")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element ref="tns:snapshot" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="metadatum"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Key/value pairs",indexedProps="metaname",dependentOn="tenant,image,service-instance,connector,model",container="metadata")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="metaname" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true)</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="metaval" type="xs:string"/> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="metadata"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Collection of metadatum (key/value pairs)")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element ref="tns:metadatum" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="image"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Openstack image.",nameProps="image-name",indexedProps="application,image-name,application-vendor,image-id,application-version",dependentOn="cloud-region",container="images")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="image-id" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="Image id, expected to be unique across cloud region")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="image-name" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Image name")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="image-architecture" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Operating system architecture.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="image-os-distro" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="The common name of the operating system distribution in lowercase")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="image-os-version" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="The operating system version as specified by the distributor.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="application" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="The application that the image instantiates.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="application-vendor" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="The vendor of the application.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="application-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="The version of the application.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="image-selflink" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="URL to endpoint where AAI can get more details")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - <xs:element ref="tns:metadata" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="images"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Collectio of Openstack images.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element ref="tns:image" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="availability-zones"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Collection of availability zones")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element ref="tns:availability-zone" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="cloud-region"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="cloud-region designates an installation of a cloud cluster or region or instantiation. In AT&Ts AIC cloud, this could be an LCP or DCP. Cloud regions are uniquely identified by a composite key, cloud-owner + cloud-region-id. The format of the cloud-owner is vendor-cloudname and we will use att-aic for AT&T's AIC.",indexedProps="cloud-owner,cloud-region-id,cloud-type,owner-defined-type",nameProps="owner-defined-type",container="cloud-regions",namespace="cloud-infrastructure")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="cloud-owner" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="Identifies the vendor and cloud name, e.g., att-aic. First part of composite key should be formatted as vendor-cloudname")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="cloud-region-id" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="Identifier used by the vendor for the region. Second part of composite key")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="cloud-type" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Type of the cloud (e.g., openstack)")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="owner-defined-type" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Cloud-owner defined type indicator (e.g., dcp, lcp)")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="cloud-region-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Software version employed at the site. NOTE - THIS FIELD IS NOT KEPT UP TO DATE.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="identity-url" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="URL of the keystone identity service")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="cloud-zone" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Zone where the cloud is homed. NOTE - THIS FIELD IS NOT CORRECTLY POPULATED.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="complex-name" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="complex name for cloud-region instance. NOTE - THIS FIELD IS NOT CORRECTLY POPULATED.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="sriov-automation" type="xs:boolean"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(defaultValue="false",description="Whether the cloud region supports (true) or does not support (false) SR-IOV automation.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:volume-groups" minOccurs="0"/> - <xs:element ref="tns:tenants" minOccurs="0"/> - <xs:element ref="tns:flavors" minOccurs="0"/> - <xs:element ref="tns:group-assignments" minOccurs="0"/> - <xs:element ref="tns:snapshots" minOccurs="0"/> - <xs:element ref="tns:images" minOccurs="0"/> - <xs:element ref="tns:dvs-switches" minOccurs="0"/> - <xs:element ref="tns:oam-networks" minOccurs="0"/> - <xs:element ref="tns:availability-zones" minOccurs="0"/> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="cloud-regions"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(maximumDepth="0")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element ref="tns:cloud-region" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="network-profile"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Network profile populated by SDN-GP for SNMP",indexedProps="nm-profile-name",container="network-profiles",namespace="cloud-infrastructure")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="nm-profile-name" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="Unique name of network profile.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="community-string" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Encrypted SNMP community string")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="network-profiles"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Collection of network profiles")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element ref="tns:network-profile" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="sriov-pf"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="SR-IOV Physical Function",indexedProps="pf-pci-id",dependentOn="p-interface",container="sriov-pfs")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="pf-pci-id" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="Identifier for the sriov-pf")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="sriov-pfs"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Collection of SR-IOV Physical Functions.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element ref="tns:sriov-pf" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="p-interface"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Physical interface (e.g., nic)",indexedProps="interface-name,prov-status",nameProps="prov-status",dependentOn="vpls-pe,pserver,pnf",container="p-interfaces")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="interface-name" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="Name that identifies the physical interface")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="speed-value" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Captures the numeric part of the speed")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="speed-units" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Captures the units corresponding to the speed")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="port-description" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Nature of the services and connectivity on this port.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="equipment-identifier" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="CLEI or other specification for p-interface hardware.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="interface-role" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Role specification for p-interface hardware.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="interface-type" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Indicates the physical properties of the interface.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="prov-status" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Trigger for operational monitoring of this resource by Service Assurance systems.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="in-maint" type="xs:boolean"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(defaultValue="false",description="used to indicate whether or not this object is in maintenance mode (maintenance mode = true)")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="inv-status" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="inventory status")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - <xs:element ref="tns:sriov-pfs" minOccurs="0"/> - <xs:element ref="tns:l-interfaces" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="p-interfaces"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Collection of physical interfaces.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element ref="tns:p-interface" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="lag-interface"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Link aggregate interface",indexedProps="interface-name,interface-id,interface-role",dependentOn="generic-vnf,pserver,vpe,vpls-pe,pnf",container="lag-interfaces")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="interface-name" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="Name that identifies the link aggregate interface")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="interface-description" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Human friendly text regarding this interface.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="speed-value" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Captures the numeric part of the speed")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="speed-units" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Captures the units corresponding to the speed")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="interface-id" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="ID of interface")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="interface-role" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Role assigned to this Interface, should use values as defined in ECOMP Yang models.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="prov-status" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Trigger for operational monitoring of this resource by Service Assurance systems.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="in-maint" type="xs:boolean"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(defaultValue="false",description="used to indicate whether or not this object is in maintenance mode (maintenance mode = true)")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - <xs:element ref="tns:l-interfaces" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="lag-interfaces"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Collection of link aggregate interfaces.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element ref="tns:lag-interface" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="pserver"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Compute host whose hostname must be unique and must exactly match what is sent as a relationship to a vserver.",nameProps="pserver-name2",indexedProps="hostname,in-maint,pserver-id,pserver-name2,inv-status",searchable="hostname,pserver-name2,pserver-id,ipv4-oam-address",container="pservers",namespace="cloud-infrastructure")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="hostname" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="Value from executing hostname on the compute node.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="ptnii-equip-name" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="PTNII name")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="number-of-cpus" type="xs:int" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Number of cpus")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="disk-in-gigabytes" type="xs:int" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Disk size, in GBs")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="ram-in-megabytes" type="xs:int" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="RAM size, in MBs")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="equip-type" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Equipment type. Source of truth should define valid values.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="equip-vendor" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Equipment vendor. Source of truth should define valid values.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="equip-model" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Equipment model. Source of truth should define valid values.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="fqdn" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Fully-qualified domain name")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="pserver-selflink" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="URL to endpoint where AAI can get more details")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="ipv4-oam-address" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used to configure device, also used for troubleshooting and is IP used for traps generated by device.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="serial-number" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Serial number, may be queried")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="ipaddress-v4-loopback-0" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="IPV4 Loopback 0 address")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="ipaddress-v6-loopback-0" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="IPV6 Loopback 0 address")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="ipaddress-v4-aim" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="IPV4 AIM address")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="ipaddress-v6-aim" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="IPV6 AIM address")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="ipaddress-v6-oam" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="IPV6 OAM address")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="inv-status" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="CANOPI's inventory status. Only set with values exactly as defined by CANOPI.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="pserver-id" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="ID of Pserver")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="internet-topology" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="internet topology of Pserver")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="in-maint" type="xs:boolean"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(defaultValue="false",description="used to indicate whether or not this object is in maintenance mode (maintenance mode = true). This field (in conjunction with prov-status) is used to suppress alarms and vSCL on VNFs/VMs.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="pserver-name2" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="alternative pserver name")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="purpose" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="purpose of pserver")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="prov-status" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Prov Status of this device (not under canopi control) Valid values [PREPROV/NVTPROV/PROV]")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="management-option" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Indicates who owns and or manages the device.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="host-profile" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="The host profile that defines the configuration of the pserver.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - <xs:element ref="tns:p-interfaces" minOccurs="0"/> - <xs:element ref="tns:lag-interfaces" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="pservers"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Collection of compute hosts.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element ref="tns:pserver" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="virtual-data-center"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Virtual organization of cloud infrastructure elements in a data center context",nameProps="vdc-name",indexedProps="vdc-name,vdc-id",container="virtual-data-centers",namespace="cloud-infrastructure")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="vdc-id" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="Unique ID of the vdc")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="vdc-name" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Name of the virtual data center")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="virtual-data-centers"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Virtual organization of cloud infrastructure elements in a data center context")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element ref="tns:virtual-data-center" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="cloud-infrastructure"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Namespace for cloud infrastructure.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element ref="tns:complexes" minOccurs="0"/> - <xs:element ref="tns:cloud-regions" minOccurs="0"/> - <xs:element ref="tns:network-profiles" minOccurs="0"/> - <xs:element ref="tns:pservers" minOccurs="0"/> - <xs:element ref="tns:virtual-data-centers" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="license-key-resource"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="OBSOLETE OBJECT: do not use",nameProps="name",indexedProps="assignment-group-uuid,att-uuid,name",uniqueProps="att-uuid",container="license-key-resources",namespace="license-management")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="att-uuid" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true)</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="assignment-type" type="xs:string" minOccurs="0"/> - <xs:element name="assignment-status" type="xs:string" minOccurs="0"/> - <xs:element name="assignment-group-uuid" type="xs:string"/> - <xs:element name="assignment-date" type="xs:string" minOccurs="0"/> - <xs:element name="name" type="xs:string" minOccurs="0"/> - <xs:element name="model-uuid" type="xs:string" minOccurs="0"/> - <xs:element name="model-version" type="xs:string" minOccurs="0"/> - <xs:element name="license-key" type="xs:string" minOccurs="0"/> - <xs:element name="license-key-file-url" type="xs:string" minOccurs="0"/> - <xs:element name="supplier-release-list" type="xs:string" minOccurs="0" maxOccurs="unbounded"/> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="license-key-resources"> - <xs:complexType> - <xs:sequence> - <xs:element ref="tns:license-key-resource" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="license-management"> - <xs:complexType> - <xs:sequence> - <xs:element ref="tns:license-key-resources" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="connector"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Collection of resource instances used to connect a variety of disparate inventory widgets",indexedProps="resource-instance-id,model-invariant-id,model-version-id,widget-model-id,widget-model-version",container="connectors",namespace="business")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="resource-instance-id" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="Unique id of resource instance.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="model-invariant-id" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="the ASDC model id for this resource or service model.",visibility="deployment",requires="model-version-id",dbAlias="model-invariant-id-local")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="model-version-id" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="the ASDC model version for this resource or service model.",visibility="deployment",requires="model-invariant-id",dbAlias="model-version-id-local")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="persona-model-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="the ASDC model version for this resource or service model.",visibility="internal",dataCopy="service-design-and-creation/models/model/{model-invariant-id}/model-vers/model-ver/{model-version-id}#model-version")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="widget-model-id" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="the ASDC data dictionary widget model. This maps directly to the A&AI widget.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="widget-model-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="the ASDC data dictionary version of the widget model.This maps directly to the A&AI version of the widget.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - <xs:element ref="tns:metadata" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="connectors"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Collection of resource instances used to connect a variety of disparate inventory widgets")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element ref="tns:connector" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="tunnel-xconnect"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Represents the specifics of a tunnel cross connect piece of a resource that gets separately allotted",uniqueProps="id",indexedProps="id",dependentOn="allotted-resource",container="tunnel-xconnects")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="id" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="Allotted Resource id UUID assigned to this instance.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="bandwidth-up-wan1" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="The WAN uplink bandwidth for WAN1")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="bandwidth-down-wan1" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="The WAN downlink bandwidth for WAN1")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="bandwidth-up-wan2" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="The WAN uplink bandwidth for WAN2")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="bandwidth-down-wan2" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="The WAN downlink bandwidth for WAN2")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Concurrency value")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="tunnel-xconnects"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="This object is used to store the specific tunnel cross connect aspects of an allotted resource")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element ref="tns:tunnel-xconnect" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="allotted-resource"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Represents a slice or partial piece of a resource that gets separately allotted",nameProps="description",uniqueProps="id",indexedProps="id,model-invariant-id,model-version-id,type,role",dependentOn="service-instance",container="allotted-resources")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="id" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="Allotted Resource id UUID assigned to this instance.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="description" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="The descriptive information assigned to this allotted resource instance")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="selflink" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Link back to more information in the controller")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="model-invariant-id" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="the ASDC model id for this resource or service model.",visibility="deployment",requires="model-version-id",dbAlias="model-invariant-id-local")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="model-version-id" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="the ASDC model version for this resource or service model.",visibility="deployment",requires="model-invariant-id",dbAlias="model-version-id-local")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="persona-model-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="the ASDC model version for this resource or service model.",visibility="internal",dataCopy="service-design-and-creation/models/model/{model-invariant-id}/model-vers/model-ver/{model-version-id}#model-version")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Concurrency value")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="orchestration-status" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Orchestration status")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="operational-status" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Indicator for whether the resource is considered operational")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="type" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Generic description of the type of allotted resource.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="role" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="role in the network that this resource will be providing.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:tunnel-xconnects" minOccurs="0"/> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="allotted-resources"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="This object is used to store slices of services being offered")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element ref="tns:allotted-resource" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="service-instance"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Instance of a service",indexedProps="service-instance-id,model-invariant-id,model-version-id,widget-model-id,widget-model-version,service-instance-name,service-instance-location-id,orchestration-status,environment-context,workload-context",nameProps="service-instance-name",searchable="service-instance-id,service-instance-name",uniqueProps="service-instance-id",dependentOn="service-subscription",container="service-instances")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="service-type" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="String capturing type of service.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="service-role" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="String capturing the service role.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="service-instance-id" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="Uniquely identifies this instance of a service")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="service-instance-name" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="This field will store a name assigned to the service-instance.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="environment-context" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="This field will store the environment context assigned to the service-instance.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="workload-context" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="This field will store the workload context assigned to the service-instance.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="model-invariant-id" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="the ASDC model id for this resource or service model.",visibility="deployment",requires="model-version-id",dbAlias="model-invariant-id-local")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="model-version-id" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="the ASDC model version for this resource or service model.",visibility="deployment",requires="model-invariant-id",dbAlias="model-version-id-local")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="persona-model-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="the ASDC model version for this resource or service model.",visibility="internal",dataCopy="service-design-and-creation/models/model/{model-invariant-id}/model-vers/model-ver/{model-version-id}#model-version")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="widget-model-id" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="the ASDC data dictionary widget model. This maps directly to the A&AI widget.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="widget-model-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="the ASDC data dictionary version of the widget model.This maps directly to the A&AI version of the widget.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="bandwidth-total" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Indicates the total bandwidth to be used for this service.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="bandwidth-up-wan1" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="indicates the upstream bandwidth this service will use on the WAN1 port of the physical device.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="bandwidth-down-wan1" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="indicates the downstream bandwidth this service will use on the WAN1 port of the physical device.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="bandwidth-up-wan2" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="indicates the upstream bandwidth this service will use on the WAN2 port of the physical device.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="bandwidth-down-wan2" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="indicates the downstream bandwidth this service will use on the WAN2 port of the physical device.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="vhn-portal-url" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="URL customers will use to access the vHN Portal.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="service-instance-location-id" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="An identifier that customers assign to the location where this service is being used.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="selflink" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Path to the controller object.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="orchestration-status" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Orchestration status of this service.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - <xs:element ref="tns:metadata" minOccurs="0"/> - <xs:element ref="tns:allotted-resources" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="service-instances"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Collection of service instances")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element ref="tns:service-instance" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="service-subscription"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Object that group service instances.",indexedProps="service-type",dependentOn="customer",container="service-subscriptions",crossEntityReference="service-instance,service-type")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="service-type" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="Value defined by orchestration to identify this service across ECOMP.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="temp-ub-sub-account-id" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="This property will be deleted from A&AI in the near future. Only stop gap solution.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:service-instances" minOccurs="0"/> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="service-subscriptions"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Collection of objects that group service instances.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element ref="tns:service-subscription" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="customer"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="customer identifiers to provide linkage back to BSS information.",nameProps="subscriber-name",indexedProps="subscriber-name,global-customer-id,subscriber-type",searchable="global-customer-id,subscriber-name",uniqueProps="global-customer-id",container="customers",namespace="business")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="global-customer-id" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="Global customer id used across ECOMP to uniquely identify customer.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="subscriber-name" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Subscriber name, an alternate way to retrieve a customer.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="subscriber-type" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Subscriber type, a way to provide VID with only the INFRA customers.",defaultValue="CUST")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:service-subscriptions" minOccurs="0"/> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="customers"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Collection of customer identifiers to provide linkage back to BSS information.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element ref="tns:customer" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="business"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Namespace for business related constructs")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element ref="tns:connectors" minOccurs="0"/> - <xs:element ref="tns:customers" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="vnf-image"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Image object that pertain to a VNF that doesn't have associated vservers. This is a kludge.",indexedProps="application,att-uuid,application-vendor,application-version",uniqueProps="att-uuid",container="vnf-images",namespace="service-design-and-creation")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="att-uuid" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="Unique ID of this asset")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="application" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="The application that the image instantiates.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="application-vendor" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="The vendor of the application.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="application-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="The version of the application.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="selflink" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="URL to endpoint where AAI can get more details")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="vnf-images"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Collection of image objects that pertain to a VNF that doesn't have associated vservers. This is a kludge.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element ref="tns:vnf-image" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="service"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Stand-in for service model definitions. Likely to be deprecated in favor of models from ASDC. Does not strictly map to ASDC services.",indexedProps="service-description,service-id",container="services",namespace="service-design-and-creation")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="service-id" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="This gets defined by others to provide a unique ID for the service, we accept what is sent.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="service-description" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Description of the service")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="service-selflink" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="URL to endpoint where AAI can get more details")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="service-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="service version")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="services"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Collection of service model definitions. Likely to be deprecated in favor of models from ASDC.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element ref="tns:service" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="service-capability"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Early definition of server/resource pairings, likely to be replaced by models. No new use should be made of this.",indexedProps="service-type,vnf-type",container="service-capabilities",namespace="service-design-and-creation")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="service-type" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="This gets defined by others to provide a unique ID for the service, we accept what is sent.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="vnf-type" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="String capturing type of vnf, that was intended to identify the ASDC resource. This field has been overloaded in service-specific ways and clients should expect changes to occur in the future to this field as ECOMP matures.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="service-capabilities"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Collection of service capabilities.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element ref="tns:service-capability" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="element-choice-set"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="This is how we would capture constraints defining allowed sets of elements.",uniqueProps="element-choice-set-uuid",indexedProps="element-choice-set-uuid",allowDirectRead="true",allowDirectWrite="false",container="element-choice-sets")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="element-choice-set-uuid" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,autoGenerateUuid="true")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="element-choice-set-name" type="xs:string"/> - <xs:element name="cardinality" type="xs:string" minOccurs="0"/> - <xs:element name="resource-version" type="xs:string" minOccurs="0"/> - <xs:element ref="tns:model-elements" minOccurs="0"/> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="element-choice-sets"> - <xs:complexType> - <xs:sequence> - <xs:element ref="tns:element-choice-set" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="constrained-element-set"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="This is how we would capture constraints defining allowed sets of elements.",uniqueProps="constrained-element-set-uuid",indexedProps="constrained-element-set-uuid",allowDirectRead="true",allowDirectWrite="false",container="constrained-element-sets")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="constrained-element-set-uuid" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,autoGenerateUuid="true")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="constraint-type" type="xs:string"/> - <xs:element name="check-type" type="xs:string"/> - <xs:element name="resource-version" type="xs:string" minOccurs="0"/> - <xs:element ref="tns:element-choice-sets" minOccurs="0"/> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="constrained-element-sets"> - <xs:complexType> - <xs:sequence> - <xs:element ref="tns:constrained-element-set" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="model-constraint"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="This is how we would capture constraints defining allowed sets of elements.",uniqueProps="model-constraint-uuid",indexedProps="model-constraint-uuid",allowDirectRead="true",allowDirectWrite="false",container="model-constraints")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="model-constraint-uuid" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,autoGenerateUuid="true")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="constrained-element-set-uuid-to-replace" type="xs:string"/> - <xs:element ref="tns:constrained-element-sets" minOccurs="0"/> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="model-constraints"> - <xs:complexType> - <xs:sequence> - <xs:element ref="tns:model-constraint" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="model-element"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Defines how other models combine to make up a higher-level model.",uniqueProps="model-element-uuid",indexedProps="model-element-uuid",allowDirectRead="true",allowDirectWrite="false",container="model-elements")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="model-element-uuid" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,autoGenerateUuid="true")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="new-data-del-flag" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Indicates whether this element was created as part of instantiation from this model")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="cardinality" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="How many of this type of element are required/allowed")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="linkage-points" type="xs:string" minOccurs="0" maxOccurs="unbounded"/> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:model-elements" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Defines how other models combine to make up a higher-level model")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:model-constraints" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Describes new constraints on this model element that are not part of that model's definition")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="model-elements"> - <xs:complexType> - <xs:sequence> - <xs:element ref="tns:model-element" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="model-ver"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Subgraph definition provided by ASDC to describe a specific version of an inventory asset and its connections related to ASDC models",nameProps="model-name",indexedProps="model-version-id,model-name,model-version",uniqueProps="model-version-id",container="model-vers")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="model-version-id" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="Unique identifier corresponding to one version of a model in ASDC")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="model-name" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Name of the model, which can change from version to version.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="model-version" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Version")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="model-description" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Description")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:model-elements" minOccurs="0"/> - <xs:element ref="tns:metadata" minOccurs="0"/> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="model-vers"> - <xs:complexType> - <xs:sequence> - <xs:element ref="tns:model-ver" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="model"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Subgraph definition provided by ASDC to describe an inventory asset and its connections related to ASDC models, independent of version",nameProps="model-type",indexedProps="model-invariant-id,model-type",uniqueProps="model-invariant-id",container="models",namespace="service-design-and-creation")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="model-invariant-id" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="Unique identifier corresponding to the main definition of a model in ASDC")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="model-type" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Type of the model, e.g., service, resource, widget, etc.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:model-vers" minOccurs="0"/> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="models"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Collection of subgraph definitions provided by ASDC to describe the inventory assets and their connections related to ASDC models")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element ref="tns:model" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="related-lookup"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="TBD",uniqueProps="related-lookup-uuid",indexedProps="related-lookup-uuid",allowDirectRead="true",allowDirectWrite="false",container="related-lookups")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="related-lookup-uuid" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,autoGenerateUuid="true")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="source-node-type" type="xs:string"/> - <xs:element name="source-node-property" type="xs:string"/> - <xs:element name="target-node-type" type="xs:string"/> - <xs:element name="target-node-property" type="xs:string"/> - <xs:element name="property-collect-list" type="xs:string" minOccurs="0" maxOccurs="unbounded"/> - <xs:element name="resource-version" type="xs:string" minOccurs="0"/> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="related-lookups"> - <xs:complexType> - <xs:sequence> - <xs:element ref="tns:related-lookup" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="property-constraint"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="TBD",uniqueProps="property-constraint-uuid",indexedProps="property-constraint-uuid",allowDirectRead="true",allowDirectWrite="false",container="property-constraints")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="property-constraint-uuid" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,autoGenerateUuid="true")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="constraint-type" type="xs:string"/> - <xs:element name="property-name" type="xs:string"/> - <xs:element name="property-value" type="xs:string"/> - <xs:element name="resource-version" type="xs:string" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="property-constraints"> - <xs:complexType> - <xs:sequence> - <xs:element ref="tns:property-constraint" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="named-query-element"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="TBD",uniqueProps="named-query-element-uuid",indexedProps="named-query-element-uuid",allowDirectRead="true",allowDirectWrite="false",container="named-query-elements")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="named-query-element-uuid" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,autoGenerateUuid="true")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="property-collect-list" type="xs:string" minOccurs="0" maxOccurs="unbounded"/> - <xs:element name="resource-version" type="xs:string" minOccurs="0"/> - <xs:element name="property-limit-desc" type="xs:string" minOccurs="0"/> - <xs:element name="do-not-output" type="xs:string" minOccurs="0"/> - <xs:element ref="tns:named-query-elements" minOccurs="0"/> - <xs:element ref="tns:related-lookups" minOccurs="0"/> - <xs:element ref="tns:property-constraints" minOccurs="0"/> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="named-query-elements"> - <xs:complexType> - <xs:sequence> - <xs:element ref="tns:named-query-element" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="named-query"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="TBD",nameProps="named-query-name",uniqueProps="named-query-uuid",indexedProps="named-query-uuid,named-query-name",container="named-queries",namespace="service-design-and-creation")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="named-query-uuid" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true)</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="named-query-name" type="xs:string"/> - <xs:element name="named-query-version" type="xs:string"/> - <xs:element name="required-input-params" minOccurs="0"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="TBD",nameProps="named-query-name",uniqueProps="named-query-uuid",indexedProps="named-query-uuid,named-query-name",container="named-queries",namespace="service-design-and-creation")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="required-input-param" type="xs:string" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="description" type="xs:string" minOccurs="0"/> - <xs:element name="resource-version" type="xs:string" minOccurs="0"/> - <xs:element ref="tns:named-query-elements" minOccurs="0"/> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="named-queries"> - <xs:complexType> - <xs:sequence> - <xs:element ref="tns:named-query" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="service-design-and-creation"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Namespace for objects managed by ASDC")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element ref="tns:vnf-images" minOccurs="0"/> - <xs:element ref="tns:services" minOccurs="0"/> - <xs:element ref="tns:service-capabilities" minOccurs="0"/> - <xs:element ref="tns:models" minOccurs="0"/> - <xs:element ref="tns:named-queries" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="logical-link"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Logical links generally connect l-interfaces but are used to express logical connectivity between two points",indexedProps="link-name,model-invariant-id,model-version-id,widget-model-id,widget-model-version,link-id,prov-status,circuit-id,purpose",uniqueProps="link-id",container="logical-links",namespace="network",searchable="link-name")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="link-name" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="e.g., evc-name, or vnf-nameA_interface-nameA_vnf-nameZ_interface-nameZ")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="in-maint" type="xs:boolean"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(defaultValue="false",description="used to indicate whether or not this object is in maintenance mode (maintenance mode = true). This field (in conjunction with prov-status) is used to suppress alarms and vSCL on VNFs/VMs.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="link-type" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Type of logical link, e.g., evc")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="speed-value" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Captures the numeric part of the speed")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="speed-units" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Captures the units corresponding to the speed")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="ip-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="v4, v6, or ds for dual stack (should be att-ip-version)")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="routing-protocol" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="For example, static or BGP")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="model-invariant-id" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="the ASDC model id for this resource or service model.",visibility="deployment",requires="model-version-id",dbAlias="model-invariant-id-local")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="model-version-id" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="the ASDC model version for this resource or service model.",visibility="deployment",requires="model-invariant-id",dbAlias="model-version-id-local")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="persona-model-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="the ASDC model version for this resource or service model.",visibility="internal",dataCopy="service-design-and-creation/models/model/{model-invariant-id}/model-vers/model-ver/{model-version-id}#model-version")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="widget-model-id" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="the ASDC data dictionary widget model. This maps directly to the A&AI widget.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="widget-model-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="the ASDC data dictionary version of the widget model.This maps directly to the A&AI version of the widget.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="operational-status" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Indication of operational status of the logical link.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="prov-status" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Trigger for operational monitoring of this VNF by BAU Service Assurance systems.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="link-role" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Indication of the network use of the logical link.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="link-name2" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Alias or alternate name (CLCI or D1 name).")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="link-id" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="UUID of the logical-link, SDNC generates this.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="circuit-id" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Circuit id")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="purpose" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Reason for this entity, role it is playing")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="logical-links"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Collection of logical connections")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element ref="tns:logical-link" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="class-of-service"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(indexedProps="cos",dependentOn="site-pair",container="classes-of-service")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="cos" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="unique identifier of probe")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="probe-id" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="identifier of probe")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="probe-type" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="type of probe")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="classes-of-service"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="class-of-service of probe")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element ref="tns:class-of-service" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="site-pair"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(indexedProps="site-pair-id",uniqueProps="site-pair-id",dependentOn="routing-instance",container="site-pairs")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="site-pair-id" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="unique identifier of probe")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="source-ip" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Prefix address")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="destination-ip" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Prefix address")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="ip-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="ip version, v4, v6")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="destination-hostname" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Hostname of the destination equipment to which SLAs are measured against.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="destination-equip-type" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="The type of destinatination equipment. Could be Router, UCPE, etc.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:classes-of-service" minOccurs="0"/> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="site-pairs"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="probe within a set")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element ref="tns:site-pair" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="routing-instance"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(indexedProps="routing-instance-id",uniqueProps="routing-instance-id",dependentOn="site-pair-set",container="routing-instances")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="routing-instance-id" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="Unique id of routing instance")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="rpm-owner" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="rpm owner")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:site-pairs" minOccurs="0"/> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="routing-instances"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="set of probes related to generic-vnf routing instance")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element ref="tns:routing-instance" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="site-pair-set"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Set of instances for probes used to measure service level agreements",indexedProps="site-pair-set-id",uniqueProps="site-pair-set-id",container="site-pair-sets",namespace="network")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="site-pair-set-id" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="Unique id of site pair set.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:routing-instances" minOccurs="0"/> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="site-pair-sets"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Collection of sets of instances for probes related to generic-vnf")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element ref="tns:site-pair-set" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="route-target"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Route target information",container="route-targets",dependentOn="vpn-binding",canBeLinked="true")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="global-route-target" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="Number used to identify an RT, globally unique in the network")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="route-target-role" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="Role assigned to this route target")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="route-targets"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Collection of route target information")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element ref="tns:route-target" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="vpn-binding"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="VPN binding",nameProps="vpn-name,vpn-type",indexedProps="vpn-name,vpn-id,vpn-type",searchable="vpn-id,vpn-name",uniqueProps="vpn-id",container="vpn-bindings",namespace="network")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="vpn-id" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="VPN ID, globally unique within A&AI")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="vpn-name" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="VPN Name")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="vpn-platform" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="the platform associated with the VPN example AVPN, Mobility")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="vpn-type" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Type of the vpn, should be taken from enumerated/valid values")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="vpn-region" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="region of customer vpn")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="customer-vpn-id" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="id for this customer vpn")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="route-distinguisher" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used to distinguish the distinct VPN routes of separate customers who connect to the provider in an MPLS network.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:route-targets" minOccurs="0"/> - <xs:element ref="tns:relationship-list" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="l3-networks relate to vpn-bindings")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="vpn-bindings"> - <xs:complexType> - <xs:sequence> - <xs:element ref="tns:vpn-binding" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="vpls-pe"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="VPLS Provider Edge routers.",indexedProps="prov-status,equipment-name",container="vpls-pes",namespace="network")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="equipment-name" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true)</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="prov-status" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Trigger for operational monitoring of this VNF by BAU Service Assurance systems.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="ipv4-oam-address" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Address tail-f uses to configure vpe, also used for troubleshooting and is IP used for traps generated by VPE (v4-loopback0-ip-address).")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="equipment-role" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Client should send valid enumerated value, e.g., VPLS-PE.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="vlan-id-outer" type="xs:unsignedInt" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Temporary location for stag to get to VCE")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - <xs:element ref="tns:p-interfaces" minOccurs="0"/> - <xs:element ref="tns:lag-interfaces" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="vpls-pes"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Collection of VPLS Provider Edge routers")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element ref="tns:vpls-pe" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="multicast-configuration"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(indexedProps="multicast-configuration-id",uniqueProps="multicast-configuration-id",container="multicast-configurations",namespace="network")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="multicast-configuration-id" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="Unique id of multicast configuration.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="multicast-protocol" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="protocol of multicast configuration")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="rp-type" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="rp type of multicast configuration")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="multicast-configurations"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="multicast configuration of generic-vnf ip-address")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element ref="tns:multicast-configuration" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="cvlan-tag-entry"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(dependentOn="port-group",indexedProps="cvlan-tag",container="cvlan-tags")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="cvlan-tag" type="xs:unsignedInt"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="See mis-na-virtualization-platform.yang")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="cvlan-tags"> - <xs:complexType> - <xs:sequence> - <xs:element ref="tns:cvlan-tag-entry" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="port-group"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Used to capture the network interfaces of this VCE",nameProps="port-group-name",indexedProps="port-group-id,heat-stack-id,interface-id,interface-name,switch-name",dependentOn="vce",container="port-groups")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="interface-id" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="Unique ID of the interface")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="neutron-network-id" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Neutron network id of this Interface")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="neutron-network-name" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Neutron network name of this Interface")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="interface-role" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Role assigned to this Interface, should use values as defined in ECOMP Yang models.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="port-group-id" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Unique ID for port group in vmware")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="port-group-name" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Likely to duplicate value of neutron network name")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="switch-name" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="DVS or standard switch name (should be non-null for port groups associated with DVS)")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="orchestration-status" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Orchestration status of this VNF, mastered by MSO")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="heat-stack-id" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Heat stack id corresponding to this instance, managed by MSO")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="mso-catalog-key" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Corresponds to the SDN-C catalog id used to configure this VCE")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:cvlan-tags" minOccurs="0"/> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="port-groups"> - <xs:complexType> - <xs:sequence> - <xs:element ref="tns:port-group" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="license"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Metadata for license group.",indexedProps="group-uuid,resource-uuid",dependentOn="generic-vnf,vce,vpe",container="licenses")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="group-uuid" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="Unique ID for the license group the resource belongs to, should be uuid.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-uuid" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="Unique ID of a license resource. ")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Concurrency value")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="licenses"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Licenses to be allocated across resources, keyed by group-uuid and resource-uuid, related to license management")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element ref="tns:license" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="entitlement"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Metadata for entitlement group.",indexedProps="group-uuid,resource-uuid",dependentOn="generic-vnf,vce,vpe",container="entitlements")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="group-uuid" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="Unique ID for the entitlement group the resource comes from, should be uuid.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-uuid" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="Unique ID of an entitlement resource. ")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Concurrency value")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="entitlements"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Entitlements, keyed by group-uuid and resource-uuid, related to license management")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element ref="tns:entitlement" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="vce"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Virtual Customer Edge Router, used specifically for Gamma. This object is deprecated.",nameProps="vnf-name",indexedProps="vnf-name,vnf-name2,vnf-type,heat-stack-id,vnf-id,interface-name,regional-resource-zone,vpe-id,prov-status,service-id",searchable="vnf-id,vnf-name,vnf-name2",uniqueProps="vnf-id",container="vces",namespace="network",extendsFrom="vnf")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="vnf-id" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="Unique id of VNF. This is unique across the graph.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="vnf-name" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Name of VNF.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="vnf-name2" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Alternate name of VNF.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="vnf-type" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="String capturing type of vnf, that was intended to identify the ASDC resource. This field has been overloaded in service-specific ways and clients should expect changes to occur in the future to this field as ECOMP matures.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="service-id" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Unique identifier of service, does not strictly map to ASDC services, SOON TO BE DEPRECATED.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="regional-resource-zone" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Regional way of organizing pservers, source of truth should define values")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="prov-status" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Trigger for operational monitoring of this resource by Service Assurance systems.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="operational-status" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Indicator for whether the resource is considered operational")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="license-key" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="OBSOLETE - do not use")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="equipment-role" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Network role being played by this VNF")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="orchestration-status" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Orchestration status of this VNF, mastered by MSO")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="heat-stack-id" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Heat stack id corresponding to this instance, managed by MSO")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="mso-catalog-key" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Corresponds to the SDN-C catalog id used to configure this VCE")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="vpe-id" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Unique ID of VPE connected to this VCE.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="v6-vce-wan-address" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Valid v6 IP address for the WAN Link on this router. Implied length of /64.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="ipv4-oam-address" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Address tail-f uses to configure vce, also used for troubleshooting and is IP used for traps generated by VCE.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="ipv4-loopback0-address" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Loopback0 address")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="entitlement-resource-uuid" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="OBSOLETE - see child relationships")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:port-groups" minOccurs="0"/> - <xs:element ref="tns:licenses" minOccurs="0"/> - <xs:element ref="tns:entitlements" minOccurs="0"/> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="vces"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Collection of Virtual Customer Edge Routers, used specifically for Gamma. This object is deprecated.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element ref="tns:vce" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="vpe"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Relationship-list must include related to info for complex.",nameProps="vnf-name",indexedProps="vnf-name,vnf-name2,vnf-type,heat-stack-id,vnf-id,regional-resource-zone,prov-status,service-id",searchable="vnf-id,vnf-name,vnf-name2",uniqueProps="vnf-id",container="vpes",namespace="network",extendsFrom="vnf")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="vnf-id" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="Unique id of VNF. This is unique across the graph.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="vnf-name" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Name of VNF.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="vnf-name2" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Alternate name of VNF.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="vnf-type" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="String capturing type of vnf, that was intended to identify the ASDC resource. This field has been overloaded in service-specific ways and clients should expect changes to occur in the future to this field as ECOMP matures.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="service-id" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Unique identifier of service. Does not map strictly to ASDC services. SOON TO BE DEPRECATED")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="regional-resource-zone" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Regional way of organizing pservers, source of truth should define values")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="prov-status" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Trigger for operational monitoring of this resource by Service Assurance systems.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="operational-status" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Indicator for whether the resource is considered operational")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="license-key" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="OBSOLETE - do not use. See child relationships.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="equipment-role" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Client should send valid enumerated value")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="orchestration-status" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Orchestration status of this VNF, mastered by MSO")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="heat-stack-id" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Heat stack id corresponding to this instance, managed by MSO")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="mso-catalog-key" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Corresponds to the SDN-C catalog id used to configure this VCE")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="ipv4-oam-address" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Address tail-f uses to configure vpe, also used for troubleshooting and is IP used for traps generated by VPE (v4-loopback0-ip-address).")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="ipv4-oam-gateway-address-prefix-length" type="xs:int" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Prefix length for oam-address")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="ipv4-oam-gateway-address" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Gateway address")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="v4-loopback0-ip-address" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Loopback0 address")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="vlan-id-outer" type="xs:unsignedInt" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Temporary location for stag to get to VCE")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="as-number" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="as-number of the VPE")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="summary-status" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="details regarding the vpe operation, PLEASE DISCONTINUE USE OF THIS FIELD.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="encrypted-access-flag" type="xs:boolean" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="indicates whether vpe access uses SSH")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - <xs:element ref="tns:l-interfaces" minOccurs="0"/> - <xs:element ref="tns:lag-interfaces" minOccurs="0"/> - <xs:element ref="tns:licenses" minOccurs="0"/> - <xs:element ref="tns:entitlements" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="vpes"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Virtual provider edge router. In 1504, A&AI will populate this object through an M&P and tool provided to operations.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element ref="tns:vpe" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="vnfc"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(indexedProps="vnfc-name,prov-status,nfc-function,nfc-naming-code,ipaddress-v4-oam-vip,in-maint,is-closed-loop-disabled,group-notation,model-invariant-id,model-version-id",searchable="vnfc-name",container="vnfcs",namespace="network")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="vnfc-name" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="Unique ID of vnfc.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="nfc-naming-code" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Short code that is used in naming instances of the item being modeled")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="nfc-function" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="English description of function that the specific resource deployment is providing. Assigned as part of the customization of a resource in a service")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="prov-status" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="prov status of this vnfc")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="orchestration-status" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Orchestration status of this VNF, mastered by APP-C")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="ipaddress-v4-oam-vip" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Oam V4 vip address of this vnfc")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="in-maint" type="xs:boolean"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(defaultValue="false",description="used to indicate whether or not this object is in maintenance mode (maintenance mode = true)")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="is-closed-loop-disabled" type="xs:boolean"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(defaultValue="false",description="used to indicate whether closed loop function is enabled on this node")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="group-notation" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Group notation of VNFC")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="model-invariant-id" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="the ASDC model id for this resource or service model.",visibility="deployment",requires="model-version-id")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="model-version-id" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="the ASDC model version for this resource or service model.",visibility="deployment",requires="model-invariant-id")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="vnfcs"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="virtual network components associated with a vserver from application controller.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element ref="tns:vnfc" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="subnet"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(indexedProps="subnet-id,subnet-name",nameProps="subnet-name",uniqueProps="subnet-id",dependentOn="l3-network",container="subnets")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="subnet-id" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="Subnet ID, should be UUID.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="subnet-name" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Name associated with the subnet.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="neutron-subnet-id" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Neutron id of this subnet")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="gateway-address" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="gateway ip address")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="network-start-address" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="network start address")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="cidr-mask" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="cidr mask")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="ip-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="ip version")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="orchestration-status" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Orchestration status of this VNF, mastered by MSO")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="dhcp-enabled" type="xs:boolean"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(defaultValue="false",description="dhcp enabled")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="dhcp-start" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="the start address reserved for use by dhcp")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="dhcp-end" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="the last address reserved for use by dhcp")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="subnet-role" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="role of the subnet, referenced when assigning IPs")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="subnets"> - <xs:complexType> - <xs:sequence> - <xs:element ref="tns:subnet" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="ctag-assignment"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(indexedProps="vlan-id-inner",dependentOn="l3-network",container="ctag-assignments")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="vlan-id-inner" type="xs:unsignedInt"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="id.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="ctag-assignments"> - <xs:complexType> - <xs:sequence> - <xs:element ref="tns:ctag-assignment" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="segmentation-assignment"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Openstack segmentation assignment.",indexedProps="segmentation-id",dependentOn="l3-network",container="segmentation-assignments")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="segmentation-id" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="Route Table Reference id, UUID assigned to this instance.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Concurrency value")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="segmentation-assignments"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Collection of openstack segmentation assignments")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element ref="tns:segmentation-assignment" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="l3-network"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Generic network definition",nameProps="network-name",indexedProps="heat-stack-id,network-uuid,service-id,network-id,network-name,model-invariant-id,model-version-id,widget-model-id,widget-model-version,contrail-network-fqdn,network-role",searchable="network-id,network-name",uniqueProps="network-id",container="l3-networks",namespace="network")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="network-id" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="Network ID, should be uuid. Unique across A&AI.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="network-name" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Name of the network, governed by some naming convention..")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="network-type" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Type of the network - who defines these values?")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="network-role" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Role the network plans - who defines these values?")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="network-technology" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Network technology - who defines these values?")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="neutron-network-id" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Neutron network id of this Interface")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="is-bound-to-vpn" type="xs:boolean"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(defaultValue="false",description="Set to true if bound to VPN")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="service-id" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Unique identifier of service from ASDC. Does not strictly map to ASDC services. SOON TO BE DEPRECATED")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="network-role-instance" type="xs:unsignedInt" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="network role instance")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="orchestration-status" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Orchestration status of this VNF, mastered by MSO")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="heat-stack-id" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Heat stack id corresponding to this instance, managed by MSO")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="mso-catalog-key" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Corresponds to the SDN-C catalog id used to configure this VCE")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="contrail-network-fqdn" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Contrail FQDN for the network")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="model-invariant-id" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="the ASDC model id for this resource or service model.",visibility="deployment",requires="model-version-id",dbAlias="model-invariant-id-local")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="model-version-id" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="the ASDC model version for this resource or service model.",visibility="deployment",requires="model-invariant-id",dbAlias="model-version-id-local")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="persona-model-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="the ASDC model version for this resource or service model.",visibility="internal",dataCopy="service-design-and-creation/models/model/{model-invariant-id}/model-vers/model-ver/{model-version-id}#model-version")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="model-customization-id" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="captures the id of all the configuration used to customize the resource for the service.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="widget-model-id" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="the ASDC data dictionary widget model. This maps directly to the A&AI widget.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="widget-model-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="the ASDC data dictionary version of the widget model.This maps directly to the A&AI version of the widget.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="physical-network-name" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Name associated with the physical network.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="is-provider-network" type="xs:boolean"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(defaultValue="false",description="boolean indicatating whether or not network is a provider network.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="is-shared-network" type="xs:boolean"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(defaultValue="false",description="boolean indicatating whether or not network is a shared network.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="is-external-network" type="xs:boolean"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(defaultValue="false",description="boolean indicatating whether or not network is an external network.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="selflink" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Path to the controller object.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="operational-status" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Indicator for whether the resource is considered operational.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:subnets" minOccurs="0"/> - <xs:element ref="tns:ctag-assignments" minOccurs="0"/> - <xs:element ref="tns:segmentation-assignments" minOccurs="0"/> - <xs:element ref="tns:relationship-list" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Relates to tenant (or is it a child of tenant), complex, service, vpn-binding")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="l3-networks"> - <xs:complexType> - <xs:sequence> - <xs:element ref="tns:l3-network" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="network-policy"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(nameProps="network-policy-fqdn",indexedProps="network-policy-id,network-policy-fqdn",searchable="network-policy-id,network-policy-fqdn",uniqueProps="network-policy-id",container="network-policies",namespace="network")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="network-policy-id" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="UUID representing unique key to this instance")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="network-policy-fqdn" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Contrail FQDN for the policy")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="heat-stack-id" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="ID for the openStack Heat instance")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="network-policies"> - <xs:complexType> - <xs:sequence> - <xs:element ref="tns:network-policy" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="vf-module"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="a deployment unit of VNFCs",indexedProps="vf-module-id,vf-module-name,heat-stack-id,model-invariant-id,model-version-id,widget-model-id,widget-model-version,contrail-service-instance-fqdn",searchable="vf-module-id,vf-module-name",dependentOn="generic-vnf",container="vf-modules")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="vf-module-id" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="Unique ID of vf-module.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="vf-module-name" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Name of vf-module")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="heat-stack-id" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Heat stack id corresponding to this instance.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="orchestration-status" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="orchestration status of this vf-module, mastered by MSO")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="is-base-vf-module" type="xs:boolean"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(defaultValue="false",description="used to indicate whether or not this object is base vf module")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="model-invariant-id" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="the ASDC model id for this resource or service model.",visibility="deployment",requires="model-version-id",dbAlias="model-invariant-id-local")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="model-version-id" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="the ASDC model version for this resource or service model.",visibility="deployment",requires="model-invariant-id",dbAlias="model-version-id-local")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="persona-model-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="the ASDC model version for this resource or service model.",visibility="internal",dataCopy="service-design-and-creation/models/model/{model-invariant-id}/model-vers/model-ver/{model-version-id}#model-version")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="model-customization-id" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="captures the id of all the configuration used to customize the resource for the service.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="widget-model-id" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="the ASDC data dictionary widget model. This maps directly to the A&AI widget.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="widget-model-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="the ASDC data dictionary version of the widget model.This maps directly to the A&AI version of the widget.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="contrail-service-instance-fqdn" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="the Contrail unique ID for a service-instance")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="module-index" type="xs:int" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="the index will track the number of modules of a given type that have been deployed in a VNF, starting with 0, and always choosing the lowest available digit")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="selflink" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Path to the controller object.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="vf-modules"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Collection of vf-modules, a deployment unit of VNFCs")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element ref="tns:vf-module" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="generic-vnf"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="General purpose VNF",nameProps="vnf-name",indexedProps="is-closed-loop-disabled,vnf-name2,vnf-type,heat-stack-id,in-maint,vnf-name,vnf-id,regional-resource-zone,prov-status,service-id,model-invariant-id,model-version-id,widget-model-id,widget-model-version,nf-type,nf-function,nf-naming-code,nf-role",searchable="vnf-id,vnf-name,vnf-name2",uniqueProps="vnf-id",container="generic-vnfs",namespace="network",extendsFrom="vnf",containsSuggestibleProps="true",suggestionAliases="VNFs")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="vnf-id" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="Unique id of VNF. This is unique across the graph.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="vnf-name" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Name of VNF.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="vnf-name2" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Alternate name of VNF.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="vnf-type" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="String capturing type of vnf, that was intended to identify the ASDC resource. This field has been overloaded in service-specific ways and clients should expect changes to occur in the future to this field as ECOMP matures.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="service-id" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Unique identifier of service, does not necessarily map to ASDC service models. SOON TO BE DEPRECATED")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="regional-resource-zone" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Regional way of organizing pservers, source of truth should define values")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="prov-status" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Trigger for operational monitoring of this resource by Service Assurance systems.",suggestibleOnSearch="true")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="operational-status" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Indicator for whether the resource is considered operational. Valid values are in-service-path and out-of-service-path.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="license-key" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="OBSOLETE - do not use")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="equipment-role" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Client should send valid enumerated value")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="orchestration-status" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Orchestration status of this VNF, used by MSO.",suggestibleOnSearch="true")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="heat-stack-id" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Heat stack id corresponding to this instance, managed by MSO")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="mso-catalog-key" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Corresponds to the SDN-C catalog id used to configure this VCE")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="management-option" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="identifier of managed by ATT or customer")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="ipv4-oam-address" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Address tail-f uses to configure generic-vnf, also used for troubleshooting and is IP used for traps generated by generic-vnf.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="ipv4-loopback0-address" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="v4 Loopback0 address")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="nm-lan-v6-address" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="v6 Loopback address")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="management-v6-address" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="v6 management address")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="vcpu" type="xs:unsignedInt" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="number of vcpus ordered for this instance of VNF, used for VNFs with no vservers/flavors, to be used only by uCPE")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="vcpu-units" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="units associated with vcpu, used for VNFs with no vservers/flavors, to be used only by uCPE")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="vmemory" type="xs:unsignedInt" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="number of GB of memory ordered for this instance of VNF, used for VNFs with no vservers/flavors, to be used only by uCPE")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="vmemory-units" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="units associated with vmemory, used for VNFs with no vservers/flavors, to be used only by uCPE")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="vdisk" type="xs:unsignedInt" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="number of vdisks ordered for this instance of VNF, used for VNFs with no vservers/flavors, to be used only uCPE")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="vdisk-units" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="units associated with vdisk, used for VNFs with no vservers/flavors, to be used only by uCPE")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="in-maint" type="xs:boolean"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(defaultValue="false",description="used to indicate whether or not this object is in maintenance mode (maintenance mode = true). This field (in conjunction with prov-status) is used to suppress alarms and vSCL on VNFs/VMs.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="is-closed-loop-disabled" type="xs:boolean"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(defaultValue="false",description="used to indicate whether closed loop function is enabled on this node")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="summary-status" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="details regarding the generic-vnf operation, PLEASE DISCONTINUE USE OF THIS FIELD.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="encrypted-access-flag" type="xs:boolean" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="indicates whether generic-vnf access uses SSH")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="entitlement-assignment-group-uuid" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="UUID of the Entitlement group used for licensing VNFs, OBSOLETE - See child relationships.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="entitlement-resource-uuid" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="UUID of the specific entitlement resource. OBSOLETE - See child relationships.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="license-assignment-group-uuid" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="UUID of the license assignment group. OBSOLETE - See child relationships.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="license-key-uuid" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="UUID of the actual license resource. OBSOLETE - See child relationships.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="model-invariant-id" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="the ASDC model id for this resource or service model.",visibility="deployment",requires="model-version-id",dbAlias="model-invariant-id-local")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="model-version-id" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="the ASDC model version for this resource or service model.",visibility="deployment",requires="model-invariant-id",dbAlias="model-version-id-local")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="persona-model-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="the ASDC model version for this resource or service model.",visibility="internal",dataCopy="service-design-and-creation/models/model/{model-invariant-id}/model-vers/model-ver/{model-version-id}#model-version")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="model-customization-id" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="captures the id of all the configuration used to customize the resource for the service.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="widget-model-id" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="the ASDC data dictionary widget model. This maps directly to the A&AI widget.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="widget-model-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="the ASDC data dictionary version of the widget model.This maps directly to the A&AI version of the widget.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="as-number" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="as-number of the VNF")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="regional-resource-subzone" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="represents sub zone of the rr plane")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="nf-type" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Generic description of the type of NF",suggestibleOnSearch="true")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="nf-function" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="English description of Network function that the specific VNF deployment is providing")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="nf-role" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="role in the network that this model will be providing")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="nf-naming-code" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="string assigned to this model used for naming purposes")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="selflink" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Path to the controller object.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="ipv4-oam-gateway-address" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Gateway address")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="ipv4-oam-gateway-address-prefix-length" type="xs:int" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Prefix length for oam-address")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="vlan-id-outer" type="xs:unsignedInt" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Temporary location for S-TAG to get to VCE")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="nm-profile-name" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Network Management profile of this VNF")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - <xs:element ref="tns:l-interfaces" minOccurs="0"/> - <xs:element ref="tns:lag-interfaces" minOccurs="0"/> - <xs:element ref="tns:vf-modules" minOccurs="0"/> - <xs:element ref="tns:licenses" minOccurs="0"/> - <xs:element ref="tns:entitlements" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="generic-vnfs"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Collection of VNFs")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element ref="tns:generic-vnf" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="lag-link"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="LAG links can connect lag-interfaces",indexedProps="link-name",container="lag-links",namespace="network")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="link-name" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="Alphabetical concatenation of lag-interface names")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="lag-links"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Collection of link aggregation connections")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element ref="tns:lag-link" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="newvce"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="This object fills in the gaps from vce that were incorporated into generic-vnf. This object will be retired with vce.",nameProps="vnf-name",indexedProps="vnf-name,vnf-name2,vnf-type,heat-stack-id,prov-status,vnf-id2",searchable="vnf-id2,vnf-name,vnf-name2",uniqueProps="vnf-id2",container="newvces",namespace="network")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="vnf-id2" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="Unique id of VNF, can't use same attribute name right now until we promote this new object")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="vnf-name" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Name of VNF.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="vnf-name2" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Alternate name of VNF.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="vnf-type" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="String capturing type of vnf, that was intended to identify the ASDC resource. This field has been overloaded in service-specific ways and clients should expect changes to occur in the future to this field as ECOMP matures.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="prov-status" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Trigger for operational monitoring of this VNF by BAU Service Assurance systems.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="operational-status" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Indicator for whether the resource is considered operational")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="license-key" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="OBSOLETE - do not use")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="ipv4-oam-address" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Address tail-f uses to configure vpe, also used for troubleshooting and is IP used for traps generated by VPE (v4-loopback0-ip-address).")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="equipment-role" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Client should send valid enumerated value, e.g., VPE.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="ipv4-loopback0-address" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="v4 Loopback0 address")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="orchestration-status" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Orchestration status of this VNF, mastered by MSO.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="heat-stack-id" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Heat stack id corresponding to this instance, managed by MSO")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="mso-catalog-key" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Corresponds to the SDN-C catalog id used to configure this VCE")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - <xs:element ref="tns:l-interfaces" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="newvces"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="This object fills in the gaps from vce that were incorporated into generic-vnf. This object will be retired with vce.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element ref="tns:newvce" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="pnf"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="PNF represents a physical network function. typically equipment used in the D1 world. in 1607, this will be populated by SDN-C to represent a premises router that a uCPE connects to. But this can be used to represent any physical device that is not an AIC node or uCPE.",indexedProps="pnf-name,orchestration-status,inv-status",searchable="pnf-name",uniqueProps="pnf-name",container="pnfs",namespace="network")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="pnf-name" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="unique name of Physical Network Function.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="pnf-name2" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="name of Physical Network Function.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="pnf-name2-source" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="source of name2")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="pnf-id" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="id of pnf")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="equip-type" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Equipment type. Source of truth should define valid values.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="equip-vendor" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Equipment vendor. Source of truth should define valid values.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="equip-model" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Equipment model. Source of truth should define valid values.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="management-option" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="identifier of managed by ATT or customer")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="ipaddress-v4-oam" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="ipv4-oam-address with new naming convention for IP addresses")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="sw-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="sw-version is the version of SW for the hosted application on the PNF.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="in-maint" type="xs:boolean"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(defaultValue="false",description="Used to indicate whether or not this object is in maintenance mode (maintenance mode = true). This field (in conjunction with prov-status) is used to suppress alarms and vSCL on VNFs/VMs.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="frame-id" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="ID of the physical frame (relay rack) where pnf is installed.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="serial-number" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Serial number of the device")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="ipaddress-v4-loopback-0" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="IPV4 Loopback 0 address")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="ipaddress-v6-loopback-0" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="IPV6 Loopback 0 address")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="ipaddress-v4-aim" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="IPV4 AIM address")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="ipaddress-v6-aim" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="IPV6 AIM address")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="ipaddress-v6-oam" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="IPV6 OAM address")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="inv-status" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="CANOPI's inventory status. Only set with values exactly as defined by CANOPI.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="prov-status" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Prov Status of this device (not under canopi control) Valid values [PREPROV/NVTPROV/PROV]")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="nf-role" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Nf Role is the role performed by this instance in the network.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - <xs:element ref="tns:p-interfaces" minOccurs="0"/> - <xs:element ref="tns:lag-interfaces" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="pnfs"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Collection of Physical Network Functions.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element ref="tns:pnf" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="physical-link"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Collection of physical connections, typically between p-interfaces",indexedProps="circuit-id,link-name",alternateKeys1="circuit-id",container="physical-links",namespace="network",searchable="link-name,circuit-id")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="link-name" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="e.g., hostnameA_p-connection_nameA_hostnameZ+p_connection-nameZ")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="speed-value" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Captures the numeric part of the speed")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="speed-units" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Captures the units corresponding to the speed")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="circuit-id" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Circuit it")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="dual-mode" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Dual access mode (e.g., primary, secondary")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="management-option" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="To provide information on who manages this circuit. A&AI or 3rd party transport provider")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="service-provider-name" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Name of the service Provider on this link.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="physical-links"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Collection of physical connections, typically between p-interfaces")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element ref="tns:physical-link" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="vig-server"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="vig-server contains information about a vig server used for IPSec-configuration. Populated by SDN-C from 1607",indexedProps="vig-address-type",dependentOn="ipsec-configuration",container="vig-servers")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="vig-address-type" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="indicates whether the VIG is for AVPN or INTERNET")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="ipaddress-v4-vig" type="xs:string" minOccurs="0" maxOccurs="unbounded"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="v4 IP of the vig server")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="ipaddress-v6-vig" type="xs:string" minOccurs="0" maxOccurs="unbounded"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="v6 IP of the vig server")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="vig-servers"> - <xs:complexType> - <xs:sequence> - <xs:element ref="tns:vig-server" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="ipsec-configuration"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="IPSec configuration node will contain various configuration data for the NMTE VNF. This node will have an edge to the generic-vnf (vnf type = TE). Starting 1607, this data will be populated by SDN-C",indexedProps="ipsec-configuration-id",uniqueProps="ipsec-configuration-id",container="ipsec-configurations",namespace="network")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="ipsec-configuration-id" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="UUID of this configuration")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="requested-vig-address-type" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Indicate the type of VIG server like AVPN, INTERNET, BOTH")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="requested-encryption-strength" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Encryption values like 3des-cbc, des-cbc, aes-128-cbc, aes-192-cbc, aes-265-cbc")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="requested-dmz-type" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="ATT can offer a shared DMZ or a DMZ specific to a customer")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="shared-dmz-network-address" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Network address of shared DMZ")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="requested-customer-name" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="If the DMZ is a custom DMZ, this field will indicate the customer information")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="ike-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="can be 1 or 2")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="ikev1-authentication" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Contains values like md5, sha1, sha256, sha384")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="ikev1-encryption" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Encyption values like 3des-cbc, des-cbc, aes-128-cbc, aes-192-cbc, aes-265-cbc")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="ikev1-dh-group" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Diffie-Hellman group like DH-GROUP2, DH-GROUP5, DH-GROUP14")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="ikev1-am-group-id" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Group name defined in VIG for clients using aggressive mode")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="ikev1-am-password" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="pre-shared key for the above group name ")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="ikev1-sa-lifetime" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Lifetime for IKEv1 SA")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="ipsec-authentication" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="md5, sha1, sha256, sha384")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="ipsec-encryption" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="3des-cbc, des-cbc, aes-128-cbc, aes-192-cbc, aes-265-cbc")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="ipsec-sa-lifetime" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Life time for IPSec SA")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="ipsec-pfs" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="enable PFS or not")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="xauth-userid" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="user ID for xAuth, sm-user,ucpeHostName,nmteHostName")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="xauth-user-password" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Encrypted using the Juniper $9$ algorithm")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="dpd-interval" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="The time between DPD probe")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="dpd-frequency" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Maximum number of DPD before claiming the tunnel is down")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - <xs:element ref="tns:vig-servers" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="ipsec-configurations"> - <xs:complexType> - <xs:sequence> - <xs:element ref="tns:ipsec-configuration" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="route-table-reference"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Openstack route table reference.",nameProps="route-table-reference-fqdn",uniqueProps="route-table-reference-id",indexedProps="route-table-reference-id,route-table-reference-fqdn",container="route-table-references",namespace="network")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="route-table-reference-id" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="Route Table Reference id, UUID assigned to this instance.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="route-table-reference-fqdn" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="FQDN entry in the route table.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Concurrency value")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="route-table-references"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Collection of openstack route table references")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element ref="tns:route-table-reference" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="instance-group"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="General mechanism for grouping instances",nameProps="description",uniqueProps="id",searchable="id,description",indexedProps="id,description,type,sub-type",container="instance-groups",namespace="network")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="instance-group-role" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="role of the instance group.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="model-invariant-id" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="ASDC model id for this resource or service model.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="model-version-id" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="ASDC model version uid for this resource model.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="id" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="Instance Group ID, UUID assigned to this instance.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="description" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Descriptive text to help identify the usage of this instance-group")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="type" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Only valid value today is lower case ha for high availability")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="sub-type" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Valid values for ha type are [geo-activeactive, geo-activestandby, local-activeactive, local-activestandby]")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Concurrency value")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="instance-groups"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Collection of openstack route table references")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element ref="tns:instance-group" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="zone"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="A zone is a grouping of assets in a location homing to the same connections into the CBB",nameProps="zone-name",indexedProps="zone-id,design-type,zone-context",uniqueProps="zone-id",container="zones",namespace="network")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="zone-id" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="Code assigned by AIC to the zone")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="zone-name" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="English name associated with the zone")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="design-type" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Design of zone [Medium/Large…]")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="zone-context" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Context of zone [production/test]")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="status" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Status of a zone.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Concurrency value")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="zones"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Collection of zones")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element ref="tns:zone" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="network"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Namespace for network inventory resources.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element ref="tns:logical-links" minOccurs="0"/> - <xs:element ref="tns:site-pair-sets" minOccurs="0"/> - <xs:element ref="tns:vpn-bindings" minOccurs="0"/> - <xs:element ref="tns:vpls-pes" minOccurs="0"/> - <xs:element ref="tns:multicast-configurations" minOccurs="0"/> - <xs:element ref="tns:vces" minOccurs="0"/> - <xs:element ref="tns:vpes" minOccurs="0"/> - <xs:element ref="tns:vnfcs" minOccurs="0"/> - <xs:element ref="tns:l3-networks" minOccurs="0"/> - <xs:element ref="tns:network-policies" minOccurs="0"/> - <xs:element ref="tns:generic-vnfs" minOccurs="0"/> - <xs:element ref="tns:lag-links" minOccurs="0"/> - <xs:element ref="tns:newvces" minOccurs="0"/> - <xs:element ref="tns:pnfs" minOccurs="0"/> - <xs:element ref="tns:physical-links" minOccurs="0"/> - <xs:element ref="tns:ipsec-configurations" minOccurs="0"/> - <xs:element ref="tns:route-table-references" minOccurs="0"/> - <xs:element ref="tns:instance-groups" minOccurs="0"/> - <xs:element ref="tns:zones" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="reserved-prop-names"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Internal map to define some reserved properties of a vertex",uniqueProps="aai-unique-key",indexedProps="aai-unique-key,source-of-truth,aai-node-type,aai-uri")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="last-mod-source-of-truth" type="xs:string" minOccurs="0"/> - <xs:element name="aai-node-type" type="xs:string" minOccurs="0"/> - <xs:element name="aai-created-ts" type="xs:unsignedInt" minOccurs="0"/> - <xs:element name="aai-unique-key" type="xs:string" minOccurs="0"/> - <xs:element name="aai-last-mod-ts" type="xs:unsignedInt" minOccurs="0"/> - <xs:element name="source-of-truth" type="xs:string" minOccurs="0"/> - <xs:element name="aai-uri" type="xs:string" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="edge-prop-names"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Internal map to define the properties of an edge and interpret the map EdgeRules",edgeInfo="edgeLabel,direction,multiplicityRule,isParent,usesResource,hasDelTarget,SVC-INFRA,SVC-INFRA-REV")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="edgeLabel" type="xs:string" minOccurs="0"/> - <xs:element name="direction" type="xs:string" minOccurs="0"/> - <xs:element name="multiplicityRule" type="xs:string" minOccurs="0"/> - <xs:element name="isParent" type="xs:boolean" minOccurs="0"/> - <xs:element name="usesResource" type="xs:boolean" minOccurs="0"/> - <xs:element name="hasDelTarget" type="xs:boolean" minOccurs="0"/> - <xs:element name="SVC-INFRA" type="xs:boolean" minOccurs="0"/> - <xs:element name="SVC-INFRA-REV" type="xs:boolean" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="aai-internal"> - <xs:complexType> - <xs:sequence> - <xs:element ref="tns:reserved-prop-names" minOccurs="0" maxOccurs="unbounded"/> - <xs:element ref="tns:edge-prop-names" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="inventory"> - <xs:complexType> - <xs:sequence> - <xs:element ref="tns:search" minOccurs="0"/> - <xs:element ref="tns:actions" minOccurs="0"/> - <xs:element ref="tns:cloud-infrastructure" minOccurs="0"/> - <xs:element ref="tns:license-management" minOccurs="0"/> - <xs:element ref="tns:business" minOccurs="0"/> - <xs:element ref="tns:service-design-and-creation" minOccurs="0"/> - <xs:element ref="tns:network" minOccurs="0"/> - <xs:element ref="tns:aai-internal" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="notification-event-header"> - <xs:complexType> - <xs:sequence> - <xs:element name="id" type="xs:string" minOccurs="0"/> - <xs:element name="timestamp" type="xs:string" minOccurs="0"/> - <xs:element name="source-name" type="xs:string" minOccurs="0"/> - <xs:element name="domain" type="xs:string" minOccurs="0"/> - <xs:element name="sequence-number" type="xs:string" minOccurs="0"/> - <xs:element name="severity" type="xs:string" minOccurs="0"/> - <xs:element name="event-type" type="xs:string" minOccurs="0"/> - <xs:element name="version" type="xs:string" minOccurs="0"/> - <xs:element name="action" type="xs:string" minOccurs="0"/> - <xs:element name="entity-type" type="xs:string" minOccurs="0"/> - <xs:element name="top-entity-type" type="xs:string" minOccurs="0"/> - <xs:element name="entity-link" type="xs:string" minOccurs="0"/> - <xs:element name="status" type="xs:string" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="notification-event"> - <xs:complexType> - <xs:sequence> - <xs:element name="cambria.partition" type="xs:string" minOccurs="0"/> - <xs:element ref="tns:notification-event-header" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="overloaded-model"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Allows for legacy POST of old-style and new-style models")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="model-invariant-id" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="Unique identifier corresponding to the main definition of a model in ASDC")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="model-name-version-id" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="Unique identifier corresponding to one version of a model in ASDC")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="model-type" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Type of the model, e.g., service, resource, widget, etc.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="model-name" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Name of the model, which can change from version to version.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="model-id" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Invariant unique ID which does not change from version to version")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="model-version" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Version")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="model-description" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Description")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element name="resource-version" type="xs:string" minOccurs="0"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - <xs:element ref="tns:model-vers" minOccurs="0"/> - <xs:element ref="tns:relationship-list" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="query-parameters"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="QueryParameters for performing a named-query or model query")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element ref="tns:named-query" minOccurs="0"/> - <xs:element ref="tns:overloaded-model" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="instance-filter"> - <xs:complexType> - <xs:sequence/> - </xs:complexType> - </xs:element> - <xs:element name="instance-filters"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="InstanceFilters for performing a named-query or model query")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element ref="tns:instance-filter" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="secondary-filt"> - <xs:complexType> - <xs:sequence/> - </xs:complexType> - </xs:element> - <xs:element name="secondary-filts"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="SecondaryFilts for performing a named-query or model query")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element ref="tns:secondary-filt" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="model-and-named-query-search"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="ModelAndNamedQuerySearch holds query-parameters and instance-properties for performing a named-query or model query")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element ref="tns:query-parameters" minOccurs="0"/> - <xs:element ref="tns:instance-filters" minOccurs="0"/> - <xs:element ref="tns:secondary-filts" minOccurs="0"/> - <xs:element name="top-node-type" type="xs:string" minOccurs="0"/> - <xs:element name="secondary-filter-cut-point" type="xs:string" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="properties"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Property holder for query properties or instance properties")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="property-name" type="xs:string" minOccurs="0"/> - <xs:element name="property-value" type="xs:string" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="extra-property"> - <xs:complexType> - <xs:sequence> - <xs:element name="property-name" type="xs:string" minOccurs="0"/> - <xs:element name="property-value" type="xs:string" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="extra-properties"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Extra properties for inventory item for response list")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element ref="tns:extra-property" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="inventory-response-item"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Inventory item for response list",container="inventory-response-items")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="model-name" type="xs:string" minOccurs="0"/> - <xs:element ref="tns:extra-properties" minOccurs="0"/> - <xs:element ref="tns:inventory-response-items" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="inventory-response-items"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Container for inventory items in response list",container="response-list")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element ref="tns:inventory-response-item" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="response-list"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Response container for the results of a named-query or model query")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element ref="tns:inventory-response-items" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="vnf"> - <xs:complexType> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Abstract vnf class",indexedProps="vnf-id",uniqueProps="vnf-id",inheritors="vce,vpe,generic-vnf",isAbstract="true")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- <xs:sequence> - <xs:element name="vnf-id" type="xs:string"> - <xs:annotation>
- <xs:appinfo>
- <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="Unique id of VNF. This is unique across the graph.")</annox:annotate>
- </xs:appinfo>
- </xs:annotation>
- </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> -</xs:schema> diff --git a/bpmn/MSOCommonBPMN/src/main/resources/xsd/test.xsd b/bpmn/MSOCommonBPMN/src/main/resources/xsd/test.xsd deleted file mode 100644 index 456ae1e9a7..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/resources/xsd/test.xsd +++ /dev/null @@ -1,68 +0,0 @@ -<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://org.openecomp/mso/workflow/schema/v1" xmlns:xs="http://www.w3.org/2001/XMLSchema" > - <xs:element name="request-id" type="xs:string"/> - <xs:element name="source" type="xs:string"/> - <xs:element name="notification-url" type="xs:string"/> - <xs:element name="order-number" type="xs:string"/> - <xs:element name="order-version" type="xs:string"/> - <xs:element name="request-action" type="xs:string"/> - <xs:element name="model-invariant-uuid" type="xs:string"/> - <xs:element name="model-uuid" type="xs:string"/> - <xs:element name="model-version" type="xs:string"/> - <xs:element name="model-name" type="xs:string"/> - <xs:element name="service-id" type="xs:string"/> - <xs:element name="subscription-service-type" type="xs:string"/> - <xs:element name="ecomp-model-information"> - <xs:complexType> - <xs:sequence> - <xs:element ref="v1:model-invariant-uuid" xmlns:v1="http://org.openecomp/mso/workflow/schema/v1"/> - <xs:element ref="v1:model-uuid" xmlns:v1="http://org.openecomp/mso/workflow/schema/v1"/> - <xs:element ref="v1:model-version" xmlns:v1="http://org.openecomp/mso/workflow/schema/v1"/> - <xs:element ref="v1:model-name" xmlns:v1="http://org.openecomp/mso/workflow/schema/v1"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="service-instance-id" type="xs:string"/> - <xs:element name="subscriber-name" type="xs:string"/> - <xs:element name="global-customer-id" type="xs:string"/> - <xs:element name="service-instance-name" type="xs:string"/> - <xs:element name="request-information"> - <xs:complexType> - <xs:sequence> - <xs:element ref="v1:request-id" xmlns:v1="http://org.openecomp/mso/workflow/schema/v1"/> - <xs:element ref="v1:source" xmlns:v1="http://org.openecomp/mso/workflow/schema/v1"/> - <xs:element ref="v1:notification-url" xmlns:v1="http://org.openecomp/mso/workflow/schema/v1"/> - <xs:element ref="v1:order-number" xmlns:v1="http://org.openecomp/mso/workflow/schema/v1"/> - <xs:element ref="v1:order-version" xmlns:v1="http://org.openecomp/mso/workflow/schema/v1"/> - <xs:element ref="v1:request-action" xmlns:v1="http://org.openecomp/mso/workflow/schema/v1"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="service-information"> - <xs:complexType> - <xs:sequence> - <xs:element ref="v1:service-id" xmlns:v1="http://org.openecomp/mso/workflow/schema/v1"/> - <xs:element ref="v1:subscription-service-type" xmlns:v1="http://org.openecomp/mso/workflow/schema/v1"/> - <xs:element ref="v1:ecomp-model-information" xmlns:v1="http://org.openecomp/mso/workflow/schema/v1"/> - <xs:element ref="v1:service-instance-id" xmlns:v1="http://org.openecomp/mso/workflow/schema/v1"/> - <xs:element ref="v1:subscriber-name" xmlns:v1="http://org.openecomp/mso/workflow/schema/v1"/> - <xs:element ref="v1:global-customer-id" xmlns:v1="http://org.openecomp/mso/workflow/schema/v1"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="service-request-input"> - <xs:complexType> - <xs:sequence> - <xs:element ref="v1:service-instance-name" xmlns:v1="http://org.openecomp/mso/workflow/schema/v1"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="SDNCServiceInstanceRequestData"> - <xs:complexType> - <xs:sequence> - <xs:element ref="v1:request-information" xmlns:v1="http://org.openecomp/mso/workflow/schema/v1"/> - <xs:element ref="v1:service-information" xmlns:v1="http://org.openecomp/mso/workflow/schema/v1"/> - <xs:element ref="v1:service-request-input" xmlns:v1="http://org.openecomp/mso/workflow/schema/v1"/> - </xs:sequence> - </xs:complexType> - </xs:element> -</xs:schema>
\ No newline at end of file |