diff options
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java')
-rw-r--r-- | bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java | 96 |
1 files changed, 53 insertions, 43 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 f412720af7..746f136e96 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 @@ -21,9 +21,7 @@ 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.so.client.aai.AAIObjectType; @@ -37,11 +35,11 @@ import org.springframework.stereotype.Component; @Component public class AAIConfigurationResources { - @Autowired - private InjectionHelper injectionHelper; + @Autowired + private InjectionHelper injectionHelper; - @Autowired - private AAIObjectMapper aaiObjectMapper; + @Autowired + private AAIObjectMapper aaiObjectMapper; /** * A&AI call to create configuration @@ -49,14 +47,15 @@ public class AAIConfigurationResources { * @param configuration */ public void createConfiguration(Configuration configuration) { - AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId()); + AAIResourceUri configurationURI = + AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId()); configuration.setOrchestrationStatus(OrchestrationStatus.ASSIGNED); org.onap.aai.domain.yang.Configuration aaiConfiguration = aaiObjectMapper.mapConfiguration(configuration); injectionHelper.getAaiClient().create(configurationURI, aaiConfiguration); } /** - * method to get Configuration details from A&AI + * method to get Configuration details from A&AI * * @param configurationId * @return @@ -72,21 +71,24 @@ public class AAIConfigurationResources { * @param configuration */ public void updateConfiguration(Configuration configuration) { - AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId()); + AAIResourceUri configurationURI = + AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId()); org.onap.aai.domain.yang.Configuration aaiConfiguration = aaiObjectMapper.mapConfiguration(configuration); injectionHelper.getAaiClient().update(configurationURI, aaiConfiguration); } + /** * A&AI call to disconnect configuration relation with service instance + * * @param configurationId * @param serviceInstanceId */ - public void disconnectConfigurationToServiceInstance(String configurationId, String serviceInstanceId){ + public void disconnectConfigurationToServiceInstance(String configurationId, String serviceInstanceId) { AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId); - AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, - serviceInstanceId); - injectionHelper.getAaiClient().disconnect(configurationURI,serviceInstanceURI); + AAIResourceUri serviceInstanceURI = + AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId); + injectionHelper.getAaiClient().disconnect(configurationURI, serviceInstanceURI); } /** @@ -96,8 +98,10 @@ public class AAIConfigurationResources { * @param vnrConfigurationId */ public void connectVrfConfigurationToVnrConfiguration(String vrfConfigurationId, String vnrConfigurationId) { - AAIResourceUri vnrConfigurationUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, vnrConfigurationId); - AAIResourceUri vrfConfigurationUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, vrfConfigurationId); + AAIResourceUri vnrConfigurationUri = + AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, vnrConfigurationId); + AAIResourceUri vrfConfigurationUri = + AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, vrfConfigurationId); injectionHelper.getAaiClient().connect(vrfConfigurationUri, vnrConfigurationUri); } @@ -121,11 +125,11 @@ public class AAIConfigurationResources { */ public void connectConfigurationToServiceInstance(String configurationId, String serviceInstanceId) { AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId); - AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, - serviceInstanceId); + AAIResourceUri serviceInstanceURI = + AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId); injectionHelper.getAaiClient().connect(configurationURI, serviceInstanceURI); } - + /** * A&AI call to add configuration relationship with service instance * @@ -133,10 +137,11 @@ public class AAIConfigurationResources { * @param serviceInstanceId * @param aaiLabel */ - public void connectConfigurationToServiceInstance(String configurationId, String serviceInstanceId, AAIEdgeLabel aaiLabel) { + public void connectConfigurationToServiceInstance(String configurationId, String serviceInstanceId, + AAIEdgeLabel aaiLabel) { AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId); - AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, - serviceInstanceId); + AAIResourceUri serviceInstanceURI = + AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId); injectionHelper.getAaiClient().connect(configurationURI, serviceInstanceURI, aaiLabel); } @@ -165,22 +170,22 @@ public class AAIConfigurationResources { 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); - injectionHelper.getAaiClient().connect(configurationURI, vfModuleURI); + 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); + 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 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); + 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); } /** @@ -192,30 +197,35 @@ public class AAIConfigurationResources { AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId); injectionHelper.getAaiClient().delete(aaiResourceUri); } + /** * method to delete Configuration details in A&AI * * @param configuration */ public void deleteConfiguration(Configuration configuration) { - AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId()); + AAIResourceUri aaiResourceUri = + AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId()); injectionHelper.getAaiClient().delete(aaiResourceUri); } /** * Get Configuration from AAI using related Link + * * @param relatedLink related link - URI * @return AAI Configuration object */ - 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())); + 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())); } - public void updateOrchestrationStatusConfiguration(Configuration configuration, OrchestrationStatus orchestrationStatus) { - AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId()); - configuration.setOrchestrationStatus(orchestrationStatus); - org.onap.aai.domain.yang.Configuration aaiConfiguration = aaiObjectMapper.mapConfiguration(configuration); - injectionHelper.getAaiClient().update(aaiResourceUri, aaiConfiguration); - } + public void updateOrchestrationStatusConfiguration(Configuration configuration, + OrchestrationStatus orchestrationStatus) { + AAIResourceUri aaiResourceUri = + AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId()); + configuration.setOrchestrationStatus(orchestrationStatus); + org.onap.aai.domain.yang.Configuration aaiConfiguration = aaiObjectMapper.mapConfiguration(configuration); + injectionHelper.getAaiClient().update(aaiResourceUri, aaiConfiguration); + } } |