aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java15
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java8
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/AAIEdgeLabel.java4
3 files changed, 25 insertions, 2 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 a96f01c3d0..3bb1d81e27 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
@@ -27,6 +27,7 @@ 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;
+import org.onap.so.client.aai.entities.AAIEdgeLabel;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.aai.mapper.AAIObjectMapper;
@@ -124,6 +125,20 @@ public class AAIConfigurationResources {
serviceInstanceId);
injectionHelper.getAaiClient().connect(configurationURI, serviceInstanceURI);
}
+
+ /**
+ * A&AI call to add configuration relationship with service instance
+ *
+ * @param configurationId
+ * @param serviceInstanceId
+ * @param 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);
+ injectionHelper.getAaiClient().connect(configurationURI, serviceInstanceURI, aaiLabel);
+ }
/**
* A&AI call to add configuration relationship with generic-vnf
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java
index a38c8be686..4aeed71177 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java
@@ -48,6 +48,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.AAIResourcesClient;
+import org.onap.so.client.aai.entities.AAIEdgeLabel;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.aai.mapper.AAIObjectMapper;
@@ -118,6 +119,13 @@ public class AAIConfigurationResourcesTest extends TestDataSetup{
}
@Test
+ public void connectConfigurationToServiceInstanceWithEdgeTest() {
+ doNothing().when(MOCK_aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class), any(AAIEdgeLabel.class));
+ aaiConfigurationResources.connectConfigurationToServiceInstance(configuration.getConfigurationId(), serviceInstance.getServiceInstanceId(), AAIEdgeLabel.USES);
+ verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class), any(AAIEdgeLabel.class));
+ }
+
+ @Test
public void disconnectConfigurationToServiceInstanceTest(){
doNothing().when(MOCK_aaiResourcesClient).disconnect(isA(AAIResourceUri.class), isA(AAIResourceUri.class));
aaiConfigurationResources.disconnectConfigurationToServiceInstance("TEST_CONFIGURATION_ID", "TEST_SERVICE_INSTANCE_ID");
diff --git a/common/src/main/java/org/onap/so/client/aai/entities/AAIEdgeLabel.java b/common/src/main/java/org/onap/so/client/aai/entities/AAIEdgeLabel.java
index 434dbf946b..eb6d0d0b43 100644
--- a/common/src/main/java/org/onap/so/client/aai/entities/AAIEdgeLabel.java
+++ b/common/src/main/java/org/onap/so/client/aai/entities/AAIEdgeLabel.java
@@ -25,8 +25,8 @@ import org.onap.so.client.graphinventory.entities.GraphInventoryEdgeLabel;
public enum AAIEdgeLabel implements GraphInventoryEdgeLabel {
BELONGS_TO("org.onap.relationships.inventory.BelongsTo"),
- USES("org.onap.relationships.inventory.Uses");
-
+ USES("org.onap.relationships.inventory.Uses"),
+ COMPOSED_OF("org.onap.relationships.inventory.ComposedOf");
private final String label;
private AAIEdgeLabel(String label) {