summaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-tasks
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn/so-bpmn-tasks')
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java11
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java9
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIQueryTasks.java21
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnf/tasks/CnfAdapter.java24
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnf/tasks/CnfAdapterCreateTasks.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessor.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSControllerRunnableBB.java24
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/vfmodule/CreateVFModule.java26
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/VrfValidation.java6
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java30
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java33
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionExtractResourcesAAI.java12
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/CnfAdapterClient.java26
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/entities/InstanceRequest.java26
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAICollectionResources.java13
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java88
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIInstanceGroupResources.java36
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java112
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIPnfResources.java23
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java80
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java45
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java77
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.java49
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVpnBindingResources.java32
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSControllerRunnableBBTest.java77
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/service/level/impl/ServiceLevelUpgradeTest.java66
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/vfmodule/DeleteVfModuleTest.java125
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/VrfValidationTest.java6
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java19
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAICollectionResourcesTest.java21
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java16
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIInstanceGroupResourcesTest.java38
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java74
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIPnfResourcesTest.java28
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIServiceInstanceResourcesTest.java14
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVfModuleResourcesTest.java16
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java47
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVolumeGroupResourcesTest.java14
39 files changed, 879 insertions, 495 deletions
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java
index 806d4b5151..9ac3579957 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java
@@ -32,6 +32,10 @@ import java.util.UUID;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.camunda.bpm.engine.delegate.BpmnError;
+import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
+import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection;
@@ -52,9 +56,6 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
-import org.onap.aaiclient.client.aai.AAIObjectPlurals;
-import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
-import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.exception.BBObjectNotFoundException;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.client.orchestration.AAIConfigurationResources;
@@ -66,7 +67,6 @@ import org.onap.so.client.orchestration.AAIVfModuleResources;
import org.onap.so.client.orchestration.AAIVnfResources;
import org.onap.so.client.orchestration.AAIVolumeGroupResources;
import org.onap.so.client.orchestration.AAIVpnBindingResources;
-import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.LoggingAnchor;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
@@ -695,7 +695,8 @@ public class AAICreateTasks {
if (fqdnCount > 0) {
for (int i = 0; i < fqdnCount; i++) {
String fqdn = fqdnList[i];
- AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY);
+ AAIPluralResourceUri uri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicies());
uri.queryParam(NETWORK_POLICY_FQDN_PARAM, fqdn);
Optional<org.onap.aai.domain.yang.NetworkPolicy> oNetPolicy =
aaiNetworkResources.getNetworkPolicy(uri);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java
index 42fb719f89..d62fc6f50f 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java
@@ -27,6 +27,9 @@ import java.util.List;
import java.util.Optional;
import org.onap.aai.domain.yang.NetworkPolicies;
import org.onap.aai.domain.yang.NetworkPolicy;
+import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
+import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
@@ -38,9 +41,6 @@ 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.tasks.ExtractPojosForBB;
-import org.onap.aaiclient.client.aai.AAIObjectPlurals;
-import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
-import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.client.orchestration.AAIConfigurationResources;
import org.onap.so.client.orchestration.AAIInstanceGroupResources;
@@ -279,7 +279,8 @@ public class AAIDeleteTasks {
if (fqdnCount > 0) {
for (int i = 0; i < fqdnCount; i++) {
String fqdn = fqdnList[i];
- AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY);
+ AAIPluralResourceUri uri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicies());
uri.queryParam(networkPolicyFqdnParam, fqdn);
Optional<NetworkPolicies> oNetPolicies = aaiNetworkResources.getNetworkPolicies(uri);
if (oNetPolicies.isPresent()) {
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIQueryTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIQueryTasks.java
index 0912cba94a..9df9dd330c 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIQueryTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIQueryTasks.java
@@ -32,15 +32,15 @@ import org.onap.aai.domain.yang.RouteTableReference;
import org.onap.aai.domain.yang.RouteTargets;
import org.onap.aai.domain.yang.Subnet;
import org.onap.aai.domain.yang.VpnBinding;
+import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
+import org.onap.aaiclient.client.aai.entities.Relationships;
+import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
import org.onap.so.adapters.nwrest.CreateNetworkRequest;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
-import org.onap.aaiclient.client.aai.AAIObjectType;
-import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
-import org.onap.aaiclient.client.aai.entities.Relationships;
-import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.client.orchestration.AAINetworkResources;
import org.slf4j.Logger;
@@ -76,8 +76,7 @@ public class AAIQueryTasks {
if (!networkRelationships.isPresent()) {
throw (new Exception(ERROR_MSG));
}
- List<AAIResourceUri> netBindingsUriList =
- networkRelationships.get().getRelatedAAIUris(AAIObjectType.VPN_BINDING);
+ List<AAIResourceUri> netBindingsUriList = networkRelationships.get().getRelatedUris(Types.VPN_BINDING);
List<org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding> mappedVpnBindings = new ArrayList<>();
if (netBindingsUriList != null && !netBindingsUriList.isEmpty()) {
@@ -115,8 +114,7 @@ public class AAIQueryTasks {
if (!networkRelationships.isPresent()) {
throw (new Exception(ERROR_MSG));
}
- List<AAIResourceUri> netBindingsUriList =
- networkRelationships.get().getRelatedAAIUris(AAIObjectType.VPN_BINDING);
+ List<AAIResourceUri> netBindingsUriList = networkRelationships.get().getRelatedUris(Types.VPN_BINDING);
List<org.onap.so.openstack.beans.RouteTarget> routeTargets = new ArrayList<>();
for (AAIResourceUri netBindingUri : netBindingsUriList) {
logger.info("Get Route Targests");
@@ -168,8 +166,7 @@ public class AAIQueryTasks {
if (!networkRelationships.isPresent()) {
throw (new Exception(ERROR_MSG));
}
- List<AAIResourceUri> netPoliciesUriList =
- networkRelationships.get().getRelatedAAIUris(AAIObjectType.NETWORK_POLICY);
+ List<AAIResourceUri> netPoliciesUriList = networkRelationships.get().getRelatedUris(Types.NETWORK_POLICY);
if (!netPoliciesUriList.isEmpty()) {
for (AAIResourceUri netPolicyUri : netPoliciesUriList) {
@@ -201,7 +198,7 @@ public class AAIQueryTasks {
throw (new Exception(ERROR_MSG));
}
List<AAIResourceUri> routeTableUriList =
- networkRelationships.get().getRelatedAAIUris(AAIObjectType.ROUTE_TABLE_REFERENCE);
+ networkRelationships.get().getRelatedUris(Types.ROUTE_TABLE_REFERENCE);
if (!routeTableUriList.isEmpty()) {
for (AAIResourceUri routeTableUri : routeTableUriList) {
@@ -241,7 +238,7 @@ public class AAIQueryTasks {
if (!networkRelationships.isPresent()) {
throw (new Exception(ERROR_MSG));
}
- List<AAIResourceUri> subnetsUriList = networkRelationships.get().getRelatedAAIUris(AAIObjectType.SUBNET);
+ List<AAIResourceUri> subnetsUriList = networkRelationships.get().getRelatedUris(Types.SUBNET);
if (!subnetsUriList.isEmpty()) {
for (AAIResourceUri subnetUri : subnetsUriList) {
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnf/tasks/CnfAdapter.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnf/tasks/CnfAdapter.java
index c21b467a95..a556d3088c 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnf/tasks/CnfAdapter.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnf/tasks/CnfAdapter.java
@@ -1,19 +1,16 @@
package org.onap.so.bpmn.infrastructure.adapter.cnf.tasks;
-import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
import org.camunda.bpm.engine.delegate.DelegateExecution;
-import org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowAction;
import org.onap.so.client.adapter.cnf.CnfAdapterClient;
-import org.onap.so.client.adapter.cnf.CnfAdapterClientException;
import org.onap.so.client.adapter.cnf.entities.InstanceRequest;
import org.onap.so.client.adapter.cnf.entities.InstanceResponse;
+import org.onap.so.client.adapter.cnf.entities.Labels;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
-import com.fasterxml.jackson.core.JsonParseException;
-import com.fasterxml.jackson.databind.JsonMappingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
@Component
public class CnfAdapter {
@@ -25,8 +22,19 @@ public class CnfAdapter {
public void callCnfAdapter(DelegateExecution execution) throws Exception {
try {
- final String instanceRequest = (String) execution.getVariable("instanceRequest");
- InstanceRequest request = new ObjectMapper().readValue(instanceRequest, InstanceRequest.class);
+ InstanceRequest request = new InstanceRequest();
+ request.setRbName("test-rbdef");
+ request.setRbVersion("v1");
+ request.setCloudRegion("krd");
+ request.setVfModuleUUID("VF module UUID");
+ request.setProfileName("p1");
+ Map<String, String> overrideValues = new HashMap<>();
+ overrideValues.put("image.tag", "latest");
+ overrideValues.put("dcae_collector_ip", "1.2.3.4");
+ Map<String, String> labels = new HashMap<String, String>();
+ labels.put("custom-label-1", "abcdef");
+ request.setLabels(labels);
+ request.setOverrideValues(overrideValues);
InstanceResponse response = cnfAdapterClient.createVfModule(request);
} catch (Exception ex) {
logger.error("Exception in callCnfAdapter", ex);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnf/tasks/CnfAdapterCreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnf/tasks/CnfAdapterCreateTasks.java
index 93d30512b6..7624bcb811 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnf/tasks/CnfAdapterCreateTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnf/tasks/CnfAdapterCreateTasks.java
@@ -112,7 +112,7 @@ public class CnfAdapterCreateTasks {
request.setRbName(vfModule.getModelInfoVfModule().getModelInvariantUUID());
request.setRbVersion(vfModule.getModelInfoVfModule().getModelUUID());
request.setCloudRegion(cloudRegion.getLcpCloudRegionId());
- request.setReleaseName(vfModule.getVfModuleId());
+ request.setVfModuleUUID(vfModule.getVfModuleId());
request.setProfileName(sdncDirectives.get("k8s-rb-profile-name"));
request.setOverrideValues(sdncDirectives);
return request;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessor.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessor.java
index 1f05522011..2644ae1b58 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessor.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessor.java
@@ -6,11 +6,11 @@ import java.util.List;
import java.util.Map;
import java.util.Optional;
import org.onap.aai.domain.yang.Vserver;
-import org.onap.aaiclient.client.aai.AAIObjectType;
import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
import org.onap.aaiclient.client.aai.entities.Relationships;
import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
import org.onap.appc.client.lcm.model.Action;
import org.onap.so.appc.orchestrator.service.beans.ApplicationControllerTaskRequest;
import org.onap.so.appc.orchestrator.service.beans.ApplicationControllerVm;
@@ -186,7 +186,7 @@ public class AppcOrchestratorPreProcessor {
if (aaiRW != null && aaiRW.getRelationships().isPresent()) {
Relationships relationships = aaiRW.getRelationships().get();
if (relationships != null) {
- List<AAIResourceUri> vserverUris = relationships.getRelatedAAIUris(AAIObjectType.VSERVER);
+ List<AAIResourceUri> vserverUris = relationships.getRelatedUris(Types.VSERVER);
ArrayList<String> vserverIds = new ArrayList<String>();
ArrayList<String> vserverSelfLinks = new ArrayList<String>();
for (AAIResourceUri j : vserverUris) {
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java
index 70edc375c4..de2976fb80 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java
@@ -30,11 +30,11 @@ import java.util.Map;
import java.util.Optional;
import org.json.JSONArray;
import org.json.JSONObject;
-import org.onap.aaiclient.client.aai.AAIObjectType;
import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
import org.onap.aaiclient.client.aai.entities.Relationships;
import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
import org.onap.appc.client.lcm.model.Action;
import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.bpmn.common.BuildingBlockExecution;
@@ -251,7 +251,7 @@ public class AppcRunTasks {
return;
}
Relationships relationships = aaiRW.getRelationships().get();
- List<AAIResourceUri> vserverUris = relationships.getRelatedAAIUris(AAIObjectType.VSERVER);
+ List<AAIResourceUri> vserverUris = relationships.getRelatedUris(Types.VSERVER);
JSONArray vserverIds = new JSONArray();
JSONArray vserverSelfLinks = new JSONArray();
if (vserverUris != null) {
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSControllerRunnableBB.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSControllerRunnableBB.java
index a1e513fd47..3b81d52703 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSControllerRunnableBB.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSControllerRunnableBB.java
@@ -22,17 +22,22 @@ import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerRunnable;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
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.tasks.ExtractPojosForBB;
import org.onap.so.client.cds.AbstractCDSProcessingBBUtils;
+import org.onap.so.client.cds.ConfigureInstanceParamsForPnf;
import org.onap.so.client.cds.beans.AbstractCDSPropertiesBean;
import org.onap.so.client.cds.PayloadConstants;
import org.onap.so.client.exception.BBObjectNotFoundException;
import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.client.exception.PayloadGenerationException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
+import java.util.List;
+import java.util.Map;
import java.util.UUID;
import static org.onap.so.client.cds.PayloadConstants.PRC_BLUEPRINT_NAME;
import static org.onap.so.client.cds.PayloadConstants.PRC_BLUEPRINT_VERSION;
@@ -54,13 +59,16 @@ public class GenericPnfCDSControllerRunnableBB implements ControllerRunnable<Bui
private AbstractCDSProcessingBBUtils abstractCDSProcessingBBUtils;
private ExtractPojosForBB extractPojosForBB;
private ExceptionBuilder exceptionBuilder;
+ private ConfigureInstanceParamsForPnf configureInstanceParamsForPnf;
@Autowired
public GenericPnfCDSControllerRunnableBB(AbstractCDSProcessingBBUtils abstractCDSProcessingBBUtils,
- ExtractPojosForBB extractPojosForBB, ExceptionBuilder exceptionBuilder) {
+ ExtractPojosForBB extractPojosForBB, ExceptionBuilder exceptionBuilder,
+ ConfigureInstanceParamsForPnf configureInstanceParamsForPnf) {
this.abstractCDSProcessingBBUtils = abstractCDSProcessingBBUtils;
this.extractPojosForBB = extractPojosForBB;
this.exceptionBuilder = exceptionBuilder;
+ this.configureInstanceParamsForPnf = configureInstanceParamsForPnf;
}
@Override
@@ -115,6 +123,7 @@ public class GenericPnfCDSControllerRunnableBB implements ControllerRunnable<Bui
String resolutionKey = null;
try {
final Pnf pnf = getPnf(execution);
+ final String modelCustomizationUuid = pnf.getModelInfoPnf().getModelCustomizationUuid();
final ServiceInstance serviceInstance = getServiceInstance(execution);
resolutionKey = pnf.getPnfName();
@@ -123,10 +132,17 @@ public class GenericPnfCDSControllerRunnableBB implements ControllerRunnable<Bui
pnfObject);
setExecutionVariable("pnf-id", pnf.getPnfId(), pnfObject);
setExecutionVariable("pnf-name", resolutionKey, pnfObject);
- setExecutionVariable("pnf-customization-uuid", pnf.getModelInfoPnf().getModelCustomizationUuid(),
- pnfObject);
+ setExecutionVariable("pnf-customization-uuid", modelCustomizationUuid, pnfObject);
+
+ final GeneralBuildingBlock generalBuildingBlock = execution.getGeneralBuildingBlock();
- } catch (BBObjectNotFoundException exception) {
+ List<Map<String, Object>> userParamsFromRequest =
+ generalBuildingBlock.getRequestContext().getRequestParameters().getUserParams();
+ if (userParamsFromRequest != null && userParamsFromRequest.size() != 0) {
+ configureInstanceParamsForPnf.populateInstanceParams(pnfObject, userParamsFromRequest,
+ modelCustomizationUuid);
+ }
+ } catch (BBObjectNotFoundException | PayloadGenerationException exception) {
logger.error("An exception occurred when creating payload for CDS request", exception);
exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, exception);
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/vfmodule/CreateVFModule.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/vfmodule/CreateVFModule.java
index 751e91d009..f7c42b97e9 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/vfmodule/CreateVFModule.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/vfmodule/CreateVFModule.java
@@ -1,6 +1,14 @@
package org.onap.so.bpmn.infrastructure.vfmodule;
import java.util.Optional;
+import org.onap.aaiclient.client.aai.AAIResourcesClient;
+import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
+import org.onap.aaiclient.client.aai.entities.Relationships;
+import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
+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.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
@@ -8,14 +16,6 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
-import org.onap.aaiclient.client.aai.AAIObjectPlurals;
-import org.onap.aaiclient.client.aai.AAIObjectType;
-import org.onap.aaiclient.client.aai.AAIResourcesClient;
-import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
-import org.onap.aaiclient.client.aai.entities.Relationships;
-import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
-import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
-import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.cloud.resource.beans.CloudInformation;
import org.onap.so.cloud.resource.beans.NodeType;
@@ -60,15 +60,15 @@ public class CreateVFModule {
}
protected NodeType getNodeType(CloudRegion cloudRegion) {
- AAIResourceUri cloudRegionUri = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION,
- cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId());
+ AAIResourceUri cloudRegionUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+ .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId()));
AAIResourcesClient client = getAAIClient();
Optional<Relationships> relationships = client.get(cloudRegionUri).getRelationships();
if (relationships.isPresent()) {
AAIPluralResourceUri networkTechsGreenfieldUri = AAIUriFactory
- .createResourceUri(AAIObjectType.CLOUD_REGION, cloudRegion.getCloudOwner(),
- cloudRegion.getLcpCloudRegionId())
- .relatedTo(AAIObjectPlurals.NETWORK_TECHNOLOGY)
+ .createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+ .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId()))
+ .relatedTo(Types.NETWORK_TECHNOLOGIES.getFragment())
.queryParam("network-technology-name", NodeType.GREENFIELD.getNetworkTechnologyName());
AAIResultWrapper networkTechsGreenfield = client.get(networkTechsGreenfieldUri);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/VrfValidation.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/VrfValidation.java
index 905862880f..304cb9f4b4 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/VrfValidation.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/VrfValidation.java
@@ -23,10 +23,10 @@ package org.onap.so.bpmn.infrastructure.workflow.tasks;
import java.util.List;
import java.util.Optional;
import org.onap.aai.domain.yang.L3Network;
-import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils;
-import org.onap.aaiclient.client.aai.AAIObjectType;
import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
+import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils;
import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -143,7 +143,7 @@ public class VrfValidation {
AAIResultWrapper networkWrapper = new AAIResultWrapper(aaiLocalNetwork);
if (networkWrapper.getRelationships().isPresent()) {
List<AAIResourceUri> vpnBindingUris =
- networkWrapper.getRelationships().get().getRelatedUris(AAIObjectType.VPN_BINDING);
+ networkWrapper.getRelationships().get().getRelatedUris(Types.VPN_BINDING);
if (!vpnBindingUris.isEmpty()) {
Optional<org.onap.aai.domain.yang.VpnBinding> vpnBindingOp =
bbInputSetupUtils.getAAIResourceDepthOne(vpnBindingUris.get(0))
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
index 9b9433afdb..0f955e2851 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
@@ -50,12 +50,13 @@ import org.onap.aai.domain.yang.Vnfc;
import org.onap.aai.domain.yang.VolumeGroup;
import org.onap.aai.domain.yang.VpnBinding;
import org.onap.aaiclient.client.aai.AAICommonObjectMapperProvider;
-import org.onap.aaiclient.client.aai.AAIObjectType;
+import org.onap.aaiclient.client.aai.AAIObjectName;
import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
import org.onap.aaiclient.client.aai.entities.Relationships;
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.bpmn.common.BBConstants;
import org.onap.so.bpmn.infrastructure.workflow.tasks.utils.WorkflowResourceIdsUtils;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
@@ -485,16 +486,17 @@ public class WorkflowAction {
}
protected <T> List<T> getRelatedResourcesInVfModule(String vnfId, String vfModuleId, Class<T> resultClass,
- AAIObjectType type) {
+ AAIObjectName name) {
List<T> vnfcs = new ArrayList<>();
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId);
+ AAIResourceUri uri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId).vfModule(vfModuleId));
AAIResultWrapper vfModuleResultsWrapper = bbInputSetupUtils.getAAIResourceDepthOne(uri);
Optional<Relationships> relationshipsOp = vfModuleResultsWrapper.getRelationships();
if (!relationshipsOp.isPresent()) {
logger.debug("No relationships were found for vfModule in AAI");
} else {
Relationships relationships = relationshipsOp.get();
- List<AAIResultWrapper> vnfcResultWrappers = relationships.getByType(type);
+ List<AAIResultWrapper> vnfcResultWrappers = relationships.getByType(name);
for (AAIResultWrapper vnfcResultWrapper : vnfcResultWrappers) {
Optional<T> vnfcOp = vnfcResultWrapper.asBean(resultClass);
vnfcOp.ifPresent(vnfcs::add);
@@ -503,9 +505,9 @@ public class WorkflowAction {
return vnfcs;
}
- protected <T> T getRelatedResourcesInVnfc(Vnfc vnfc, Class<T> resultClass, AAIObjectType type) throws Exception {
+ protected <T> T getRelatedResourcesInVnfc(Vnfc vnfc, Class<T> resultClass, AAIObjectName name) throws Exception {
T configuration = null;
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VNFC, vnfc.getVnfcName());
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().vnfc(vnfc.getVnfcName()));
AAIResultWrapper vnfcResultsWrapper = bbInputSetupUtils.getAAIResourceDepthOne(uri);
Optional<Relationships> relationshipsOp = vnfcResultsWrapper.getRelationships();
if (!relationshipsOp.isPresent()) {
@@ -513,7 +515,7 @@ public class WorkflowAction {
} else {
Relationships relationships = relationshipsOp.get();
List<AAIResultWrapper> configurationResultWrappers =
- this.getResultWrappersFromRelationships(relationships, type);
+ this.getResultWrappersFromRelationships(relationships, name);
if (configurationResultWrappers.size() > 1) {
String multipleRelationshipsError =
"Multiple relationships exist from VNFC " + vnfc.getVnfcName() + " to Configurations";
@@ -530,8 +532,8 @@ public class WorkflowAction {
}
protected List<AAIResultWrapper> getResultWrappersFromRelationships(Relationships relationships,
- AAIObjectType type) {
- return relationships.getByType(type);
+ AAIObjectName name) {
+ return relationships.getByType(name);
}
protected boolean isConfiguration(List<OrchestrationFlow> orchFlows) {
@@ -565,12 +567,12 @@ public class WorkflowAction {
vfModuleCustomizationUUID = aaiVfModule.getModelCustomizationId();
}
- List<org.onap.aai.domain.yang.Vnfc> vnfcs = getRelatedResourcesInVfModule(vnfId, vfModuleId,
- org.onap.aai.domain.yang.Vnfc.class, AAIObjectType.VNFC);
+ List<org.onap.aai.domain.yang.Vnfc> vnfcs =
+ getRelatedResourcesInVfModule(vnfId, vfModuleId, org.onap.aai.domain.yang.Vnfc.class, Types.VNFC);
for (org.onap.aai.domain.yang.Vnfc vnfc : vnfcs) {
WorkflowResourceIds workflowIdsCopy = SerializationUtils.clone(dataObj.getWorkflowResourceIds());
- org.onap.aai.domain.yang.Configuration configuration = getRelatedResourcesInVnfc(vnfc,
- org.onap.aai.domain.yang.Configuration.class, AAIObjectType.CONFIGURATION);
+ org.onap.aai.domain.yang.Configuration configuration =
+ getRelatedResourcesInVnfc(vnfc, org.onap.aai.domain.yang.Configuration.class, Types.CONFIGURATION);
if (configuration == null) {
logger.warn(String.format("No configuration found for VNFC %s in AAI", vnfc.getVnfcName()));
continue;
@@ -813,7 +815,7 @@ public class WorkflowAction {
new AAICommonObjectMapperProvider().getMapper().writeValueAsString(aaiLocalNetwork)).getRelationships();
if (relationshipsOp.isPresent()) {
List<AAIResultWrapper> configurationsRelatedToLocalNetwork =
- relationshipsOp.get().getByType(AAIObjectType.CONFIGURATION);
+ relationshipsOp.get().getByType(Types.CONFIGURATION);
if (configurationsRelatedToLocalNetwork.size() > 1) {
throw new VrfBondingServiceException(
"Network: " + aaiLocalNetwork.getNetworkId() + " has more than 1 configuration related to it");
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
index 7420df144a..5425b2a725 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
@@ -20,12 +20,23 @@
package org.onap.so.bpmn.infrastructure.workflow.tasks;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+import java.util.UUID;
+import java.util.stream.Collectors;
+import javax.persistence.EntityNotFoundException;
import org.camunda.bpm.engine.delegate.DelegateExecution;
-import org.onap.aai.domain.yang.*;
-import org.onap.aaiclient.client.aai.AAIObjectType;
+import org.onap.aai.domain.yang.GenericVnf;
+import org.onap.aai.domain.yang.InstanceGroup;
+import org.onap.aai.domain.yang.L3Network;
+import org.onap.aai.domain.yang.ServiceInstance;
+import org.onap.aai.domain.yang.VfModule;
+import org.onap.aai.domain.yang.Vnfc;
+import org.onap.aai.domain.yang.VolumeGroup;
import org.onap.aaiclient.client.aai.entities.Configuration;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
import org.onap.so.bpmn.common.DelegateExecutionImpl;
import org.onap.so.bpmn.common.listener.db.RequestsDbListenerRunner;
import org.onap.so.bpmn.common.listener.flowmanipulator.FlowManipulatorListenerRunner;
@@ -48,13 +59,8 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
-import javax.persistence.EntityNotFoundException;
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Optional;
-import java.util.UUID;
-import java.util.stream.Collectors;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
@Component
public class WorkflowActionBBTasks {
@@ -421,8 +427,7 @@ public class WorkflowActionBBTasks {
String vnfCustomizationUUID = bbInputSetupUtils.getAAIGenericVnf(vnfId).getModelCustomizationId();
String vfModuleCustomizationUUID =
bbInputSetupUtils.getAAIVfModule(vnfId, vfModuleId).getModelCustomizationId();
- List<Vnfc> vnfcs =
- workflowAction.getRelatedResourcesInVfModule(vnfId, vfModuleId, Vnfc.class, AAIObjectType.VNFC);
+ List<Vnfc> vnfcs = workflowAction.getRelatedResourcesInVfModule(vnfId, vfModuleId, Vnfc.class, Types.VNFC);
logger.debug("Vnfc Size: {}", vnfcs.size());
for (Vnfc vnfc : vnfcs) {
String modelCustomizationId = vnfc.getModelCustomizationId();
@@ -461,7 +466,7 @@ public class WorkflowActionBBTasks {
protected String getConfigurationId(Vnfc vnfc) throws Exception {
Configuration configuration =
- workflowAction.getRelatedResourcesInVnfc(vnfc, Configuration.class, AAIObjectType.CONFIGURATION);
+ workflowAction.getRelatedResourcesInVnfc(vnfc, Configuration.class, Types.CONFIGURATION);
if (configuration != null) {
return configuration.getConfigurationId();
} else {
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionExtractResourcesAAI.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionExtractResourcesAAI.java
index de674daca3..4140692b44 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionExtractResourcesAAI.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionExtractResourcesAAI.java
@@ -23,12 +23,12 @@ package org.onap.so.bpmn.infrastructure.workflow.tasks;
import java.util.List;
import java.util.Optional;
import org.onap.aai.domain.yang.VpnBinding;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
-import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils;
-import org.onap.aaiclient.client.aai.AAIObjectType;
import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
import org.onap.aaiclient.client.aai.entities.Relationships;
import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
+import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -42,7 +42,7 @@ public class WorkflowActionExtractResourcesAAI {
protected BBInputSetupUtils bbInputSetupUtils;
public Optional<Configuration> extractRelationshipsConfiguration(Relationships relationships) {
- List<AAIResultWrapper> configurations = relationships.getByType(AAIObjectType.CONFIGURATION);
+ List<AAIResultWrapper> configurations = relationships.getByType(Types.CONFIGURATION);
for (AAIResultWrapper configWrapper : configurations) {
Optional<Configuration> config = configWrapper.asBean(Configuration.class);
if (config.isPresent()) {
@@ -53,7 +53,7 @@ public class WorkflowActionExtractResourcesAAI {
}
public Optional<VpnBinding> extractRelationshipsVpnBinding(Relationships relationships) {
- List<AAIResourceUri> configurations = relationships.getRelatedUris(AAIObjectType.VPN_BINDING);
+ List<AAIResourceUri> configurations = relationships.getRelatedUris(Types.VPN_BINDING);
for (AAIResourceUri vpnBindingUri : configurations) {
AAIResultWrapper vpnBindingWrapper = bbInputSetupUtils.getAAIResourceDepthOne(vpnBindingUri);
Optional<VpnBinding> vpnBinding = vpnBindingWrapper.asBean(VpnBinding.class);
@@ -65,7 +65,7 @@ public class WorkflowActionExtractResourcesAAI {
}
public Optional<Relationships> extractRelationshipsVnfc(Relationships relationships) {
- List<AAIResultWrapper> vnfcs = relationships.getByType(AAIObjectType.VNFC);
+ List<AAIResultWrapper> vnfcs = relationships.getByType(Types.VNFC);
for (AAIResultWrapper vnfcWrapper : vnfcs) {
if (vnfcWrapper.getRelationships().isPresent()) {
return vnfcWrapper.getRelationships();
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/CnfAdapterClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/CnfAdapterClient.java
index f44c15ac54..b74aa9056d 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/CnfAdapterClient.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/CnfAdapterClient.java
@@ -34,6 +34,7 @@ import org.springframework.core.env.Environment;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
+import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.retry.annotation.Backoff;
import org.springframework.retry.annotation.Retryable;
@@ -75,11 +76,32 @@ public class CnfAdapterClient {
}
}
+ @Retryable(value = {HttpServerErrorException.class}, maxAttempts = 3, backoff = @Backoff(delay = 3000))
+ public InstanceResponse healthcheck() throws CnfAdapterClientException {
+ try {
+ // String uri = env.getRequiredProperty("mso.cnf.adapter.endpoint"); //TODO: This needs to be added as well
+ // for configuration
+ String uri = "https://localhost:32780"; // TODO: What is the correct uri?
+ String endpoint = UriBuilder.fromUri(uri).path("/api/cnf-adapter/v1/healthcheck").build().toString();
+ HttpEntity<?> entity = new HttpEntity<>(getHttpHeaders());
+ ResponseEntity<InstanceResponse> result =
+ restTemplate.exchange(endpoint, HttpMethod.GET, entity, InstanceResponse.class);
+ return result.getBody();
+ } catch (HttpClientErrorException e) {
+ logger.error("Error Calling CNF Adapter, e");
+ if (HttpStatus.SC_NOT_FOUND == e.getStatusCode().value()) {
+ throw new EntityNotFoundException(e.getResponseBodyAsString());
+ }
+ throw e;
+ }
+ }
+
protected HttpHeaders getHttpHeaders() {
HttpHeaders headers = new HttpHeaders();
- List<org.springframework.http.MediaType> acceptableMediaTypes = new ArrayList<>();
- acceptableMediaTypes.add(org.springframework.http.MediaType.APPLICATION_JSON);
+ List<MediaType> acceptableMediaTypes = new ArrayList<>();
+ acceptableMediaTypes.add(MediaType.APPLICATION_JSON);
headers.setAccept(acceptableMediaTypes);
+ headers.setContentType(MediaType.APPLICATION_JSON);
/*
* try { String userCredentials = CryptoUtils.decrypt(env.getRequiredProperty("mso.cnf.adapter.auth"),
* env.getRequiredProperty("mso.msoKey")); if (userCredentials != null) { headers.add(HttpHeaders.AUTHORIZATION,
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/entities/InstanceRequest.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/entities/InstanceRequest.java
index e4058097ab..37d4e41553 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/entities/InstanceRequest.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/entities/InstanceRequest.java
@@ -11,18 +11,18 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
"override-values"})
public class InstanceRequest {
- @JsonProperty("rb-name")
+ @JsonProperty("modelInvariantId")
private String rbName;
- @JsonProperty("rb-version")
+ @JsonProperty("modelVersionId")
private String rbVersion;
- @JsonProperty("profile-name")
+ @JsonProperty("k8sRBProfileName")
private String profileName;
- @JsonProperty("release-name")
- private String releaseName;
- @JsonProperty("cloud-region")
+ @JsonProperty("vfModuleUUID")
+ private String vfModuleUUID;
+ @JsonProperty("cloudRegionId")
private String cloudRegion;
@JsonProperty("labels")
- private Labels labels;
+ private Map<String, String> labels;
@JsonProperty(value = "override-values")
private Map<String, String> overrideValues;
@@ -67,21 +67,21 @@ public class InstanceRequest {
}
@JsonProperty("labels")
- public Labels getLabels() {
+ public Map<String, String> getLabels() {
return labels;
}
@JsonProperty("labels")
- public void setLabels(Labels labels) {
+ public void setLabels(Map<String, String> labels) {
this.labels = labels;
}
- public String getReleaseName() {
- return releaseName;
+ public String getVfModuleUUID() {
+ return vfModuleUUID;
}
- public void setReleaseName(String releaseName) {
- this.releaseName = releaseName;
+ public void setVfModuleUUID(String vfModuleUUID) {
+ this.vfModuleUUID = vfModuleUUID;
}
public Map<String, String> getOverrideValues() {
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAICollectionResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAICollectionResources.java
index 7386740c25..78c8cfb145 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAICollectionResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAICollectionResources.java
@@ -20,11 +20,11 @@
package org.onap.so.client.orchestration;
-import org.onap.so.bpmn.common.InjectionHelper;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection;
-import org.onap.aaiclient.client.aai.AAIObjectType;
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.so.bpmn.common.InjectionHelper;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection;
import org.onap.so.client.aai.mapper.AAIObjectMapper;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
import org.springframework.beans.factory.annotation.Autowired;
@@ -40,7 +40,7 @@ public class AAICollectionResources {
public void createCollection(Collection collection) {
AAIResourceUri networkCollectionURI =
- AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, collection.getId());
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().collection(collection.getId()));
collection.setOrchestrationStatus(OrchestrationStatus.INVENTORIED);
org.onap.aai.domain.yang.Collection aaiCollection = aaiObjectMapper.mapCollection(collection);
injectionHelper.getAaiClient().create(networkCollectionURI, aaiCollection);
@@ -48,13 +48,14 @@ public class AAICollectionResources {
public void updateCollection(Collection collection) {
AAIResourceUri networkCollectionURI =
- AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, collection.getId());
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().collection(collection.getId()));
org.onap.aai.domain.yang.Collection aaiCollection = aaiObjectMapper.mapCollection(collection);
injectionHelper.getAaiClient().update(networkCollectionURI, aaiCollection);
}
public void deleteCollection(Collection collection) {
- AAIResourceUri instanceGroupUri = AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, collection.getId());
+ AAIResourceUri instanceGroupUri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().collection(collection.getId()));
injectionHelper.getAaiClient().delete(instanceGroupUri);
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java
index a832930723..1373c2ca97 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java
@@ -22,12 +22,13 @@ package org.onap.so.client.orchestration;
import java.util.Optional;
import javax.ws.rs.core.UriBuilder;
-import org.onap.so.bpmn.common.InjectionHelper;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
-import org.onap.aaiclient.client.aai.AAIObjectType;
import org.onap.aaiclient.client.aai.entities.AAIEdgeLabel;
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.bpmn.common.InjectionHelper;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
import org.onap.so.client.aai.mapper.AAIObjectMapper;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
import org.springframework.beans.factory.annotation.Autowired;
@@ -47,8 +48,8 @@ public class AAIConfigurationResources {
* @param configuration
*/
public void createConfiguration(Configuration configuration) {
- AAIResourceUri configurationURI =
- AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId());
+ AAIResourceUri configurationURI = AAIUriFactory
+ .createResourceUri(AAIFluentTypeBuilder.network().configuration(configuration.getConfigurationId()));
configuration.setOrchestrationStatus(OrchestrationStatus.INVENTORIED);
org.onap.aai.domain.yang.Configuration aaiConfiguration = aaiObjectMapper.mapConfiguration(configuration);
injectionHelper.getAaiClient().createIfNotExists(configurationURI, Optional.of(aaiConfiguration));
@@ -61,7 +62,8 @@ public class AAIConfigurationResources {
* @return
*/
public Optional<org.onap.aai.domain.yang.Configuration> getConfiguration(String configurationId) {
- AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId);
+ AAIResourceUri aaiResourceUri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configuration(configurationId));
return injectionHelper.getAaiClient().get(org.onap.aai.domain.yang.Configuration.class, aaiResourceUri);
}
@@ -71,8 +73,8 @@ public class AAIConfigurationResources {
* @param configuration
*/
public void updateConfiguration(Configuration configuration) {
- AAIResourceUri configurationURI =
- AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId());
+ AAIResourceUri configurationURI = AAIUriFactory
+ .createResourceUri(AAIFluentTypeBuilder.network().configuration(configuration.getConfigurationId()));
org.onap.aai.domain.yang.Configuration aaiConfiguration = aaiObjectMapper.mapConfiguration(configuration);
injectionHelper.getAaiClient().update(configurationURI, aaiConfiguration);
}
@@ -85,9 +87,10 @@ public class AAIConfigurationResources {
*/
public void disconnectConfigurationToServiceInstance(String configurationId, String serviceInstanceId) {
- AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId);
+ AAIResourceUri configurationURI =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configuration(configurationId));
AAIResourceUri serviceInstanceURI =
- AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId);
+ AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId));
injectionHelper.getAaiClient().disconnect(configurationURI, serviceInstanceURI);
}
@@ -99,9 +102,9 @@ public class AAIConfigurationResources {
*/
public void connectVrfConfigurationToVnrConfiguration(String vrfConfigurationId, String vnrConfigurationId) {
AAIResourceUri vnrConfigurationUri =
- AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, vnrConfigurationId);
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configuration(vnrConfigurationId));
AAIResourceUri vrfConfigurationUri =
- AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, vrfConfigurationId);
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configuration(vrfConfigurationId));
injectionHelper.getAaiClient().connect(vrfConfigurationUri, vnrConfigurationUri);
}
@@ -112,8 +115,9 @@ public class AAIConfigurationResources {
* @param configurationId
*/
public void connectConfigurationToPnfObject(String pnfId, String configurationId) {
- AAIResourceUri pnfUri = AAIUriFactory.createResourceUri(AAIObjectType.PNF, pnfId);
- AAIResourceUri configurationUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId);
+ AAIResourceUri pnfUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().pnf(pnfId));
+ AAIResourceUri configurationUri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configuration(configurationId));
injectionHelper.getAaiClient().connect(configurationUri, pnfUri);
}
@@ -124,9 +128,10 @@ public class AAIConfigurationResources {
* @param serviceInstanceId
*/
public void connectConfigurationToServiceInstance(String configurationId, String serviceInstanceId) {
- AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId);
+ AAIResourceUri configurationURI =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configuration(configurationId));
AAIResourceUri serviceInstanceURI =
- AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId);
+ AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId));
injectionHelper.getAaiClient().connect(configurationURI, serviceInstanceURI);
}
@@ -139,9 +144,10 @@ public class AAIConfigurationResources {
*/
public void connectConfigurationToServiceInstance(String configurationId, String serviceInstanceId,
AAIEdgeLabel aaiLabel) {
- AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId);
+ AAIResourceUri configurationURI =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configuration(configurationId));
AAIResourceUri serviceInstanceURI =
- AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId);
+ AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId));
injectionHelper.getAaiClient().connect(configurationURI, serviceInstanceURI, aaiLabel);
}
@@ -152,8 +158,10 @@ public class AAIConfigurationResources {
* @param genericVnfId
*/
public void connectConfigurationToGenericVnf(String configurationId, String genericVnfId) {
- AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId);
- AAIResourceUri genericVnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, genericVnfId);
+ AAIResourceUri configurationURI =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configuration(configurationId));
+ AAIResourceUri genericVnfURI =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(genericVnfId));
injectionHelper.getAaiClient().connect(configurationURI, genericVnfURI);
}
@@ -165,26 +173,33 @@ public class AAIConfigurationResources {
*
*/
public void connectConfigurationToVpnBinding(String configurationId, String vpnId) {
- AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId);
- AAIResourceUri vpnBindingURI = AAIUriFactory.createResourceUri(AAIObjectType.VPN_BINDING, vpnId);
+ AAIResourceUri configurationURI =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configuration(configurationId));
+ AAIResourceUri vpnBindingURI =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().vpnBinding(vpnId));
injectionHelper.getAaiClient().connect(configurationURI, vpnBindingURI);
}
public void connectConfigurationToVfModule(String configurationId, String vnfId, String vfModuleId) {
- AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId);
- AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId);
+ AAIResourceUri configurationURI =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configuration(configurationId));
+ AAIResourceUri vfModuleURI =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId).vfModule(vfModuleId));
injectionHelper.getAaiClient().connect(configurationURI, vfModuleURI);
}
public void connectConfigurationToVnfc(String configurationId, String vnfcName) {
- AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId);
- AAIResourceUri vnfcURI = AAIUriFactory.createResourceUri(AAIObjectType.VNFC, vnfcName);
+ AAIResourceUri configurationURI =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configuration(configurationId));
+ AAIResourceUri vnfcURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().vnfc(vnfcName));
injectionHelper.getAaiClient().connect(configurationURI, vnfcURI);
}
public void connectConfigurationToL3Network(String configurationId, String networkId) {
- AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId);
- AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, networkId);
+ AAIResourceUri configurationURI =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configuration(configurationId));
+ AAIResourceUri networkURI =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(networkId));
injectionHelper.getAaiClient().connect(configurationURI, networkURI);
}
@@ -194,7 +209,8 @@ public class AAIConfigurationResources {
* @param configurationId
*/
public void deleteConfiguration(String configurationId) {
- AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId);
+ AAIResourceUri aaiResourceUri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configuration(configurationId));
injectionHelper.getAaiClient().delete(aaiResourceUri);
}
@@ -204,8 +220,8 @@ public class AAIConfigurationResources {
* @param configuration
*/
public void deleteConfiguration(Configuration configuration) {
- AAIResourceUri aaiResourceUri =
- AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId());
+ AAIResourceUri aaiResourceUri = AAIUriFactory
+ .createResourceUri(AAIFluentTypeBuilder.network().configuration(configuration.getConfigurationId()));
injectionHelper.getAaiClient().delete(aaiResourceUri);
}
@@ -217,13 +233,13 @@ public class AAIConfigurationResources {
*/
public Optional<org.onap.aai.domain.yang.Configuration> getConfigurationFromRelatedLink(String relatedLink) {
return injectionHelper.getAaiClient().get(org.onap.aai.domain.yang.Configuration.class, AAIUriFactory
- .createResourceFromExistingURI(AAIObjectType.CONFIGURATION, UriBuilder.fromPath(relatedLink).build()));
+ .createResourceFromExistingURI(Types.CONFIGURATION, UriBuilder.fromPath(relatedLink).build()));
}
public void updateOrchestrationStatusConfiguration(Configuration configuration,
OrchestrationStatus orchestrationStatus) {
- AAIResourceUri aaiResourceUri =
- AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId());
+ AAIResourceUri aaiResourceUri = AAIUriFactory
+ .createResourceUri(AAIFluentTypeBuilder.network().configuration(configuration.getConfigurationId()));
configuration.setOrchestrationStatus(orchestrationStatus);
org.onap.aai.domain.yang.Configuration aaiConfiguration = aaiObjectMapper.mapConfiguration(configuration);
injectionHelper.getAaiClient().update(aaiResourceUri, aaiConfiguration);
@@ -231,8 +247,8 @@ public class AAIConfigurationResources {
public void updateConfigurationOrchestrationStatus(Configuration configuration,
OrchestrationStatus orchestrationStatus) {
- AAIResourceUri aaiResourceUri =
- AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId());
+ AAIResourceUri aaiResourceUri = AAIUriFactory
+ .createResourceUri(AAIFluentTypeBuilder.network().configuration(configuration.getConfigurationId()));
org.onap.aai.domain.yang.Configuration aaiConfiguration = new org.onap.aai.domain.yang.Configuration();
aaiConfiguration.setOrchestrationStatus(orchestrationStatus.name());
injectionHelper.getAaiClient().update(aaiResourceUri, aaiConfiguration);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIInstanceGroupResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIInstanceGroupResources.java
index 05c8f7dd8f..27fa4304c4 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIInstanceGroupResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIInstanceGroupResources.java
@@ -21,16 +21,16 @@
package org.onap.so.client.orchestration;
import java.util.Optional;
-import org.onap.so.bpmn.common.InjectionHelper;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
-import org.onap.aaiclient.client.aai.AAIObjectPlurals;
-import org.onap.aaiclient.client.aai.AAIObjectType;
import org.onap.aaiclient.client.aai.entities.AAIEdgeLabel;
import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
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.bpmn.common.InjectionHelper;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.client.aai.mapper.AAIObjectMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -45,50 +45,52 @@ public class AAIInstanceGroupResources {
public void createInstanceGroup(InstanceGroup instanceGroup) {
AAIResourceUri instanceGroupUri =
- AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId());
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId()));
org.onap.aai.domain.yang.InstanceGroup aaiInstanceGroup = aaiObjectMapper.mapInstanceGroup(instanceGroup);
injectionHelper.getAaiClient().createIfNotExists(instanceGroupUri, Optional.of(aaiInstanceGroup));
}
public void deleteInstanceGroup(InstanceGroup instanceGroup) {
AAIResourceUri instanceGroupUri =
- AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId());
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId()));
injectionHelper.getAaiClient().delete(instanceGroupUri);
}
public void connectInstanceGroupToVnf(InstanceGroup instanceGroup, GenericVnf vnf) {
AAIResourceUri instanceGroupUri =
- AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId());
- AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId());
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId()));
+ AAIResourceUri vnfURI =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId()));
injectionHelper.getAaiClient().connect(instanceGroupUri, vnfURI);
}
public void connectInstanceGroupToVnf(InstanceGroup instanceGroup, GenericVnf vnf, AAIEdgeLabel aaiLabel) {
AAIResourceUri instanceGroupUri =
- AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId());
- AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId());
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId()));
+ AAIResourceUri vnfURI =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId()));
injectionHelper.getAaiClient().connect(instanceGroupUri, vnfURI, aaiLabel);
}
public boolean exists(InstanceGroup instanceGroup) {
AAIResourceUri instanceGroupUri =
- AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId());
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId()));
return injectionHelper.getAaiClient().exists(instanceGroupUri);
}
public void createInstanceGroupandConnectServiceInstance(InstanceGroup instanceGroup,
ServiceInstance serviceInstance) {
AAIResourceUri instanceGroupUri =
- AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId());
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId()));
org.onap.aai.domain.yang.InstanceGroup aaiInstanceGroup = aaiObjectMapper.mapInstanceGroup(instanceGroup);
- AAIResourceUri serviceInstanceURI =
- AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance.getServiceInstanceId());
+ AAIResourceUri serviceInstanceURI = AAIUriFactory
+ .createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance.getServiceInstanceId()));
injectionHelper.getAaiClient().createIfNotExists(instanceGroupUri, Optional.of(aaiInstanceGroup))
.connect(instanceGroupUri, serviceInstanceURI);
}
public boolean checkInstanceGroupNameInUse(String instanceGroupName) {
- AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.INSTANCE_GROUP)
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroups())
.queryParam("instance-group-name", instanceGroupName);
return injectionHelper.getAaiClient().exists(uri);
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java
index 611d715331..2e8e50aebf 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java
@@ -25,6 +25,15 @@ import org.onap.aai.domain.yang.NetworkPolicies;
import org.onap.aai.domain.yang.NetworkPolicy;
import org.onap.aai.domain.yang.RouteTableReference;
import org.onap.aai.domain.yang.VpnBinding;
+import org.onap.aaiclient.client.aai.entities.AAIEdgeLabel;
+import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
+import org.onap.aaiclient.client.aai.entities.uri.AAIBaseResourceUri;
+import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
+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.aaiclient.client.graphinventory.entities.uri.Depth;
import org.onap.so.bpmn.common.InjectionHelper;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection;
@@ -34,16 +43,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet;
-import org.onap.aaiclient.client.aai.AAIObjectPlurals;
-import org.onap.aaiclient.client.aai.AAIObjectType;
-import org.onap.aaiclient.client.aai.entities.AAIEdgeLabel;
-import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
-import org.onap.aaiclient.client.aai.entities.uri.AAIBaseResourceUri;
-import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
-import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
-import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.aai.mapper.AAIObjectMapper;
-import org.onap.aaiclient.client.graphinventory.entities.uri.Depth;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -58,46 +58,51 @@ public class AAINetworkResources {
private AAIObjectMapper aaiObjectMapper;
public void updateNetwork(L3Network network) {
- AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, network.getNetworkId());
+ AAIResourceUri networkURI =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(network.getNetworkId()));
org.onap.aai.domain.yang.L3Network aaiL3Network = aaiObjectMapper.mapNetwork(network);
injectionHelper.getAaiClient().update(networkURI, aaiL3Network);
}
public void updateSubnet(L3Network network, Subnet subnet) {
- AAIResourceUri subnetURI =
- AAIUriFactory.createResourceUri(AAIObjectType.SUBNET, network.getNetworkId(), subnet.getSubnetId());
+ AAIResourceUri subnetURI = AAIUriFactory.createResourceUri(
+ AAIFluentTypeBuilder.network().l3Network(network.getNetworkId()).subnet(subnet.getSubnetId()));
org.onap.aai.domain.yang.Subnet aaiSubnet = aaiObjectMapper.mapSubnet(subnet);
injectionHelper.getAaiClient().update(subnetURI, aaiSubnet);
}
public void createNetworkConnectToServiceInstance(L3Network network, ServiceInstance serviceInstance) {
- AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, network.getNetworkId());
+ AAIResourceUri networkURI =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(network.getNetworkId()));
network.setOrchestrationStatus(OrchestrationStatus.INVENTORIED);
- AAIResourceUri serviceInstanceURI =
- AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance.getServiceInstanceId());
+ AAIResourceUri serviceInstanceURI = AAIUriFactory
+ .createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance.getServiceInstanceId()));
org.onap.aai.domain.yang.L3Network aaiL3Network = aaiObjectMapper.mapNetwork(network);
injectionHelper.getAaiClient().createIfNotExists(networkURI, Optional.of(aaiL3Network)).connect(networkURI,
serviceInstanceURI);
}
public void createLineOfBusinessAndConnectNetwork(LineOfBusiness lineOfBusiness, L3Network network) {
- AAIResourceUri lineOfBusinessURI =
- AAIUriFactory.createResourceUri(AAIObjectType.LINE_OF_BUSINESS, lineOfBusiness.getLineOfBusinessName());
- AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, network.getNetworkId());
+ AAIResourceUri lineOfBusinessURI = AAIUriFactory.createResourceUri(
+ AAIFluentTypeBuilder.business().lineOfBusiness(lineOfBusiness.getLineOfBusinessName()));
+ AAIResourceUri networkURI =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(network.getNetworkId()));
injectionHelper.getAaiClient().createIfNotExists(lineOfBusinessURI, Optional.of(lineOfBusiness))
.connect(networkURI, lineOfBusinessURI);
}
public void createPlatformAndConnectNetwork(Platform platform, L3Network network) {
AAIResourceUri platformURI =
- AAIUriFactory.createResourceUri(AAIObjectType.PLATFORM, platform.getPlatformName());
- AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, network.getNetworkId());
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().platform(platform.getPlatformName()));
+ AAIResourceUri networkURI =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(network.getNetworkId()));
injectionHelper.getAaiClient().createIfNotExists(platformURI, Optional.of(platform)).connect(networkURI,
platformURI);
}
public void deleteNetwork(L3Network network) {
- AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, network.getNetworkId());
+ AAIResourceUri networkURI =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(network.getNetworkId()));
injectionHelper.getAaiClient().delete(networkURI);
}
@@ -122,115 +127,122 @@ public class AAINetworkResources {
}
public Optional<org.onap.aai.domain.yang.L3Network> queryNetworkById(L3Network l3network) {
- AAIResourceUri uri =
- AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, l3network.getNetworkId()).depth(Depth.ALL);
+ AAIResourceUri uri = AAIUriFactory
+ .createResourceUri(AAIFluentTypeBuilder.network().l3Network(l3network.getNetworkId())).depth(Depth.ALL);
AAIResultWrapper aaiWrapper = injectionHelper.getAaiClient().get(uri);
return aaiWrapper.asBean(org.onap.aai.domain.yang.L3Network.class);
}
public AAIResultWrapper queryNetworkWrapperById(L3Network l3network) {
- AAIResourceUri uri =
- AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, l3network.getNetworkId()).depth(Depth.ALL);
+ AAIResourceUri uri = AAIUriFactory
+ .createResourceUri(AAIFluentTypeBuilder.network().l3Network(l3network.getNetworkId())).depth(Depth.ALL);
return injectionHelper.getAaiClient().get(uri);
}
public void createNetworkInstanceGroup(InstanceGroup instanceGroup) {
AAIResourceUri instanceGroupURI =
- AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId());
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId()));
org.onap.aai.domain.yang.InstanceGroup aaiInstanceGroup = aaiObjectMapper.mapInstanceGroup(instanceGroup);
injectionHelper.getAaiClient().create(instanceGroupURI, aaiInstanceGroup);
}
public void createNetworkCollection(Collection networkCollection) {
AAIResourceUri networkCollectionURI =
- AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, networkCollection.getId());
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().collection(networkCollection.getId()));
networkCollection.setOrchestrationStatus(OrchestrationStatus.INVENTORIED);
org.onap.aai.domain.yang.Collection aaiCollection = aaiObjectMapper.mapCollection(networkCollection);
injectionHelper.getAaiClient().create(networkCollectionURI, aaiCollection);
}
public void connectNetworkToTenant(L3Network l3network, CloudRegion cloudRegion) {
- AAIResourceUri tenantURI = AAIUriFactory.createResourceUri(AAIObjectType.TENANT, cloudRegion.getCloudOwner(),
- cloudRegion.getLcpCloudRegionId(), cloudRegion.getTenantId());
- AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, l3network.getNetworkId());
+ AAIResourceUri tenantURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+ .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId())
+ .tenant(cloudRegion.getTenantId()));
+ AAIResourceUri networkURI =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(l3network.getNetworkId()));
injectionHelper.getAaiClient().connect(tenantURI, networkURI);
}
public void connectNetworkToCloudRegion(L3Network l3network, CloudRegion cloudRegion) {
- AAIResourceUri cloudRegionURI = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION,
- cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId());
- AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, l3network.getNetworkId());
+ AAIResourceUri cloudRegionURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+ .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId()));
+ AAIResourceUri networkURI =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(l3network.getNetworkId()));
injectionHelper.getAaiClient().connect(networkURI, cloudRegionURI);
}
public void connectNetworkToNetworkCollectionInstanceGroup(L3Network l3network, InstanceGroup instanceGroup) {
AAIResourceUri netwrokCollectionInstanceGroupURI =
- AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId());
- AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, l3network.getNetworkId());
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId()));
+ AAIResourceUri networkURI =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(l3network.getNetworkId()));
injectionHelper.getAaiClient().connect(netwrokCollectionInstanceGroupURI, networkURI);
}
public void connectNetworkToNetworkCollectionServiceInstance(L3Network l3network,
ServiceInstance networkCollectionServiceInstance) {
AAIResourceUri networkCollectionServiceInstanceUri = AAIUriFactory.createResourceUri(
- AAIObjectType.SERVICE_INSTANCE, networkCollectionServiceInstance.getServiceInstanceId());
- AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, l3network.getNetworkId());
+ Types.SERVICE_INSTANCE.getFragment(networkCollectionServiceInstance.getServiceInstanceId()));
+ AAIResourceUri networkURI =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(l3network.getNetworkId()));
injectionHelper.getAaiClient().connect(networkCollectionServiceInstanceUri, networkURI);
}
public void connectNetworkCollectionInstanceGroupToNetworkCollection(InstanceGroup instanceGroup,
Collection networkCollection) {
AAIResourceUri networkCollectionUri =
- AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, networkCollection.getId());
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().collection(networkCollection.getId()));
AAIResourceUri netwrokCollectionInstanceGroupURI =
- AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId());
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId()));
injectionHelper.getAaiClient().connect(networkCollectionUri, netwrokCollectionInstanceGroupURI);
}
public void connectInstanceGroupToCloudRegion(InstanceGroup instanceGroup, CloudRegion cloudRegion) {
- AAIResourceUri cloudRegionURI = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION,
- cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId());
+ AAIResourceUri cloudRegionURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+ .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId()));
AAIResourceUri instanceGroupURI =
- AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId());
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId()));
injectionHelper.getAaiClient().connect(instanceGroupURI, cloudRegionURI, AAIEdgeLabel.USES);
}
public void connectNetworkCollectionToServiceInstance(Collection networkCollection,
ServiceInstance networkCollectionServiceInstance) {
AAIResourceUri networkCollectionUri =
- AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, networkCollection.getId());
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().collection(networkCollection.getId()));
AAIResourceUri networkCollectionServiceInstanceUri = AAIUriFactory.createResourceUri(
- AAIObjectType.SERVICE_INSTANCE, networkCollectionServiceInstance.getServiceInstanceId());
+ Types.SERVICE_INSTANCE.getFragment(networkCollectionServiceInstance.getServiceInstanceId()));
injectionHelper.getAaiClient().connect(networkCollectionUri, networkCollectionServiceInstanceUri);
}
public void deleteCollection(Collection collection) {
- AAIResourceUri collectionURI = AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, collection.getId());
+ AAIResourceUri collectionURI =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().collection(collection.getId()));
injectionHelper.getAaiClient().delete(collectionURI);
}
public void deleteNetworkInstanceGroup(InstanceGroup instanceGroup) {
AAIResourceUri instanceGroupURI =
- AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId());
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId()));
injectionHelper.getAaiClient().delete(instanceGroupURI);
}
public void createNetworkPolicy(org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy networkPolicy) {
NetworkPolicy aaiNetworkPolicy = aaiObjectMapper.mapNetworkPolicy(networkPolicy);
String networkPolicyId = networkPolicy.getNetworkPolicyId();
- AAIResourceUri netUri = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, networkPolicyId);
+ AAIResourceUri netUri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicy(networkPolicyId));
injectionHelper.getAaiClient().create(netUri, aaiNetworkPolicy);
}
public void deleteNetworkPolicy(String networkPolicyId) {
AAIResourceUri networkPolicyURI =
- AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, networkPolicyId);
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicy(networkPolicyId));
injectionHelper.getAaiClient().delete(networkPolicyURI);
}
public boolean checkNetworkNameInUse(String networkName) {
- AAIPluralResourceUri uri =
- AAIUriFactory.createResourceUri(AAIObjectPlurals.L3_NETWORK).queryParam("network-name", networkName);
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Networks())
+ .queryParam("network-name", networkName);
return injectionHelper.getAaiClient().exists(uri);
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIPnfResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIPnfResources.java
index 3da17194ff..a426c39646 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIPnfResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIPnfResources.java
@@ -20,24 +20,25 @@
package org.onap.so.client.orchestration;
-import com.google.common.base.Strings;
import java.util.Optional;
import org.apache.commons.lang3.StringUtils;
import org.onap.aai.domain.yang.RelatedToProperty;
import org.onap.aai.domain.yang.Relationship;
import org.onap.aai.domain.yang.RelationshipData;
+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.bpmn.common.InjectionHelper;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
-import org.onap.aaiclient.client.aai.AAIObjectType;
-import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
-import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.aai.mapper.AAIObjectMapper;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
+import com.google.common.base.Strings;
@Component
public class AAIPnfResources {
@@ -51,16 +52,16 @@ public class AAIPnfResources {
private AAIObjectMapper aaiObjectMapper;
public void createPnfAndConnectServiceInstance(Pnf pnf, ServiceInstance serviceInstance) {
- AAIResourceUri pnfURI = AAIUriFactory.createResourceUri(AAIObjectType.PNF, pnf.getPnfName());
+ AAIResourceUri pnfURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().pnf(pnf.getPnfName()));
pnf.setOrchestrationStatus(OrchestrationStatus.INVENTORIED);
- AAIResourceUri serviceInstanceURI =
- AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance.getServiceInstanceId());
+ AAIResourceUri serviceInstanceURI = AAIUriFactory
+ .createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance.getServiceInstanceId()));
injectionHelper.getAaiClient().createIfNotExists(pnfURI, Optional.of(aaiObjectMapper.mapPnf(pnf)))
.connect(pnfURI, serviceInstanceURI);
}
public void updateOrchestrationStatusPnf(Pnf pnf, OrchestrationStatus orchestrationStatus) {
- AAIResourceUri pnfURI = AAIUriFactory.createResourceUri(AAIObjectType.PNF, pnf.getPnfName());
+ AAIResourceUri pnfURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().pnf(pnf.getPnfName()));
Pnf pnfCopy = pnf.shallowCopyId();
@@ -72,7 +73,7 @@ public class AAIPnfResources {
public void checkIfPnfExistsInAaiAndCanBeUsed(Pnf pnf) throws Exception {
Optional<org.onap.aai.domain.yang.Pnf> pnfFromAai =
injectionHelper.getAaiClient().get(org.onap.aai.domain.yang.Pnf.class,
- AAIUriFactory.createResourceUri(AAIObjectType.PNF, pnf.getPnfName()));
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().pnf(pnf.getPnfName())));
if (pnfFromAai.isPresent()) {
checkIfPnfCanBeUsed(pnfFromAai.get());
updatePnfInAAI(pnf, pnfFromAai.get());
@@ -81,8 +82,8 @@ public class AAIPnfResources {
private void updatePnfInAAI(Pnf pnf, org.onap.aai.domain.yang.Pnf pnfFromAai) {
updatePnfFields(pnf, pnfFromAai);
- injectionHelper.getAaiClient().update(AAIUriFactory.createResourceUri(AAIObjectType.PNF, pnf.getPnfName()),
- pnfFromAai);
+ injectionHelper.getAaiClient().update(
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().pnf(pnf.getPnfName())), pnfFromAai);
logger.debug("updatePnfInAAI: {}", pnfFromAai);
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java
index 424b3ecefa..cc99f178bd 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java
@@ -27,17 +27,17 @@ package org.onap.so.client.orchestration;
import java.util.List;
import java.util.Optional;
import org.onap.aai.domain.yang.OwningEntities;
+import org.onap.aaiclient.client.aai.AAIResourcesClient;
+import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
+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.bpmn.common.InjectionHelper;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Project;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
-import org.onap.aaiclient.client.aai.AAIObjectPlurals;
-import org.onap.aaiclient.client.aai.AAIObjectType;
-import org.onap.aaiclient.client.aai.AAIResourcesClient;
-import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
-import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
-import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.aai.mapper.AAIObjectMapper;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
import org.springframework.beans.factory.annotation.Autowired;
@@ -53,15 +53,16 @@ public class AAIServiceInstanceResources {
private AAIObjectMapper aaiObjectMapper;
public boolean existsServiceInstance(ServiceInstance serviceInstance) {
- AAIResourceUri serviceInstanceURI =
- AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance.getServiceInstanceId());
+ AAIResourceUri serviceInstanceURI = AAIUriFactory
+ .createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance.getServiceInstanceId()));
return injectionHelper.getAaiClient().exists(serviceInstanceURI);
}
public void createServiceInstance(ServiceInstance serviceInstance, Customer customer) {
AAIResourceUri serviceInstanceURI =
- AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, customer.getGlobalCustomerId(),
- customer.getServiceSubscription().getServiceType(), serviceInstance.getServiceInstanceId());
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(customer.getGlobalCustomerId())
+ .serviceSubscription(customer.getServiceSubscription().getServiceType())
+ .serviceInstance(serviceInstance.getServiceInstanceId()));
serviceInstance.setOrchestrationStatus(OrchestrationStatus.INVENTORIED);
org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance =
aaiObjectMapper.mapServiceInstance(serviceInstance);
@@ -74,58 +75,63 @@ public class AAIServiceInstanceResources {
* @param customer
*/
public void createServiceSubscription(Customer customer) {
- AAIResourceUri serviceSubscriptionURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_SUBSCRIPTION,
- customer.getGlobalCustomerId(), customer.getServiceSubscription().getServiceType());
+ AAIResourceUri serviceSubscriptionURI =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(customer.getGlobalCustomerId())
+ .serviceSubscription(customer.getServiceSubscription().getServiceType()));
org.onap.aai.domain.yang.ServiceSubscription serviceSubscription =
aaiObjectMapper.mapServiceSubscription(customer.getServiceSubscription());
injectionHelper.getAaiClient().createIfNotExists(serviceSubscriptionURI, Optional.of(serviceSubscription));
}
public void deleteServiceInstance(ServiceInstance serviceInstance) {
- AAIResourceUri serviceInstanceURI =
- AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance.getServiceInstanceId());
+ AAIResourceUri serviceInstanceURI = AAIUriFactory
+ .createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance.getServiceInstanceId()));
injectionHelper.getAaiClient().delete(serviceInstanceURI);
}
public void createProject(Project project) {
- AAIResourceUri projectURI = AAIUriFactory.createResourceUri(AAIObjectType.PROJECT, project.getProjectName());
+ AAIResourceUri projectURI =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().project(project.getProjectName()));
org.onap.aai.domain.yang.Project aaiProject = aaiObjectMapper.mapProject(project);
injectionHelper.getAaiClient().createIfNotExists(projectURI, Optional.of(aaiProject));
}
public void createProjectandConnectServiceInstance(Project project, ServiceInstance serviceInstance) {
- AAIResourceUri projectURI = AAIUriFactory.createResourceUri(AAIObjectType.PROJECT, project.getProjectName());
- AAIResourceUri serviceInstanceURI =
- AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance.getServiceInstanceId());
+ AAIResourceUri projectURI =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().project(project.getProjectName()));
+ AAIResourceUri serviceInstanceURI = AAIUriFactory
+ .createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance.getServiceInstanceId()));
org.onap.aai.domain.yang.Project aaiProject = aaiObjectMapper.mapProject(project);
injectionHelper.getAaiClient().createIfNotExists(projectURI, Optional.of(aaiProject)).connect(projectURI,
serviceInstanceURI);
}
public void createOwningEntity(OwningEntity owningEntity) {
- AAIResourceUri owningEntityURI =
- AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntity.getOwningEntityId());
+ AAIResourceUri owningEntityURI = AAIUriFactory
+ .createResourceUri(AAIFluentTypeBuilder.business().owningEntity(owningEntity.getOwningEntityId()));
org.onap.aai.domain.yang.OwningEntity aaiOwningEntity = aaiObjectMapper.mapOwningEntity(owningEntity);
injectionHelper.getAaiClient().createIfNotExists(owningEntityURI, Optional.of(aaiOwningEntity));
}
public boolean existsOwningEntity(OwningEntity owningEntity) {
- AAIResourceUri owningEntityUri =
- AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntity.getOwningEntityId());
+ AAIResourceUri owningEntityUri = AAIUriFactory
+ .createResourceUri(AAIFluentTypeBuilder.business().owningEntity(owningEntity.getOwningEntityId()));
return injectionHelper.getAaiClient().exists(owningEntityUri);
}
public boolean existsOwningEntityName(String owningEntityName) {
- AAIPluralResourceUri owningEntityUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.OWNING_ENTITY)
- .queryParam("owning-entity-name", owningEntityName);
+ AAIPluralResourceUri owningEntityUri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().owningEntities())
+ .queryParam("owning-entity-name", owningEntityName);
AAIResourcesClient aaiRC = injectionHelper.getAaiClient();
return aaiRC.exists(owningEntityUri);
}
public org.onap.aai.domain.yang.OwningEntity getOwningEntityByName(String owningEntityName)
throws AAIEntityNotFoundException {
- AAIPluralResourceUri owningEntityUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.OWNING_ENTITY)
- .queryParam("owning-entity-name", owningEntityName);
+ AAIPluralResourceUri owningEntityUri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().owningEntities())
+ .queryParam("owning-entity-name", owningEntityName);
AAIResourcesClient aaiRC = injectionHelper.getAaiClient();
Optional<OwningEntities> owningEntities = aaiRC.get(OwningEntities.class, owningEntityUri);
if (owningEntities.isPresent()) {
@@ -142,19 +148,19 @@ public class AAIServiceInstanceResources {
}
public void connectOwningEntityandServiceInstance(OwningEntity owningEntity, ServiceInstance serviceInstance) {
- AAIResourceUri owningEntityURI =
- AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntity.getOwningEntityId());
- AAIResourceUri serviceInstanceURI =
- AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance.getServiceInstanceId());
+ AAIResourceUri owningEntityURI = AAIUriFactory
+ .createResourceUri(AAIFluentTypeBuilder.business().owningEntity(owningEntity.getOwningEntityId()));
+ AAIResourceUri serviceInstanceURI = AAIUriFactory
+ .createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance.getServiceInstanceId()));
injectionHelper.getAaiClient().connect(owningEntityURI, serviceInstanceURI);
}
public void createOwningEntityandConnectServiceInstance(OwningEntity owningEntity,
ServiceInstance serviceInstance) {
- AAIResourceUri owningEntityURI =
- AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntity.getOwningEntityId());
- AAIResourceUri serviceInstanceURI =
- AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance.getServiceInstanceId());
+ AAIResourceUri owningEntityURI = AAIUriFactory
+ .createResourceUri(AAIFluentTypeBuilder.business().owningEntity(owningEntity.getOwningEntityId()));
+ AAIResourceUri serviceInstanceURI = AAIUriFactory
+ .createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance.getServiceInstanceId()));
org.onap.aai.domain.yang.OwningEntity aaiOwningEntity = aaiObjectMapper.mapOwningEntity(owningEntity);
injectionHelper.getAaiClient().createIfNotExists(owningEntityURI, Optional.of(aaiOwningEntity))
.connect(owningEntityURI, serviceInstanceURI);
@@ -171,15 +177,15 @@ public class AAIServiceInstanceResources {
}
public void updateServiceInstance(ServiceInstance serviceInstance) {
- AAIResourceUri serviceInstanceURI =
- AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance.getServiceInstanceId());
+ AAIResourceUri serviceInstanceURI = AAIUriFactory
+ .createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance.getServiceInstanceId()));
org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance =
aaiObjectMapper.mapServiceInstance(serviceInstance);
injectionHelper.getAaiClient().update(serviceInstanceURI, aaiServiceInstance);
}
public boolean checkInstanceServiceNameInUse(ServiceInstance serviceInstance) {
- AAIPluralResourceUri uriSI = AAIUriFactory.createNodesUri(AAIObjectPlurals.SERVICE_INSTANCE)
+ AAIPluralResourceUri uriSI = AAIUriFactory.createNodesUri(Types.SERVICE_INSTANCES.getFragment())
.queryParam("service-instance-name", serviceInstance.getServiceInstanceName());
return injectionHelper.getAaiClient().exists(uriSI);
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java
index d5d0b0868a..72c9b7cc4f 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java
@@ -23,16 +23,16 @@
package org.onap.so.client.orchestration;
import java.util.Optional;
+import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
+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.bpmn.common.InjectionHelper;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
-import org.onap.aaiclient.client.aai.AAIObjectPlurals;
-import org.onap.aaiclient.client.aai.AAIObjectType;
-import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
-import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
-import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.aai.mapper.AAIObjectMapper;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
import org.springframework.beans.factory.annotation.Autowired;
@@ -48,23 +48,23 @@ public class AAIVfModuleResources {
private AAIObjectMapper aaiObjectMapper;
public void createVfModule(VfModule vfModule, GenericVnf vnf) {
- AAIResourceUri vfModuleURI =
- AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnf.getVnfId(), vfModule.getVfModuleId());
+ AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri(
+ AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId()).vfModule(vfModule.getVfModuleId()));
vfModule.setOrchestrationStatus(OrchestrationStatus.INVENTORIED);
injectionHelper.getAaiClient().createIfNotExists(vfModuleURI,
Optional.of(aaiObjectMapper.mapVfModule(vfModule)));
}
public void deleteVfModule(VfModule vfModule, GenericVnf vnf) {
- AAIResourceUri vfModuleURI =
- AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnf.getVnfId(), vfModule.getVfModuleId());
+ AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri(
+ AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId()).vfModule(vfModule.getVfModuleId()));
injectionHelper.getAaiClient().delete(vfModuleURI);
}
public void updateOrchestrationStatusVfModule(VfModule vfModule, GenericVnf vnf,
OrchestrationStatus orchestrationStatus) {
- AAIResourceUri vfModuleURI =
- AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnf.getVnfId(), vfModule.getVfModuleId());
+ AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri(
+ AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId()).vfModule(vfModule.getVfModuleId()));
VfModule copiedVfModule = vfModule.shallowCopyId();
vfModule.setOrchestrationStatus(orchestrationStatus);
@@ -74,8 +74,8 @@ public class AAIVfModuleResources {
}
public void updateHeatStackIdVfModule(VfModule vfModule, GenericVnf vnf) {
- AAIResourceUri vfModuleURI =
- AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnf.getVnfId(), vfModule.getVfModuleId());
+ AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri(
+ AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId()).vfModule(vfModule.getVfModuleId()));
VfModule copiedVfModule = vfModule.shallowCopyId();
copiedVfModule.setHeatStackId(vfModule.getHeatStackId());
@@ -84,8 +84,8 @@ public class AAIVfModuleResources {
}
public void updateContrailServiceInstanceFqdnVfModule(VfModule vfModule, GenericVnf vnf) {
- AAIResourceUri vfModuleURI =
- AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnf.getVnfId(), vfModule.getVfModuleId());
+ AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri(
+ AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId()).vfModule(vfModule.getVfModuleId()));
VfModule copiedVfModule = vfModule.shallowCopyId();
copiedVfModule.setContrailServiceInstanceFqdn(vfModule.getContrailServiceInstanceFqdn());
@@ -94,24 +94,25 @@ public class AAIVfModuleResources {
}
public void changeAssignVfModule(VfModule vfModule, GenericVnf vnf) {
- AAIResourceUri vfModuleURI =
- AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnf.getVnfId(), vfModule.getVfModuleId());
+ AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri(
+ AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId()).vfModule(vfModule.getVfModuleId()));
org.onap.aai.domain.yang.VfModule aaiVfModule = aaiObjectMapper.mapVfModule(vfModule);
injectionHelper.getAaiClient().update(vfModuleURI, aaiVfModule);
}
public void connectVfModuleToVolumeGroup(GenericVnf vnf, VfModule vfModule, VolumeGroup volumeGroup,
CloudRegion cloudRegion) {
- AAIResourceUri vfModuleURI =
- AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnf.getVnfId(), vfModule.getVfModuleId());
- AAIResourceUri volumeGroupURI = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP,
- cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId());
+ AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri(
+ AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId()).vfModule(vfModule.getVfModuleId()));
+ AAIResourceUri volumeGroupURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+ .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId())
+ .volumeGroup(volumeGroup.getVolumeGroupId()));
injectionHelper.getAaiClient().connect(vfModuleURI, volumeGroupURI);
}
public boolean checkNameInUse(VfModule vfModule) {
boolean nameInUse = false;
- AAIPluralResourceUri vfModuleUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VF_MODULE)
+ AAIPluralResourceUri vfModuleUri = AAIUriFactory.createNodesUri(Types.VF_MODULES.getFragment())
.queryParam("vf-module-name", vfModule.getVfModuleName());
AAIPluralResourceUri vfModuleUriWithCustomization = vfModuleUri.clone().queryParam("model-customization-id",
vfModule.getModelInfoVfModule().getModelCustomizationUUID());
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java
index c2e84f668c..2f48b1f2f5 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java
@@ -25,22 +25,22 @@ package org.onap.so.client.orchestration;
import java.io.IOException;
import java.util.Optional;
import org.onap.aai.domain.yang.Vserver;
-import org.onap.so.bpmn.common.InjectionHelper;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
-import org.onap.aaiclient.client.aai.AAIObjectPlurals;
-import org.onap.aaiclient.client.aai.AAIObjectType;
import org.onap.aaiclient.client.aai.AAIRestClientImpl;
import org.onap.aaiclient.client.aai.AAIValidatorImpl;
import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
-import org.onap.so.client.aai.mapper.AAIObjectMapper;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
import org.onap.aaiclient.client.graphinventory.entities.uri.Depth;
+import org.onap.so.bpmn.common.InjectionHelper;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.client.aai.mapper.AAIObjectMapper;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -57,37 +57,42 @@ public class AAIVnfResources {
private AAIValidatorImpl aaiValidatorImpl = new AAIValidatorImpl();
public void createVnfandConnectServiceInstance(GenericVnf vnf, ServiceInstance serviceInstance) {
- AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId());
+ AAIResourceUri vnfURI =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId()));
vnf.setOrchestrationStatus(OrchestrationStatus.INVENTORIED);
- AAIResourceUri serviceInstanceURI =
- AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance.getServiceInstanceId());
+ AAIResourceUri serviceInstanceURI = AAIUriFactory
+ .createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance.getServiceInstanceId()));
injectionHelper.getAaiClient().createIfNotExists(vnfURI, Optional.of(aaiObjectMapper.mapVnf(vnf)))
.connect(vnfURI, serviceInstanceURI);
}
public void createPlatformandConnectVnf(Platform platform, GenericVnf vnf) {
AAIResourceUri platformURI =
- AAIUriFactory.createResourceUri(AAIObjectType.PLATFORM, platform.getPlatformName());
- AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId());
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().platform(platform.getPlatformName()));
+ AAIResourceUri vnfURI =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId()));
injectionHelper.getAaiClient().createIfNotExists(platformURI, Optional.of(platform)).connect(vnfURI,
platformURI);
}
public void createLineOfBusinessandConnectVnf(LineOfBusiness lineOfBusiness, GenericVnf vnf) {
- AAIResourceUri lineOfBusinessURI =
- AAIUriFactory.createResourceUri(AAIObjectType.LINE_OF_BUSINESS, lineOfBusiness.getLineOfBusinessName());
- AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId());
+ AAIResourceUri lineOfBusinessURI = AAIUriFactory.createResourceUri(
+ AAIFluentTypeBuilder.business().lineOfBusiness(lineOfBusiness.getLineOfBusinessName()));
+ AAIResourceUri vnfURI =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId()));
injectionHelper.getAaiClient().createIfNotExists(lineOfBusinessURI, Optional.of(lineOfBusiness)).connect(vnfURI,
lineOfBusinessURI);
}
public void deleteVnf(GenericVnf vnf) {
- AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId());
+ AAIResourceUri vnfURI =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId()));
injectionHelper.getAaiClient().delete(vnfURI);
}
public void updateOrchestrationStatusVnf(GenericVnf vnf, OrchestrationStatus orchestrationStatus) {
- AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId());
+ AAIResourceUri vnfURI =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId()));
GenericVnf copiedVnf = vnf.shallowCopyId();
@@ -97,7 +102,8 @@ public class AAIVnfResources {
}
public void updateObjectVnf(GenericVnf vnf) {
- AAIResourceUri vnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId());
+ AAIResourceUri vnfUri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId()));
injectionHelper.getAaiClient().update(vnfUri, aaiObjectMapper.mapVnf(vnf));
}
@@ -109,7 +115,7 @@ public class AAIVnfResources {
*/
public Optional<org.onap.aai.domain.yang.GenericVnf> getGenericVnf(String vnfId) {
return injectionHelper.getAaiClient().get(org.onap.aai.domain.yang.GenericVnf.class,
- AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId));
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)));
}
/**
@@ -121,29 +127,32 @@ public class AAIVnfResources {
public boolean checkInMaintFlag(String vnfId) {
org.onap.aai.domain.yang.GenericVnf vnf = injectionHelper.getAaiClient()
.get(org.onap.aai.domain.yang.GenericVnf.class,
- AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId))
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)))
.orElse(new org.onap.aai.domain.yang.GenericVnf());
return vnf.isInMaint();
}
public void connectVnfToCloudRegion(GenericVnf vnf, CloudRegion cloudRegion) {
- AAIResourceUri cloudRegionURI = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION,
- cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId());
- AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId());
+ AAIResourceUri cloudRegionURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+ .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId()));
+ AAIResourceUri vnfURI =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId()));
injectionHelper.getAaiClient().connect(vnfURI, cloudRegionURI);
}
public void connectVnfToTenant(GenericVnf vnf, CloudRegion cloudRegion) {
- AAIResourceUri tenantURI = AAIUriFactory.createResourceUri(AAIObjectType.TENANT, cloudRegion.getCloudOwner(),
- cloudRegion.getLcpCloudRegionId(), cloudRegion.getTenantId());
- AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId());
+ AAIResourceUri tenantURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+ .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId())
+ .tenant(cloudRegion.getTenantId()));
+ AAIResourceUri vnfURI =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId()));
injectionHelper.getAaiClient().connect(tenantURI, vnfURI);
}
public boolean checkVnfClosedLoopDisabledFlag(String vnfId) {
org.onap.aai.domain.yang.GenericVnf vnf = injectionHelper.getAaiClient()
.get(org.onap.aai.domain.yang.GenericVnf.class,
- AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId))
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)))
.orElse(new org.onap.aai.domain.yang.GenericVnf());
return vnf.isIsClosedLoopDisabled();
}
@@ -151,7 +160,7 @@ public class AAIVnfResources {
public boolean checkVnfPserversLockedFlag(String vnfId) throws IOException {
org.onap.aai.domain.yang.GenericVnf vnf = injectionHelper.getAaiClient()
.get(org.onap.aai.domain.yang.GenericVnf.class,
- AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId))
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)))
.orElse(new org.onap.aai.domain.yang.GenericVnf());
AAIRestClientImpl client = new AAIRestClientImpl();
aaiValidatorImpl.setClient(client);
@@ -160,14 +169,14 @@ public class AAIVnfResources {
}
public boolean checkNameInUse(String vnfName) {
- AAIPluralResourceUri vnfUri =
- AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName);
+ AAIPluralResourceUri vnfUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnfs())
+ .queryParam("vnf-name", vnfName);
return injectionHelper.getAaiClient().exists(vnfUri);
}
public AAIResultWrapper queryVnfWrapperById(GenericVnf vnf) {
- AAIResourceUri uri =
- AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId()).depth(Depth.ALL);
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId()))
+ .depth(Depth.ALL);
return injectionHelper.getAaiClient().get(uri);
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.java
index 886dafe626..1fbfe8cab0 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.java
@@ -22,15 +22,15 @@
package org.onap.so.client.orchestration;
+import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
+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.bpmn.common.InjectionHelper;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
-import org.onap.aaiclient.client.aai.AAIObjectPlurals;
-import org.onap.aaiclient.client.aai.AAIObjectType;
-import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
-import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
-import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.aai.mapper.AAIObjectMapper;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
import org.springframework.beans.factory.annotation.Autowired;
@@ -46,16 +46,18 @@ public class AAIVolumeGroupResources {
private AAIObjectMapper aaiObjectMapper;
public void createVolumeGroup(VolumeGroup volumeGroup, CloudRegion cloudRegion) {
- AAIResourceUri uriVolumeGroup = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP,
- cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId());
+ AAIResourceUri uriVolumeGroup = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+ .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId())
+ .volumeGroup(volumeGroup.getVolumeGroupId()));
volumeGroup.setOrchestrationStatus(OrchestrationStatus.ASSIGNED);
injectionHelper.getAaiClient().create(uriVolumeGroup, aaiObjectMapper.mapVolumeGroup(volumeGroup));
}
public void updateOrchestrationStatusVolumeGroup(VolumeGroup volumeGroup, CloudRegion cloudRegion,
OrchestrationStatus orchestrationStatus) {
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, cloudRegion.getCloudOwner(),
- cloudRegion.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId());
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+ .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId())
+ .volumeGroup(volumeGroup.getVolumeGroupId()));
VolumeGroup copiedVolumeGroup = volumeGroup.shallowCopyId();
volumeGroup.setOrchestrationStatus(orchestrationStatus);
@@ -65,29 +67,34 @@ public class AAIVolumeGroupResources {
public void connectVolumeGroupToVnf(GenericVnf genericVnf, VolumeGroup volumeGroup, CloudRegion cloudRegion) {
AAIResourceUri uriGenericVnf =
- AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, genericVnf.getVnfId());
- AAIResourceUri uriVolumeGroup = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP,
- cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId());
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(genericVnf.getVnfId()));
+ AAIResourceUri uriVolumeGroup = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+ .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId())
+ .volumeGroup(volumeGroup.getVolumeGroupId()));
injectionHelper.getAaiClient().connect(uriGenericVnf, uriVolumeGroup);
}
public void connectVolumeGroupToTenant(VolumeGroup volumeGroup, CloudRegion cloudRegion) {
- AAIResourceUri uriTenant = AAIUriFactory.createResourceUri(AAIObjectType.TENANT, cloudRegion.getCloudOwner(),
- cloudRegion.getLcpCloudRegionId(), cloudRegion.getTenantId());
- AAIResourceUri uriVolumeGroup = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP,
- cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId());
+ AAIResourceUri uriTenant = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+ .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId())
+ .tenant(cloudRegion.getTenantId()));
+ AAIResourceUri uriVolumeGroup = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+ .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId())
+ .volumeGroup(volumeGroup.getVolumeGroupId()));
injectionHelper.getAaiClient().connect(uriTenant, uriVolumeGroup);
}
public void deleteVolumeGroup(VolumeGroup volumeGroup, CloudRegion cloudRegion) {
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, cloudRegion.getCloudOwner(),
- cloudRegion.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId());
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+ .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId())
+ .volumeGroup(volumeGroup.getVolumeGroupId()));
injectionHelper.getAaiClient().delete(uri);
}
public void updateHeatStackIdVolumeGroup(VolumeGroup volumeGroup, CloudRegion cloudRegion) {
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, cloudRegion.getCloudOwner(),
- cloudRegion.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId());
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+ .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId())
+ .volumeGroup(volumeGroup.getVolumeGroupId()));
VolumeGroup copiedVolumeGroup = volumeGroup.shallowCopyId();
copiedVolumeGroup.setHeatStackId(volumeGroup.getHeatStackId());
@@ -95,7 +102,7 @@ public class AAIVolumeGroupResources {
}
public boolean checkNameInUse(VolumeGroup volumeGroup) {
- AAIPluralResourceUri volumeGroupUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VOLUME_GROUP)
+ AAIPluralResourceUri volumeGroupUri = AAIUriFactory.createNodesUri(Types.VOLUME_GROUPS.getFragment())
.queryParam("volume-group-name", volumeGroup.getVolumeGroupName());
return injectionHelper.getAaiClient().exists(volumeGroupUri);
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVpnBindingResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVpnBindingResources.java
index 5ce8268d55..5200be9d65 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVpnBindingResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVpnBindingResources.java
@@ -22,14 +22,13 @@ package org.onap.so.client.orchestration;
import java.util.Optional;
import org.onap.aai.domain.yang.VpnBindings;
-import org.onap.so.bpmn.common.InjectionHelper;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding;
-import org.onap.aaiclient.client.aai.AAIObjectPlurals;
-import org.onap.aaiclient.client.aai.AAIObjectType;
import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
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.so.bpmn.common.InjectionHelper;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding;
import org.onap.so.client.aai.mapper.AAIObjectMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -46,8 +45,8 @@ public class AAIVpnBindingResources {
* @param customer
*/
public boolean existsCustomer(Customer customer) {
- AAIResourceUri uriCustomer =
- AAIUriFactory.createResourceUri(AAIObjectType.CUSTOMER, customer.getGlobalCustomerId());
+ AAIResourceUri uriCustomer = AAIUriFactory
+ .createResourceUri(AAIFluentTypeBuilder.business().customer(customer.getGlobalCustomerId()));
return injectionHelper.getAaiClient().exists(uriCustomer);
}
@@ -56,8 +55,9 @@ public class AAIVpnBindingResources {
* @return
*/
public Optional<VpnBindings> getVpnBindingByCustomerVpnId(String customerVpnId) {
- AAIPluralResourceUri aaiVpnBindingsResourceUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VPN_BINDING)
- .queryParam("customer-vpn-id", customerVpnId);
+ AAIPluralResourceUri aaiVpnBindingsResourceUri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().vpnBindings())
+ .queryParam("customer-vpn-id", customerVpnId);
return injectionHelper.getAaiClient().get(VpnBindings.class, aaiVpnBindingsResourceUri);
}
@@ -67,7 +67,7 @@ public class AAIVpnBindingResources {
*/
public void createVpnBinding(VpnBinding vpnBinding) {
AAIResourceUri aaiVpnBindingResourceUri =
- AAIUriFactory.createResourceUri(AAIObjectType.VPN_BINDING, vpnBinding.getVpnId());
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().vpnBinding(vpnBinding.getVpnId()));
injectionHelper.getAaiClient().create(aaiVpnBindingResourceUri, aaiObjectMapper.mapVpnBinding(vpnBinding));
}
@@ -75,8 +75,8 @@ public class AAIVpnBindingResources {
* @param customer
*/
public void createCustomer(Customer customer) {
- AAIResourceUri uriCustomer =
- AAIUriFactory.createResourceUri(AAIObjectType.CUSTOMER, customer.getGlobalCustomerId());
+ AAIResourceUri uriCustomer = AAIUriFactory
+ .createResourceUri(AAIFluentTypeBuilder.business().customer(customer.getGlobalCustomerId()));
injectionHelper.getAaiClient().create(uriCustomer, aaiObjectMapper.mapCustomer(customer));
}
@@ -88,7 +88,7 @@ public class AAIVpnBindingResources {
*/
public Optional<org.onap.aai.domain.yang.VpnBinding> getVpnBinding(String vpnId) {
return injectionHelper.getAaiClient().get(org.onap.aai.domain.yang.VpnBinding.class,
- AAIUriFactory.createResourceUri(AAIObjectType.VPN_BINDING, vpnId));
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().vpnBinding(vpnId)));
}
@@ -97,8 +97,10 @@ public class AAIVpnBindingResources {
* @param vpnId
*/
public void connectCustomerToVpnBinding(String globalSubscriberId, String vpnId) {
- AAIResourceUri customerURI = AAIUriFactory.createResourceUri(AAIObjectType.CUSTOMER, globalSubscriberId);
- AAIResourceUri vpnBindingURI = AAIUriFactory.createResourceUri(AAIObjectType.VPN_BINDING, vpnId);
+ AAIResourceUri customerURI =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId));
+ AAIResourceUri vpnBindingURI =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().vpnBinding(vpnId));
injectionHelper.getAaiClient().connect(customerURI, vpnBindingURI);
}
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSControllerRunnableBBTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSControllerRunnableBBTest.java
index d6a28cba25..1cba35dc74 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSControllerRunnableBBTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSControllerRunnableBBTest.java
@@ -29,16 +29,31 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
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.generalobjects.RequestContext;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters;
import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoPnf;
import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance;
import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.cds.ConfigureInstanceParamsForPnf;
import org.onap.so.client.cds.beans.AbstractCDSPropertiesBean;
import org.onap.so.client.exception.BBObjectNotFoundException;
+import org.onap.so.client.exception.PayloadGenerationException;
+import org.onap.so.serviceinstancebeans.Service;
+import org.onap.so.serviceinstancebeans.Pnfs;
+import org.onap.so.serviceinstancebeans.Resources;
+import org.onap.so.serviceinstancebeans.ModelInfo;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.when;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.EXECUTION_OBJECT;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.MSO_REQUEST_ID;
@@ -51,6 +66,8 @@ public class GenericPnfCDSControllerRunnableBBTest {
@Mock
private ExtractPojosForBB extractPojosForBB;
+ @Mock
+ private ConfigureInstanceParamsForPnf configureInstanceParamsForPnf;
@InjectMocks
private GenericPnfCDSControllerRunnableBB genericPnfCDSControllerRunnableBB;
@@ -67,6 +84,7 @@ public class GenericPnfCDSControllerRunnableBBTest {
private final static String serviceModelUUID = "6bc0b04d-1873-4721-b53d-6615225b2a28";
private final static String pnfCustomizationUUID = "9acb3a83-8a52-412c-9a45-901764938144";
private final static String action = "action";
+ private static final String GENERAL_BLOCK_EXECUTION_MAP_KEY = "gBBInput";
@Before
public void setUp() {
@@ -104,7 +122,7 @@ public class GenericPnfCDSControllerRunnableBBTest {
}
@Test
- public void prepareTest() throws BBObjectNotFoundException {
+ public void prepareTest() throws BBObjectNotFoundException, PayloadGenerationException {
// given
prepareData();
@@ -119,6 +137,7 @@ public class GenericPnfCDSControllerRunnableBBTest {
assertThat(abstractCDSPropertiesBean).isNotNull();
assertThat(abstractCDSPropertiesBean.getRequestObject()).isNotNull();
assertThat(abstractCDSPropertiesBean.getRequestObject()).isInstanceOf(String.class);
+ assertThat(execution.getGeneralBuildingBlock()).isNotNull();
assertEquals(blueprintName, abstractCDSPropertiesBean.getBlueprintName());
assertEquals(blueprintVersion, abstractCDSPropertiesBean.getBlueprintVersion());
@@ -134,7 +153,7 @@ public class GenericPnfCDSControllerRunnableBBTest {
assertEquals(pnfCustomizationUUID, actionProperties.get("pnf-customization-uuid"));
}
- private void prepareData() throws BBObjectNotFoundException {
+ private void prepareData() throws BBObjectNotFoundException, PayloadGenerationException {
Pnf pnf = new Pnf();
ServiceInstance serviceInstance = new ServiceInstance();
@@ -149,8 +168,62 @@ public class GenericPnfCDSControllerRunnableBBTest {
modelInfoServiceInstance.setModelUuid(serviceModelUUID);
serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance);
+ execution.setVariable(GENERAL_BLOCK_EXECUTION_MAP_KEY,
+ createGeneralBuildingBlock(createService(createPnfsList())));
when(extractPojosForBB.extractByKey(eq(execution), eq(ResourceKey.PNF))).thenReturn(pnf);
when(extractPojosForBB.extractByKey(eq(execution), eq(ResourceKey.SERVICE_INSTANCE_ID)))
.thenReturn(serviceInstance);
+ doNothing().when(configureInstanceParamsForPnf).populateInstanceParams(any(), any(), any());
+ }
+
+ private Service createService(List<Pnfs> pnfList) {
+ Service service = new Service();
+ Resources resources = new Resources();
+ resources.setPnfs(pnfList);
+ service.setResources(resources);
+ return service;
+ }
+
+ private GeneralBuildingBlock createGeneralBuildingBlock(Object serviceJson) {
+ GeneralBuildingBlock generalBuildingBlock = new GeneralBuildingBlock();
+ RequestContext requestContext = new RequestContext();
+ RequestParameters requestParameters = new RequestParameters();
+ requestParameters.setUserParams(createRequestUserParams(serviceJson));
+ requestContext.setRequestParameters(requestParameters);
+ generalBuildingBlock.setRequestContext(requestContext);
+ return generalBuildingBlock;
+ }
+
+ private List<Map<String, Object>> createRequestUserParams(Object serviceJson) {
+ List<Map<String, Object>> userParams = new ArrayList<>();
+ Map<String, Object> userParamMap = new HashMap<>();
+ userParamMap.put("service", serviceJson);
+ userParams.add(userParamMap);
+ return userParams;
+ }
+
+ private List<Pnfs> createPnfsList() {
+ List<Map<String, String>> instanceParamsListSearchedPnf = new ArrayList<>();
+ Map<String, String> instanceParam = new HashMap<>();
+ instanceParam.put("INSTANCE_PARAM1_NAME", "INSTANCE_PARAM1_VALUE");
+ instanceParam.put("INSTANCE_PARAM2_NAME", "INSTANCE_PARAM2_VALUE");
+ Map<String, String> instanceParam2 = new HashMap<>();
+ instanceParam2.put("INSTANCE_PARAM3_NAME", "INSTANCE_PARAM3_VALUE");
+ instanceParamsListSearchedPnf.add(instanceParam);
+ instanceParamsListSearchedPnf.add(instanceParam2);
+ Pnfs searchedPnf = createPnfs("0c1ac643-377e-475b-be50-6be65f91a7ad", instanceParamsListSearchedPnf);
+
+ List<Pnfs> pnfList = new ArrayList<>();
+ pnfList.add(searchedPnf);
+ return pnfList;
+ }
+
+ private Pnfs createPnfs(String pnfModelCustomizationId, List<Map<String, String>> instanceParamsList) {
+ Pnfs pnfs = new Pnfs();
+ ModelInfo modelInfo = new ModelInfo();
+ modelInfo.setModelCustomizationUuid(pnfModelCustomizationId);
+ pnfs.setModelInfo(modelInfo);
+ pnfs.setInstanceParams(instanceParamsList);
+ return pnfs;
}
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/service/level/impl/ServiceLevelUpgradeTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/service/level/impl/ServiceLevelUpgradeTest.java
new file mode 100644
index 0000000000..67f08f7108
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/service/level/impl/ServiceLevelUpgradeTest.java
@@ -0,0 +1,66 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Nokia
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.service.level.impl;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
+import org.junit.Test;
+
+public class ServiceLevelUpgradeTest {
+
+ @Test
+ public void ServiceLevelUpgradeWithPnf() throws Exception {
+ // given
+ ServiceLevelUpgrade testedObject = new ServiceLevelUpgrade();
+ DelegateExecution execution = prepareExecution();
+ execution.setVariable(ServiceLevelConstants.RESOURCE_TYPE, "pnf");
+ // when
+ testedObject.execute(execution);
+ // then
+ assertThat(execution.getVariable(ServiceLevelConstants.SOFTWARE_WORKFLOW_TO_INVOKE))
+ .isEqualTo("GenericPnfSoftwareUpgrade");
+ assertThat(execution.getVariable(ServiceLevelConstants.CONTROLLER_STATUS)).isEqualTo("");
+ }
+
+ @Test
+ public void ServiceLevelUpgradeWithVnf() throws Exception {
+ // given
+ ServiceLevelUpgrade testedObject = new ServiceLevelUpgrade();
+ DelegateExecution execution = prepareExecution();
+ execution.setVariable(ServiceLevelConstants.RESOURCE_TYPE, "vnf");
+ // when
+ testedObject.execute(execution);
+ // then
+ assertThat(execution.getVariable(ServiceLevelConstants.SOFTWARE_WORKFLOW_TO_INVOKE))
+ .isEqualTo("GenericVnfSoftwareUpgrade");
+ assertThat(execution.getVariable(ServiceLevelConstants.CONTROLLER_STATUS)).isEqualTo("");
+ }
+
+ private DelegateExecution prepareExecution() {
+ DelegateExecution execution = new DelegateExecutionFake();
+ execution.setVariable(ServiceLevelConstants.SERVICE_INSTANCE_ID, "serviceTest");
+ execution.setVariable(ServiceLevelConstants.BPMN_REQUEST, "bpmnRequestTest");
+ execution.setVariable(ServiceLevelConstants.PNF_NAME, "pnfNameTest");
+ return execution;
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/vfmodule/DeleteVfModuleTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/vfmodule/DeleteVfModuleTest.java
new file mode 100644
index 0000000000..60a0bf12d9
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/vfmodule/DeleteVfModuleTest.java
@@ -0,0 +1,125 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Nokia
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.vfmodule;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.when;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
+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.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Tenant;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
+import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.exception.BBObjectNotFoundException;
+import org.onap.so.cloud.resource.beans.CloudInformation;
+
+@RunWith(MockitoJUnitRunner.class)
+public class DeleteVfModuleTest {
+
+ private static final String VF_MODULE_ID = "vfModuleIdTest";
+ private static final String HEAT_STACK_ID = "hsId";
+ private static final String VNF_ID = "vnfId";
+ private static final String VNF_NAME = "vnfName";
+
+ private static final String CLOUD_OWNER = "cloudOwTest";
+ private static final String LCP_CLOUD_REGION_ID = "lcpClRegTest";
+ private static final String TENANT_ID = "tenantIdTest";
+ private static final String TENANT_NAME = "tenantNameTest";
+ private static final String TENANT_CONTEXT = "tenantContext";
+
+ @Mock
+ private ExtractPojosForBB extractPojosForBB;
+
+ @InjectMocks
+ private DeleteVFModule testedObject;
+
+ @Test
+ public void createInventoryVariable_Success() throws BBObjectNotFoundException {
+ // given
+ BuildingBlockExecution buildingBlockExecution = prepareBuildingBlockExecution();
+ when(extractPojosForBB.extractByKey(buildingBlockExecution, ResourceKey.VF_MODULE_ID))
+ .thenReturn(prepareVmModule());
+ when(extractPojosForBB.extractByKey(buildingBlockExecution, ResourceKey.GENERIC_VNF_ID))
+ .thenReturn(prepareGenericVnf());
+ // when
+ testedObject.createInventoryVariable(buildingBlockExecution);
+ // then
+ verifyExecution(buildingBlockExecution);
+ }
+
+ private void verifyExecution(BuildingBlockExecution buildingBlockExecution) {
+ CloudInformation cloudInformation = buildingBlockExecution.getVariable("cloudInformation");
+ assertThat(cloudInformation.getOwner()).isEqualTo(CLOUD_OWNER);
+ assertThat(cloudInformation.getRegionId()).isEqualTo(LCP_CLOUD_REGION_ID);
+ assertThat(cloudInformation.getTenantId()).isEqualTo(TENANT_ID);
+ assertThat(cloudInformation.getTenantName()).isEqualTo(TENANT_NAME);
+ assertThat(cloudInformation.getTenantContext()).isEqualTo(TENANT_CONTEXT);
+ assertThat(cloudInformation.getTemplateInstanceId()).isEqualTo(HEAT_STACK_ID);
+
+ assertThat(cloudInformation.getVnfId()).isEqualTo(VNF_ID);
+ assertThat(cloudInformation.getVnfName()).isEqualTo(VNF_NAME);
+ assertThat(cloudInformation.getVfModuleId()).isEqualTo(VF_MODULE_ID);
+ }
+
+ private BuildingBlockExecution prepareBuildingBlockExecution() {
+ DelegateExecution execution = new DelegateExecutionFake();
+ execution.setVariable("gBBInput", prepareGeneralBuildingBlock());
+ return new DelegateExecutionImpl(execution);
+ }
+
+ private GeneralBuildingBlock prepareGeneralBuildingBlock() {
+ GeneralBuildingBlock generalBuildingBlock = new GeneralBuildingBlock();
+ CloudRegion cloudRegion = new CloudRegion();
+ cloudRegion.setCloudOwner(CLOUD_OWNER);
+ cloudRegion.setLcpCloudRegionId(LCP_CLOUD_REGION_ID);
+ generalBuildingBlock.setCloudRegion(cloudRegion);
+ Tenant tenant = new Tenant();
+ tenant.setTenantId(TENANT_ID);
+ tenant.setTenantName(TENANT_NAME);
+ tenant.setTenantContext(TENANT_CONTEXT);
+ generalBuildingBlock.setTenant(tenant);
+ return generalBuildingBlock;
+ }
+
+ private VfModule prepareVmModule() {
+ VfModule vfModule = new VfModule();
+ vfModule.setVfModuleId(VF_MODULE_ID);
+ vfModule.setHeatStackId(HEAT_STACK_ID);
+ return vfModule;
+ }
+
+ private GenericVnf prepareGenericVnf() {
+ GenericVnf genericVnf = new GenericVnf();
+ genericVnf.setVnfId(VNF_ID);
+ genericVnf.setVnfName(VNF_NAME);
+ return genericVnf;
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/VrfValidationTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/VrfValidationTest.java
index d9fb7f676c..7f9f0417ea 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/VrfValidationTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/VrfValidationTest.java
@@ -41,10 +41,10 @@ import org.onap.aai.domain.yang.RouteTargets;
import org.onap.aai.domain.yang.Subnet;
import org.onap.aai.domain.yang.Subnets;
import org.onap.aai.domain.yang.VpnBinding;
-import org.onap.so.bpmn.BaseTaskTest;
-import org.onap.aaiclient.client.aai.AAIObjectType;
import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
+import org.onap.so.bpmn.BaseTaskTest;
import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization;
import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.beans.ServiceProxyResourceCustomization;
@@ -205,7 +205,7 @@ public class VrfValidationTest extends BaseTaskTest {
AAIResultWrapper networkWrapper = new AAIResultWrapper(l3Network);
if (networkWrapper.getRelationships().isPresent()) {
List<AAIResourceUri> vpnBindingUris =
- networkWrapper.getRelationships().get().getRelatedUris(AAIObjectType.VPN_BINDING);
+ networkWrapper.getRelationships().get().getRelatedUris(Types.VPN_BINDING);
VpnBinding vpnBinding = new VpnBinding();
vpnBinding.setRouteTargets(new RouteTargets());
vpnBinding.getRouteTargets().getRouteTarget().add(new RouteTarget());
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
index c1970ec32c..53d1bea1f2 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
@@ -39,7 +39,6 @@ import static org.mockito.ArgumentMatchers.anyObject;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.ArgumentMatchers.isA;
-import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.when;
@@ -78,12 +77,12 @@ import org.onap.aai.domain.yang.ServiceInstances;
import org.onap.aai.domain.yang.VfModule;
import org.onap.aai.domain.yang.VfModules;
import org.onap.aai.domain.yang.VolumeGroup;
-import org.onap.aaiclient.client.aai.AAIObjectType;
import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
import org.onap.aaiclient.client.aai.entities.Relationships;
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.bpmn.BaseTaskTest;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
@@ -1584,11 +1583,11 @@ public class WorkflowActionTest extends BaseTaskTest {
when(bbSetupUtils.getAAIVfModule(any(), any())).thenReturn(vfModule);
doReturn(vnfcs).when(SPY_workflowAction).getRelatedResourcesInVfModule(any(), any(),
- eq(org.onap.aai.domain.yang.Vnfc.class), eq(AAIObjectType.VNFC));
+ eq(org.onap.aai.domain.yang.Vnfc.class), eq(Types.VNFC));
doReturn(config1).when(SPY_workflowAction).getRelatedResourcesInVnfc(eq(vnfc1),
- eq(org.onap.aai.domain.yang.Configuration.class), eq(AAIObjectType.CONFIGURATION));
+ eq(org.onap.aai.domain.yang.Configuration.class), eq(Types.CONFIGURATION));
doReturn(config2).when(SPY_workflowAction).getRelatedResourcesInVnfc(eq(vnfc2),
- eq(org.onap.aai.domain.yang.Configuration.class), eq(AAIObjectType.CONFIGURATION));
+ eq(org.onap.aai.domain.yang.Configuration.class), eq(Types.CONFIGURATION));
List<ExecuteBuildingBlock> results = SPY_workflowAction.getConfigBuildingBlocks(dataObj);
@@ -1659,11 +1658,11 @@ public class WorkflowActionTest extends BaseTaskTest {
when(bbSetupUtils.getAAIVfModule(any(), any())).thenReturn(vfModule);
doReturn(vnfcs).when(SPY_workflowAction).getRelatedResourcesInVfModule(any(), any(),
- eq(org.onap.aai.domain.yang.Vnfc.class), eq(AAIObjectType.VNFC));
+ eq(org.onap.aai.domain.yang.Vnfc.class), eq(Types.VNFC));
doReturn(config1).when(SPY_workflowAction).getRelatedResourcesInVnfc(eq(vnfc1),
- eq(org.onap.aai.domain.yang.Configuration.class), eq(AAIObjectType.CONFIGURATION));
+ eq(org.onap.aai.domain.yang.Configuration.class), eq(Types.CONFIGURATION));
doReturn(config2).when(SPY_workflowAction).getRelatedResourcesInVnfc(eq(vnfc2),
- eq(org.onap.aai.domain.yang.Configuration.class), eq(AAIObjectType.CONFIGURATION));
+ eq(org.onap.aai.domain.yang.Configuration.class), eq(Types.CONFIGURATION));
List<ExecuteBuildingBlock> results = SPY_workflowAction.getConfigBuildingBlocks(dataObj);
@@ -1763,13 +1762,13 @@ public class WorkflowActionTest extends BaseTaskTest {
List<AAIResultWrapper> configurationResultWrappers = new ArrayList<AAIResultWrapper>();
configurationResultWrappers.add(configurationWrapper);
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VNFC, vnfc.getVnfcName());
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().vnfc(vnfc.getVnfcName()));
when(bbSetupUtils.getAAIResourceDepthOne(uri)).thenReturn(vfncWrapper);
doReturn(configurationResultWrappers).when(SPY_workflowAction).getResultWrappersFromRelationships(anyObject(),
anyObject());
org.onap.aai.domain.yang.Configuration configuration = SPY_workflowAction.getRelatedResourcesInVnfc(vnfc,
- org.onap.aai.domain.yang.Configuration.class, AAIObjectType.CONFIGURATION);
+ org.onap.aai.domain.yang.Configuration.class, Types.CONFIGURATION);
assertEquals("testConfigurationId", configuration.getConfigurationId());
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAICollectionResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAICollectionResourcesTest.java
index 2c7ab92438..fcd44e137b 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAICollectionResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAICollectionResourcesTest.java
@@ -28,18 +28,11 @@ import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import org.junit.Before;
import org.junit.Test;
-import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
import org.onap.so.bpmn.BaseTaskTest;
-import org.onap.so.bpmn.common.InjectionHelper;
-import org.onap.so.bpmn.common.data.TestDataSetup;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection;
-import org.onap.aaiclient.client.aai.AAIObjectType;
-import org.onap.aaiclient.client.aai.AAIResourcesClient;
-import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
-import org.onap.so.client.aai.mapper.AAIObjectMapper;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
public class AAICollectionResourcesTest extends BaseTaskTest {
@@ -65,7 +58,8 @@ public class AAICollectionResourcesTest extends BaseTaskTest {
assertEquals(OrchestrationStatus.INVENTORIED, networkCollection.getOrchestrationStatus());
verify(MOCK_aaiResourcesClient, times(1)).create(
- eq(AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, networkCollection.getId())),
+ eq(AAIUriFactory
+ .createResourceUri(AAIFluentTypeBuilder.network().collection(networkCollection.getId()))),
isA(org.onap.aai.domain.yang.Collection.class));
}
@@ -74,15 +68,16 @@ public class AAICollectionResourcesTest extends BaseTaskTest {
doReturn(new org.onap.aai.domain.yang.Collection()).when(MOCK_aaiObjectMapper).mapCollection(networkCollection);
aaiCollectionResources.updateCollection(networkCollection);
verify(MOCK_aaiResourcesClient, times(1)).update(
- eq(AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, networkCollection.getId())),
+ eq(AAIUriFactory
+ .createResourceUri(AAIFluentTypeBuilder.network().collection(networkCollection.getId()))),
isA(org.onap.aai.domain.yang.Collection.class));
}
@Test
public void deleteCollectionTest() throws Exception {
aaiCollectionResources.deleteCollection(networkCollection);
- verify(MOCK_aaiResourcesClient, times(1))
- .delete(eq(AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, networkCollection.getId())));
+ verify(MOCK_aaiResourcesClient, times(1)).delete(eq(
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().collection(networkCollection.getId()))));
}
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java
index 2bf177ef83..11694ff83f 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java
@@ -35,6 +35,11 @@ import org.mockito.ArgumentMatchers;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.aaiclient.client.aai.AAIResourcesClient;
+import org.onap.aaiclient.client.aai.entities.AAIEdgeLabel;
+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.so.bpmn.common.InjectionHelper;
import org.onap.so.bpmn.common.data.TestDataSetup;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
@@ -44,11 +49,6 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceProxy;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding;
-import org.onap.aaiclient.client.aai.AAIObjectType;
-import org.onap.aaiclient.client.aai.AAIResourcesClient;
-import org.onap.aaiclient.client.aai.entities.AAIEdgeLabel;
-import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
-import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.aai.mapper.AAIObjectMapper;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
@@ -204,7 +204,8 @@ public class AAIConfigurationResourcesTest extends TestDataSetup {
@Test
public void getConfigurationTest() {
- AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, "configurationId");
+ AAIResourceUri aaiResourceUri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configuration("configurationId"));
doReturn(Optional.of(new org.onap.aai.domain.yang.Configuration())).when(MOCK_aaiResourcesClient)
.get(org.onap.aai.domain.yang.Configuration.class, aaiResourceUri);
aaiConfigurationResources.getConfiguration("configurationId");
@@ -213,7 +214,8 @@ public class AAIConfigurationResourcesTest extends TestDataSetup {
@Test
public void deleteConfigurationTest() {
- AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, "configurationId");
+ AAIResourceUri aaiResourceUri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configuration("configurationId"));
doNothing().when(MOCK_aaiResourcesClient).delete(aaiResourceUri);
aaiConfigurationResources.deleteConfiguration("configurationId");
verify(MOCK_aaiResourcesClient, times(1)).delete(aaiResourceUri);
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIInstanceGroupResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIInstanceGroupResourcesTest.java
index a73cf81e75..b2978e6e62 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIInstanceGroupResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIInstanceGroupResourcesTest.java
@@ -36,18 +36,17 @@ import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
-import org.onap.so.bpmn.common.InjectionHelper;
-import org.onap.so.bpmn.common.data.TestDataSetup;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
-import org.onap.aaiclient.client.aai.AAIObjectPlurals;
-import org.onap.aaiclient.client.aai.AAIObjectType;
import org.onap.aaiclient.client.aai.AAIResourcesClient;
import org.onap.aaiclient.client.aai.entities.AAIEdgeLabel;
import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
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.so.bpmn.common.InjectionHelper;
+import org.onap.so.bpmn.common.data.TestDataSetup;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.client.aai.mapper.AAIObjectMapper;
@RunWith(MockitoJUnitRunner.Silent.class)
@@ -83,39 +82,42 @@ public class AAIInstanceGroupResourcesTest extends TestDataSetup {
.mapInstanceGroup(instanceGroup);
aaiInstanceGroupResources.createInstanceGroup(instanceGroup);
verify(MOCK_aaiResourcesClient, times(1)).createIfNotExists(
- eq(AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId())),
+ eq(AAIUriFactory
+ .createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId()))),
isA(Optional.class));
}
@Test
public void deleteInstanceGroupTest() throws Exception {
aaiInstanceGroupResources.deleteInstanceGroup(instanceGroup);
- verify(MOCK_aaiResourcesClient, times(1))
- .delete(eq(AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId())));
+ verify(MOCK_aaiResourcesClient, times(1)).delete(eq(
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId()))));
}
@Test
public void connectInstanceGroupTest() throws Exception {
aaiInstanceGroupResources.connectInstanceGroupToVnf(instanceGroup, vnf);
verify(MOCK_aaiResourcesClient, times(1)).connect(
- eq(AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId())),
- eq(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId())));
+ eq(AAIUriFactory
+ .createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId()))),
+ eq(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId()))));
}
@Test
public void connectInstanceGroupWithEdgeTest() throws Exception {
aaiInstanceGroupResources.connectInstanceGroupToVnf(instanceGroup, vnf, AAIEdgeLabel.BELONGS_TO);
verify(MOCK_aaiResourcesClient, times(1)).connect(
- eq(AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId())),
- eq(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId())),
+ eq(AAIUriFactory
+ .createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId()))),
+ eq(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId()))),
eq(AAIEdgeLabel.BELONGS_TO));
}
@Test
public void existsTest() throws Exception {
aaiInstanceGroupResources.exists(instanceGroup);
- verify(MOCK_aaiResourcesClient, times(1))
- .exists(eq(AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId())));
+ verify(MOCK_aaiResourcesClient, times(1)).exists(eq(
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId()))));
}
@Test
@@ -135,7 +137,7 @@ public class AAIInstanceGroupResourcesTest extends TestDataSetup {
@Test
public void checkInstanceGroupNameInUseTrueTest() throws Exception {
- AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.INSTANCE_GROUP)
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroups())
.queryParam("instance-group-name", "instanceGroupName");
doReturn(true).when(MOCK_aaiResourcesClient).exists(eq(uri));
boolean nameInUse = aaiInstanceGroupResources.checkInstanceGroupNameInUse("instanceGroupName");
@@ -144,7 +146,7 @@ public class AAIInstanceGroupResourcesTest extends TestDataSetup {
@Test
public void checkInstanceGroupNameInUseFalseTest() throws Exception {
- AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.INSTANCE_GROUP)
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroups())
.queryParam("instance-group-name", "instanceGroupName");
doReturn(false).when(MOCK_aaiResourcesClient).exists(eq(uri));
boolean nameInUse = aaiInstanceGroupResources.checkInstanceGroupNameInUse("instanceGroupName");
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java
index 3bc4fc0503..535a159e10 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java
@@ -46,6 +46,14 @@ import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.aai.domain.yang.RouteTableReference;
import org.onap.aai.domain.yang.VpnBinding;
+import org.onap.aaiclient.client.aai.AAIResourcesClient;
+import org.onap.aaiclient.client.aai.entities.AAIEdgeLabel;
+import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
+import org.onap.aaiclient.client.aai.entities.Relationships;
+import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
+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.so.bpmn.common.InjectionHelper;
import org.onap.so.bpmn.common.data.TestDataSetup;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
@@ -55,15 +63,6 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
import org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet;
-import org.onap.aaiclient.client.aai.AAIObjectPlurals;
-import org.onap.aaiclient.client.aai.AAIObjectType;
-import org.onap.aaiclient.client.aai.AAIResourcesClient;
-import org.onap.aaiclient.client.aai.entities.AAIEdgeLabel;
-import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
-import org.onap.aaiclient.client.aai.entities.Relationships;
-import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
-import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
-import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.aai.mapper.AAIObjectMapper;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
@@ -167,7 +166,8 @@ public class AAINetworkResourcesTest extends TestDataSetup {
new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "queryAaiVpnBinding.json")));
AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(content);
Optional<VpnBinding> oVpnBinding = Optional.empty();
- AAIResourceUri aaiUri = AAIUriFactory.createResourceUri(AAIObjectType.VPN_BINDING, "ModelInvariantUUID");
+ AAIResourceUri aaiUri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().vpnBinding("ModelInvariantUUID"));
doReturn(aaiResultWrapper).when(MOCK_aaiResourcesClient).get(isA(AAIResourceUri.class));
oVpnBinding = aaiNetworkResources.getVpnBinding(aaiUri);
@@ -186,7 +186,7 @@ public class AAINetworkResourcesTest extends TestDataSetup {
AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(content);
Optional<org.onap.aai.domain.yang.NetworkPolicy> oNetPolicy = Optional.empty();
AAIResourceUri netPolicyUri =
- AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, "ModelInvariantUUID");
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicy("ModelInvariantUUID"));
doReturn(aaiResultWrapper).when(MOCK_aaiResourcesClient).get(isA(AAIResourceUri.class));
oNetPolicy = aaiNetworkResources.getNetworkPolicy(netPolicyUri);
@@ -204,7 +204,8 @@ public class AAINetworkResourcesTest extends TestDataSetup {
new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "queryAaiNetworkPolicies.json")));
AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(content);
Optional<org.onap.aai.domain.yang.NetworkPolicies> oNetPolicies = Optional.empty();
- AAIPluralResourceUri netPoliciesUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY);
+ AAIPluralResourceUri netPoliciesUri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicies());
doReturn(aaiResultWrapper).when(MOCK_aaiResourcesClient).get(isA(AAIPluralResourceUri.class));
oNetPolicies = aaiNetworkResources.getNetworkPolicies(netPoliciesUri);
@@ -222,8 +223,8 @@ public class AAINetworkResourcesTest extends TestDataSetup {
new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "queryAaiNetworkTableRefs.json")));
AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(content);
Optional<RouteTableReference> oRtref = Optional.empty();
- AAIResourceUri rTRefUri =
- AAIUriFactory.createResourceUri(AAIObjectType.ROUTE_TABLE_REFERENCE, "ModelInvariantUUID");
+ AAIResourceUri rTRefUri = AAIUriFactory
+ .createResourceUri(AAIFluentTypeBuilder.network().routeTableReference("ModelInvariantUUID"));
doReturn(aaiResultWrapper).when(MOCK_aaiResourcesClient).get(isA(AAIResourceUri.class));
oRtref = aaiNetworkResources.getRouteTable(rTRefUri);
@@ -310,41 +311,45 @@ public class AAINetworkResourcesTest extends TestDataSetup {
public void connectNetworkToNetworkCollectionInstanceGroupTest() throws Exception {
aaiNetworkResources.connectNetworkToNetworkCollectionInstanceGroup(network, instanceGroup);
verify(MOCK_aaiResourcesClient, times(1)).connect(
- eq(AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId())),
- eq(AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, network.getNetworkId())));
+ eq(AAIUriFactory
+ .createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId()))),
+ eq(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(network.getNetworkId()))));
}
@Test
public void connectNetworkToNetworkCollectionServiceInstanceTest() throws Exception {
aaiNetworkResources.connectNetworkToNetworkCollectionServiceInstance(network, serviceInstance);
verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class),
- eq(AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, network.getNetworkId())));
+ eq(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(network.getNetworkId()))));
}
@Test
public void connectNetworkToCloudRegionTest() throws Exception {
aaiNetworkResources.connectNetworkToCloudRegion(network, cloudRegion);
verify(MOCK_aaiResourcesClient, times(1)).connect(
- eq(AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, network.getNetworkId())),
- eq(AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, cloudRegion.getCloudOwner(),
- cloudRegion.getLcpCloudRegionId())));
+ eq(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(network.getNetworkId()))),
+ eq(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+ .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId()))));
}
@Test
public void connectNetworkToTenantTest() throws Exception {
aaiNetworkResources.connectNetworkToTenant(network, cloudRegion);
verify(MOCK_aaiResourcesClient, times(1)).connect(
- eq(AAIUriFactory.createResourceUri(AAIObjectType.TENANT, cloudRegion.getCloudOwner(),
- cloudRegion.getLcpCloudRegionId(), cloudRegion.getTenantId())),
- eq(AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, network.getNetworkId())));
+ eq(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+ .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId())
+ .tenant(cloudRegion.getTenantId()))),
+ (eq(AAIUriFactory
+ .createResourceUri(AAIFluentTypeBuilder.network().l3Network(network.getNetworkId())))));
}
@Test
public void connectNetworkCollectionInstanceGroupToNetworkCollectionTest() throws Exception {
aaiNetworkResources.connectNetworkCollectionInstanceGroupToNetworkCollection(instanceGroup, collection);
verify(MOCK_aaiResourcesClient, times(1)).connect(
- eq(AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, collection.getId())),
- eq(AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId())));
+ eq(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().collection(collection.getId()))),
+ eq(AAIUriFactory
+ .createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId()))));
}
@Test
@@ -384,9 +389,10 @@ public class AAINetworkResourcesTest extends TestDataSetup {
public void connectInstanceGroupToCloudRegionTest() throws Exception {
aaiNetworkResources.connectInstanceGroupToCloudRegion(instanceGroup, cloudRegion);
verify(MOCK_aaiResourcesClient, times(1)).connect(
- eq(AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId())),
- eq(AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, cloudRegion.getCloudOwner(),
- cloudRegion.getLcpCloudRegionId())),
+ eq(AAIUriFactory
+ .createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId()))),
+ eq(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+ .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId()))),
eq(AAIEdgeLabel.USES));
}
@@ -396,8 +402,8 @@ public class AAINetworkResourcesTest extends TestDataSetup {
new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "aaiSubnetsMapped_to_aai.json")));
AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(content);
Optional<org.onap.aai.domain.yang.Subnet> oSubnet = Optional.empty();
- AAIResourceUri subnetUri =
- AAIUriFactory.createResourceUri(AAIObjectType.SUBNET, "ModelInvariantUUID", "serviceModelVersionId");
+ AAIResourceUri subnetUri = AAIUriFactory.createResourceUri(
+ AAIFluentTypeBuilder.network().l3Network("ModelInvariantUUID").subnet("serviceModelVersionId"));
doReturn(aaiResultWrapper).when(MOCK_aaiResourcesClient).get(isA(AAIResourceUri.class));
oSubnet = aaiNetworkResources.getSubnet(subnetUri);
@@ -429,8 +435,8 @@ public class AAINetworkResourcesTest extends TestDataSetup {
@Test
public void checkInstanceGroupNameInUseTrueTest() throws Exception {
- AAIPluralResourceUri uri =
- AAIUriFactory.createResourceUri(AAIObjectPlurals.L3_NETWORK).queryParam("network-name", "networkName");
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Networks())
+ .queryParam("network-name", "networkName");
doReturn(true).when(MOCK_aaiResourcesClient).exists(eq(uri));
boolean nameInUse = aaiNetworkResources.checkNetworkNameInUse("networkName");
assertTrue(nameInUse);
@@ -438,8 +444,8 @@ public class AAINetworkResourcesTest extends TestDataSetup {
@Test
public void checkInstanceGroupNameInUseFalseTest() throws Exception {
- AAIPluralResourceUri uri =
- AAIUriFactory.createResourceUri(AAIObjectPlurals.L3_NETWORK).queryParam("network-name", "networkName");
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Networks())
+ .queryParam("network-name", "networkName");
doReturn(false).when(MOCK_aaiResourcesClient).exists(eq(uri));
boolean nameInUse = aaiNetworkResources.checkNetworkNameInUse("networkName");
assertFalse(nameInUse);
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIPnfResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIPnfResourcesTest.java
index b8be045f97..8547ea53b4 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIPnfResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIPnfResourcesTest.java
@@ -32,25 +32,25 @@ import static org.mockito.Mockito.when;
import java.io.File;
import java.io.IOException;
import java.util.Optional;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import joptsimple.internal.Strings;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
-import org.onap.aaiclient.client.aai.AAIObjectType;
+import org.onap.aaiclient.client.aai.AAIResourcesClient;
+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.so.bpmn.common.InjectionHelper;
import org.onap.so.bpmn.common.data.TestDataSetup;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
-import org.onap.aaiclient.client.aai.AAIResourcesClient;
-import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoPnf;
import org.onap.so.client.aai.mapper.AAIObjectMapper;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import joptsimple.internal.Strings;
@RunWith(MockitoJUnitRunner.Silent.class)
public class AAIPnfResourcesTest extends TestDataSetup {
@@ -118,7 +118,8 @@ public class AAIPnfResourcesTest extends TestDataSetup {
Pnf pnfTest = createPnfWithDefaultName();
org.onap.aai.domain.yang.Pnf pnfFromAai = createPnf(OrchestrationStatus.INVENTORIED.toString());
when(injectionHelperMock.getAaiClient().get(org.onap.aai.domain.yang.Pnf.class,
- AAIUriFactory.createResourceUri(AAIObjectType.PNF, PNF_NAME))).thenReturn(Optional.of(pnfFromAai));
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().pnf(PNF_NAME))))
+ .thenReturn(Optional.of(pnfFromAai));
// when
testedObject.checkIfPnfExistsInAaiAndCanBeUsed(pnfTest);
verify(aaiResourcesClientMock, times(1)).update(any(), any());
@@ -131,7 +132,8 @@ public class AAIPnfResourcesTest extends TestDataSetup {
org.onap.aai.domain.yang.Pnf pnfFromAai = createPnf(null);
pnfTest.setRole("test");
when(injectionHelperMock.getAaiClient().get(org.onap.aai.domain.yang.Pnf.class,
- AAIUriFactory.createResourceUri(AAIObjectType.PNF, PNF_NAME))).thenReturn(Optional.of(pnfFromAai));
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().pnf(PNF_NAME))))
+ .thenReturn(Optional.of(pnfFromAai));
// when
testedObject.checkIfPnfExistsInAaiAndCanBeUsed(pnfTest);
verify(aaiResourcesClientMock, times(1)).update(any(), eq(pnfFromAai));
@@ -143,7 +145,8 @@ public class AAIPnfResourcesTest extends TestDataSetup {
org.onap.aai.domain.yang.Pnf pnfFromAai = createPnf(null);
Pnf pnfTest = getPnfWithTestValues();
when(injectionHelperMock.getAaiClient().get(org.onap.aai.domain.yang.Pnf.class,
- AAIUriFactory.createResourceUri(AAIObjectType.PNF, PNF_NAME))).thenReturn(Optional.of(pnfFromAai));
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().pnf(PNF_NAME))))
+ .thenReturn(Optional.of(pnfFromAai));
// when
testedObject.checkIfPnfExistsInAaiAndCanBeUsed(pnfTest);
verify(aaiResourcesClientMock, times(1)).update(any(), eq(pnfFromAai));
@@ -181,7 +184,8 @@ public class AAIPnfResourcesTest extends TestDataSetup {
Pnf pnfTest = createPnfWithDefaultName();
org.onap.aai.domain.yang.Pnf pnfFromAai = createPnf(Strings.EMPTY);
when(injectionHelperMock.getAaiClient().get(org.onap.aai.domain.yang.Pnf.class,
- AAIUriFactory.createResourceUri(AAIObjectType.PNF, PNF_NAME))).thenReturn(Optional.of(pnfFromAai));
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().pnf(PNF_NAME))))
+ .thenReturn(Optional.of(pnfFromAai));
// when
testedObject.checkIfPnfExistsInAaiAndCanBeUsed(pnfTest);
}
@@ -192,7 +196,8 @@ public class AAIPnfResourcesTest extends TestDataSetup {
Pnf pnfTest = createPnfWithDefaultName();
org.onap.aai.domain.yang.Pnf pnfFromAai = createPnf(OrchestrationStatus.ACTIVE.toString());
when(injectionHelperMock.getAaiClient().get(org.onap.aai.domain.yang.Pnf.class,
- AAIUriFactory.createResourceUri(AAIObjectType.PNF, PNF_NAME))).thenReturn(Optional.of(pnfFromAai));
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().pnf(PNF_NAME))))
+ .thenReturn(Optional.of(pnfFromAai));
// when
try {
testedObject.checkIfPnfExistsInAaiAndCanBeUsed(pnfTest);
@@ -216,7 +221,8 @@ public class AAIPnfResourcesTest extends TestDataSetup {
org.onap.aai.domain.yang.Pnf pnfFromAai =
new ObjectMapper().readValue(new File(path), org.onap.aai.domain.yang.Pnf.class);
when(injectionHelperMock.getAaiClient().get(org.onap.aai.domain.yang.Pnf.class,
- AAIUriFactory.createResourceUri(AAIObjectType.PNF, PNF_NAME))).thenReturn(Optional.of(pnfFromAai));
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().pnf(PNF_NAME))))
+ .thenReturn(Optional.of(pnfFromAai));
// when
try {
testedObject.checkIfPnfExistsInAaiAndCanBeUsed(pnfTest);
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIServiceInstanceResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIServiceInstanceResourcesTest.java
index 9f9ac88c3c..8ccb46257d 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIServiceInstanceResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIServiceInstanceResourcesTest.java
@@ -39,6 +39,11 @@ import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.aaiclient.client.aai.AAIResourcesClient;
+import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
+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.Types;
import org.onap.so.bpmn.common.InjectionHelper;
import org.onap.so.bpmn.common.data.TestDataSetup;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
@@ -46,11 +51,6 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Project;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription;
-import org.onap.aaiclient.client.aai.AAIObjectPlurals;
-import org.onap.aaiclient.client.aai.AAIResourcesClient;
-import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
-import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
-import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.aai.mapper.AAIObjectMapper;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
@@ -195,7 +195,7 @@ public class AAIServiceInstanceResourcesTest extends TestDataSetup {
@Test
public void checkInstanceServiceNameInUseTrueTest() throws Exception {
- AAIPluralResourceUri uri = AAIUriFactory.createNodesUri(AAIObjectPlurals.SERVICE_INSTANCE)
+ AAIPluralResourceUri uri = AAIUriFactory.createNodesUri(Types.SERVICE_INSTANCES.getFragment())
.queryParam("service-instance-name", serviceInstance.getServiceInstanceName());
doReturn(true).when(MOCK_aaiResourcesClient).exists(eq(uri));
boolean nameInUse = aaiServiceInstanceResources.checkInstanceServiceNameInUse(serviceInstance);
@@ -204,7 +204,7 @@ public class AAIServiceInstanceResourcesTest extends TestDataSetup {
@Test
public void checkInstanceServiceNameInUseFalseTest() throws Exception {
- AAIPluralResourceUri uri = AAIUriFactory.createNodesUri(AAIObjectPlurals.SERVICE_INSTANCE)
+ AAIPluralResourceUri uri = AAIUriFactory.createNodesUri(Types.SERVICE_INSTANCES.getFragment())
.queryParam("service-instance-name", serviceInstance.getServiceInstanceName());
doReturn(false).when(MOCK_aaiResourcesClient).exists(eq(uri));
boolean nameInUse = aaiServiceInstanceResources.checkInstanceServiceNameInUse(serviceInstance);
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVfModuleResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVfModuleResourcesTest.java
index 3dbacd2679..7cc628266b 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVfModuleResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVfModuleResourcesTest.java
@@ -38,17 +38,17 @@ import org.mockito.ArgumentMatchers;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.aaiclient.client.aai.AAIResourcesClient;
+import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
+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.Types;
import org.onap.so.bpmn.common.InjectionHelper;
import org.onap.so.bpmn.common.data.TestDataSetup;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
-import org.onap.aaiclient.client.aai.AAIObjectPlurals;
-import org.onap.aaiclient.client.aai.AAIResourcesClient;
-import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
-import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
-import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.aai.mapper.AAIObjectMapper;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
@@ -163,7 +163,7 @@ public class AAIVfModuleResourcesTest extends TestDataSetup {
@Test
public void checkNameInUseTrueTest() throws Exception {
- AAIPluralResourceUri vfModuleUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VF_MODULE)
+ AAIPluralResourceUri vfModuleUri = AAIUriFactory.createNodesUri(Types.VF_MODULES.getFragment())
.queryParam("vf-module-name", vfModule.getVfModuleName());
AAIPluralResourceUri vfModuleUriWithCustomization = vfModuleUri.clone().queryParam("model-customization-id",
vfModule.getModelInfoVfModule().getModelCustomizationUUID());
@@ -175,7 +175,7 @@ public class AAIVfModuleResourcesTest extends TestDataSetup {
@Test
public void checkNameInUseFalseIsResumeTest() throws Exception {
- AAIPluralResourceUri vfModuleUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VF_MODULE)
+ AAIPluralResourceUri vfModuleUri = AAIUriFactory.createNodesUri(Types.VF_MODULES.getFragment())
.queryParam("vf-module-name", vfModule.getVfModuleName());
AAIPluralResourceUri vfModuleUriWithCustomization = vfModuleUri.clone().queryParam("model-customization-id",
vfModule.getModelInfoVfModule().getModelCustomizationUUID());
@@ -186,7 +186,7 @@ public class AAIVfModuleResourcesTest extends TestDataSetup {
@Test
public void checkNameInUseFalseTest() throws Exception {
- AAIPluralResourceUri vfModuleUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VF_MODULE)
+ AAIPluralResourceUri vfModuleUri = AAIUriFactory.createNodesUri(Types.VF_MODULES.getFragment())
.queryParam("vf-module-name", vfModule.getVfModuleName());
AAIPluralResourceUri vfModuleUriWithCustomization = vfModuleUri.clone().queryParam("model-customization-id",
vfModule.getModelInfoVfModule().getModelCustomizationUUID());
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java
index 7750c8ad90..bdde1a1237 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java
@@ -43,15 +43,6 @@ import org.mockito.ArgumentMatchers;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
-import org.onap.so.bpmn.common.InjectionHelper;
-import org.onap.so.bpmn.common.data.TestDataSetup;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
-import org.onap.aaiclient.client.aai.AAIObjectPlurals;
-import org.onap.aaiclient.client.aai.AAIObjectType;
import org.onap.aaiclient.client.aai.AAIResourcesClient;
import org.onap.aaiclient.client.aai.AAIRestClientImpl;
import org.onap.aaiclient.client.aai.AAIValidatorImpl;
@@ -59,8 +50,16 @@ import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
-import org.onap.so.client.aai.mapper.AAIObjectMapper;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
import org.onap.aaiclient.client.graphinventory.entities.uri.Depth;
+import org.onap.so.bpmn.common.InjectionHelper;
+import org.onap.so.bpmn.common.data.TestDataSetup;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.client.aai.mapper.AAIObjectMapper;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
@RunWith(MockitoJUnitRunner.Silent.class)
@@ -197,18 +196,19 @@ public class AAIVnfResourcesTest extends TestDataSetup {
public void connectVnfToTenantTest() throws Exception {
aaiVnfResources.connectVnfToTenant(genericVnf, cloudRegion);
verify(MOCK_aaiResourcesClient, times(1)).connect(
- eq(AAIUriFactory.createResourceUri(AAIObjectType.TENANT, cloudRegion.getCloudOwner(),
- cloudRegion.getLcpCloudRegionId(), cloudRegion.getTenantId())),
- eq(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, genericVnf.getVnfId())));
+ eq(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+ .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId())
+ .tenant(cloudRegion.getTenantId()))),
+ eq(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(genericVnf.getVnfId()))));
}
@Test
public void connectVnfToCloudRegionTest() throws Exception {
aaiVnfResources.connectVnfToCloudRegion(genericVnf, cloudRegion);
verify(MOCK_aaiResourcesClient, times(1)).connect(
- eq(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, genericVnf.getVnfId())),
- eq(AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, cloudRegion.getCloudOwner(),
- cloudRegion.getLcpCloudRegionId())));
+ eq(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(genericVnf.getVnfId()))),
+ eq(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+ .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId()))));
}
@@ -244,8 +244,8 @@ public class AAIVnfResourcesTest extends TestDataSetup {
@Test
public void checkNameInUseTrueTest() {
- AAIPluralResourceUri vnfUri =
- AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", "vnfName");
+ AAIPluralResourceUri vnfUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnfs())
+ .queryParam("vnf-name", "vnfName");
doReturn(true).when(MOCK_aaiResourcesClient).exists(eq(vnfUri));
boolean nameInUse = aaiVnfResources.checkNameInUse("vnfName");
assertTrue(nameInUse);
@@ -253,8 +253,8 @@ public class AAIVnfResourcesTest extends TestDataSetup {
@Test
public void checkNameInUseFalseTest() {
- AAIPluralResourceUri vnfUri =
- AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", "vnfName");
+ AAIPluralResourceUri vnfUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnfs())
+ .queryParam("vnf-name", "vnfName");
doReturn(false).when(MOCK_aaiResourcesClient).exists(eq(vnfUri));
boolean nameInUse = aaiVnfResources.checkNameInUse("vnfName");
assertFalse(nameInUse);
@@ -262,7 +262,8 @@ public class AAIVnfResourcesTest extends TestDataSetup {
@Test
public void queryVnfWrapperByIdTest() throws Exception {
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "vnfId").depth(Depth.ALL);
+ AAIResourceUri uri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("vnfId")).depth(Depth.ALL);
final String aaiResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "aaiGenericVnf.json")));
GenericVnf genericVnf = new GenericVnf();
genericVnf.setVnfId("vnfId");
@@ -279,8 +280,8 @@ public class AAIVnfResourcesTest extends TestDataSetup {
new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "aaiVserverQueryResponse.json")));
AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(content);
Optional<org.onap.aai.domain.yang.Vserver> oVserver = Optional.empty();
- AAIResourceUri vserverUri = AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, "ModelInvariantUUID",
- "serviceModelVersionId", "abc", "abc");
+ AAIResourceUri vserverUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+ .cloudRegion("ModelInvariantUUID", "serviceModelVersionId").tenant("abc").vserver("abc"));
doReturn(aaiResultWrapper).when(MOCK_aaiResourcesClient).get(isA(AAIResourceUri.class));
oVserver = aaiVnfResources.getVserver(vserverUri);
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVolumeGroupResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVolumeGroupResourcesTest.java
index 0eae6a3fdc..ada59721fe 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVolumeGroupResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVolumeGroupResourcesTest.java
@@ -37,16 +37,16 @@ import org.mockito.ArgumentMatchers;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.aaiclient.client.aai.AAIResourcesClient;
+import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
+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.Types;
import org.onap.so.bpmn.common.InjectionHelper;
import org.onap.so.bpmn.common.data.TestDataSetup;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
-import org.onap.aaiclient.client.aai.AAIObjectPlurals;
-import org.onap.aaiclient.client.aai.AAIResourcesClient;
-import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
-import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
-import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.aai.mapper.AAIObjectMapper;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
@@ -155,7 +155,7 @@ public class AAIVolumeGroupResourcesTest extends TestDataSetup {
@Test
public void checkNameInUseTrueTest() {
- AAIPluralResourceUri volumeGroupUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VOLUME_GROUP)
+ AAIPluralResourceUri volumeGroupUri = AAIUriFactory.createNodesUri(Types.VOLUME_GROUPS.getFragment())
.queryParam("volume-group-name", "testVolumeGroupName1");
doReturn(true).when(MOCK_aaiResourcesClient).exists(eq(volumeGroupUri));
boolean nameInUse = aaiVolumeGroupResources.checkNameInUse(volumeGroup);
@@ -164,7 +164,7 @@ public class AAIVolumeGroupResourcesTest extends TestDataSetup {
@Test
public void checkNameInUseFalseTest() {
- AAIPluralResourceUri volumeGroupUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VOLUME_GROUP)
+ AAIPluralResourceUri volumeGroupUri = AAIUriFactory.createNodesUri(Types.VOLUME_GROUPS.getFragment())
.queryParam("volume-group-name", "testVolumeGroupName1");
doReturn(false).when(MOCK_aaiResourcesClient).exists(eq(volumeGroupUri));
boolean nameInUse = aaiVolumeGroupResources.checkNameInUse(volumeGroup);