summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSmokowski, Steven <steve.smokowski@att.com>2020-04-02 15:12:56 -0400
committerBenjamin, Max (mb388a) <mb388a@att.com>2020-04-04 14:30:17 -0400
commit9fc66f6f36acf76fec157a1b759f13456d009e8e (patch)
treeb7316f29ec4e9f2fcf88b8c9c086ffa99eb35a8f
parent3534e7089c955406866bd8e796a8f5e40b08100b (diff)
mso to add additional validation for alacarte
Initial check in for querying AAI via DSL remove code which is not needed from validator Issue-ID: SO-2781 Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com> Change-Id: I2828d9c107e747bac4dad02c46c2b505ca96a214
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrieval.java28
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/ServiceInstanceDeleteValidator.java3
2 files changed, 29 insertions, 2 deletions
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrieval.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrieval.java
index 4e3d8736c2..a522129c31 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrieval.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrieval.java
@@ -1,19 +1,29 @@
package org.onap.so.apihandlerinfra.infra.rest;
+import java.util.List;
import java.util.Optional;
import org.onap.aai.domain.yang.GenericVnf;
import org.onap.aai.domain.yang.L3Network;
+import org.onap.aai.domain.yang.LInterface;
import org.onap.aai.domain.yang.Service;
import org.onap.aai.domain.yang.ServiceInstance;
import org.onap.aai.domain.yang.Tenant;
import org.onap.aai.domain.yang.VfModule;
import org.onap.aai.domain.yang.VolumeGroup;
import org.onap.so.apihandlerinfra.infra.rest.exception.AAIEntityNotFound;
+import org.onap.so.client.aai.AAIDSLQueryClient;
import org.onap.so.client.aai.AAIObjectPlurals;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.AAIResourcesClient;
import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
+import org.onap.so.client.graphinventory.entities.DSLQuery;
+import org.onap.so.client.graphinventory.entities.DSLQueryBuilder;
+import org.onap.so.client.graphinventory.entities.DSLStartNode;
+import org.onap.so.client.graphinventory.entities.Node;
+import org.onap.so.client.graphinventory.entities.Start;
+import org.onap.so.client.graphinventory.entities.TraversalBuilder;
+import org.onap.so.client.graphinventory.entities.__;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@@ -25,6 +35,8 @@ public class AAIDataRetrieval {
private AAIResourcesClient aaiResourcesClient;
+ private AAIDSLQueryClient aaiDslQueryClient;
+
private static final Logger logger = LoggerFactory.getLogger(AAIDataRetrieval.class);
public ServiceInstance getServiceInstance(String serviceInstanceId) {
@@ -129,6 +141,22 @@ public class AAIDataRetrieval {
});
}
+ public List<LInterface> getLinterfacesOfVnf(String vnfId) {
+ DSLStartNode startNode = new DSLStartNode(AAIObjectType.GENERIC_VNF, __.key("generic-vnf-id", vnfId));
+ DSLQueryBuilder<Start, Node> builder = TraversalBuilder.fragment(startNode)
+ .to(__.node(AAIObjectType.VSERVER).to(__.node(AAIObjectType.L_INTERFACE).output()));
+ List<LInterface> linterfaces =
+ getAAIDSLQueryClient().querySingleResource(new DSLQuery(builder.build()), LInterface.class);
+ return linterfaces;
+ }
+
+ private AAIDSLQueryClient getAAIDSLQueryClient() {
+ if (aaiDslQueryClient == null) {
+ aaiDslQueryClient = new AAIDSLQueryClient();
+ }
+ return aaiDslQueryClient;
+ }
+
protected AAIResourcesClient getAaiResourcesClient() {
if (aaiResourcesClient == null) {
aaiResourcesClient = new AAIResourcesClient();
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/ServiceInstanceDeleteValidator.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/ServiceInstanceDeleteValidator.java
index 0c7ba65cf4..61f757ba64 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/ServiceInstanceDeleteValidator.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/ServiceInstanceDeleteValidator.java
@@ -6,11 +6,10 @@ import java.util.regex.Pattern;
import org.onap.so.apihandlerinfra.Action;
import org.onap.so.apihandlerinfra.Actions;
import org.onap.so.apihandlerinfra.infra.rest.AAIDataRetrieval;
-import org.onap.so.listener.Skip;
import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
import org.springframework.beans.factory.annotation.Autowired;
-@Skip
+
public class ServiceInstanceDeleteValidator implements RequestValidator {
@Autowired