aboutsummaryrefslogtreecommitdiffstats
path: root/graph-inventory
diff options
context:
space:
mode:
Diffstat (limited to 'graph-inventory')
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIObjectPlurals.java2
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIRestClientI.java7
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIRestClientImpl.java24
3 files changed, 33 insertions, 0 deletions
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIObjectPlurals.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIObjectPlurals.java
index 5b68d0c69a..78f8350eff 100644
--- a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIObjectPlurals.java
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIObjectPlurals.java
@@ -74,6 +74,8 @@ public class AAIObjectPlurals implements AAIObjectBase, GraphInventoryObjectPlur
new AAIObjectPlurals(AAIObjectType.INSTANCE_GROUP, AAINamespaceConstants.NETWORK, "/instance-groups");
public static final AAIObjectPlurals PNF =
new AAIObjectPlurals(AAIObjectType.PNF, AAINamespaceConstants.NETWORK, "/pnfs");
+ public static final AAIObjectPlurals PROJECT =
+ new AAIObjectPlurals(AAIObjectType.PROJECT, AAINamespaceConstants.BUSINESS, "/projects");
private final String uriTemplate;
private final String partialUri;
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIRestClientI.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIRestClientI.java
index ef6ca00a32..3b08761568 100644
--- a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIRestClientI.java
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIRestClientI.java
@@ -26,6 +26,7 @@ import java.util.Optional;
import org.onap.aai.domain.yang.GenericVnf;
import org.onap.aai.domain.yang.Pnf;
import org.onap.aai.domain.yang.Pserver;
+import org.onap.aai.domain.yang.ServiceInstance;
public interface AAIRestClientI {
@@ -40,4 +41,10 @@ public interface AAIRestClientI {
void createPnf(String pnfId, Pnf pnf);
void updatePnf(String pnfId, Pnf pnf);
+
+ Optional<ServiceInstance> getServiceInstanceById(String serviceInstanceId, String serviceType,
+ String globalSubscriberId);
+
+ void updateServiceInstance(String globalSubscriberId, String serviceType, String serviceInstanceId,
+ ServiceInstance serviceInstance);
}
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIRestClientImpl.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIRestClientImpl.java
index 886891a34e..0aff965ac0 100644
--- a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIRestClientImpl.java
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIRestClientImpl.java
@@ -31,14 +31,18 @@ import javax.ws.rs.core.Response;
import org.onap.aai.domain.yang.GenericVnf;
import org.onap.aai.domain.yang.Pnf;
import org.onap.aai.domain.yang.Pserver;
+import org.onap.aai.domain.yang.ServiceInstance;
import org.onap.aaiclient.client.aai.entities.CustomQuery;
import org.onap.aaiclient.client.aai.entities.Results;
import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
import org.onap.aaiclient.client.graphinventory.Format;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class AAIRestClientImpl implements AAIRestClientI {
+ private final Logger log = LoggerFactory.getLogger(getClass());
private static final String PSERVER_VNF_QUERY = "pservers-fromVnf";
@Override
@@ -97,4 +101,24 @@ public class AAIRestClientImpl implements AAIRestClientI {
public void updatePnf(String pnfId, Pnf pnf) {
new AAIResourcesClient().update(AAIUriFactory.createResourceUri(AAIObjectType.PNF, pnfId), pnf);
}
+
+ @Override
+ public Optional<ServiceInstance> getServiceInstanceById(String globalSubscriberId, String serviceType,
+ String serviceInstanceId) {
+ Response response = new AAIResourcesClient().getFullResponse(AAIUriFactory
+ .createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId, serviceType, serviceInstanceId));
+ return Optional.ofNullable(response.readEntity(ServiceInstance.class));
+ }
+
+ @Override
+ public void updateServiceInstance(String globalSubscriberId, String serviceType, String serviceInstanceId,
+ ServiceInstance serviceInstance) {
+ try {
+ new AAIResourcesClient().update(AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
+ globalSubscriberId, serviceType, serviceInstanceId), serviceInstance);
+ } catch (Throwable ex) {
+ log.error("Exception happened while updating ServiceInstance, Exception: {}", ex.getLocalizedMessage());
+ throw new RuntimeException(ex);
+ }
+ }
}