Merge "remove unused methods"
authorRob Daugherty <rd472p@att.com>
Mon, 10 Dec 2018 14:39:24 +0000 (14:39 +0000)
committerGerrit Code Review <gerrit@onap.org>
Mon, 10 Dec 2018 14:39:24 +0000 (14:39 +0000)
1  2 
bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModule.groovy

@@@ -174,12 -174,14 +174,12 @@@ public class UpdateAAIVfModule extends 
                                personaModelVersionEntry = updateVfModuleNode(origRequest,  'persona-model-version')
                        }
                        String contrailServiceInstanceFqdnEntry = updateVfModuleNode(origRequest,  'contrail-service-instance-fqdn')
 -                      def payload = """
 -                                      {       ${orchestrationStatusEntry}
 -                                              ${heatStackIdEntry}
 -                                              ${personaModelVersionEntry}
 -                                              ${contrailServiceInstanceFqdnEntry}
 -                                              "vf-module-id": "${vfModuleId}"                                         
 -                                      }
 -                      """
 +                      org.onap.aai.domain.yang.VfModule payload = new org.onap.aai.domain.yang.VfModule();
 +                      payload.setVfModuleId(vfModuleId)
 +                      payload.setOrchestrationStatus(orchestrationStatusEntry)
 +                      payload.setHeatStackId(heatStackIdEntry)
 +                      payload.setPersonaModelVersion(personaModelVersionEntry)
 +                      payload.setContrailServiceInstanceFqdn(contrailServiceInstanceFqdnEntry)
  
              try {
                  AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId)
        private String updateVfModuleNode(String origRequest, String elementName) {
  
                if (!utils.nodeExists(origRequest, elementName)) {
 -                      return "" 
 +                      return null
                }
                def elementValue = utils.getNodeText(origRequest, elementName)
  
                if (elementValue.equals('DELETE')) {
 -                      // Set the element being deleted to null
 -                      return """"${elementName}": null,"""
 +                      // Set the element being deleted to empty string
 +                      return ""
                }
                else {
 -                      return """"${elementName}": "${elementValue}","""
 +                      return 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.
         *