scopeOverlap errorfix actionrequest fr force=false 57/66757/8
authorModaboina, Kusumakumari (km583p) <km583p@us.att.com>
Fri, 14 Sep 2018 21:01:04 +0000 (17:01 -0400)
committerPatrick Brady <pb071s@att.com>
Tue, 18 Sep 2018 20:23:47 +0000 (20:23 +0000)
Issue-ID: APPC-1188
Change-Id: Ife6666e80025a595c5a8f840a00d0882ac80ed71
Signed-off-by: Modaboina, Kusumakumari (km583p) <km583p@us.att.com>
appc-dispatcher/appc-request-handler/appc-request-handler-core/src/main/java/org/onap/appc/requesthandler/impl/RequestValidatorImpl.java
appc-dispatcher/appc-request-handler/appc-request-handler-core/src/main/java/org/onap/appc/requesthandler/model/RequestModel.java
appc-inbound/appc-interfaces-service/bundle/pom.xml
appc-inbound/appc-interfaces-service/bundle/src/main/java/org/onap/appc/interfaces/service/data/Request.java
appc-inbound/appc-interfaces-service/bundle/src/main/java/org/onap/appc/interfaces/service/executorImpl/ServiceExecutorImpl.java
appc-inbound/appc-interfaces-service/bundle/src/test/java/org/onap/appc/interfaceService/serviceExecutor/TestServiceExecutor.java
appc-outbound/appc-aai-client/provider/pom.xml

index e97f7c0..da571bd 100644 (file)
@@ -396,6 +396,7 @@ public class RequestValidatorImpl extends AbstractRequestValidatorImpl {
 
                     request.getActionIdentifier().setVnfId(null);
             }
+            request.setTargetId(record.getTargetId());
             inProgressRequests.add(request);
         }
 
index 692f5a4..61da106 100644 (file)
@@ -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
@@ -33,6 +31,8 @@ public class RequestModel {
     private String action;
     @JsonProperty("action-identifiers")
     private ActionIdentifierModel actionIdentifier;
+    @JsonProperty("target-id")
+    private String targetId;
 
     public ActionIdentifierModel getActionIdentifier() {
         return actionIdentifier;
@@ -49,5 +49,13 @@ public class RequestModel {
     public void setAction(String action) {
         this.action = action;
     }
+
+    public String getTargetId() {
+               return targetId;
+       }
+
+    public void setTargetId(String targetId) {
+               this.targetId = targetId;
+       }
     
 }
index f9d21e1..bf85243 100644 (file)
                 <configuration>
                     <instructions>
                     <Export-Package>org.onap.appc.interfaces.services</Export-Package>
-                         <Import-Package>org.onap.appc.aai.client,*;resolution:=optional</Import-Package>
+                         <Import-Package>org.onap.appc.aai.client,org.onap.appc.aai.client.*,*;resolution:=optional</Import-Package>
                          <Embed-Dependency>jackson-dataformat-yaml</Embed-Dependency>
                          <DynamicImport-Package>*</DynamicImport-Package>
-                                     <Embed-Transitive>true</Embed-Transitive>
+                         <Embed-Transitive>true</Embed-Transitive>
                     </instructions>
                 </configuration>
             </plugin>
@@ -57,7 +57,7 @@
             <artifactId>appc-interfaces-service-model</artifactId>
             <version>${project.version}</version>
         </dependency>
-        <dependency>
+       <dependency>
             <groupId>org.onap.appc</groupId>
             <artifactId>appc-aai-client-provider</artifactId>
             <version>${project.version}</version>
index d43c927..9188835 100644 (file)
@@ -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;
+       }
 }
index f38ea83..cafa8dc 100644 (file)
@@ -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;
+    }
 }
index 735b8d9..6567a2c 100644 (file)
@@ -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);
     }
 
index 836e298..126e461 100755 (executable)
                                        <instructions>\r
                                                <Bundle-SymbolicName>org.onap.appc.aai.client</Bundle-SymbolicName>\r
                                                <Bundle-Activator>org.onap.appc.aai.client.AppcAaiClientActivator</Bundle-Activator>\r
-                                               <Export-Package>org.onap.appc.aai.client</Export-Package>\r
+                                               <Export-Package>org.onap.appc.aai.client,org.onap.appc.aai.client.*</Export-Package>\r
                                                <Import-Package>*</Import-Package>\r
                                                <DynamicImport-Package>*</DynamicImport-Package>\r
                                                <Embed-Dependency>eelf-core,logback-core,logback-classic</Embed-Dependency>\r