aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-tasks/src/main/java
diff options
context:
space:
mode:
authorBenjamin, Max (mb388a) <mb388a@us.att.com>2019-02-14 18:14:00 -0500
committerBenjamin, Max (mb388a) <mb388a@us.att.com>2019-02-14 18:16:44 -0500
commit758f70985e3c7a6243d87bc649367f0013503a11 (patch)
treee22dc2f903f9d35a47fffc7539cbd2a9f4269000 /bpmn/so-bpmn-tasks/src/main/java
parent1d69925fef5c972f045081db9b5e4795d96c6f84 (diff)
Process query of Network Policies from A&AI
Process query of Network Policies from A&AI as a NetworkPolicies object. Change-Id: I01b4c00e3732a5518ddc21d08740c0684de86d5e Issue-ID: SO-1511 Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/main/java')
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java23
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java5
2 files changed, 19 insertions, 9 deletions
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 8f0334e462..0d9aeed1ae 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
@@ -21,15 +21,16 @@
package org.onap.so.bpmn.infrastructure.aai.tasks;
+import java.util.List;
import java.util.Optional;
-import java.util.UUID;
+import org.onap.aai.domain.yang.NetworkPolicies;
+import org.onap.aai.domain.yang.NetworkPolicy;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
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.VfModule;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
@@ -169,18 +170,22 @@ public class AAIDeleteTasks {
String fqdn = fqdnList[i];
AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY);
uri.queryParam(NETWORK_POLICY_FQDN_PARAM, fqdn);
- Optional<org.onap.aai.domain.yang.NetworkPolicy> oNetPolicy = aaiNetworkResources.getNetworkPolicy(uri);
- if(oNetPolicy.isPresent()) {
- String networkPolicyId = oNetPolicy.get().getNetworkPolicyId();
- msoLogger.debug("Deleting network-policy with network-policy-id " + networkPolicyId);
-
- aaiNetworkResources.deleteNetworkPolicy(networkPolicyId);
+ Optional<NetworkPolicies> oNetPolicies = aaiNetworkResources.getNetworkPolicies(uri);
+ if(oNetPolicies.isPresent()) {
+ NetworkPolicies networkPolicies = oNetPolicies.get();
+ List<NetworkPolicy> networkPolicyList = networkPolicies.getNetworkPolicy();
+ if (networkPolicyList != null && !networkPolicyList.isEmpty()) {
+ NetworkPolicy networkPolicy = networkPolicyList.get(0);
+ String networkPolicyId = networkPolicy.getNetworkPolicyId();
+ msoLogger.debug("Deleting network-policy with network-policy-id " + networkPolicyId);
+ aaiNetworkResources.deleteNetworkPolicy(networkPolicyId);
+ }
}
}
}
}
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
+ }
}
}
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 4ca3f2a78d..7283c9967c 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
@@ -22,6 +22,7 @@ package org.onap.so.client.orchestration;
import java.util.Optional;
+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;
@@ -86,6 +87,10 @@ public class AAINetworkResources {
return injectionHelper.getAaiClient().get(netPolicyUri).asBean(NetworkPolicy.class);
}
+ public Optional<NetworkPolicies> getNetworkPolicies(AAIResourceUri netPoliciesUri) {
+ return injectionHelper.getAaiClient().get(netPoliciesUri).asBean(NetworkPolicies.class);
+ }
+
public Optional<org.onap.aai.domain.yang.Subnet> getSubnet(AAIResourceUri subnetUri) {
return injectionHelper.getAaiClient().get(subnetUri).asBean(org.onap.aai.domain.yang.Subnet.class);
}