diff options
author | Rob Daugherty <rd472p@att.com> | 2018-12-05 14:04:26 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-12-05 14:04:26 +0000 |
commit | 8c56c58a5546a24d7a341fe985efa5845bf31fbb (patch) | |
tree | 83cfea354635f4db47f20690b4e10855a16206bd /bpmn/so-bpmn-tasks/src/main/java | |
parent | b6757920a3a86e750b378d57262d4155a1c2caff (diff) | |
parent | 815bcc529480e122c270771dc974cba3d754233e (diff) |
Merge "Updated Network Logic"
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/main/java')
2 files changed, 42 insertions, 34 deletions
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); } - + } |