summaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-tasks/src/main
diff options
context:
space:
mode:
authorSteve Smokowski <ss835w@att.com>2019-01-12 13:16:21 +0000
committerGerrit Code Review <gerrit@onap.org>2019-01-12 13:16:21 +0000
commitc3830202743f9d8ec861c6b2a0b434f76e30124a (patch)
tree4f2f783520c7aff5d29f7cc93b6b0e05d7adc7a9 /bpmn/so-bpmn-tasks/src/main
parentefb42bcc116535dad00c23a39fccdc5f9e5c321a (diff)
parenta9f86b8996c3dfb880098691048686a37ac40dd0 (diff)
Merge "get subnet sequence number from A&AI"
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/main')
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIQueryTasks.java25
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java1
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java4
3 files changed, 30 insertions, 0 deletions
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 0079b351f2..46ff8495f9 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
@@ -29,6 +29,7 @@ import org.modelmapper.PropertyMap;
import org.onap.aai.domain.yang.NetworkPolicy;
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.so.adapters.nwrest.CreateNetworkRequest;
import org.onap.so.bpmn.common.BuildingBlockExecution;
@@ -222,4 +223,28 @@ public class AAIQueryTasks {
}
return mappedRouteTargets;
}
+
+ public void querySubnet(BuildingBlockExecution execution) {
+ try {
+ L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID,
+ execution.getLookupMap().get(ResourceKey.NETWORK_ID));
+ AAIResultWrapper aaiResultWrapper = aaiNetworkResources.queryNetworkWrapperById(l3network);
+ Optional<Relationships> networkRelationships = aaiResultWrapper.getRelationships();
+ if (!networkRelationships.isPresent()) {
+ throw (new Exception(ERROR_MSG));
+ }
+ List<AAIResourceUri> subnetsUriList = networkRelationships.get().getRelatedAAIUris(AAIObjectType.SUBNET);
+
+ if(!subnetsUriList.isEmpty()) {
+ for(AAIResourceUri subnetUri : subnetsUriList) {
+ Optional<Subnet> oSubnet = aaiNetworkResources.getSubnet(subnetUri);
+ if(oSubnet.isPresent()) {
+ l3network.getSubnets().add(modelMapper.map(oSubnet.get(), org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet.class));
+ }
+ }
+ }
+ } catch(Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java
index 4abb0a1b2c..3081ab86d8 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java
@@ -260,6 +260,7 @@ public class NetworkAdapterObjectMapper {
map(source.getGatewayAddress(), destination.getGatewayIp());
map(source.getIpVersion(), destination.getIpVersion());
map(source.isDhcpEnabled(), destination.getEnableDHCP());
+ map(source.getSubnetSequence(), destination.getSubnetSequence());
}
};
modelMapper.addMappings(personMap);
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 16d5e8e1db..d2bf95a28e 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
@@ -84,6 +84,10 @@ public class AAINetworkResources {
public Optional<NetworkPolicy> getNetworkPolicy(AAIResourceUri netPolicyUri) {
return injectionHelper.getAaiClient().get(netPolicyUri).asBean(NetworkPolicy.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);
+ }
public Optional<RouteTableReference> getRouteTable(AAIResourceUri rTableUri) {
return injectionHelper.getAaiClient().get(rTableUri).asBean(RouteTableReference.class);