aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/MSOCommonBPMN
diff options
context:
space:
mode:
authorGamboa, Gilbert <gilbert.g.gamboa@att.com>2019-06-06 14:23:36 -0400
committerBenjamin, Max (mb388a) <mb388a@us.att.com>2019-06-06 15:38:14 -0400
commit62b2e47808fe1adcbac31dbcdf992617b7f0bd4d (patch)
tree6fbdcf652784be141c869259f2c2919d2a7ce378 /bpmn/MSOCommonBPMN
parentc4b90365d5c117bc6fd64af421a1468539a8aec3 (diff)
Accommodate WAN Networking
checked and evaluated naming policy only if infra bonding. Updated workflowAction to include vrf configuration for vpn-binding in resourceIds list. added in linked resource to service proxy cust committing the asdc controller classpath change added some unit tests for vrf validation and updated bbinput setup test update config resource cust foreign key mapping Moved mockbean for AssignVrfConfiguration task class into BaseBpmnTest. added in a check to see if list is empty before access added unit tests for bbinput setup for vrf config Update AssignFlows enum with correct AssignVrfConfiguration flow name Change-Id: Ibf14e36505638b19c1366ecebfce560c02e69e44 Issue-ID: SO-1975 Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'bpmn/MSOCommonBPMN')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Configuration.java11
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceInstance.java4
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/wrappers/ServiceInstanceWrapper.java32
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/wrappers/exceptions/ServiceProxyNotFoundException.java14
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/SolutionCandidates.java6
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoServiceInstance.java21
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoServiceProxy.java20
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/AssignFlows.java3
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java73
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java36
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java41
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java1
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/bbobjects/wrappers/ServiceInstanceWrapperTest.java47
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java123
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_serviceMacro.json4
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_serviceMacroVrf.json48
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroNetworks.json2
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroNoCloudConfig.json2
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroVfModules.json2
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroVnfs.json2
20 files changed, 469 insertions, 23 deletions
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
index dff5a57040..36262ec800 100644
--- 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
@@ -78,6 +78,9 @@ public class Configuration implements Serializable, ShallowCopy<Configuration> {
@JsonProperty("l-interface")
private LInterface lInterface;
+ @JsonProperty("vpn-binding")
+ private VpnBinding vpnBinding;
+
public ModelInfoConfiguration getModelInfoConfiguration() {
return modelInfoConfiguration;
}
@@ -222,6 +225,14 @@ public class Configuration implements Serializable, ShallowCopy<Configuration> {
this.lInterface = lInterface;
}
+ public VpnBinding getVpnBinding() {
+ return vpnBinding;
+ }
+
+ public void setVpnBinding(VpnBinding vpnBinding) {
+ this.vpnBinding = vpnBinding;
+ }
+
@Override
public boolean equals(final Object other) {
if (!(other instanceof Configuration)) {
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
index b9f5a6af8e..0803bed574 100644
--- 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
@@ -81,6 +81,10 @@ public class ServiceInstance implements Serializable, ShallowCopy<ServiceInstanc
@JsonProperty("service-proxies")
private List<ServiceProxy> serviceProxies = new ArrayList<ServiceProxy>();
+ public void setServiceProxies(List<ServiceProxy> serviceProxies) {
+ this.serviceProxies = serviceProxies;
+ }
+
public List<GenericVnf> getVnfs() {
return vnfs;
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/wrappers/ServiceInstanceWrapper.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/wrappers/ServiceInstanceWrapper.java
new file mode 100644
index 0000000000..40ffe7356c
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/wrappers/ServiceInstanceWrapper.java
@@ -0,0 +1,32 @@
+package org.onap.so.bpmn.servicedecomposition.bbobjects.wrappers;
+
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceProxy;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.wrappers.exceptions.ServiceProxyNotFoundException;
+
+public class ServiceInstanceWrapper {
+
+ private final ServiceInstance serviceInstance;
+ private static final String SERVICE_PROXY_TRANSPORT = "TRANSPORT";
+
+ public ServiceInstanceWrapper(ServiceInstance serviceInstance) {
+ this.serviceInstance = serviceInstance;
+ }
+
+ public ServiceProxy getTransportServiceProxy() throws ServiceProxyNotFoundException {
+ ServiceProxy serviceProxy = null;
+ for (ServiceProxy sp : serviceInstance.getServiceProxies()) {
+ if (SERVICE_PROXY_TRANSPORT.equalsIgnoreCase(sp.getType())) {
+ serviceProxy = sp;
+ break;
+ }
+ }
+ if (serviceProxy == null) {
+ throw new ServiceProxyNotFoundException("Transport Service Proxy not found for service instance: "
+ + serviceInstance.getServiceInstanceId());
+ }
+ return serviceProxy;
+ }
+
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/wrappers/exceptions/ServiceProxyNotFoundException.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/wrappers/exceptions/ServiceProxyNotFoundException.java
new file mode 100644
index 0000000000..924d9eda87
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/wrappers/exceptions/ServiceProxyNotFoundException.java
@@ -0,0 +1,14 @@
+package org.onap.so.bpmn.servicedecomposition.bbobjects.wrappers.exceptions;
+
+public class ServiceProxyNotFoundException extends Exception {
+
+ private static final long serialVersionUID = 717577158109655720L;
+
+ public ServiceProxyNotFoundException() {
+ super();
+ }
+
+ public ServiceProxyNotFoundException(String message) {
+ super(message);
+ }
+}
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
index 4c91ad38a0..068fa876ce 100644
--- 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
@@ -36,6 +36,8 @@ public class SolutionCandidates implements Serializable {
private List<Candidate> excludedCandidates = new ArrayList<Candidate>();
@JsonProperty("existingCandidates")
private List<Candidate> existingCandidates = new ArrayList<Candidate>();
+ @JsonProperty("filteringAttributes")
+ private List<Candidate> filteringAttributes = new ArrayList<Candidate>();
public List<Candidate> getRequiredCandidates() {
@@ -58,6 +60,8 @@ public class SolutionCandidates implements Serializable {
return existingCandidates;
}
-
+ public List<Candidate> getFilteringAttributes() {
+ return filteringAttributes;
+ }
}
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
index 05cad456d0..bc330eeafd 100644
--- 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
@@ -39,6 +39,10 @@ public class ModelInfoServiceInstance extends ModelInfoMetadata implements Seria
private String environmentContext;
@JsonProperty("workload-context")
private String workloadContext;
+ @JsonProperty("naming-policy")
+ private String namingPolicy;
+ @JsonProperty("onap-generated-naming")
+ private Boolean onapGeneratedNaming;
public String getDescription() {
@@ -88,4 +92,21 @@ public class ModelInfoServiceInstance extends ModelInfoMetadata implements Seria
public void setWorkloadContext(String workloadContext) {
this.workloadContext = workloadContext;
}
+
+
+ public String getNamingPolicy() {
+ return namingPolicy;
+ }
+
+ public void setNamingPolicy(String namingPolicy) {
+ this.namingPolicy = namingPolicy;
+ }
+
+ public Boolean getOnapGeneratedNaming() {
+ return onapGeneratedNaming;
+ }
+
+ public void setOnapGeneratedNaming(Boolean onapGeneratedNaming) {
+ this.onapGeneratedNaming = onapGeneratedNaming;
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoServiceProxy.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoServiceProxy.java
index b2494384f4..91ff3d623d 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoServiceProxy.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoServiceProxy.java
@@ -22,11 +22,31 @@ package org.onap.so.bpmn.servicedecomposition.modelinfo;
import java.io.Serializable;
+import com.fasterxml.jackson.annotation.JsonProperty;
public class ModelInfoServiceProxy extends ModelInfoMetadata implements Serializable {
private static final long serialVersionUID = -6256897576261215926L;
+ @JsonProperty("tosca-node-type")
+ private String toscaNodeType;
+ @JsonProperty("description")
+ private String description;
+ public String getToscaNodeType() {
+ return toscaNodeType;
+ }
+
+ public void setToscaNodeType(String toscaNodeType) {
+ this.toscaNodeType = toscaNodeType;
+ }
+
+ 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/tasks/AssignFlows.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/AssignFlows.java
index 2d6ce0fad7..f23f62d763 100644
--- 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
@@ -29,7 +29,8 @@ public enum AssignFlows {
NETWORK_MACRO("AssignNetworkBB"),
VOLUME_GROUP("AssignVolumeGroupBB"),
NETWORK_COLLECTION("CreateNetworkCollectionBB"),
- FABRIC_CONFIGURATION("AssignFabricConfigurationBB");
+ FABRIC_CONFIGURATION("AssignFabricConfigurationBB"),
+ VRF_CONFIGURATION("AssignVrfConfigurationBBV2");
private final String 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
index 2d066285a4..c7665acc68 100644
--- 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
@@ -47,11 +47,13 @@ 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.ServiceProxy;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Tenant;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Vnfc;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding;
import org.onap.so.bpmn.servicedecomposition.entities.ConfigurationResourceKeys;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
@@ -76,6 +78,7 @@ import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization;
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.ServiceProxyResourceCustomization;
import org.onap.so.db.catalog.beans.VfModuleCustomization;
import org.onap.so.db.catalog.beans.VnfResourceCustomization;
import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization;
@@ -342,7 +345,7 @@ public class BBInputSetup implements JavaDelegate {
ModelInfo configurationModelInfo = new ModelInfo();
configurationModelInfo.setModelCustomizationUuid(configurationKey);
populateConfiguration(configurationModelInfo, service, bbName, serviceInstance, lookupKeyMap,
- configurationId, instanceName, configurationResourceKeys);
+ configurationId, instanceName, configurationResourceKeys, requestDetails);
} else {
lookupKeyMap.put(ResourceKey.VF_MODULE_ID, resourceId);
this.populateVfModule(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId,
@@ -372,7 +375,7 @@ public class BBInputSetup implements JavaDelegate {
protected void populateConfiguration(ModelInfo modelInfo, Service service, String bbName,
ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap, String resourceId,
- String instanceName, ConfigurationResourceKeys configurationResourceKeys) {
+ String instanceName, ConfigurationResourceKeys configurationResourceKeys, RequestDetails requestDetails) {
Configuration configuration = null;
for (Configuration configurationTemp : serviceInstance.getConfigurations()) {
if (lookupKeyMap.get(ResourceKey.CONFIGURATION_ID) != null && configurationTemp.getConfigurationId()
@@ -385,14 +388,20 @@ public class BBInputSetup implements JavaDelegate {
}
}
}
- if (configuration == null && bbName.equalsIgnoreCase(AssignFlows.FABRIC_CONFIGURATION.toString())) {
+ if (configuration == null && (bbName.equalsIgnoreCase(AssignFlows.FABRIC_CONFIGURATION.toString())
+ || bbName.equalsIgnoreCase(AssignFlows.VRF_CONFIGURATION.toString()))) {
configuration = this.createConfiguration(lookupKeyMap, instanceName, resourceId);
serviceInstance.getConfigurations().add(configuration);
}
- if (configuration != null) {
+ if (configuration != null && bbName.contains("Fabric")) {
Vnfc vnfc = getVnfcToConfiguration(configurationResourceKeys.getVnfcName());
configuration.setVnfc(vnfc);
this.mapCatalogConfiguration(configuration, modelInfo, service, configurationResourceKeys);
+ } else if (configuration != null && bbName.contains("Vrf")) {
+ configuration.setModelInfoConfiguration(mapperLayer.mapCatalogConfigurationToConfiguration(
+ findConfigurationResourceCustomization(modelInfo, service), null));
+ configuration.setConfigurationType(configuration.getModelInfoConfiguration().getConfigurationType());
+ configuration.setConfigurationSubType(configuration.getModelInfoConfiguration().getConfigurationRole());
}
}
@@ -1115,15 +1124,67 @@ public class BBInputSetup implements JavaDelegate {
ModelInfo configurationModelInfo = new ModelInfo();
configurationModelInfo.setModelCustomizationUuid(key);
this.populateConfiguration(configurationModelInfo, service, bbName, serviceInstance, lookupKeyMap,
- configurationId, null, executeBB.getConfigurationResourceKeys());
+ configurationId, null, executeBB.getConfigurationResourceKeys(), executeBB.getRequestDetails());
}
if (executeBB.getWorkflowResourceIds() != null) {
this.populateNetworkCollectionAndInstanceGroupAssign(service, bbName, serviceInstance,
executeBB.getWorkflowResourceIds().getNetworkCollectionId(), key);
}
+ RelatedInstance relatedVpnBinding =
+ bbInputSetupUtils.getRelatedInstanceByType(executeBB.getRequestDetails(), ModelType.vpnBinding);
+ RelatedInstance relatedLocalNetwork =
+ bbInputSetupUtils.getRelatedInstanceByType(executeBB.getRequestDetails(), ModelType.network);
+ if (relatedVpnBinding != null && relatedLocalNetwork != null) {
+ org.onap.aai.domain.yang.VpnBinding aaiVpnBinding =
+ bbInputSetupUtils.getAAIVpnBinding(relatedVpnBinding.getInstanceId());
+ org.onap.aai.domain.yang.L3Network aaiLocalNetwork =
+ bbInputSetupUtils.getAAIL3Network(relatedLocalNetwork.getInstanceId());
+ VpnBinding vpnBinding = mapperLayer.mapAAIVpnBinding(aaiVpnBinding);
+ L3Network localNetwork = mapperLayer.mapAAIL3Network(aaiLocalNetwork);
+ Optional<org.onap.aai.domain.yang.VpnBinding> aaiAICVpnBindingOp =
+ bbInputSetupUtils.getAICVpnBindingFromNetwork(aaiLocalNetwork);
+ if (aaiAICVpnBindingOp.isPresent()) {
+ localNetwork.getVpnBindings().add(mapperLayer.mapAAIVpnBinding(aaiAICVpnBindingOp.get()));
+ }
+ ServiceProxy serviceProxy = getServiceProxy(service);
+ gBB.getServiceInstance().getServiceProxies().add(serviceProxy);
+ gBB.getCustomer().getVpnBindings().add(vpnBinding);
+ lookupKeyMap.put(ResourceKey.VPN_ID, vpnBinding.getVpnId());
+ gBB.getServiceInstance().getNetworks().add(localNetwork);
+ lookupKeyMap.put(ResourceKey.NETWORK_ID, localNetwork.getNetworkId());
+ }
return gBB;
}
+ protected ServiceProxy getServiceProxy(Service service) {
+ if (!service.getServiceProxyCustomizations().isEmpty()) {
+ ServiceProxyResourceCustomization serviceProxyCatalog = getServiceProxyResourceCustomization(service);
+ ServiceProxy serviceProxy = new ServiceProxy();
+ serviceProxy.setModelInfoServiceProxy(
+ mapperLayer.mapServiceProxyCustomizationToServiceProxy(serviceProxyCatalog));
+ Service sourceService = serviceProxyCatalog.getSourceService();
+ ServiceInstance sourceServiceShell = new ServiceInstance();
+ sourceServiceShell
+ .setModelInfoServiceInstance(mapperLayer.mapCatalogServiceIntoServiceInstance(sourceService));
+ serviceProxy.setServiceInstance(sourceServiceShell);
+ serviceProxy.setType(sourceService.getServiceType());
+ return serviceProxy;
+ } else {
+ return null;
+ }
+ }
+
+ protected ServiceProxyResourceCustomization getServiceProxyResourceCustomization(Service service) {
+ ServiceProxyResourceCustomization serviceProxyCatalog = null;
+ for (ServiceProxyResourceCustomization serviceProxyTemp : service.getServiceProxyCustomizations()) {
+ if (serviceProxyTemp.getSourceService() != null
+ && serviceProxyTemp.getSourceService().getServiceType().equalsIgnoreCase("TRANSPORT")) {
+ serviceProxyCatalog = serviceProxyTemp;
+ }
+ }
+ return serviceProxyCatalog;
+ }
+
protected L3Network getVirtualLinkL3Network(Map<ResourceKey, String> lookupKeyMap, String bbName, String key,
String networkId, CollectionNetworkResourceCustomization collectionNetworkResourceCust,
ServiceInstance serviceInstance) {
@@ -1348,7 +1409,7 @@ public class BBInputSetup implements JavaDelegate {
findConfigurationResourceCustomization(configurationModelInfo, service);
if (configurationCust != null) {
this.populateConfiguration(configurationModelInfo, service, bbName, serviceInstance, lookupKeyMap,
- configurationId, null, executeBB.getConfigurationResourceKeys());
+ configurationId, null, executeBB.getConfigurationResourceKeys(), executeBB.getRequestDetails());
} else {
logger.debug("Could not find a configuration customization with key: {}", key);
}
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
index 2fc84b5dde..63dd72566b 100644
--- 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
@@ -49,6 +49,7 @@ 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.RouteTarget;
import org.onap.so.bpmn.servicedecomposition.bbobjects.SegmentationAssignment;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription;
@@ -57,6 +58,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.Tenant;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Vnfc;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.generalobjects.License;
import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext;
@@ -68,6 +70,7 @@ 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.ModelInfoServiceProxy;
import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule;
import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization;
import org.onap.so.db.catalog.beans.CollectionResource;
@@ -80,6 +83,7 @@ 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.ServiceProxyResourceCustomization;
import org.onap.so.db.catalog.beans.VfModuleCustomization;
import org.onap.so.db.catalog.beans.VnfResourceCustomization;
import org.onap.so.serviceinstancebeans.CloudConfiguration;
@@ -517,13 +521,18 @@ public class BBInputSetupMapperLayer {
protected ModelInfoConfiguration mapCatalogConfigurationToConfiguration(
ConfigurationResourceCustomization configurationResourceCustomization,
CvnfcConfigurationCustomization cvnfcConfigurationCustomization) {
+
ModelInfoConfiguration modelInfoConfiguration = new ModelInfoConfiguration();
modelInfoConfiguration
.setModelVersionId(configurationResourceCustomization.getConfigurationResource().getModelUUID());
modelInfoConfiguration.setModelCustomizationId(configurationResourceCustomization.getModelCustomizationUUID());
modelInfoConfiguration.setModelInvariantId(
configurationResourceCustomization.getConfigurationResource().getModelInvariantUUID());
- modelInfoConfiguration.setPolicyName(cvnfcConfigurationCustomization.getPolicyName());
+ modelInfoConfiguration.setConfigurationRole(configurationResourceCustomization.getRole());
+ modelInfoConfiguration.setConfigurationType(configurationResourceCustomization.getType());
+ if (cvnfcConfigurationCustomization != null) {
+ modelInfoConfiguration.setPolicyName(cvnfcConfigurationCustomization.getPolicyName());
+ }
return modelInfoConfiguration;
}
@@ -549,4 +558,29 @@ public class BBInputSetupMapperLayer {
public Vnfc mapAAIVnfc(org.onap.aai.domain.yang.Vnfc vnfcAAI) {
return modelMapper.map(vnfcAAI, Vnfc.class);
}
+
+ public VpnBinding mapAAIVpnBinding(org.onap.aai.domain.yang.VpnBinding aaiVpnBinding) {
+ VpnBinding vpnBinding = modelMapper.map(aaiVpnBinding, VpnBinding.class);
+ mapAllRouteTargetsToAAIVpnBinding(aaiVpnBinding, vpnBinding);
+ return vpnBinding;
+ }
+
+ protected void mapAllRouteTargetsToAAIVpnBinding(org.onap.aai.domain.yang.VpnBinding aaiVpnBinding,
+ VpnBinding vpnBinding) {
+ if (aaiVpnBinding.getRouteTargets() != null) {
+ for (org.onap.aai.domain.yang.RouteTarget aaiRouteTarget : aaiVpnBinding.getRouteTargets()
+ .getRouteTarget()) {
+ vpnBinding.getRouteTargets().add(mapAAIRouteTarget(aaiRouteTarget));
+ }
+ }
+ }
+
+ public RouteTarget mapAAIRouteTarget(org.onap.aai.domain.yang.RouteTarget aaiRouteTarget) {
+ return modelMapper.map(aaiRouteTarget, RouteTarget.class);
+ }
+
+ protected ModelInfoServiceProxy mapServiceProxyCustomizationToServiceProxy(
+ ServiceProxyResourceCustomization serviceProxyCustomization) {
+ return modelMapper.map(serviceProxyCustomization, ModelInfoServiceProxy.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
index 5cf2bd7b39..8ac5f6e69b 100644
--- 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
@@ -39,6 +39,7 @@ 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.aai.domain.yang.VpnBinding;
import org.onap.so.bpmn.common.InjectionHelper;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.MultipleObjectsFoundException;
@@ -60,6 +61,9 @@ import org.onap.so.db.catalog.client.CatalogDbClient;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.client.RequestsDbClient;
import org.onap.so.serviceinstancebeans.CloudConfiguration;
+import org.onap.so.serviceinstancebeans.ModelType;
+import org.onap.so.serviceinstancebeans.RelatedInstance;
+import org.onap.so.serviceinstancebeans.RelatedInstanceList;
import org.onap.so.serviceinstancebeans.RequestDetails;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -85,6 +89,20 @@ public class BBInputSetupUtils {
@Autowired
protected InjectionHelper injectionHelper;
+ public RelatedInstance getRelatedInstanceByType(RequestDetails requestDetails, ModelType modelType) {
+ if (requestDetails.getRelatedInstanceList() != null) {
+ for (RelatedInstanceList relatedInstanceList : requestDetails.getRelatedInstanceList()) {
+ RelatedInstance relatedInstance = relatedInstanceList.getRelatedInstance();
+ if (relatedInstance != null && relatedInstance.getModelInfo() != null
+ && relatedInstance.getModelInfo().getModelType() != null
+ && relatedInstance.getModelInfo().getModelType().equals(modelType)) {
+ return relatedInstance;
+ }
+ }
+ }
+ return null;
+ }
+
public void updateInfraActiveRequestVnfId(InfraActiveRequests request, String vnfId) {
if (request != null) {
request.setVnfId(vnfId);
@@ -334,6 +352,17 @@ public class BBInputSetupUtils {
});
}
+ public VpnBinding getAAIVpnBinding(String vpnBindingId) {
+
+ return this.injectionHelper.getAaiClient()
+ .get(VpnBinding.class,
+ AAIUriFactory.createResourceUri(AAIObjectType.VPN_BINDING, vpnBindingId).depth(Depth.ONE))
+ .orElseGet(() -> {
+ logger.debug("No VpnBinding matched by id");
+ return null;
+ });
+ }
+
public VolumeGroup getAAIVolumeGroup(String cloudOwnerId, String cloudRegionId, String volumeGroupId) {
return this.injectionHelper.getAaiClient()
.get(VolumeGroup.class, AAIUriFactory
@@ -463,4 +492,16 @@ public class BBInputSetupUtils {
return Optional.of(volumeGroup);
}
}
+
+ public Optional<org.onap.aai.domain.yang.VpnBinding> getAICVpnBindingFromNetwork(
+ org.onap.aai.domain.yang.L3Network aaiLocalNetwork) {
+ AAIResultWrapper networkWrapper = new AAIResultWrapper(aaiLocalNetwork);
+ if (networkWrapper.getRelationships().isPresent()
+ && !networkWrapper.getRelationships().get().getRelatedUris(AAIObjectType.VPN_BINDING).isEmpty()) {
+ return getAAIResourceDepthOne(
+ networkWrapper.getRelationships().get().getRelatedUris(AAIObjectType.VPN_BINDING).get(0))
+ .asBean(org.onap.aai.domain.yang.VpnBinding.class);
+ }
+ return Optional.empty();
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java
index 3bb417741f..9e10058ec8 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java
@@ -247,6 +247,7 @@ public class BuildingBlockTestDataSetup {
modelInfoConfiguration.setModelCustomizationId("testModelCustomizationId" + configurationCounter);
configuration.setModelInfoConfiguration(modelInfoConfiguration);
+ configuration.setVpnBinding(buildVpnBinding());
return configuration;
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/bbobjects/wrappers/ServiceInstanceWrapperTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/bbobjects/wrappers/ServiceInstanceWrapperTest.java
new file mode 100644
index 0000000000..bcee62013f
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/bbobjects/wrappers/ServiceInstanceWrapperTest.java
@@ -0,0 +1,47 @@
+package org.onap.so.bpmn.servicedecomposition.bbobjects.wrappers;
+
+import static org.junit.Assert.assertEquals;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceProxy;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.wrappers.exceptions.ServiceProxyNotFoundException;
+
+public class ServiceInstanceWrapperTest {
+
+ @Rule
+ public ExpectedException expectedException = ExpectedException.none();
+
+ @Test
+ public void getTransportServiceProxyTest() throws ServiceProxyNotFoundException {
+ ServiceInstance si = buildServiceInstance();
+ si.getServiceProxies().add(buildServiceProxy());
+ ServiceInstanceWrapper sw = new ServiceInstanceWrapper(si);
+ ServiceProxy sp = sw.getTransportServiceProxy();
+ assertEquals("sp-001", sp.getId());
+ assertEquals("transport", sp.getType());
+ }
+
+ @Test
+ public void getTransportServiceProxyExceptionTest() throws ServiceProxyNotFoundException {
+ expectedException.expect(ServiceProxyNotFoundException.class);
+ ServiceInstanceWrapper sw = new ServiceInstanceWrapper(buildServiceInstance());
+ sw.getTransportServiceProxy();
+ }
+
+ private ServiceInstance buildServiceInstance() {
+ ServiceInstance si = new ServiceInstance();
+ si.setServiceInstanceId("si-001");
+ si.setServiceInstanceName("Test SI");
+ return si;
+ }
+
+ private ServiceProxy buildServiceProxy() {
+ ServiceProxy sp = new ServiceProxy();
+ sp.setId("sp-001");
+ sp.setType("transport");
+ return sp;
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
index ad1918e6da..787957dc38 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
@@ -65,6 +65,7 @@ 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.ServiceProxy;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Vnfc;
@@ -82,6 +83,7 @@ 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.ModelInfoServiceProxy;
import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule;
import org.onap.so.client.aai.AAICommonObjectMapperProvider;
import org.onap.so.client.aai.AAIObjectType;
@@ -94,14 +96,15 @@ import org.onap.so.db.catalog.beans.CollectionResourceCustomization;
import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization;
import org.onap.so.db.catalog.beans.ConfigurationResource;
import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization;
+import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization;
import org.onap.so.db.catalog.beans.InstanceGroupType;
import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization;
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.ServiceProxyResourceCustomization;
import org.onap.so.db.catalog.beans.VfModuleCustomization;
import org.onap.so.db.catalog.beans.VnfResourceCustomization;
-import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization;
import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.serviceinstancebeans.CloudConfiguration;
@@ -1231,19 +1234,19 @@ public class BBInputSetupTest {
configResourceKeys.setVnfcName(vnfcName);
Vnfc vnfc = new Vnfc();
vnfc.setVnfcName(vnfcName);
-
+ RequestDetails requestDetails = new RequestDetails();
doNothing().when(SPY_bbInputSetup).mapCatalogConfiguration(configuration, modelInfo, service,
configResourceKeys);
doReturn(vnfc).when(SPY_bbInputSetup).getVnfcToConfiguration(vnfcName);
SPY_bbInputSetup.populateConfiguration(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId,
- instanceName, configResourceKeys);
+ instanceName, configResourceKeys, requestDetails);
verify(SPY_bbInputSetup, times(1)).mapCatalogConfiguration(configuration, modelInfo, service,
configResourceKeys);
lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, null);
SPY_bbInputSetup.populateConfiguration(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId,
- instanceName, configResourceKeys);
+ instanceName, configResourceKeys, requestDetails);
verify(SPY_bbInputSetup, times(2)).mapCatalogConfiguration(configuration, modelInfo, service,
configResourceKeys);
@@ -1255,7 +1258,7 @@ public class BBInputSetupTest {
doNothing().when(SPY_bbInputSetup).mapCatalogConfiguration(configuration2, modelInfo, service,
configResourceKeys);
SPY_bbInputSetup.populateConfiguration(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId,
- instanceName, configResourceKeys);
+ instanceName, configResourceKeys, requestDetails);
verify(SPY_bbInputSetup, times(1)).mapCatalogConfiguration(configuration2, modelInfo, service,
configResourceKeys);
}
@@ -1307,6 +1310,7 @@ public class BBInputSetupTest {
configResourceKeys.setVnfcName(vnfcName);
Vnfc vnfc = new Vnfc();
vnfc.setVnfcName(vnfcName);
+ RequestDetails requestDetails = new RequestDetails();
CvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization =
new CvnfcConfigurationCustomization();
@@ -1319,7 +1323,7 @@ public class BBInputSetupTest {
doReturn(vnfc).when(SPY_bbInputSetup).getVnfcToConfiguration(vnfcName);
SPY_bbInputSetup.populateConfiguration(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId,
- instanceName, configResourceKeys);
+ instanceName, configResourceKeys, requestDetails);
verify(SPY_bbInputSetup, times(1)).mapCatalogConfiguration(configuration, modelInfo, service,
configResourceKeys);
}
@@ -1972,14 +1976,117 @@ public class BBInputSetupTest {
configurationCustList.add(configurationCust);
doNothing().when(SPY_bbInputSetup).populateConfiguration(isA(ModelInfo.class), isA(Service.class),
any(String.class), isA(ServiceInstance.class), any(), any(String.class), ArgumentMatchers.isNull(),
- isA(ConfigurationResourceKeys.class));
+ isA(ConfigurationResourceKeys.class), isA(RequestDetails.class));
executeBB.getBuildingBlock().setBpmnFlowName("AssignFabricConfigurationBB");
executeBB.getBuildingBlock().setKey("72d9d1cd-f46d-447a-abdb-451d6fb05fa9");
SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType);
verify(SPY_bbInputSetup, times(1)).populateConfiguration(isA(ModelInfo.class), isA(Service.class),
any(String.class), isA(ServiceInstance.class), any(), any(String.class), ArgumentMatchers.isNull(),
- isA(ConfigurationResourceKeys.class));
+ isA(ConfigurationResourceKeys.class), isA(RequestDetails.class));
+
+
+ }
+
+ @Test
+ public void testGBBMacroNoUserParamsVrfConfiguration() throws Exception {
+ GeneralBuildingBlock gBB = mapper.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockExpected.json"),
+ GeneralBuildingBlock.class);
+ ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"),
+ ExecuteBuildingBlock.class);
+ RequestDetails requestDetails = mapper
+ .readValue(new File(RESOURCE_PATH + "RequestDetailsInput_serviceMacroVrf.json"), RequestDetails.class);
+ InfraActiveRequests request = Mockito.mock(InfraActiveRequests.class);
+ Map<ResourceKey, String> lookupKeyMap = new HashMap<>();
+ lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, "serviceInstanceId");
+ lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, "configurationId");
+ String resourceId = "123";
+ String vnfType = "vnfType";
+ Service service = Mockito.mock(Service.class);
+ String requestAction = "createInstance";
+
+ ConfigurationResourceKeys configResourceKeys = new ConfigurationResourceKeys();
+ configResourceKeys.setCvnfcCustomizationUUID("cvnfcCustomizationUUID");
+ configResourceKeys.setVfModuleCustomizationUUID("vfModuleCustomizationUUID");
+ configResourceKeys.setVnfResourceCustomizationUUID("vnfResourceCustomizationUUID");
+ executeBB.setConfigurationResourceKeys(configResourceKeys);
+
+ executeBB.setRequestDetails(requestDetails);
+ doReturn(gBB).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap,
+ requestAction, lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID));
+ doReturn(service).when(SPY_bbInputSetupUtils)
+ .getCatalogServiceByModelUUID(gBB.getServiceInstance().getModelInfoServiceInstance().getModelUuid());
+
+ RelatedInstance relatedVpnBinding = new RelatedInstance();
+ relatedVpnBinding.setInstanceId("vpnBindingInstanceId");
+ RelatedInstance relatedLocalNetwork = new RelatedInstance();
+ relatedLocalNetwork.setInstanceId("localNetworkInstanceId");
+ org.onap.aai.domain.yang.VpnBinding aaiVpnBinding = new org.onap.aai.domain.yang.VpnBinding();
+ aaiVpnBinding.setVpnId("vpnBindingId");
+ org.onap.aai.domain.yang.L3Network aaiLocalNetwork = new org.onap.aai.domain.yang.L3Network();
+ aaiLocalNetwork.setNetworkId("localNetworkId");
+ Optional<org.onap.aai.domain.yang.VpnBinding> aaiAICVpnBindingOp =
+ Optional.of(new org.onap.aai.domain.yang.VpnBinding());
+ aaiAICVpnBindingOp.get().setVpnId("AICVpnBindingId");
+ ServiceProxy proxy = new ServiceProxy();
+ proxy.setType("transport");
+ proxy.setServiceInstance(new ServiceInstance());
+ proxy.getServiceInstance().setModelInfoServiceInstance(new ModelInfoServiceInstance());
+ proxy.getServiceInstance().getModelInfoServiceInstance().setModelUuid("sourceServiceModelUUID");
+ doReturn(relatedVpnBinding).when(SPY_bbInputSetupUtils).getRelatedInstanceByType(requestDetails,
+ ModelType.vpnBinding);
+ doReturn(relatedLocalNetwork).when(SPY_bbInputSetupUtils).getRelatedInstanceByType(requestDetails,
+ ModelType.network);
+ doReturn(aaiVpnBinding).when(SPY_bbInputSetupUtils).getAAIVpnBinding(relatedVpnBinding.getInstanceId());
+ doReturn(aaiLocalNetwork).when(SPY_bbInputSetupUtils).getAAIL3Network(relatedLocalNetwork.getInstanceId());
+ doReturn(aaiAICVpnBindingOp).when(SPY_bbInputSetupUtils).getAICVpnBindingFromNetwork(aaiLocalNetwork);
+ doReturn(proxy).when(SPY_bbInputSetup).getServiceProxy(service);
+
+ Configuration configuration = new Configuration();
+ configuration.setConfigurationId("configurationId");
+ gBB.getServiceInstance().getConfigurations().add(configuration);
+ List<ConfigurationResourceCustomization> configurationCustList = new ArrayList<>();
+ ConfigurationResourceCustomization configurationCust = new ConfigurationResourceCustomization();
+ configurationCust.setModelCustomizationUUID("72d9d1cd-f46d-447a-abdb-451d6fb05fa9");
+ configurationCustList.add(configurationCust);
+ doNothing().when(SPY_bbInputSetup).populateConfiguration(isA(ModelInfo.class), isA(Service.class),
+ any(String.class), isA(ServiceInstance.class), any(), any(String.class), ArgumentMatchers.isNull(),
+ isA(ConfigurationResourceKeys.class), isA(RequestDetails.class));
+
+ executeBB.getBuildingBlock().setBpmnFlowName("AssignVrfConfigurationBB");
+ executeBB.getBuildingBlock().setKey("72d9d1cd-f46d-447a-abdb-451d6fb05fa9");
+ gBB = SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType);
+ verify(SPY_bbInputSetup, times(1)).populateConfiguration(isA(ModelInfo.class), isA(Service.class),
+ any(String.class), isA(ServiceInstance.class), any(), any(String.class), ArgumentMatchers.isNull(),
+ isA(ConfigurationResourceKeys.class), isA(RequestDetails.class));
+ assertEquals(gBB.getCustomer().getVpnBindings().get(0).getVpnId(), "vpnBindingId");
+ assertEquals(gBB.getServiceInstance().getNetworks().get(0).getNetworkId(), "localNetworkId");
+ assertEquals(gBB.getServiceInstance().getNetworks().get(0).getVpnBindings().get(0).getVpnId(),
+ "AICVpnBindingId");
+ assertEquals(gBB.getServiceInstance().getServiceProxies().get(0).getType(), "transport");
+ }
+
+ @Test
+ public void testGetServiceProxy() {
+ ServiceProxy expected = new ServiceProxy();
+ expected.setType("TRANSPORT");
+ expected.setModelInfoServiceProxy(new ModelInfoServiceProxy());
+ expected.getModelInfoServiceProxy().setModelCustomizationUuid("modelCustomizationUUID");
+ expected.setServiceInstance(new ServiceInstance());
+ expected.getServiceInstance().setModelInfoServiceInstance(new ModelInfoServiceInstance());
+ expected.getServiceInstance().getModelInfoServiceInstance().setModelUuid("modelUUID");
+ expected.getServiceInstance().getModelInfoServiceInstance().setServiceType("TRANSPORT");
+ Service service = new Service();
+ ServiceProxyResourceCustomization serviceProxyCatalog = new ServiceProxyResourceCustomization();
+ serviceProxyCatalog.setModelCustomizationUUID("modelCustomizationUUID");
+ Service sourceService = new Service();
+ sourceService.setModelUUID("modelUUID");
+ sourceService.setServiceType("TRANSPORT");
+ serviceProxyCatalog.setSourceService(sourceService);
+ service.setServiceProxyCustomizations(new ArrayList<ServiceProxyResourceCustomization>());
+ service.getServiceProxyCustomizations().add(serviceProxyCatalog);
+ ServiceProxy actual = SPY_bbInputSetup.getServiceProxy(service);
+ assertThat(actual, sameBeanAs(expected));
}
@Test
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_serviceMacro.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_serviceMacro.json
index 1cc387aaa0..97a230a1db 100644
--- a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_serviceMacro.json
+++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_serviceMacro.json
@@ -3,7 +3,7 @@
"modelType": "service",
"modelInvariantId": "5d48acb5-097d-4982-aeb2-f4a3bd87d31b",
"modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
- "modelName": "MOW AVPN vMX BV vPE 1 Service",
+ "modelName": "Sample Service Model",
"modelVersion": "10.0"
},
"owningEntity": {
@@ -31,7 +31,7 @@
"service": {
"modelInfo": {
"modelType": "service",
- "modelName": "MOW AVPN vMX BV vPE 1 Service",
+ "modelName": "Sample Service Model",
"modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a"
},
"instanceName": "vPE_Service",
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_serviceMacroVrf.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_serviceMacroVrf.json
new file mode 100644
index 0000000000..32745e19f3
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_serviceMacroVrf.json
@@ -0,0 +1,48 @@
+{
+ "modelInfo": {
+ "modelType": "service",
+ "modelInvariantId": "5d48acb5-097d-4982-aeb2-f4a3bd87d31b",
+ "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
+ "modelName": "Sample Service Model",
+ "modelVersion": "10.0"
+ },
+ "owningEntity": {
+ "owningEntityId": "038d99af-0427-42c2-9d15-971b99b9b489",
+ "owningEntityName": "PACKET CORE"
+ },
+ "project": {
+ "projectName": "projectName"
+ },
+ "subscriberInfo": {
+ "globalSubscriberId": "subscriberId"
+ },
+ "requestInfo": {
+ "instanceName": "vPE_Service",
+ "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ "source": "VID",
+ "suppressRollback": true,
+ "requestorId": "xxxxxx"
+ },
+ "requestParameters": {
+ "subscriptionServiceType": "VMX",
+ "aLaCarte": false
+ },
+ "relatedInstanceList": [
+ {
+ "relatedInstance": {
+ "instanceId": "vpnBindingId",
+ "modelInfo": {
+ "modelType": "vpnBinding"
+ }
+ }
+ },
+ {
+ "relatedInstance": {
+ "instanceId": "localNetworkId",
+ "modelInfo": {
+ "modelType": "network"
+ }
+ }
+ }
+ ]
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroNetworks.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroNetworks.json
index f458d732d2..8d03005a9e 100644
--- a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroNetworks.json
+++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroNetworks.json
@@ -1,7 +1,7 @@
{
"modelInfo": {
"modelType": "service",
- "modelName": "MOW AVPN vMX BV vPE 1 Service",
+ "modelName": "Sample Service Model",
"modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a"
},
"instanceName": "vPE_Service",
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroNoCloudConfig.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroNoCloudConfig.json
index 0c3d8e709e..3201ec1bc0 100644
--- a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroNoCloudConfig.json
+++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroNoCloudConfig.json
@@ -1,7 +1,7 @@
{
"modelInfo": {
"modelType": "service",
- "modelName": "MOW AVPN vMX BV vPE 1 Service",
+ "modelName": "Sample Service Model",
"modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a"
},
"instanceName": "vPE_Service",
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroVfModules.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroVfModules.json
index de20a5a963..fd6f8fad6a 100644
--- a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroVfModules.json
+++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroVfModules.json
@@ -1,7 +1,7 @@
{
"modelInfo": {
"modelType": "service",
- "modelName": "MOW AVPN vMX BV vPE 1 Service",
+ "modelName": "Sample Service Model",
"modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a"
},
"instanceName": "vPE_Service",
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroVnfs.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroVnfs.json
index c4ad0ac047..80ea6b34ec 100644
--- a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroVnfs.json
+++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroVnfs.json
@@ -1,7 +1,7 @@
{
"modelInfo": {
"modelType": "service",
- "modelName": "MOW AVPN vMX BV vPE 1 Service",
+ "modelName": "Sample Service Model",
"modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a"
},
"instanceName": "vPE_Service",