Add nssiId for AllocateTNNSSI request
[so.git] / bpmn / so-bpmn-infrastructure-common / src / main / groovy / org / onap / so / bpmn / infrastructure / scripts / VnfConfigUpdate.groovy
index 6075f0d..ee173ca 100644 (file)
 
 package org.onap.so.bpmn.infrastructure.scripts
 
-import groovy.json.JsonOutput
-import groovy.json.JsonSlurper
 import org.camunda.bpm.engine.delegate.BpmnError
 import org.camunda.bpm.engine.delegate.DelegateExecution
 import org.onap.appc.client.lcm.model.Action
+import org.onap.logging.filter.base.ErrorCode
 import org.onap.so.bpmn.common.scripts.ExceptionUtil
 import org.onap.so.bpmn.common.scripts.MsoUtils
 import org.onap.so.bpmn.core.json.JsonUtils
-import org.onap.so.client.aai.*
-import org.onap.so.client.aai.entities.AAIResultWrapper
-import org.onap.so.client.aai.entities.uri.AAIUri
-import org.onap.so.client.aai.entities.uri.AAIUriFactory
+import org.onap.aaiclient.client.aai.*
+import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
+import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
+import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types
 import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
 import org.slf4j.Logger
 import org.slf4j.LoggerFactory
+import groovy.json.JsonOutput
+import groovy.json.JsonSlurper
 
 public class VnfConfigUpdate extends VnfCmBase {
     private static final Logger logger = LoggerFactory.getLogger( VnfConfigUpdate.class)
@@ -158,8 +160,8 @@ public class VnfConfigUpdate extends VnfCmBase {
                }
                catch(Exception e) {
                        String restFaultMessage = e.getMessage()
-            logger.error("{} {} {} Exception Encountered - \n {} \n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
-                    MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), restFaultMessage, e)
+            logger.error("{} {} Exception Encountered - \n {} \n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+                    ErrorCode.UnknownError.getValue(), restFaultMessage, e)
                        exceptionUtil.buildAndThrowWorkflowException(execution, 5000, restFaultMessage)
                }
        }
@@ -200,8 +202,8 @@ public class VnfConfigUpdate extends VnfCmBase {
                } catch (BpmnError e) {
                        throw e;
                } catch (Exception e) {
-            logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
-                    MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+            logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+                    ErrorCode.UnknownError.getValue(), method, e)
                        exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage())
                }
        }
@@ -241,8 +243,8 @@ public class VnfConfigUpdate extends VnfCmBase {
                } catch (BpmnError e) {
                        throw e;
                } catch (Exception e) {
-            logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
-                    MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+            logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+                    ErrorCode.UnknownError.getValue(), method, e)
                        execution.setVariable("errorCode", "1002")
                        execution.setVariable("errorText", e.getMessage())
                        //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfVnfInMaintInAAI(): ' + e.getMessage())
@@ -284,8 +286,8 @@ public class VnfConfigUpdate extends VnfCmBase {
                } catch (BpmnError e) {
                        throw e;
                } catch (Exception e) {
-            logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
-                    MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+            logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+                    ErrorCode.UnknownError.getValue(), method, e)
                        execution.setVariable("errorCode", "1002")
                        execution.setVariable("errorText", e.getMessage())
                        //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfPserversInMaintInAAI(): ' + e.getMessage())
@@ -332,8 +334,8 @@ public class VnfConfigUpdate extends VnfCmBase {
                } catch (BpmnError e) {
                        throw e;
                } catch (Exception e) {
-            logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
-                    MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+            logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+                    ErrorCode.UnknownError.getValue(), method, e)
                        execution.setVariable("errorCode", "1002")
                        execution.setVariable("errorText", e.getMessage())
                }
@@ -360,7 +362,7 @@ public class VnfConfigUpdate extends VnfCmBase {
                        def vnfId = execution.getVariable("vnfId")
             logger.debug("vnfId is: {}", vnfId)
                        AAIResourcesClient client = new AAIResourcesClient()
-                       AAIUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
+                       AAIResourceUri genericVnfUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId))
                        AAIResultWrapper aaiRW = client.get(genericVnfUri)
                        Map<String, Object> result = aaiRW.asMap()
                        boolean isClosedLoopDisabled = result.getOrDefault("is-closed-loop-disabled", false)
@@ -377,8 +379,8 @@ public class VnfConfigUpdate extends VnfCmBase {
                } catch (BpmnError e) {
                        throw e;
                } catch (Exception e) {
-            logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
-                    MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+            logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+                    ErrorCode.UnknownError.getValue(), method, e)
                        execution.setVariable("errorCode", "1002")
                        execution.setVariable("errorText", e.getMessage())
                        //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfVnfInMaintInAAI(): ' + e.getMessage())
@@ -412,7 +414,7 @@ public class VnfConfigUpdate extends VnfCmBase {
                        def transactionLoggingUuid = UUID.randomUUID().toString()
                        def vnfId = execution.getVariable("vnfId")
                        AAIResourcesClient client = new AAIResourcesClient()
-                       AAIUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
+                       AAIResourceUri genericVnfUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId))
 
                        Map<String, Boolean> request = new HashMap<>()
                        request.put("is-closed-loop-disabled", setDisabled)
@@ -423,8 +425,8 @@ public class VnfConfigUpdate extends VnfCmBase {
                } catch (BpmnError e) {
                        throw e;
                } catch (Exception e) {
-            logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
-                    MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+            logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+                    ErrorCode.UnknownError.getValue(), method, e)
                        execution.setVariable("errorCode", "1002")
                        execution.setVariable("errorText", e.getMessage())
                        //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfVnfInMaintInAAI(): ' + e.getMessage())