aboutsummaryrefslogtreecommitdiffstats
path: root/vid-automation
diff options
context:
space:
mode:
authorPATTANAYAK, SAUMYA SWARUP (sp931a) <sp931a@att.com>2021-09-22 10:22:53 -0400
committerPATTANAYAK, SAUMYA SWARUP (sp931a) <sp931a@att.com>2021-09-29 10:28:22 -0400
commitf78df9f30d5b7bda1b291bff34dd85bdd9411c12 (patch)
tree3bdcae2f31ebdbb6bb2ff21e13a26d83f2e74a00 /vid-automation
parenta1d209deac01bc0f8f7be96a585bdbef9cc0cdb9 (diff)
AAI Query optimization for VID
Issue-ID: VID-986 Change-Id: Ia3e012c41df4e9049ce9a1ae56ec83b276e11611 Signed-off-by: PATTANAYAK, SAUMYA SWARUP (sp931a) <sp931a@att.com>
Diffstat (limited to 'vid-automation')
-rw-r--r--vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetServiceInstanceBySubscriberIdAndServiceTypeAndSIID.java230
-rw-r--r--vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIServiceInstanceDSLPut.java105
-rw-r--r--vid-automation/src/test/java/org/onap/vid/api/AaiApiTest.java99
3 files changed, 434 insertions, 0 deletions
diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetServiceInstanceBySubscriberIdAndServiceTypeAndSIID.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetServiceInstanceBySubscriberIdAndServiceTypeAndSIID.java
new file mode 100644
index 000000000..fe722ae20
--- /dev/null
+++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetServiceInstanceBySubscriberIdAndServiceTypeAndSIID.java
@@ -0,0 +1,230 @@
+package org.onap.simulator.presetGenerator.presets.aai;
+
+import org.onap.simulator.presetGenerator.presets.BasePresets.BaseAAIPreset;
+import org.springframework.http.HttpMethod;
+
+public class PresetAAIGetServiceInstanceBySubscriberIdAndServiceTypeAndSIID extends BaseAAIPreset {
+ private String subscriberId;
+
+ public String getSubscriberId() {
+ return subscriberId;
+ }
+
+ public String getServiceType() {
+ return serviceType;
+ }
+
+ public String getServiceInstanceId() {
+ return serviceInstanceId;
+ }
+
+ private String serviceType;
+ private String serviceInstanceId;
+
+ public PresetAAIGetServiceInstanceBySubscriberIdAndServiceTypeAndSIID(String subscriberId, String serviceType, String serviceInstanceId) {
+ this.subscriberId = subscriberId;
+ this.serviceType = serviceType;
+ this.serviceInstanceId = serviceInstanceId;
+ }
+
+// @Override
+// public Map<String, List> getQueryParams() {
+// return ImmutableMap.of("depth", Collections.singletonList("1"));
+// }
+
+ @Override
+ public HttpMethod getReqMethod() {
+ return HttpMethod.GET;
+ }
+
+ @Override
+ public String getReqPath() {
+ return getRootPath() +
+ "/business/customers/customer/"+getSubscriberId()+
+ "/service-subscriptions/service-subscription/"+getServiceType()+
+ "/service-instances/service-instance/"+getServiceInstanceId();
+ }
+
+ @Override
+ public Object getResponseBody() {
+ return "{\n"
+ + " \"service-instance-id\": \"5d942bc7-3acf-4e35-836a-393619ebde66\","
+ + " \"service-instance-name\": \"dpa2actsf5001v_Port_Mirroring_dpa2a_SVC\","
+ + " \"model-invariant-id\": \"0757d856-a9c6-450d-b494-e1c0a4aab76f\","
+ + " \"model-version-id\": \"a9088517-efe8-4bed-9c54-534462cb08c2\","
+ + " \"resource-version\": \"1500789244673\","
+ + " \"orchestration-status\": \"Active\","
+ + " \"relationship-list\": {"
+ + " \"relationship\": ["
+ + " {"
+ + " \"related-to\": \"generic-vnf\","
+ + " \"related-link\": \"/aai/v11/network/generic-vnfs/generic-vnf/c015cc0f-0f37-4488-aabf-53795fd93cd3\","
+ + " \"relationship-data\": ["
+ + " {"
+ + " \"relationship-key\": \"generic-vnf.vnf-id\","
+ + " \"relationship-value\": \"c015cc0f-0f37-4488-aabf-53795fd93cd3\""
+ + " }"
+ + " ],"
+ + " \"related-to-property\": ["
+ + " {"
+ + " \"property-key\": \"generic-vnf.vnf-name\","
+ + " \"property-value\": \"fsd\""
+ + " }"
+ + " ]"
+ + " },"
+ + " {"
+ + " \"related-to\": \"generic-vnf\","
+ + " \"related-link\": \"/aai/v11/network/generic-vnfs/generic-vnf/0846287b-65bf-45a6-88f6-6a1af4149fac\","
+ + " \"relationship-data\": ["
+ + " {"
+ + " \"relationship-key\": \"generic-vnf.vnf-id\","
+ + " \"relationship-value\": \"0846287b-65bf-45a6-88f6-6a1af4149fac\""
+ + " }"
+ + " ],"
+ + " \"related-to-property\": ["
+ + " {"
+ + " \"property-key\": \"generic-vnf.vnf-name\","
+ + " \"property-value\": \"kjkjk\""
+ + " }"
+ + " ]"
+ + " },"
+ + " {"
+ + " \"related-to\": \"generic-vnf\","
+ + " \"related-link\": \"/aai/v11/network/generic-vnfs/generic-vnf/9908b762-136f-4b1f-8eb4-ef670ef58bb4\","
+ + " \"relationship-data\": ["
+ + " {"
+ + " \"relationship-key\": \"generic-vnf.vnf-id\","
+ + " \"relationship-value\": \"9908b762-136f-4b1f-8eb4-ef670ef58bb4\""
+ + " }"
+ + " ],"
+ + " \"related-to-property\": ["
+ + " {"
+ + " \"property-key\": \"generic-vnf.vnf-name\","
+ + " \"property-value\": \"uiui\""
+ + " }"
+ + " ]"
+ + " },"
+ + " {"
+ + " \"related-to\": \"generic-vnf\","
+ + " \"related-link\": \"/aai/v11/network/generic-vnfs/generic-vnf/543931f5-e50e-45a2-a69f-ab727e4c7f2f\","
+ + " \"relationship-data\": ["
+ + " {"
+ + " \"relationship-key\": \"generic-vnf.vnf-id\","
+ + " \"relationship-value\": \"543931f5-e50e-45a2-a69f-ab727e4c7f2f\""
+ + " }"
+ + " ],"
+ + " \"related-to-property\": ["
+ + " {"
+ + " \"property-key\": \"generic-vnf.vnf-name\","
+ + " \"property-value\": \"sdfsdfdsf\""
+ + " }"
+ + " ]"
+ + " },"
+ + " {"
+ + " \"related-to\": \"generic-vnf\","
+ + " \"related-link\": \"/aai/v11/network/generic-vnfs/generic-vnf/25e84884-22d5-44c9-8212-cb459f63e0ba\","
+ + " \"relationship-data\": ["
+ + " {"
+ + " \"relationship-key\": \"generic-vnf.vnf-id\","
+ + " \"relationship-value\": \"25e84884-22d5-44c9-8212-cb459f63e0ba\""
+ + " }"
+ + " ],"
+ + " \"related-to-property\": ["
+ + " {"
+ + " \"property-key\": \"generic-vnf.vnf-name\","
+ + " \"property-value\": \"sdada\""
+ + " }"
+ + " ]"
+ + " },"
+ + " {"
+ + " \"related-to\": \"generic-vnf\","
+ + " \"related-link\": \"/aai/v11/network/generic-vnfs/generic-vnf/013fb0ba-977b-496c-9faa-7f8e5f083eec\","
+ + " \"relationship-data\": ["
+ + " {"
+ + " \"relationship-key\": \"generic-vnf.vnf-id\","
+ + " \"relationship-value\": \"013fb0ba-977b-496c-9faa-7f8e5f083eec\""
+ + " }"
+ + " ],"
+ + " \"related-to-property\": ["
+ + " {"
+ + " \"property-key\": \"generic-vnf.vnf-name\","
+ + " \"property-value\": \"gvb\""
+ + " }"
+ + " ]"
+ + " },"
+ + " {"
+ + " \"related-to\": \"generic-vnf\","
+ + " \"related-link\": \"/aai/v11/network/generic-vnfs/generic-vnf/06914296-cb46-4b62-9453-329a706a6cbb\","
+ + " \"relationship-data\": ["
+ + " {"
+ + " \"relationship-key\": \"generic-vnf.vnf-id\","
+ + " \"relationship-value\": \"06914296-cb46-4b62-9453-329a706a6cbb\""
+ + " }"
+ + " ],"
+ + " \"related-to-property\": ["
+ + " {"
+ + " \"property-key\": \"generic-vnf.vnf-name\","
+ + " \"property-value\": \"lkllll\""
+ + " }"
+ + " ]"
+ + " },"
+ + " {"
+ + " \"related-to\": \"generic-vnf\","
+ + " \"related-link\": \"/aai/v11/network/generic-vnfs/generic-vnf/c55da606-cf38-42c7-bc3c-be8e23b19299\","
+ + " \"relationship-data\": ["
+ + " {"
+ + " \"relationship-key\": \"generic-vnf.vnf-id\","
+ + " \"relationship-value\": \"c55da606-cf38-42c7-bc3c-be8e23b19299\""
+ + " }"
+ + " ],"
+ + " \"related-to-property\": ["
+ + " {"
+ + " \"property-key\": \"generic-vnf.vnf-name\","
+ + " \"property-value\": \"ss\""
+ + " }"
+ + " ]"
+ + " },"
+ + " {"
+ + " \"related-to\": \"generic-vnf\","
+ + " \"related-link\": \"/aai/v11/network/generic-vnfs/generic-vnf/27cc0914-70be-453e-b552-3df6b1d6cda9\","
+ + " \"relationship-data\": ["
+ + " {"
+ + " \"relationship-key\": \"generic-vnf.vnf-id\","
+ + " \"relationship-value\": \"27cc0914-70be-453e-b552-3df6b1d6cda9\""
+ + " }"
+ + " ],"
+ + " \"related-to-property\": ["
+ + " {"
+ + " \"property-key\": \"generic-vnf.vnf-name\","
+ + " \"property-value\": \"yh\""
+ + " }"
+ + " ]"
+ + " },"
+ + " {"
+ + " \"related-to\": \"logical-link\","
+ + " \"related-link\": \"/aai/v11/network/logical-links/logical-link/tesai372ve2%3Aae10%7Ctesaaisdgrbclz1a1%3Apo100\","
+ + " \"relationship-data\": ["
+ + " {"
+ + " \"relationship-key\": \"logical-link.link-name\","
+ + " \"relationship-value\": \"tesai372ve2:ae10|tesaaisdgrbclz1a1:po100\""
+ + " }"
+ + " ]"
+ + " },"
+ + " {"
+ + " \"related-to\": \"logical-link\","
+ + " \"related-link\": \"/aai/v11/network/logical-links/logical-link/SANITY6758cce9%3ALAG1992%7CSANITY6785cce9%3ALAG1961\","
+ + " \"relationship-data\": ["
+ + " {"
+ + " \"relationship-key\": \"logical-link.link-name\","
+ + " \"relationship-value\": \"SANITY6758cce9:LAG1992|SANITY6785cce9:LAG1961\""
+ + " }"
+ + " ]"
+ + " }"
+ + " ]"
+ + " }"
+ + " }"
+ + " }";
+ }
+
+}
+
diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIServiceInstanceDSLPut.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIServiceInstanceDSLPut.java
new file mode 100644
index 000000000..3ab5a4bbd
--- /dev/null
+++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIServiceInstanceDSLPut.java
@@ -0,0 +1,105 @@
+package org.onap.simulator.presetGenerator.presets.aai;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import org.onap.simulator.presetGenerator.presets.BasePresets.BaseAAIPreset;
+import org.springframework.http.HttpMethod;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+public class PresetAAIServiceInstanceDSLPut extends BaseAAIPreset {
+
+ public PresetAAIServiceInstanceDSLPut(String globalCustomerId, String serviceInstanceIdentifier, String instanceIdentifierType) {
+ this.serviceInstanceIdentifier = serviceInstanceIdentifier;
+ this.globalCustomerId = globalCustomerId;
+ this.instanceIdentifierType = instanceIdentifierType;
+ }
+
+ public String getInstanceIdentifierType() {
+ return instanceIdentifierType;
+ }
+
+ private final String instanceIdentifierType;
+ private final String globalCustomerId;
+
+ public String getGlobalCustomerId() {
+ return globalCustomerId;
+ }
+
+ public String getServiceInstanceIdentifier() {
+ return serviceInstanceIdentifier;
+ }
+
+ private final String serviceInstanceIdentifier;
+
+ @Override
+ public HttpMethod getReqMethod() {
+ return HttpMethod.PUT;
+ }
+
+ @Override
+ public String getReqPath() {
+ return getRootPath() + "/dsl";
+ }
+
+ @Override
+ public Map<String, List> getQueryParams() {
+ return ImmutableMap.of(
+ "format", Collections.singletonList("resource"),
+ "nodesOnly", Collections.singletonList("true"),
+ "depth", Collections.singletonList("0"),
+ "as-tree", Collections.singletonList("true")
+ );
+ }
+
+ @Override
+ public Object getRequestBody() {
+ String requestBody = null;
+ String query = null;
+ if(getInstanceIdentifierType().equals("Service Instance Id")) {
+ query = "customer*('global-customer-id','" + getGlobalCustomerId() + "')>" +
+ "service-subscription>service-instance*('service-instance-id','" + getServiceInstanceIdentifier() + "')";
+ requestBody = "{\"dsl\":\"" + query + "\"}";
+ } else {
+ query = "customer*('global-customer-id','" + getGlobalCustomerId() + "')>" +
+ "service-subscription>service-instance*('service-instance-name','" + getServiceInstanceIdentifier() + "')";
+ requestBody = "{\"dsl\":\"" + query + "\"}";
+ }
+ return requestBody;
+ }
+
+
+ @Override
+ public Object getResponseBody() {
+ return "{\"results\": [\n"
+ + "{\n"
+ + "\"customer\": {\n"
+ + "\"global-customer-id\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\",\n"
+ + "\"subscriber-name\": \"Mobility\",\n"
+ + "\"subscriber-type\": \"INFRA\",\n"
+ + "\"resource-version\": \"1602518417955\",\n"
+ + "\"related-nodes\": [\n"
+ + "{\n"
+ + "\"service-subscription\": {\n"
+ + "\"service-type\": \"VPMS\",\n"
+ + "\"resource-version\": \"1629183620246\",\n"
+ + "\"related-nodes\": [\n"
+ + "{\n"
+ + "\"service-instance\": {\n"
+ + "\"service-instance-id\": \"5d942bc7-3acf-4e35-836a-393619ebde66\",\n"
+ + "\"service-instance-name\": \"dpa2actsf5001v_Port_Mirroring_dpa2a_SVC\",\n"
+ + "\"service-type\": \"PORT-MIRROR\",\n"
+ + "\"service-role\": \"VPROBE\",\n"
+ + "\"environment-context\": \"General_Revenue-Bearing\",\n"
+ + "\"workload-context\": \"Production\",\n"
+ + "\"model-invariant-id\": \"0757d856-a9c6-450d-b494-e1c0a4aab76f\",\n"
+ + "\"model-version-id\": \"a9088517-efe8-4bed-9c54-534462cb08c2\",\n"
+ + "\"resource-version\": \"1615330529236\",\n"
+ + "\"selflink\": \"SOME_SELF_LINK\",\n"
+ + "\"orchestration-status\": \"Active\"\n"
+ + "}}]}}]}}]}";
+
+ }
+}
diff --git a/vid-automation/src/test/java/org/onap/vid/api/AaiApiTest.java b/vid-automation/src/test/java/org/onap/vid/api/AaiApiTest.java
index 958ba87d1..98c6dafa9 100644
--- a/vid-automation/src/test/java/org/onap/vid/api/AaiApiTest.java
+++ b/vid-automation/src/test/java/org/onap/vid/api/AaiApiTest.java
@@ -40,6 +40,7 @@ import org.onap.simulator.presetGenerator.presets.BasePresets.BasePreset;
import org.onap.simulator.presetGenerator.presets.aai.AAIBaseGetL3NetworksByCloudRegionPreset;
import org.onap.simulator.presetGenerator.presets.aai.PresetAAIBadBodyForGetServicesGet;
import org.onap.simulator.presetGenerator.presets.aai.PresetAAICloudRegionAndSourceFromConfigurationPut;
+import org.onap.simulator.presetGenerator.presets.aai.PresetAAIFilterServiceInstanceById;
import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetCloudOwnersByCloudRegionId;
import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetHomingForVfModule;
import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetInstanceGroupsByCloudRegion;
@@ -54,9 +55,11 @@ import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetNetworkCollect
import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetPortMirroringSourcePorts;
import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetPortMirroringSourcePortsError;
import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetRelatedInstanceGroupsByVnfId;
+import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetServiceInstanceBySubscriberIdAndServiceTypeAndSIID;
import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetSubscribersGet;
import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetVpnsByType;
import org.onap.simulator.presetGenerator.presets.aai.PresetAAIModelVersionsByInvariantId;
+import org.onap.simulator.presetGenerator.presets.aai.PresetAAIServiceInstanceDSLPut;
import org.onap.simulator.presetGenerator.presets.aai.PresetAAIStandardQueryGet;
import org.onap.simulator.presetGenerator.presets.aai.PresetBaseAAICustomQuery;
import org.onap.simulator.presetGenerator.presets.sdc.PresetSDCGetServiceMetadataGet;
@@ -93,6 +96,10 @@ public class AaiApiTest extends BaseApiAaiTest {
public static final String OPERATIONAL_ENVIRONMENT_STATUS = "Activate";
public static final String GET_INSTANCE_GROUPS_BY_CLOUDREGION_EXPECTED_RESPONSE = "{\"results\":[{\"instance-group\":{\"id\":\"AAI-12002-test3-vm230w\",\"description\":\"a9DEa0kpY\",\"instance-group-role\":\"JZmha7QSS4tJ\",\"model-invariant-id\":\"model-id3\",\"model-version-id\":\"a0efd5fc-f7be-4502-936a-a6c6392b958f\",\"instance-group-type\":\"type\",\"resource-version\":\"1520888659539\",\"instance-group-name\":\"wKmBXiO1xm8bK\",\"instance-group-function\":\"testfunction2\",\"relationship-list\":{\"relationship\":[{\"relationDataList\":[{\"relationship-key\":\"cloud-region.cloud-owner\",\"relationship-value\":\"AAI-12002-vm230w\"},{\"relationship-key\":\"cloud-region.cloud-region-id\",\"relationship-value\":\"AAI-region-vm230w\"}],\"relatedToPropertyList\":[{\"property-key\":\"cloud-region.owner-defined-type\",\"property-value\":null}],\"related-to\":\"cloud-region\",\"related-link\":\"/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/AAI-12002-vm230w/AAI-region-vm230w\",\"relationship-label\":\"org.onap.relationships.inventory.Uses\",\"relationship-data\":[{\"relationship-key\":\"cloud-region.cloud-owner\",\"relationship-value\":\"AAI-12002-vm230w\"},{\"relationship-key\":\"cloud-region.cloud-region-id\",\"relationship-value\":\"AAI-region-vm230w\"}],\"related-to-property\":[{\"property-key\":\"cloud-region.owner-defined-type\",\"property-value\":null}]}]}}},{\"instance-group\":{\"id\":\"AAI-12002-test1-vm230w\",\"description\":\"a9DEa0kpY\",\"instance-group-role\":\"JZmha7QSS4tJ\",\"model-invariant-id\":\"model-id1\",\"model-version-id\":\"a0efd5fc-f7be-4502-936a-a6c6392b958f\",\"instance-group-type\":\"type\",\"resource-version\":\"1520886467989\",\"instance-group-name\":\"wKmBXiO1xm8bK\",\"instance-group-function\":\"testfunction2\",\"relationship-list\":{\"relationship\":[{\"relationDataList\":[{\"relationship-key\":\"cloud-region.cloud-owner\",\"relationship-value\":\"AAI-12002-vm230w\"},{\"relationship-key\":\"cloud-region.cloud-region-id\",\"relationship-value\":\"AAI-region-vm230w\"}],\"relatedToPropertyList\":[{\"property-key\":\"cloud-region.owner-defined-type\",\"property-value\":null}],\"related-to\":\"cloud-region\",\"related-link\":\"/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/AAI-12002-vm230w/AAI-region-vm230w\",\"relationship-label\":\"org.onap.relationships.inventory.Uses\",\"relationship-data\":[{\"relationship-key\":\"cloud-region.cloud-owner\",\"relationship-value\":\"AAI-12002-vm230w\"},{\"relationship-key\":\"cloud-region.cloud-region-id\",\"relationship-value\":\"AAI-region-vm230w\"}],\"related-to-property\":[{\"property-key\":\"cloud-region.owner-defined-type\",\"property-value\":null}]}]}}},{\"instance-group\":{\"id\":\"AAI-12002-test2-vm230w\",\"description\":\"a9DEa0kpY\",\"instance-group-role\":\"JZmha7QSS4tJ\",\"model-invariant-id\":\"model-id2\",\"model-version-id\":\"version2\",\"instance-group-type\":\"type\",\"resource-version\":\"1520888629970\",\"instance-group-name\":\"wKmBXiO1xm8bK\",\"instance-group-function\":\"testfunction2\",\"relationship-list\":{\"relationship\":[{\"relationDataList\":[{\"relationship-key\":\"cloud-region.cloud-owner\",\"relationship-value\":\"AAI-12002-vm230w\"},{\"relationship-key\":\"cloud-region.cloud-region-id\",\"relationship-value\":\"AAI-region-vm230w\"}],\"relatedToPropertyList\":[{\"property-key\":\"cloud-region.owner-defined-type\",\"property-value\":null}],\"related-to\":\"cloud-region\",\"related-link\":\"/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/AAI-12002-vm230w/AAI-region-vm230w\",\"relationship-label\":\"org.onap.relationships.inventory.Uses\",\"relationship-data\":[{\"relationship-key\":\"cloud-region.cloud-owner\",\"relationship-value\":\"AAI-12002-vm230w\"},{\"relationship-key\":\"cloud-region.cloud-region-id\",\"relationship-value\":\"AAI-region-vm230w\"}],\"related-to-property\":[{\"property-key\":\"cloud-region.owner-defined-type\",\"property-value\":null}]}]}}}]}\n";
public static final String GET_NETWORK_COLLECTION_EXPECTED_RESPONSE = "{\"results\":{\"collection\":{\"collection-id\":\"collection-1-2018-rs804s\",\"model-invariant-id\":\"5761e0a7-defj777\",\"model-version-id\":\"5761e0a7-defj232\",\"collection-name\":\"collection-name\",\"collection-type\":\"L3-NETWORK\",\"collection-role\":\"SUB-INTERFACE\",\"collection-function\":\"collection-function\",\"collection-customization-id\":\"custom-unique-data-id\",\"relationship-list\":{\"relationship\":[{\"relationDataList\":[{\"relationship-key\":\"customer.global-customer-id\",\"relationship-value\":\"customer-1-2017-rs804s\"},{\"relationship-key\":\"service-subscription.service-type\",\"relationship-value\":\"service-value7-rs804s\"},{\"relationship-key\":\"service-instance.service-instance-id\",\"relationship-value\":\"2UJZZ01777-rs804s\"}],\"relatedToPropertyList\":[{\"property-key\":\"service-instance.service-instance-name\",\"property-value\":null}],\"related-to\":\"service-instance\",\"related-link\":\"/aai/v13/business/customers/customer/customer-1-2017-rs804s/service-subscriptions/service-subscription/service-value7-rs804s/service-instances/service-instance/2UJZZ01777-rs804s\",\"relationship-label\":\"org.onap.relationships.inventory.MemberOf\",\"relationship-data\":[{\"relationship-key\":\"customer.global-customer-id\",\"relationship-value\":\"customer-1-2017-rs804s\"},{\"relationship-key\":\"service-subscription.service-type\",\"relationship-value\":\"service-value7-rs804s\"},{\"relationship-key\":\"service-instance.service-instance-id\",\"relationship-value\":\"2UJZZ01777-rs804s\"}],\"related-to-property\":[{\"property-key\":\"service-instance.service-instance-name\",\"property-value\":null}]},{\"relationDataList\":[{\"relationship-key\":\"instance-group.id\",\"relationship-value\":\"instanceGroup-2018-rs804s\"}],\"relatedToPropertyList\":[{\"property-key\":\"instance-group.description\",\"property-value\":\"zr6h\"},{\"property-key\":\"instance-group.instance-group-name\",\"property-value\":\"wKmBXiO1xm8bK\"}],\"related-to\":\"instance-group\",\"related-link\":\"/aai/v13/network/instance-groups/instance-group/instanceGroup-2018-rs804s\",\"relationship-label\":\"org.onap.relationships.inventory.MemberOf\",\"relationship-data\":[{\"relationship-key\":\"instance-group.id\",\"relationship-value\":\"instanceGroup-2018-rs804s\"}],\"related-to-property\":[{\"property-key\":\"instance-group.description\",\"property-value\":\"zr6h\"},{\"property-key\":\"instance-group.instance-group-name\",\"property-value\":\"wKmBXiO1xm8bK\"}]}]},\"resource-version\":\"1521662811309\"},\"networks\":[{\"network-id\":\"l3network-id-rs804s\",\"network-name\":\"oam-net\",\"network-type\":\"Tenant_Layer_3\",\"network-role\":\"RosemaProtectedOam.OAM\",\"network-technology\":\"Contrail\",\"is-bound-to-vpn\":false,\"resource-version\":\"1521662814627\",\"orchestration-status\":\"Created\",\"is-provider-network\":false,\"is-shared-network\":false,\"is-external-network\":false,\"relationship-list\":{\"relationship\":[{\"relationDataList\":[{\"relationship-key\":\"instance-group.id\",\"relationship-value\":\"instanceGroup-2018-rs804s\"}],\"relatedToPropertyList\":[{\"property-key\":\"instance-group.description\",\"property-value\":\"zr6h\"},{\"property-key\":\"instance-group.instance-group-name\",\"property-value\":\"wKmBXiO1xm8bK\"}],\"related-to\":\"instance-group\",\"related-link\":\"/aai/v13/network/instance-groups/instance-group/instanceGroup-2018-rs804s\",\"relationship-label\":\"org.onap.relationships.inventory.MemberOf\",\"relationship-data\":[{\"relationship-key\":\"instance-group.id\",\"relationship-value\":\"instanceGroup-2018-rs804s\"}],\"related-to-property\":[{\"property-key\":\"instance-group.description\",\"property-value\":\"zr6h\"},{\"property-key\":\"instance-group.instance-group-name\",\"property-value\":\"wKmBXiO1xm8bK\"}]}]}},{\"network-id\":\"l3network-id-3-rs804s\",\"network-name\":\"oam-net\",\"network-type\":\"Tenant_Layer_3\",\"network-role\":\"RosemaProtectedOam.OAM\",\"network-technology\":\"Contrail\",\"is-bound-to-vpn\":false,\"resource-version\":\"1521662816043\",\"orchestration-status\":\"Created\",\"is-provider-network\":false,\"is-shared-network\":false,\"is-external-network\":false,\"relationship-list\":{\"relationship\":[{\"relationDataList\":[{\"relationship-key\":\"instance-group.id\",\"relationship-value\":\"instanceGroup-2018-rs804s\"}],\"relatedToPropertyList\":[{\"property-key\":\"instance-group.description\",\"property-value\":\"zr6h\"},{\"property-key\":\"instance-group.instance-group-name\",\"property-value\":\"wKmBXiO1xm8bK\"}],\"related-to\":\"instance-group\",\"related-link\":\"/aai/v13/network/instance-groups/instance-group/instanceGroup-2018-rs804s\",\"relationship-label\":\"org.onap.relationships.inventory.MemberOf\",\"relationship-data\":[{\"relationship-key\":\"instance-group.id\",\"relationship-value\":\"instanceGroup-2018-rs804s\"}],\"related-to-property\":[{\"property-key\":\"instance-group.description\",\"property-value\":\"zr6h\"},{\"property-key\":\"instance-group.instance-group-name\",\"property-value\":\"wKmBXiO1xm8bK\"}]}]}},{\"network-id\":\"l3network-id-2-rs804s\",\"network-name\":\"oam-net\",\"network-type\":\"Tenant_Layer_3\",\"network-role\":\"RosemaProtectedOam.OAM\",\"network-technology\":\"Contrail\",\"is-bound-to-vpn\":false,\"resource-version\":\"1521662815304\",\"orchestration-status\":\"Created\",\"is-provider-network\":false,\"is-shared-network\":false,\"is-external-network\":false,\"relationship-list\":{\"relationship\":[{\"relationDataList\":[{\"relationship-key\":\"instance-group.id\",\"relationship-value\":\"instanceGroup-2018-rs804s\"}],\"relatedToPropertyList\":[{\"property-key\":\"instance-group.description\",\"property-value\":\"zr6h\"},{\"property-key\":\"instance-group.instance-group-name\",\"property-value\":\"wKmBXiO1xm8bK\"}],\"related-to\":\"instance-group\",\"related-link\":\"/aai/v13/network/instance-groups/instance-group/instanceGroup-2018-rs804s\",\"relationship-label\":\"org.onap.relationships.inventory.MemberOf\",\"relationship-data\":[{\"relationship-key\":\"instance-group.id\",\"relationship-value\":\"instanceGroup-2018-rs804s\"}],\"related-to-property\":[{\"property-key\":\"instance-group.description\",\"property-value\":\"zr6h\"},{\"property-key\":\"instance-group.instance-group-name\",\"property-value\":\"wKmBXiO1xm8bK\"}]}]}}],\"service-instance\":{\"service-instance-id\":\"2UJZZ01777-rs804s\",\"resource-version\":\"1521662813382\",\"relationship-list\":{\"relationship\":[{\"relationDataList\":[{\"relationship-key\":\"collection.collection-id\",\"relationship-value\":\"collection-1-2018-rs804s\"}],\"relatedToPropertyList\":null,\"related-to\":\"collection\",\"related-link\":\"/aai/v13/network/collections/collection/collection-1-2018-rs804s\",\"relationship-label\":\"org.onap.relationships.inventory.MemberOf\",\"relationship-data\":[{\"relationship-key\":\"collection.collection-id\",\"relationship-value\":\"collection-1-2018-rs804s\"}],\"related-to-property\":null}]}},\"instance-group\":{\"id\":\"instanceGroup-2018-rs804s\",\"description\":\"zr6h\",\"instance-group-role\":\"JZmha7QSS4tJ\",\"model-invariant-id\":\"5761e0a7-defj777\",\"model-version-id\":\"5761e0a7-defj22\",\"instance-group-type\":\"7DDjOdNL\",\"resource-version\":\"1521662814023\",\"instance-group-name\":\"wKmBXiO1xm8bK\",\"instance-group-function\":\"testfunction2\",\"relationship-list\":{\"relationship\":[{\"relationDataList\":[{\"relationship-key\":\"l3-network.network-id\",\"relationship-value\":\"l3network-id-rs804s\"}],\"relatedToPropertyList\":[{\"property-key\":\"l3-network.network-name\",\"property-value\":\"oam-net\"}],\"related-to\":\"l3-network\",\"related-link\":\"/aai/v13/network/l3-networks/l3-network/l3network-id-rs804s\",\"relationship-label\":\"org.onap.relationships.inventory.MemberOf\",\"relationship-data\":[{\"relationship-key\":\"l3-network.network-id\",\"relationship-value\":\"l3network-id-rs804s\"}],\"related-to-property\":[{\"property-key\":\"l3-network.network-name\",\"property-value\":\"oam-net\"}]},{\"relationDataList\":[{\"relationship-key\":\"collection.collection-id\",\"relationship-value\":\"collection-1-2018-rs804s\"}],\"relatedToPropertyList\":null,\"related-to\":\"collection\",\"related-link\":\"/aai/v13/network/collections/collection/collection-1-2018-rs804s\",\"relationship-label\":\"org.onap.relationships.inventory.MemberOf\",\"relationship-data\":[{\"relationship-key\":\"collection.collection-id\",\"relationship-value\":\"collection-1-2018-rs804s\"}],\"related-to-property\":null},{\"relationDataList\":[{\"relationship-key\":\"l3-network.network-id\",\"relationship-value\":\"l3network-id-3-rs804s\"}],\"relatedToPropertyList\":[{\"property-key\":\"l3-network.network-name\",\"property-value\":\"oam-net\"}],\"related-to\":\"l3-network\",\"related-link\":\"/aai/v13/network/l3-networks/l3-network/l3network-id-3-rs804s\",\"relationship-label\":\"org.onap.relationships.inventory.MemberOf\",\"relationship-data\":[{\"relationship-key\":\"l3-network.network-id\",\"relationship-value\":\"l3network-id-3-rs804s\"}],\"related-to-property\":[{\"property-key\":\"l3-network.network-name\",\"property-value\":\"oam-net\"}]},{\"relationDataList\":[{\"relationship-key\":\"l3-network.network-id\",\"relationship-value\":\"l3network-id-2-rs804s\"}],\"relatedToPropertyList\":[{\"property-key\":\"l3-network.network-name\",\"property-value\":\"oam-net\"}],\"related-to\":\"l3-network\",\"related-link\":\"/aai/v13/network/l3-networks/l3-network/l3network-id-2-rs804s\",\"relationship-label\":\"org.onap.relationships.inventory.MemberOf\",\"relationship-data\":[{\"relationship-key\":\"l3-network.network-id\",\"relationship-value\":\"l3network-id-2-rs804s\"}],\"related-to-property\":[{\"property-key\":\"l3-network.network-name\",\"property-value\":\"oam-net\"}]}]}}}}\n";
+
+ public static final String GET_SERVICE_INSTANCE_BY_SUBSCRIBER_DSL_EXPECTED_RESPONSE = "{\"results\": [{\"customer\": {\"global-customer-id\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\",\"subscriber-name\": \"Mobility\",\"subscriber-type\": \"INFRA\",\"resource-version\": \"1602518417955\",\"related-nodes\": [{\"service-subscription\": {\"service-type\": \"VPMS\",\"resource-version\": \"1629183620246\",\"related-nodes\": [{\"service-instance\": {\"service-instance-id\": \"5d942bc7-3acf-4e35-836a-393619ebde66\",\"service-instance-name\": \"dpa2actsf5001v_Port_Mirroring_dpa2a_SVC\",\"service-type\": \"PORT-MIRROR\",\"service-role\": \"VPROBE\",\"environment-context\": \"General_Revenue-Bearing\",\"workload-context\": \"Production\",\"model-invariant-id\": \"0757d856-a9c6-450d-b494-e1c0a4aab76f\",\"model-version-id\": \"a9088517-efe8-4bed-9c54-534462cb08c2\",\"resource-version\": \"1615330529236\",\"selflink\": \"SOME_SELF_LINK\",\"orchestration-status\": \"Active\"}}]}}]}}]}";
+ public static final String GET_SEARCH_SERVICE_INSTANCE_BY_SUBSCRIBER_DSL_EXPECTED_RESPONSE = "{\"service-instances\":[{\"serviceInstanceId\":\"5d942bc7-3acf-4e35-836a-393619ebde66\",\"serviceType\":\"VPMS\",\"serviceInstanceName\":\"dpa2actsf5001v_Port_Mirroring_dpa2a_SVC\",\"subscriberName\":\"Mobility\",\"aaiModelInvariantId\":\"0757d856-a9c6-450d-b494-e1c0a4aab76f\",\"aaiModelVersionId\":\"a9088517-efe8-4bed-9c54-534462cb08c2\",\"owningEntityId\":null,\"isPermitted\":false,\"globalCustomerId\":\"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\"}]}";
+
public static final String GET_AAI_SERVIES_EXPECTED_RESULT = "{\n" +
" \"services\": [{\n" +
" \"uuid\": \"20c4431c-246d-11e7-93ae-92361f002671\",\n" +
@@ -958,4 +965,96 @@ public class AaiApiTest extends BaseApiAaiTest {
throw e;
}
}
+
+ @Test
+ public void getServiceInstanceBySubscriberAndServiceIdentifierAndSubscriberName_dsl_givenValidAaiResponse() {
+ SimulatorApi.clearAll();
+ String globalCustomerId = "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb";
+ String serviceIdentifier = "5d942bc7-3acf-4e35-836a-393619ebde66";
+ String serviceIdentifierType = "Service Instance Id";
+ String serviceType = "TYLER SILVIA";
+ SimulatorApi.registerExpectationFromPreset(new PresetAAIServiceInstanceDSLPut(
+ globalCustomerId,serviceIdentifier,serviceIdentifierType), CLEAR_THEN_SET);
+ SimulatorApi.registerExpectationFromPreset(new PresetAAIFilterServiceInstanceById(
+ globalCustomerId,serviceType,serviceIdentifier), APPEND);
+ SimulatorApi.registerExpectationFromPreset(new PresetAAIGetServiceInstanceBySubscriberIdAndServiceTypeAndSIID(
+ globalCustomerId,serviceType,serviceIdentifier), APPEND);
+ final String response = restTemplate.getForObject(
+ uri + "/aai_get_service_instance_by_id_and_type"+ "/" + globalCustomerId + "/" + serviceIdentifier + "/" + serviceIdentifierType + "/Mobility" ,
+ String.class);
+ assertResponse(GET_SERVICE_INSTANCE_BY_SUBSCRIBER_DSL_EXPECTED_RESPONSE, response);
+ }
+
+ @Test
+ public void getServiceInstanceBySubscriberAndServiceIdentifierWithoutSubscriberName_dsl_givenValidAaiResponse() {
+ SimulatorApi.clearAll();
+ String globalCustomerId = "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb";
+ String serviceIdentifier = "5d942bc7-3acf-4e35-836a-393619ebde66";
+ String serviceIdentifierType = "Service Instance Id";
+ String serviceType = "TYLER SILVIA";
+ SimulatorApi.registerExpectationFromPreset(new PresetAAIServiceInstanceDSLPut(
+ globalCustomerId,serviceIdentifier,serviceIdentifierType), CLEAR_THEN_SET);
+ SimulatorApi.registerExpectationFromPreset(new PresetAAIFilterServiceInstanceById(
+ globalCustomerId,serviceType,serviceIdentifier), APPEND);
+ SimulatorApi.registerExpectationFromPreset(new PresetAAIGetServiceInstanceBySubscriberIdAndServiceTypeAndSIID(
+ globalCustomerId,serviceType,serviceIdentifier), APPEND);
+ final String response = restTemplate.getForObject(
+ uri + "/aai_get_service_instance_by_id_and_type"+ "/" + globalCustomerId + "/" + serviceIdentifier + "/" + serviceIdentifierType ,
+ String.class);
+ assertResponse(GET_SERVICE_INSTANCE_BY_SUBSCRIBER_DSL_EXPECTED_RESPONSE, response);
+ }
+
+ @Test
+ public void getServiceInstanceBySubscriberAndServiceIdentifierWithSubscriberName_dsl_givenValidAaiResponse() {
+ SimulatorApi.clearAll();
+ String globalCustomerId = "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb";
+ String serviceIdentifier = "5d942bc7-3acf-4e35-836a-393619ebde66";
+ String serviceIdentifierType = "Service Instance Id";
+ String serviceType = "TYLER SILVIA";
+ String subscriberName = "Mobility";
+ SimulatorApi.registerExpectationFromPreset(new PresetAAIServiceInstanceDSLPut(
+ globalCustomerId,serviceIdentifier,serviceIdentifierType), CLEAR_THEN_SET);
+ SimulatorApi.registerExpectationFromPreset(new PresetAAIFilterServiceInstanceById(
+ globalCustomerId,serviceType,serviceIdentifier), APPEND);
+ SimulatorApi.registerExpectationFromPreset(new PresetAAIGetServiceInstanceBySubscriberIdAndServiceTypeAndSIID(
+ globalCustomerId,serviceType,serviceIdentifier), APPEND);
+ final String response = restTemplate.getForObject(
+ uri + "/aai_get_service_instance_by_id_and_type"+ "/" + globalCustomerId + "/" + serviceIdentifier + "/" + serviceIdentifierType + "/" + subscriberName ,
+ String.class);
+ assertResponse(GET_SERVICE_INSTANCE_BY_SUBSCRIBER_DSL_EXPECTED_RESPONSE, response);
+ }
+
+ @Test
+ public void searchServiceInstanceByIdentifierType_id_dsl_givenValidAaiResponse() {
+ SimulatorApi.clearAll();
+ String globalCustomerId = "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb";
+ String serviceInstanceIdentifier = "5d942bc7-3acf-4e35-836a-393619ebde66";
+ String serviceInstanceIdentifierType = "Service Instance Id";
+
+ SimulatorApi.registerExpectationFromPreset(new PresetAAIServiceInstanceDSLPut(
+ globalCustomerId,serviceInstanceIdentifier,serviceInstanceIdentifierType), CLEAR_THEN_SET);
+ String path = "/search_service_instances?subscriberId="+globalCustomerId+
+ "&serviceInstanceIdentifier="+serviceInstanceIdentifier+
+ "&serviceInstanceIdentifierType="+serviceInstanceIdentifierType+"";
+ final String response = restTemplate.getForObject( uri + path, String.class);
+ assertResponse(GET_SEARCH_SERVICE_INSTANCE_BY_SUBSCRIBER_DSL_EXPECTED_RESPONSE, response);
+
+ }
+
+ @Test
+ public void searchServiceInstanceByIdentifierType_name_dsl_givenValidAaiResponse() {
+ SimulatorApi.clearAll();
+ String globalCustomerId = "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb";
+ String serviceInstanceIdentifierType = "Service Instance Name";
+ String serviceInstanceIdentifier = "dpa2actsf5001v_Port_Mirroring_dpa2a_SVC";
+
+ SimulatorApi.registerExpectationFromPreset(new PresetAAIServiceInstanceDSLPut(
+ globalCustomerId,serviceInstanceIdentifier,serviceInstanceIdentifierType), CLEAR_THEN_SET);
+ String path = "/search_service_instances?subscriberId="+globalCustomerId+
+ "&serviceInstanceIdentifier="+serviceInstanceIdentifier+
+ "&serviceInstanceIdentifierType="+serviceInstanceIdentifierType+"";
+ final String response = restTemplate.getForObject( uri + path, String.class);
+ assertResponse(GET_SEARCH_SERVICE_INSTANCE_BY_SUBSCRIBER_DSL_EXPECTED_RESPONSE, response);
+ }
+
}