From 2133020f219c8ec31c748d0a3ff9c063aa15dde9 Mon Sep 17 00:00:00 2001 From: "Modaboina, Kusumakumari (km583p)" Date: Fri, 14 Sep 2018 17:01:04 -0400 Subject: scopeOverlap errorfix actionrequest fr force=false Issue-ID: APPC-1188 Change-Id: Ife6666e80025a595c5a8f840a00d0882ac80ed71 Signed-off-by: Modaboina, Kusumakumari (km583p) --- appc-inbound/appc-interfaces-service/bundle/pom.xml | 6 +++--- .../onap/appc/interfaces/service/data/Request.java | 10 ++++++++++ .../service/executorImpl/ServiceExecutorImpl.java | 20 ++++++++++++++++++-- .../serviceExecutor/TestServiceExecutor.java | 4 ++-- 4 files changed, 33 insertions(+), 7 deletions(-) (limited to 'appc-inbound/appc-interfaces-service') diff --git a/appc-inbound/appc-interfaces-service/bundle/pom.xml b/appc-inbound/appc-interfaces-service/bundle/pom.xml index f9d21e13e..bf85243db 100644 --- a/appc-inbound/appc-interfaces-service/bundle/pom.xml +++ b/appc-inbound/appc-interfaces-service/bundle/pom.xml @@ -41,10 +41,10 @@ org.onap.appc.interfaces.services - org.onap.appc.aai.client,*;resolution:=optional + org.onap.appc.aai.client,org.onap.appc.aai.client.*,*;resolution:=optional jackson-dataformat-yaml * - true + true @@ -57,7 +57,7 @@ appc-interfaces-service-model ${project.version} - + org.onap.appc appc-aai-client-provider ${project.version} diff --git a/appc-inbound/appc-interfaces-service/bundle/src/main/java/org/onap/appc/interfaces/service/data/Request.java b/appc-inbound/appc-interfaces-service/bundle/src/main/java/org/onap/appc/interfaces/service/data/Request.java index d43c9277b..918883559 100644 --- a/appc-inbound/appc-interfaces-service/bundle/src/main/java/org/onap/appc/interfaces/service/data/Request.java +++ b/appc-inbound/appc-interfaces-service/bundle/src/main/java/org/onap/appc/interfaces/service/data/Request.java @@ -32,6 +32,9 @@ public class Request { @JsonProperty("action-identifiers") private ActionIdentifier actionIdentifiers; + + @JsonProperty("target-id") + private String targetId; public String getAction() { return action; @@ -49,4 +52,11 @@ public class Request { this.actionIdentifiers = actionIdentifiers; } + public String getTargetId() { + return targetId; + } + + public void setTargetId(String targetId) { + this.targetId = targetId; + } } diff --git a/appc-inbound/appc-interfaces-service/bundle/src/main/java/org/onap/appc/interfaces/service/executorImpl/ServiceExecutorImpl.java b/appc-inbound/appc-interfaces-service/bundle/src/main/java/org/onap/appc/interfaces/service/executorImpl/ServiceExecutorImpl.java index f38ea83e6..cafa8dc18 100644 --- a/appc-inbound/appc-interfaces-service/bundle/src/main/java/org/onap/appc/interfaces/service/executorImpl/ServiceExecutorImpl.java +++ b/appc-inbound/appc-interfaces-service/bundle/src/main/java/org/onap/appc/interfaces/service/executorImpl/ServiceExecutorImpl.java @@ -4,8 +4,6 @@ * ================================================================================ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ - * Copyright (C) 2017 Amdocs - * ============================================================================= * 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 @@ -74,6 +72,10 @@ public class ServiceExecutorImpl { } if (scopeOverlap.getCurrentRequest().getActionIdentifiers().getVnfId() != null) { return Boolean.TRUE; + } else if (!Strings.isNullOrEmpty(scopeOverlap.getVnfId()) + && scopeOverlap.getInProgressRequest().size() > 0) { + log.info("Checking overlap for similar vnfid :" + isVnfIdOverlap(scopeOverlap)); + return isVnfIdOverlap(scopeOverlap); } else if (scopeOverlap.getCurrentRequest().getActionIdentifiers().getVfModuleId() != null) { return Boolean.TRUE; } else if (scopeOverlap.getCurrentRequest().getActionIdentifiers().getvServerId() != null) { @@ -152,4 +154,18 @@ public class ServiceExecutorImpl { } return isVnfcNameOverLap(scopeOverlap); } + + private boolean isVnfIdOverlap(ScopeOverlap scopeOverlap) throws Exception { + List inProgressRequests = scopeOverlap.getInProgressRequest(); + log.info("inProgressRequests list"+inProgressRequests.toString()); + for (Request request : inProgressRequests) { + log.info("request list"+request.getTargetId()); + if (!Strings.isNullOrEmpty(scopeOverlap.getVnfId()) + && !Strings.isNullOrEmpty(request.getTargetId()) + && (request.getTargetId() + .equals(scopeOverlap.getVnfId()))) + return Boolean.TRUE; + } + return Boolean.FALSE; + } } diff --git a/appc-inbound/appc-interfaces-service/bundle/src/test/java/org/onap/appc/interfaceService/serviceExecutor/TestServiceExecutor.java b/appc-inbound/appc-interfaces-service/bundle/src/test/java/org/onap/appc/interfaceService/serviceExecutor/TestServiceExecutor.java index 735b8d985..6567a2cce 100644 --- a/appc-inbound/appc-interfaces-service/bundle/src/test/java/org/onap/appc/interfaceService/serviceExecutor/TestServiceExecutor.java +++ b/appc-inbound/appc-interfaces-service/bundle/src/test/java/org/onap/appc/interfaceService/serviceExecutor/TestServiceExecutor.java @@ -102,8 +102,8 @@ public class TestServiceExecutor { public void serviceExecutorRqstEx() throws Exception { ServiceExecutor sei = new ServiceExecutor(); String action ="isScopeOverlap"; - String requestDataType = ""; - String requestData = "{\"vnf-id\":\"ibcx8888v\",\"current-request\" :{\"action\" : \"Audit\",\"action-identifiers\" : {\"service-instance-id\" : \"service-instance-id\"}},\"in-progress-requests\" :[{\"action\" : \"HealthCheck\",\"action-identifiers\" : {\"service-instance-id\" : \"service-instance-id1\",\"vnf-id\" : \"vnf-id1\",\"vnfc-name\" : \"vnfc-name1\",\"vf-module-id\" : \"vf-module-id\",\"vserver-id\": \"vserver-id1\"}},{\"action\" : \"CheckLock\",\"action-identifiers\" : {\"service-instance-id\" : \"service-instance-id2\",\"vnf-id\" : \"vnf-id2\",\"vnfc-name\" : \"vnfc-name2\",\"vf-module-id\" : \"vf-module-id2\",\"vserver-id\": \"vserver-id2\"}}]}"; + String requestData = ""; + String requestDataType = "{\"vnf-id\":\"ibcx8888v\",\"current-request\" :{\"action\" : \"Audit\",\"action-identifiers\" : {\"service-instance-id\" : \"service-instance-id\"}},\"in-progress-requests\" :[{\"action\" : \"HealthCheck\",\"action-identifiers\" : {\"service-instance-id\" : \"service-instance-id1\",\"vnf-id\" : \"vnf-id1\",\"vnfc-name\" : \"vnfc-name1\",\"vf-module-id\" : \"vf-module-id\",\"vserver-id\": \"vserver-id1\"}},{\"action\" : \"CheckLock\",\"action-identifiers\" : {\"service-instance-id\" : \"service-instance-id2\",\"vnf-id\" : \"vnf-id2\",\"vnfc-name\" : \"vnfc-name2\",\"vf-module-id\" : \"vf-module-id2\",\"vserver-id\": \"vserver-id2\"},\"target-id\":\"ibcx0001v\"}]}"; sei.execute(action, requestData, requestDataType); } -- cgit 1.2.3-korg