diff options
author | Modaboina, Kusumakumari (km583p) <km583p@us.att.com> | 2018-09-14 17:01:04 -0400 |
---|---|---|
committer | Patrick Brady <pb071s@att.com> | 2018-09-18 20:23:47 +0000 |
commit | 2133020f219c8ec31c748d0a3ff9c063aa15dde9 (patch) | |
tree | 5037de2731c0d022f288529c6326b6e2df3624b8 /appc-inbound/appc-interfaces-service/bundle/src | |
parent | 3c0def26b386b2bc48ec7b6c0f53064bd270ce63 (diff) |
scopeOverlap errorfix actionrequest fr force=false
Issue-ID: APPC-1188
Change-Id: Ife6666e80025a595c5a8f840a00d0882ac80ed71
Signed-off-by: Modaboina, Kusumakumari (km583p) <km583p@us.att.com>
Diffstat (limited to 'appc-inbound/appc-interfaces-service/bundle/src')
3 files changed, 30 insertions, 4 deletions
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<Request> 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); } |