aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSmokowski, Steve (ss835w) <ss835w@us.att.com>2018-12-04 15:33:20 -0500
committerSmokowski, Steve (ss835w) <ss835w@us.att.com>2018-12-04 15:33:21 -0500
commit815bcc529480e122c270771dc974cba3d754233e (patch)
tree833c648d8218fb80aa200003a6d37fb15c783797
parent9a3841eadc588c3b3f50f2351b741edd139ca13c (diff)
Updated Network Logic
Added logic to get aggregate route, updated unit test, fixed bugs, refactored select code. Change-Id: I3269da1967ba903dd11459f76030c3fc2aad797a Issue-ID: SO-1270 Signed-off-by: Smokowski, Steve (ss835w) <ss835w@us.att.com>
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3Network.java6
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java36
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java22
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java54
-rw-r--r--common/pom.xml14
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIObjectType.java2
6 files changed, 75 insertions, 59 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3Network.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3Network.java
index 343bd95eaa..781eba3332 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3Network.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3Network.java
@@ -101,6 +101,8 @@ public class L3Network implements Serializable, ShallowCopy<L3Network> {
private ModelInfoNetwork modelInfoNetwork;
@JsonProperty("aggregate-routes")
private List<AggregateRoute> aggregateRoutes = new ArrayList<>();
+ @JsonProperty("vpn-binding")
+ private List<VpnBinding> vpnBindings = new ArrayList<>();
public ModelInfoNetwork getModelInfoNetwork() {
return modelInfoNetwork;
@@ -261,6 +263,10 @@ public class L3Network implements Serializable, ShallowCopy<L3Network> {
return aggregateRoutes;
}
+ public List<VpnBinding> getVpnBindings(){
+ return vpnBindings;
+ }
+
@Override
public boolean equals(final Object other) {
if (!(other instanceof L3Network)) {
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java
index 0398c87d69..d5b5cde99b 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java
@@ -290,7 +290,7 @@ public class BuildingBlockTestDataSetup{
customer.setSubscriberType("testSubscriberType" + customerCounter);
customer.setServiceSubscription(buildServiceSubscription());
-
+
return customer;
}
@@ -341,50 +341,50 @@ public class BuildingBlockTestDataSetup{
customer.setServiceSubscription(buildServiceSubscription());
gBBInput.setCustomer(customer);
-
+
return customer;
}
-
+
public Collection setCollection() {
Collection collection = new Collection();
collection.setId("testId");
-
+
ServiceInstance serviceInstance = null;
-
+
try {
serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
} catch(BBObjectNotFoundException e) {
serviceInstance = setServiceInstance();
}
-
+
serviceInstance.setCollection(collection);
-
+
return collection;
}
-
+
public InstanceGroup setInstanceGroup() {
InstanceGroup instanceGroup = new InstanceGroup();
instanceGroup.setId("testId");
instanceGroup.setInstanceGroupFunction("testInstanceGroupFunction");
-
+
Collection collection = null;
-
+
try {
ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
collection = serviceInstance.getCollection();
-
+
if (collection == null) {
collection = setCollection();
}
} catch(BBObjectNotFoundException e) {
collection = setCollection();
}
-
+
collection.setInstanceGroup(instanceGroup);
-
+
return instanceGroup;
}
-
+
public VpnBinding buildVpnBinding() {
vpnBindingCounter++;
@@ -664,12 +664,12 @@ public class BuildingBlockTestDataSetup{
modelInfo.setModelUuid("testAllottedModelUuid" + uniqueIdentifier);
modelInfo.setModelVersion("testAllottedModelVersion" + uniqueIdentifier);
modelInfo.setModelInstanceName("testAllottedInstanceName" + uniqueIdentifier);
-
+
ar.setModelInfoAllottedResource(modelInfo);
-
+
return ar;
}
-
+
public Configuration setConfiguration () {
Configuration config = new Configuration();
config.setConfigurationId("testConfigurationId");
@@ -679,7 +679,7 @@ public class BuildingBlockTestDataSetup{
modelInfoConfig.setModelInvariantId("modelInvariantId");
modelInfoConfig.setPolicyName("policyName");
config.setModelInfoConfiguration(modelInfoConfig);
-
+
List<Configuration> configurations = new ArrayList<>();
configurations.add(config);
ServiceInstance serviceInstance = new ServiceInstance();
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 e13a765cf2..a96f01c3d0 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
@@ -7,9 +7,9 @@
* 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.
@@ -38,10 +38,10 @@ import org.springframework.stereotype.Component;
public class AAIConfigurationResources {
@Autowired
private InjectionHelper injectionHelper;
-
+
@Autowired
private AAIObjectMapper aaiObjectMapper;
-
+
/**
* A&AI call to create configuration
*
@@ -142,24 +142,32 @@ public class AAIConfigurationResources {
*
* @param configurationId
* @param vpnId
+ *
*/
public void connectConfigurationToVpnBinding(String configurationId, String vpnId) {
AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId);
AAIResourceUri vpnBindingURI = AAIUriFactory.createResourceUri(AAIObjectType.VPN_BINDING, vpnId);
injectionHelper.getAaiClient().connect(configurationURI, vpnBindingURI);
}
-
+
public void connectConfigurationToVfModule(String configurationId, String vfModuleId, String vnfId){
AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId);
AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, 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);
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);
+ injectionHelper.getAaiClient().connect(configurationURI, networkURI);
+ }
+
/**
* method to delete Configuration details in A&AI
*
@@ -188,7 +196,7 @@ public class AAIConfigurationResources {
return injectionHelper.getAaiClient()
.get(org.onap.aai.domain.yang.Configuration.class, AAIUriFactory.createResourceFromExistingURI(AAIObjectType.CONFIGURATION, UriBuilder.fromPath(relatedLink).build()));
}
-
+
public void updateOrchestrationStatusConfiguration(Configuration configuration, OrchestrationStatus orchestrationStatus) {
AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId());
configuration.setOrchestrationStatus(orchestrationStatus);
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 a4c705b0c7..46b18f5e32 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
@@ -7,9 +7,9 @@
* 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.
@@ -47,22 +47,22 @@ import org.springframework.stereotype.Component;
public class AAINetworkResources {
@Autowired
private InjectionHelper injectionHelper;
-
+
@Autowired
private AAIObjectMapper aaiObjectMapper;
-
+
public void updateNetwork(L3Network network) {
AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, 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());
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());
network.setOrchestrationStatus(OrchestrationStatus.INVENTORIED);
@@ -76,11 +76,11 @@ public class AAINetworkResources {
AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, network.getNetworkId());
injectionHelper.getAaiClient().delete(networkURI);
}
-
+
public Optional<VpnBinding> getVpnBinding(AAIResourceUri netBindingUri) {
- return injectionHelper.getAaiClient().get(netBindingUri).asBean(VpnBinding.class);
+ return injectionHelper.getAaiClient().get(netBindingUri.depth(Depth.TWO)).asBean(VpnBinding.class);
}
-
+
public Optional<NetworkPolicy> getNetworkPolicy(AAIResourceUri netPolicyUri) {
return injectionHelper.getAaiClient().get(netPolicyUri).asBean(NetworkPolicy.class);
}
@@ -88,85 +88,85 @@ public class AAINetworkResources {
public Optional<RouteTableReference> getRouteTable(AAIResourceUri rTableUri) {
return injectionHelper.getAaiClient().get(rTableUri).asBean(RouteTableReference.class);
}
-
+
public Optional<org.onap.aai.domain.yang.L3Network> queryNetworkById(L3Network l3network) {
AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK,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);
return injectionHelper.getAaiClient().get(uri);
}
-
+
public void createNetworkInstanceGroup(InstanceGroup instanceGroup) {
AAIResourceUri instanceGroupURI = AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, 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());
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,
+ AAIResourceUri tenantURI = AAIUriFactory.createResourceUri(AAIObjectType.TENANT,
cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId(), cloudRegion.getTenantId());
AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, l3network.getNetworkId());
injectionHelper.getAaiClient().connect(tenantURI, networkURI);
}
-
+
public void connectNetworkToCloudRegion(L3Network l3network, CloudRegion cloudRegion) {
- AAIResourceUri cloudRegionURI = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION,
+ AAIResourceUri cloudRegionURI = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION,
cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId());
AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, l3network.getNetworkId());
injectionHelper.getAaiClient().connect(cloudRegionURI, networkURI);
}
-
+
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());
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());
injectionHelper.getAaiClient().connect(networkCollectionServiceInstanceUri, networkURI);
}
-
+
public void connectNetworkCollectionInstanceGroupToNetworkCollection(InstanceGroup instanceGroup, Collection networkCollection) {
AAIResourceUri networkCollectionUri = AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, networkCollection.getId());
AAIResourceUri netwrokCollectionInstanceGroupURI = AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId());
injectionHelper.getAaiClient().connect(networkCollectionUri, netwrokCollectionInstanceGroupURI);
}
-
+
public void connectInstanceGroupToCloudRegion(InstanceGroup instanceGroup, CloudRegion cloudRegion) {
- AAIResourceUri cloudRegionURI = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION,
+ AAIResourceUri cloudRegionURI = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION,
cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId());
AAIResourceUri instanceGroupURI = AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId());
injectionHelper.getAaiClient().connect(instanceGroupURI, cloudRegionURI, AAIEdgeLabel.USES);
}
-
+
public void connectNetworkCollectionToServiceInstance(Collection networkCollection, ServiceInstance networkCollectionServiceInstance) {
AAIResourceUri networkCollectionUri = AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, networkCollection.getId());
AAIResourceUri networkCollectionServiceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, networkCollectionServiceInstance.getServiceInstanceId());
injectionHelper.getAaiClient().connect(networkCollectionUri, networkCollectionServiceInstanceUri);
}
-
+
public void deleteCollection(Collection collection) {
AAIResourceUri collectionURI = AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, collection.getId());
injectionHelper.getAaiClient().delete(collectionURI);
}
-
+
public void deleteNetworkInstanceGroup(InstanceGroup instanceGroup) {
AAIResourceUri instanceGroupURI = AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId());
injectionHelper.getAaiClient().delete(instanceGroupURI);
}
-
+
}
diff --git a/common/pom.xml b/common/pom.xml
index b9fd64e04e..88722ccbcf 100644
--- a/common/pom.xml
+++ b/common/pom.xml
@@ -16,11 +16,11 @@
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
- <artifactId>javax.servlet-api</artifactId>
+ <artifactId>javax.servlet-api</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
- <artifactId>spring-aspects</artifactId>
+ <artifactId>spring-aspects</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
@@ -29,10 +29,10 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
- </dependency>
+ </dependency>
<dependency>
<groupId>com.jayway.jsonpath</groupId>
- <artifactId>json-path</artifactId>
+ <artifactId>json-path</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
@@ -49,7 +49,7 @@
<dependency>
<groupId>org.onap.aai.aai-common</groupId>
<artifactId>aai-schema</artifactId>
- <version>1.3.1</version>
+ <version>1.4.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.modelmapper</groupId>
@@ -85,7 +85,7 @@
<artifactId>commons-lang3</artifactId>
</exclusion>
</exclusions>
- </dependency>
+ </dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-ext</artifactId>
@@ -106,7 +106,7 @@
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
- <artifactId>spring-security-web</artifactId>
+ <artifactId>spring-security-web</artifactId>
</dependency>
<dependency>
<groupId>org.onap.logging-analytics</groupId>
diff --git a/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java b/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java
index 51d09006db..f003dc0628 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java
@@ -25,6 +25,7 @@ import java.util.Map;
import org.onap.aai.annotations.Metadata;
import org.onap.aai.domain.yang.AllottedResource;
+import org.onap.aai.domain.yang.AggregateRoute;
import org.onap.aai.domain.yang.CloudRegion;
import org.onap.aai.domain.yang.Collection;
import org.onap.aai.domain.yang.Complex;
@@ -113,6 +114,7 @@ public enum AAIObjectType implements GraphInventoryObjectType {
SP_PARTNER(AAINamespaceConstants.BUSINESS, SpPartner.class),
DEVICE(AAINamespaceConstants.NETWORK, Device.class),
EXT_AAI_NETWORK(AAINamespaceConstants.NETWORK, ExtAaiNetwork.class),
+ AGGREGATE_ROUTE(AAINamespaceConstants.NETWORK, AggregateRoute.class),
UNKNOWN("", "");
private final String uriTemplate;