RA: Fix Problems with resource query results 10/82710/1
authorStan Bonev <sb5356@att.com>
Tue, 19 Mar 2019 19:19:35 +0000 (15:19 -0400)
committerStan Bonev <sb5356@att.com>
Tue, 19 Mar 2019 19:19:35 +0000 (15:19 -0400)
Change-Id: Ic0fa65bff95ab5bd8ab65b055dcf7ec378e99d91
Issue-ID: CCSDK-1170
Signed-off-by: Stan Bonev <sb5356@att.com>
resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocatorImpl.java

index ab73dab..5779676 100644 (file)
@@ -221,6 +221,9 @@ public class EndPointAllocatorImpl implements EndPointAllocator {
         List<Resource> rlist = resourceManager.queryResources(resourceName, assetIdFilter);
 
         for (Resource r : rlist) {
+            if (r.allocationItems == null || r.allocationItems.isEmpty()) {
+                continue;
+            }
 
             log.info("ResourceName:" + r.resourceKey.resourceName + " assetId:" + r.resourceKey.assetId);
 
@@ -252,7 +255,7 @@ public class EndPointAllocatorImpl implements EndPointAllocator {
             r = resourceManager.getResource(resourceName, assetId);
         }
 
-        if (r != null) {
+        if (r != null && r.allocationItems != null && !r.allocationItems.isEmpty()) {
             log.info("ResourceName:" + r.resourceKey.resourceName + " assetId:" + r.resourceKey.assetId);
 
             ResourceData rd = getResourceData(r);