From 13837f694cabe2bd997554e5e1455f3434be9163 Mon Sep 17 00:00:00 2001 From: "Hockla, Ali (ah999m)" Date: Mon, 13 Nov 2017 17:12:28 -0600 Subject: Update SO to use is-base-vf-module=false Issue-ID: POLICY-447 Change-Id: I63cd5d20670f224aa4b9220b99ee40aad4f3e50c Signed-off-by: Hockla, Ali (ah999m) --- .../actor/so/SOActorServiceProvider.java | 23 +++++++++++++--------- .../onap/policy/simulators/AaiSimulatorJaxRs.java | 5 ++--- 2 files changed, 16 insertions(+), 12 deletions(-) (limited to 'controlloop/common') diff --git a/controlloop/common/actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SOActorServiceProvider.java b/controlloop/common/actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SOActorServiceProvider.java index 8f52608e2..72119f639 100644 --- a/controlloop/common/actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SOActorServiceProvider.java +++ b/controlloop/common/actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SOActorServiceProvider.java @@ -239,19 +239,24 @@ public class SOActorServiceProvider implements Actor { // Find the index for base vf module and non-base vf module int baseIndex = -1; + int nonBaseIndex = -1; List inventoryItems = namedQueryResponseWrapper.aainqresponse.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems; for (AAINQInventoryResponseItem m : inventoryItems) { - if (m.vfModule != null && m.vfModule.isBaseVfModule) { - baseIndex = inventoryItems.indexOf(m); - } + if (m.vfModule != null) { + if (m.vfModule.isBaseVfModule) { + baseIndex = inventoryItems.indexOf(m); + } else if (m.vfModule.isBaseVfModule == false) { + nonBaseIndex = inventoryItems.indexOf(m); + } + } // - if (baseIndex != -1) { + if (baseIndex != -1 && nonBaseIndex != -1) { break; } } // Report the error if either base vf module or non-base vf module is not found - if (baseIndex == -1) { + if (baseIndex == -1 || nonBaseIndex == -1) { logger.error("Either base or non-base vf module is not found from AAI response."); return; } @@ -261,10 +266,10 @@ public class SOActorServiceProvider implements Actor { setVfModuleItemVfModuleName(vfModuleItemVfModuleName.replace("Vfmodule", "vDNS")); // vfModuleItem - NOT the base module - setVfModuleItemModelInvariantId(namedQueryResponseWrapper.aainqresponse.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(baseIndex).vfModule.modelInvariantId); - setVfModuleItemModelNameVersionId(namedQueryResponseWrapper.aainqresponse.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(baseIndex).vfModule.modelVersionId); - setVfModuleItemModelName(namedQueryResponseWrapper.aainqresponse.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(baseIndex).extraProperties.extraProperty.get(1).propertyValue); - setVfModuleItemModelVersionId(namedQueryResponseWrapper.aainqresponse.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(baseIndex).extraProperties.extraProperty.get(4).propertyValue); + setVfModuleItemModelInvariantId(namedQueryResponseWrapper.aainqresponse.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(nonBaseIndex).vfModule.modelInvariantId); + setVfModuleItemModelNameVersionId(namedQueryResponseWrapper.aainqresponse.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(nonBaseIndex).vfModule.modelVersionId); + setVfModuleItemModelName(namedQueryResponseWrapper.aainqresponse.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(nonBaseIndex).extraProperties.extraProperty.get(1).propertyValue); + setVfModuleItemModelVersionId(namedQueryResponseWrapper.aainqresponse.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(nonBaseIndex).extraProperties.extraProperty.get(4).propertyValue); // tenantItem setTenantItemTenantId(namedQueryResponseWrapper.aainqresponse.inventoryResponseItems.get(0).items.inventoryResponseItems.get(1).tenant.tenantId); diff --git a/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/AaiSimulatorJaxRs.java b/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/AaiSimulatorJaxRs.java index 6169184ad..8c13db079 100644 --- a/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/AaiSimulatorJaxRs.java +++ b/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/AaiSimulatorJaxRs.java @@ -60,9 +60,8 @@ public class AaiSimulatorJaxRs { } else { // vll format - new - // new aai response from Brian 11/10/2017 - return "{\"inventory-response-item\":[{\"vserver\":{\"vserver-id\":\"8b8997d2-9ec8-4593-aa53-fc956e13858f\",\"vserver-name\":\"zdfw1lb01lb01\",\"vserver-name2\":\"zdfw1lb01lb01\",\"prov-status\":\"ACTIVE\",\"vserver-selflink\":\"http://10.12.25.2:8774/v2.1/41d6d38489bd40b09ea8a6b6b852dcbd/servers/8b8997d2-9ec8-4593-aa53-fc956e13858f\",\"in-maint\":false,\"is-closed-loop-disabled\":false,\"resource-version\":\"1510152376305\"},\"extra-properties\":{},\"inventory-response-items\":{\"inventory-response-item\":[{\"model-name\":\"vLoadBalancer\",\"generic-vnf\":{\"vnf-id\":\"bb02635b-bda4-49c9-af38-362e21e1ade5\",\"vnf-name\":\"vLoadBalancer-1107\",\"vnf-type\":\"vLoadBalancer-1106/vLoadBalancer 0\",\"service-id\":\"66f157fc-4148-4880-95f5-e120677e98d1\",\"prov-status\":\"PREPROV\",\"orchestration-status\":\"Created\",\"in-maint\":false,\"is-closed-loop-disabled\":false,\"resource-version\":\"1510084829850\",\"model-invariant-id\":\"cee050ed-92a5-494f-ab04-234307a846dc\",\"model-version-id\":\"fd65becc-6b2c-4fe8-ace9-cc29db9a3da2\",\"model-customization-id\":\"1983c783-444f-4e79-af3a-85e5d49628f3\",\"nf-type\":\"\",\"nf-function\":\"\",\"nf-role\":\"\",\"nf-naming-code\":\"\"},\"extra-properties\":{\"extra-property\":[{\"property-name\":\"model-ver.model-version-id\",\"property-value\":\"fd65becc-6b2c-4fe8-ace9-cc29db9a3da2\"},{\"property-name\":\"model-ver.model-name\",\"property-value\":\"vLoadBalancer\"},{\"property-name\":\"model.model-type\",\"property-value\":\"resource\"},{\"property-name\":\"model.model-invariant-id\",\"property-value\":\"cee050ed-92a5-494f-ab04-234307a846dc\"},{\"property-name\":\"model-ver.model-version\",\"property-value\":\"1.0\"}]},\"inventory-response-items\":{\"inventory-response-item\":[{\"model-name\":\"vLoadBalancer-1106\",\"service-instance\":{\"service-instance-id\":\"3c2d03e3-f264-4544-ae83-322087adf945\",\"service-instance-name\":\"vLoadBalancer-1107\",\"model-invariant-id\":\"1321d60d-f7ff-4300-96c2-6bf0b3268b7a\",\"model-version-id\":\"732d4692-4b97-46f9-a996-0b3339e88c50\",\"resource-version\":\"1510084789548\"},\"extra-properties\":{\"extra-property\":[{\"property-name\":\"model-ver.model-version-id\",\"property-value\":\"732d4692-4b97-46f9-a996-0b3339e88c50\"},{\"property-name\":\"model-ver.model-name\",\"property-value\":\"vLoadBalancer-1106\"},{\"property-name\":\"model.model-type\",\"property-value\":\"service\"},{\"property-name\":\"model.model-invariant-id\",\"property-value\":\"1321d60d-f7ff-4300-96c2-6bf0b3268b7a\"},{\"property-name\":\"model-ver.model-version\",\"property-value\":\"1.0\"}]}},{\"model-name\":\"Vloadbalancer..base_vlb..module-0\",\"vf-module\":{\"vf-module-id\":\"33736edd-4814-414e-b8d7-fce2c90430c2\",\"vf-module-name\":\"vLoadBalancer-1107-1\",\"heat-stack-id\":\"vLoadBalancer-1107-1/0843d319-1678-4ade-be13-e443e7537bb9\",\"orchestration-status\":\"active\",\"is-base-vf-module\":true,\"resource-version\":\"1510085347667\",\"model-invariant-id\":\"6d760188-9a24-451a-b05b-e08b86cb94f2\",\"model-version-id\":\"93facad9-55f2-4fe0-9574-814c2bc2d071\",\"model-customization-id\":\"93fd5bd4-8051-4074-8530-c0c504604df5\",\"module-index\":0},\"extra-properties\":{\"extra-property\":[{\"property-name\":\"model-ver.model-version-id\",\"property-value\":\"93facad9-55f2-4fe0-9574-814c2bc2d071\"},{\"property-name\":\"model-ver.model-name\",\"property-value\":\"Vloadbalancer..base_vlb..module-0\"},{\"property-name\":\"model.model-type\",\"property-value\":\"resource\"},{\"property-name\":\"model.model-invariant-id\",\"property-value\":\"6d760188-9a24-451a-b05b-e08b86cb94f2\"},{\"property-name\":\"model-ver.model-version\",\"property-value\":\"1\"}]}}]}},{\"tenant\":{\"tenant-id\":\"41d6d38489bd40b09ea8a6b6b852dcbd\",\"tenant-name\":\"Integration-SB-00\",\"resource-version\":\"1509587770200\"},\"extra-properties\":{},\"inventory-response-items\":{\"inventory-response-item\":[{\"cloud-region\":{\"cloud-owner\":\"CloudOwner\",\"cloud-region-id\":\"RegionOne\",\"cloud-type\":\"SharedNode\",\"owner-defined-type\":\"OwnerType\",\"cloud-region-version\":\"v1\",\"cloud-zone\":\"CloudZone\",\"sriov-automation\":false,\"resource-version\":\"1509587770092\"},\"extra-properties\":{}}]}}]}}]}"; - + // new aai response from Brian 11/13/2017 + return "{\"inventory-response-item\":[{\"vserver\":{\"vserver-id\":\"6ed3642c-f7a1-4a7c-9290-3d51fe1531eb\",\"vserver-name\":\"zdfw1lb01lb02\",\"vserver-name2\":\"zdfw1lb01lb02\",\"prov-status\":\"ACTIVE\",\"vserver-selflink\":\"http://10.12.25.2:8774/v2.1/41d6d38489bd40b09ea8a6b6b852dcbd/servers/6ed3642c-f7a1-4a7c-9290-3d51fe1531eb\",\"in-maint\":false,\"is-closed-loop-disabled\":false,\"resource-version\":\"1510606403522\"},\"extra-properties\":{},\"inventory-response-items\":{\"inventory-response-item\":[{\"model-name\":\"vLoadBalancer\",\"generic-vnf\":{\"vnf-id\":\"db373a8d-f7be-4d02-8ac8-6ca4c305d144\",\"vnf-name\":\"Vfmodule_vLB1113\",\"vnf-type\":\"vLoadBalancer-1106/vLoadBalancer 0\",\"service-id\":\"66f157fc-4148-4880-95f5-e120677e98d1\",\"prov-status\":\"PREPROV\",\"orchestration-status\":\"Created\",\"in-maint\":false,\"is-closed-loop-disabled\":false,\"resource-version\":\"1510604011851\",\"model-invariant-id\":\"cee050ed-92a5-494f-ab04-234307a846dc\",\"model-version-id\":\"fd65becc-6b2c-4fe8-ace9-cc29db9a3da2\",\"model-customization-id\":\"1983c783-444f-4e79-af3a-85e5d49628f3\",\"nf-type\":\"\",\"nf-function\":\"\",\"nf-role\":\"\",\"nf-naming-code\":\"\"},\"extra-properties\":{\"extra-property\":[{\"property-name\":\"model-ver.model-version-id\",\"property-value\":\"fd65becc-6b2c-4fe8-ace9-cc29db9a3da2\"},{\"property-name\":\"model-ver.model-name\",\"property-value\":\"vLoadBalancer\"},{\"property-name\":\"model.model-type\",\"property-value\":\"resource\"},{\"property-name\":\"model.model-invariant-id\",\"property-value\":\"cee050ed-92a5-494f-ab04-234307a846dc\"},{\"property-name\":\"model-ver.model-version\",\"property-value\":\"1.0\"}]},\"inventory-response-items\":{\"inventory-response-item\":[{\"model-name\":\"vLoadBalancer-1106\",\"service-instance\":{\"service-instance-id\":\"3b12f31f-8f2d-4f5c-b875-61ff1194b941\",\"service-instance-name\":\"vLoadBalancer-1113\",\"model-invariant-id\":\"1321d60d-f7ff-4300-96c2-6bf0b3268b7a\",\"model-version-id\":\"732d4692-4b97-46f9-a996-0b3339e88c50\",\"resource-version\":\"1510603936425\"},\"extra-properties\":{\"extra-property\":[{\"property-name\":\"model-ver.model-version-id\",\"property-value\":\"732d4692-4b97-46f9-a996-0b3339e88c50\"},{\"property-name\":\"model-ver.model-name\",\"property-value\":\"vLoadBalancer-1106\"},{\"property-name\":\"model.model-type\",\"property-value\":\"service\"},{\"property-name\":\"model.model-invariant-id\",\"property-value\":\"1321d60d-f7ff-4300-96c2-6bf0b3268b7a\"},{\"property-name\":\"model-ver.model-version\",\"property-value\":\"1.0\"}]}},{\"model-name\":\"Vloadbalancer..base_vlb..module-0\",\"vf-module\":{\"vf-module-id\":\"e6b3e3eb-34e1-4c00-b8c1-2a4fbe479b12\",\"vf-module-name\":\"Vfmodule_vLB1113-1\",\"heat-stack-id\":\"Vfmodule_vLB1113-1/3dd6d900-772f-4fcc-a0cb-e250ab2bb4db\",\"orchestration-status\":\"active\",\"is-base-vf-module\":true,\"resource-version\":\"1510604612557\",\"model-invariant-id\":\"6d760188-9a24-451a-b05b-e08b86cb94f2\",\"model-version-id\":\"93facad9-55f2-4fe0-9574-814c2bc2d071\",\"model-customization-id\":\"93fd5bd4-8051-4074-8530-c0c504604df5\",\"module-index\":0},\"extra-properties\":{\"extra-property\":[{\"property-name\":\"model-ver.model-version-id\",\"property-value\":\"93facad9-55f2-4fe0-9574-814c2bc2d071\"},{\"property-name\":\"model-ver.model-name\",\"property-value\":\"Vloadbalancer..base_vlb..module-0\"},{\"property-name\":\"model.model-type\",\"property-value\":\"resource\"},{\"property-name\":\"model.model-invariant-id\",\"property-value\":\"6d760188-9a24-451a-b05b-e08b86cb94f2\"},{\"property-name\":\"model-ver.model-version\",\"property-value\":\"1\"}]}},{\"model-name\":\"Vloadbalancer..dnsscaling..module-1\",\"vf-module\":{\"vf-module-id\":\"dummy_db373a8d-f7be-4d02-8ac8-6ca4c305d144\",\"vf-module-name\":\"dummy_db373a8d-f7be-4d02-8ac8-6ca4c305d144\",\"is-base-vf-module\":false,\"resource-version\":\"1510610079687\",\"model-invariant-id\":\"356a1cff-71f2-4086-9980-a2927ce11c1c\",\"model-version-id\":\"6b93d804-cfc8-4be3-92cc-9336d135859a\"},\"extra-properties\":{\"extra-property\":[{\"property-name\":\"model-ver.model-version-id\",\"property-value\":\"6b93d804-cfc8-4be3-92cc-9336d135859a\"},{\"property-name\":\"model-ver.model-name\",\"property-value\":\"Vloadbalancer..dnsscaling..module-1\"},{\"property-name\":\"model.model-type\",\"property-value\":\"resource\"},{\"property-name\":\"model.model-invariant-id\",\"property-value\":\"356a1cff-71f2-4086-9980-a2927ce11c1c\"},{\"property-name\":\"model-ver.model-version\",\"property-value\":\"1\"}]}}]}},{\"tenant\":{\"tenant-id\":\"41d6d38489bd40b09ea8a6b6b852dcbd\",\"tenant-name\":\"Integration-SB-00\",\"resource-version\":\"1509587770200\"},\"extra-properties\":{},\"inventory-response-items\":{\"inventory-response-item\":[{\"cloud-region\":{\"cloud-owner\":\"CloudOwner\",\"cloud-region-id\":\"RegionOne\",\"cloud-type\":\"SharedNode\",\"owner-defined-type\":\"OwnerType\",\"cloud-region-version\":\"v1\",\"cloud-zone\":\"CloudZone\",\"sriov-automation\":false,\"resource-version\":\"1509587770092\"},\"extra-properties\":{}}]}}]}}]}"; } } else -- cgit 1.2.3-korg