Omit service-type and service-role if empty 11/19611/1
authorRob Daugherty <rd472p@att.com>
Wed, 18 Oct 2017 21:08:46 +0000 (17:08 -0400)
committerRob Daugherty <rd472p@att.com>
Wed, 18 Oct 2017 21:08:46 +0000 (17:08 -0400)
The CreateGenericALaCarteServiceInstance flow does not use the
decomposition building block, and hence there is no service-type
or service-role for the service instance.  SO should not put
empty values into AAI; it should omit the elements completely.

Issue: SO-237
Change-Id: Ic9504cd5d5c3a4e4cbe67ef5de0c56f51f3c6938
Signed-off-by: Rob Daugherty <rd472p@att.com>
bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy

index 0eb16a2..18925d3 100644 (file)
@@ -257,6 +257,8 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
                        }
 
                        String statusLine = isBlank(oStatus) ? "" : "<orchestration-status>${oStatus}</orchestration-status>"
+                       String serviceTypeLine = isBlank(serviceType) ? "" : "<service-type>${serviceType}</service-type>"
+                       String serviceRoleLine = isBlank(serviceRole) ? "" : "<service-role>${serviceRole}</service-role>"
                                
                        AaiUtil aaiUriUtil = new AaiUtil(this)
                        String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution)
@@ -264,8 +266,8 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
                        String serviceInstanceData =
                                        """<service-instance xmlns=\"${namespace}\">
                                        <service-instance-name>${serviceInstanceName}</service-instance-name>
-                                       <service-type>${serviceType}</service-type>
-                                       <service-role>${serviceRole}</service-role>
+                                       ${serviceTypeLine}
+                                       ${serviceRoleLine}
                                        ${statusLine}
                                    <model-invariant-id>${modelInvariantUuid}</model-invariant-id>
                                    <model-version-id>${modelUuid}</model-version-id>