diff options
Diffstat (limited to 'vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai')
36 files changed, 2053 insertions, 492 deletions
diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/BasePresetAAIGetVersion.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/BasePresetAAIGetVersion.java deleted file mode 100644 index 2452a24f7..000000000 --- a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/BasePresetAAIGetVersion.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.onap.simulator.presetGenerator.presets.aai; - -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 BasePresetAAIGetVersion extends BaseAAIPreset { - public String modelVersionId1; - public String modelInvariantId; - - public BasePresetAAIGetVersion(String modelVersionId1, String modelInvariantId) { - this.modelVersionId1 = modelVersionId1; - this.modelInvariantId = modelInvariantId; - } - @Override - public HttpMethod getReqMethod() { - return HttpMethod.PUT; - } - - @Override - public String getReqPath() { - return getRootPath() + "/query"; - } - - @Override - public Map<String, List> getQueryParams() { - return ImmutableMap.of("format", Collections.singletonList("resource")); - } - - @Override - public Object getRequestBody() { - return "{\"start\" : \"service-design-and-creation/models/\", \"query\" : \"query/serviceModels-byDistributionStatus?distributionStatus=DISTRIBUTION_COMPLETE_OK\"}"; - } - - public String getModelVersionId1() { - return modelVersionId1; - } - - public String getModelInvariantId() { - return modelInvariantId; - } - - -} diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAICloudRegionAndSourceFromConfigurationPut.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAICloudRegionAndSourceFromConfigurationPut.java index c74cc0b14..66562ed63 100644 --- a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAICloudRegionAndSourceFromConfigurationPut.java +++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAICloudRegionAndSourceFromConfigurationPut.java @@ -2,12 +2,11 @@ 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; +import org.onap.simulator.presetGenerator.presets.BasePresets.BaseAAIPreset; +import org.springframework.http.HttpMethod; public class PresetAAICloudRegionAndSourceFromConfigurationPut extends BaseAAIPreset { @@ -64,9 +63,9 @@ public class PresetAAICloudRegionAndSourceFromConfigurationPut extends BaseAAIPr " \"results\": [{" + " \"id\": \"2979590232\"," + " \"node-type\": \"cloud-region\"," + - " \"url\": \"/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/att-aic/SDNO-S-BcloudReg-E1802\"," + + " \"url\": \"/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/SDNO-S-BcloudReg-E1802\"," + " \"properties\": {" + - " \"cloud-owner\": \"att-aic\"," + + " \"cloud-owner\": \"irma-aic\"," + " \"cloud-region-id\": \"" + getCloudRegionId() + "\"," + " \"sriov-automation\": false," + " \"resource-version\": \"1513631040564\"" + diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIFilterServiceInstanceById.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIFilterServiceInstanceById.java new file mode 100644 index 000000000..5fca9f392 --- /dev/null +++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIFilterServiceInstanceById.java @@ -0,0 +1,39 @@ +package org.onap.simulator.presetGenerator.presets.aai; + +import com.google.common.collect.ImmutableMap; + +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public class PresetAAIFilterServiceInstanceById extends PresetAAIBaseSearchNodeQuery { + + private String subscriberId; + private String serviceType; + private String serviceInstanceId; + + public PresetAAIFilterServiceInstanceById(String subscriberId, String serviceType, String serviceInstanceId) { + this.subscriberId = subscriberId; + this.serviceType = serviceType; + this.serviceInstanceId = serviceInstanceId; + } + + @Override + public Map<String, List> getQueryParams() { + return ImmutableMap.of("search-node-type", Collections.singletonList("service-instance"), + "filter", Collections.singletonList("service-instance-id:EQUALS:" + this.serviceInstanceId)); + } + + @Override + public Object getResponseBody() { + return "" + + "{" + + "\"result-data\": [\n" + + " {\n" + + " \"resource-type\": \"service-instance\",\n" + + " \"resource-link\": \"/aai/v11/business/customers/customer/" + this.subscriberId + "/service-subscriptions/service-subscription/" + this.serviceType + "/service-instances/service-instance/" + this.serviceInstanceId + "\"\n" + + " }\n" + + " ]" + + "}"; + } +} diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetCloudOwnersByCloudRegionId.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetCloudOwnersByCloudRegionId.java new file mode 100644 index 000000000..be075b481 --- /dev/null +++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetCloudOwnersByCloudRegionId.java @@ -0,0 +1,130 @@ +package org.onap.simulator.presetGenerator.presets.aai; + +import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic; +import static org.apache.commons.lang3.RandomStringUtils.randomNumeric; + +import com.google.common.collect.ImmutableMap; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import org.onap.simulator.presetGenerator.presets.BasePresets.BaseAAIPreset; +import org.springframework.http.HttpMethod; + +public class PresetAAIGetCloudOwnersByCloudRegionId extends BaseAAIPreset { + public static final String SOME_LEGACY_REGION = "some legacy region"; + public static final String JUST_ANOTHER_REGION = "just another region"; + public static final String MY_REGION = "my region"; + public static final String LCP_REGION_TEXT = "lcpRegionText"; + public static final String ATT_AIC = "irma-aic"; + public static final String MDT_1 = "mdt1"; + public static final String ATT_NC = "att-nc"; + public static final String hvf3 = "hvf3"; + public static final String olson3 = "olson3"; + public static final String olson5B = "olson5b"; + public static final String ATT_SABABA = "att-sababa"; + public static final String AAIAIC_25 = "JANET25"; + public static final String ONE = "One"; + public static final String hvf6 = "hvf6"; + private final String cloudRegionId; + private final String cloudOwner; + + //Since there is a cache of cloudRegionToCloudOwner, we can't have 2 preset of same cloud region that return different cloud owner. + //So all the preset instance must be declared here, for conflicts prevention. + public static final PresetAAIGetCloudOwnersByCloudRegionId PRESET_SOME_LEGACY_REGION_TO_ATT_AIC = + new PresetAAIGetCloudOwnersByCloudRegionId(SOME_LEGACY_REGION, ATT_AIC); + + public static final PresetAAIGetCloudOwnersByCloudRegionId PRESET_JUST_ANOTHER_REGION_TO_ATT_AIC = + new PresetAAIGetCloudOwnersByCloudRegionId(JUST_ANOTHER_REGION, ATT_AIC); + + public static final PresetAAIGetCloudOwnersByCloudRegionId PRESET_MDT1_TO_ATT_NC = + new PresetAAIGetCloudOwnersByCloudRegionId(MDT_1, ATT_NC); + + public static final PresetAAIGetCloudOwnersByCloudRegionId PRESET_RDM3_TO_ATT_NC = + new PresetAAIGetCloudOwnersByCloudRegionId(olson3, ATT_NC); + + public static final PresetAAIGetCloudOwnersByCloudRegionId PRESET_MTN3_TO_ATT_SABABA = + new PresetAAIGetCloudOwnersByCloudRegionId(hvf3, ATT_SABABA); + + public static final PresetAAIGetCloudOwnersByCloudRegionId PRESET_AAIAIC25_TO_ATT_AIC = + new PresetAAIGetCloudOwnersByCloudRegionId(AAIAIC_25, ATT_AIC); + + public static final PresetAAIGetCloudOwnersByCloudRegionId PRESET_ONE_TO_ATT_AIC = + new PresetAAIGetCloudOwnersByCloudRegionId(ONE, ATT_AIC); + + public static final PresetAAIGetCloudOwnersByCloudRegionId PRESET_MTN6_TO_ATT_AIC = + new PresetAAIGetCloudOwnersByCloudRegionId(hvf6, ATT_AIC); + + public static final PresetAAIGetCloudOwnersByCloudRegionId PRESET_MY_REGION_TO_ATT_AIC = + new PresetAAIGetCloudOwnersByCloudRegionId(MY_REGION, ATT_AIC); + + public static final PresetAAIGetCloudOwnersByCloudRegionId PRESET_LCP_REGION_TEXT_TO_ATT_AIC = + new PresetAAIGetCloudOwnersByCloudRegionId(LCP_REGION_TEXT, ATT_AIC); + + private PresetAAIGetCloudOwnersByCloudRegionId(String cloudRegionId, String cloudOwnerResult) { + this.cloudRegionId = cloudRegionId; + this.cloudOwner = cloudOwnerResult; + } + + @Override + public Object getResponseBody() { + return "" + + "{" + + " \"cloud-region\": [{" + + " \"cloud-owner\": \"" + cloudOwner + "\"," + + " \"cloud-region-id\": \"" + cloudRegionId + "\"," + + " \"cloud-region-version\": \"2.5\"," + + " \"identity-url\": \"http://" + randomAlphabetic(5) + ":5000/v2.0\"," + + " \"complex-name\": \"" + cloudRegionId + "\"," + + " \"resource-version\": \"" + randomNumeric(5) + "\"," + + " \"relationship-list\": {" + + " \"relationship\": [{" + + " \"related-to\": \"pserver\"," + + " \"relationship-label\": \"org.onap.relationships.inventory.LocatedIn\"," + + " \"related-link\": \"/aai/v12/cloud-infrastructure/pservers/pserver/" + randomAlphabetic(5) + "\"," + + " \"relationship-data\": [{" + + " \"relationship-key\": \"pserver.hostname\"," + + " \"relationship-value\": \"" + randomAlphabetic(5) + "\"" + + " }" + + " ]," + + " \"related-to-property\": [{" + + " \"property-key\": \"pserver.pserver-name2\"" + + " }" + + " ]" + + " }, {" + + " \"related-to\": \"l3-network\"," + + " \"relationship-label\": \"org.onap.relationships.inventory.Uses\"," + + " \"related-link\": \"/aai/v12/network/l3-networks/l3-network/" + UUID.randomUUID() + "\"," + + " \"relationship-data\": [{" + + " \"relationship-key\": \"l3-network.network-id\"," + + " \"relationship-value\": \"" + UUID.randomUUID() + "\"" + + " }" + + " ]," + + " \"related-to-property\": [{" + + " \"property-key\": \"l3-network.network-name\"," + + " \"property-value\": \"" + randomAlphabetic(5) + "\"" + + " }" + + " ]" + + " }" + + " ]" + + " }" + + " }" + + " ]" + + "}"; + } + + @Override + public HttpMethod getReqMethod() { + return HttpMethod.GET; + } + + @Override + public String getReqPath() { + return getRootPath() + "/cloud-infrastructure/cloud-regions"; + } + + @Override + public Map<String, List> getQueryParams() { + return ImmutableMap.of("cloud-region-id", Collections.singletonList(cloudRegionId)); + } +} diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetCloudRegionFromVnf.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetCloudRegionFromVnf.java new file mode 100644 index 000000000..976228bf0 --- /dev/null +++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetCloudRegionFromVnf.java @@ -0,0 +1,130 @@ +package org.onap.simulator.presetGenerator.presets.aai; + +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import org.onap.simulator.presetGenerator.presets.BasePresets.BaseAAIPreset; +import org.springframework.http.HttpMethod; + +public class PresetAAIGetCloudRegionFromVnf extends BaseAAIPreset { + + private String vnfInstanceId; + + public PresetAAIGetCloudRegionFromVnf(String vnfInstanceId) { + this.vnfInstanceId = vnfInstanceId; + } + + public String getVnfInstanceId() { + return vnfInstanceId; + } + + @Override + public HttpMethod getReqMethod() { + return HttpMethod.PUT; + } + + @Override + public String getReqPath() { + return getRootPath() + "/query"; + } + + @Override + public Map<String, List> getQueryParams() { + return ImmutableMap.of( + "format", Collections.singletonList("simple") + ); + } + + @Override + public Object getRequestBody() { + return ImmutableMap.of( + "start", ImmutableList.of("/network/generic-vnfs/generic-vnf/" + getVnfInstanceId()), + "query", "/query/cloud-region-fromVnf" + ); + } + + @Override + public Object getResponseBody() { + return "{" + + " \"results\": [" + + " {" + + " \"id\": \"363687968\"," + + " \"node-type\": \"generic-vnf\"," + + " \"url\": \"/aai/v14/network/generic-vnfs/generic-vnf/" + getVnfInstanceId() + "\"," + + " \"properties\": {" + + " \"vnf-id\": \"" + getVnfInstanceId() + "\"," + + " \"vnf-name\": \"zhvf23bmogx05_oam_01_rk\"," + + " \"vnf-type\": \"vMOG_SVC_UPDATED_FLAV_OAM/vMOG_VSP_UPDATED_FLAV 0\"," + + " \"service-id\": \"db171b8f-115c-4992-a2e3-ee04cae357e0\"," + + " \"prov-status\": \"NVTPROV\"," + + " \"orchestration-status\": \"Created\"," + + " \"in-maint\": false," + + " \"is-closed-loop-disabled\": false," + + " \"resource-version\": \"1522780608709\"," + + " \"model-invariant-id\": \"5108d7e4-f32a-44cd-8835-433a70915b8c\"," + + " \"model-version-id\": \"bae37933-b694-4b4e-a734-db63416f9cfe\"," + + " \"model-customization-id\": \"732305c6-d36a-47ee-a701-6f28f87b90cd\"," + + " \"nf-type\": \"POLICY\"," + + " \"nf-function\": \"Emanuel Orchestration Gateway (MOG)\"," + + " \"nf-role\": \"vMOG\"," + + " \"nf-naming-code\": \"\"" + + " }," + + " \"related-to\": [" + + " {" + + " \"id\": \"193753168\"," + + " \"relationship-label\": \"org.onap.relationships.inventory.ComposedOf\"," + + " \"node-type\": \"service-instance\"," + + " \"url\": \"/aai/v14/business/customers/customer/a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb/service-subscriptions/service-subscription/vMOG/service-instances/service-instance/7f10ffe2-548f-4168-8722-b782d05675b7\"" + + " }" + + " ]" + + " }," + + " {" + + " \"id\": \"8757432\"," + + " \"node-type\": \"tenant\"," + + " \"url\": \"/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/hvf23b/tenants/tenant/3e9a20a3e89e45f884e09df0cc2d2d2a\"," + + " \"properties\": {" + + " \"tenant-id\": \"3e9a20a3e89e45f884e09df0cc2d2d2a\"," + + " \"tenant-name\": \"APPC-24595-T-IST-02C\"," + + " \"resource-version\": \"1539855222745\"" + + " }," + + " \"related-to\": [" + + " {" + + " \"id\": \"264798392\"," + + " \"relationship-label\": \"org.onap.relationships.inventory.BelongsTo\"," + + " \"node-type\": \"vserver\"," + + " \"url\": \"/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/hvf23b/tenants/tenant/3e9a20a3e89e45f884e09df0cc2d2d2a/vservers/vserver/088c2bf0-80e2-4bdf-93ae-b2469fbeba84\"" + + " }" + + " ]" + + " }," + + " {" + + " \"id\": \"302227536\"," + + " \"node-type\": \"cloud-region\"," + + " \"url\": \"/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/hvf23b\"," + + " \"properties\": {" + + " \"cloud-owner\": \"irma-aic\"," + + " \"cloud-region-id\": \"hvf23b\"," + + " \"cloud-type\": \"openstack\"," + + " \"owner-defined-type\": \"lcp\"," + + " \"cloud-region-version\": \"3.0\"," + + " \"identity-url\": \"https://iden.onap.org:5000/v2.0\"," + + " \"cloud-zone\": \"z1\"," + + " \"complex-name\": \"c1\"," + + " \"sriov-automation\": \"false\"," + + " \"resource-version\": \"1539855222969\"" + + " }," + + " \"related-to\": [" + + " {" + + " \"id\": \"2744328\"," + + " \"relationship-label\": \"org.onap.relationships.inventory.BelongsTo\"," + + " \"node-type\": \"tenant\"," + + " \"url\": \"/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/hvf23b/tenants/tenant/5452d6bd0cb34e99a3553d349456c642\"" + + " }" + + " ]" + + " }" + + " ]" + + "}"; + } + +} diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetHomingForVfModule.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetHomingForVfModule.java new file mode 100644 index 000000000..6b07f5293 --- /dev/null +++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetHomingForVfModule.java @@ -0,0 +1,150 @@ +package org.onap.simulator.presetGenerator.presets.aai; + +import org.onap.simulator.presetGenerator.presets.BasePresets.BaseAAIPreset; +import org.springframework.http.HttpMethod; + +public class PresetAAIGetHomingForVfModule extends BaseAAIPreset { + private final String vnfInstanceId; + private final String vfModuleId; + private final String tenantId; + private final String lcpRegionId; + + public PresetAAIGetHomingForVfModule(String vnfInstanceId, String vfModuleId, String tenantId, String lcpRegionId) { + this.vnfInstanceId = vnfInstanceId; + this.vfModuleId = vfModuleId; + this.tenantId = tenantId; + this.lcpRegionId = lcpRegionId; + } + + public PresetAAIGetHomingForVfModule(String vnfInstanceId, String vfModuleId) { + this( + vnfInstanceId, + vfModuleId, + "db1818f7f2e34862b378bfb2cc520f91", + "olson5b" + ); + } + + public PresetAAIGetHomingForVfModule() { + this( + "0846287b-65bf-45a6-88f6-6a1af4149fac", + "a9b70ac0-5917-4203-a308-0e6920e6d09b", + "db1818f7f2e34862b378bfb2cc520f91", + "olson5b" + ); + } + + @Override + public Object getResponseBody() { + return "{" + + " \"vf-module-id\": \""+vfModuleId+"\"," + + " \"vf-module-name\": \"apndns_az_02_module_1\"," + + " \"heat-stack-id\": \"apndns_az_02_module_1/97a319f3-b095-4fff-befa-c657508ecaf8\"," + + " \"orchestration-status\": \"active\"," + + " \"is-base-vf-module\": false," + + " \"resource-version\": \"1530559380383\"," + + " \"model-invariant-id\": \"74450b48-0aa0-4743-8314-9163e92b7862\"," + + " \"model-version-id\": \"6bc01a2b-bc48-4991-b9fe-e22c2215d801\"," + + " \"model-customization-id\": \"74f638c2-0368-4212-8f73-e961005af17c\"," + + " \"module-index\": 0," + + " \"relationship-list\": {" + + " \"relationship\": [" + + " {" + + " \"related-to\": \"l3-network\"," + + " \"relationship-label\": \"org.onap.relationships.inventory.DependsOn\"," + + " \"related-link\": \"/aai/v12/network/l3-networks/l3-network/335e62be-73a3-41e8-930b-1a677bcafea5\"," + + " \"relationship-data\": [" + + " {" + + " \"relationship-key\": \"l3-network.network-id\"," + + " \"relationship-value\": \"335e62be-73a3-41e8-930b-1a677bcafea5\"" + + " }" + + " ]," + + " \"related-to-property\": [" + + " {" + + " \"property-key\": \"l3-network.network-name\"," + + " \"property-value\": \"MNS-FN-25180-T-02Shared_oam_protected_net_1\"" + + " }" + + " ]" + + " }," + + " {" + + " \"related-to\": \"l3-network\"," + + " \"relationship-label\": \"org.onap.relationships.inventory.DependsOn\"," + + " \"related-link\": \"/aai/v12/network/l3-networks/l3-network/2db4ee3e-2ac7-4fc3-8739-ecf53416459e\"," + + " \"relationship-data\": [" + + " {" + + " \"relationship-key\": \"l3-network.network-id\"," + + " \"relationship-value\": \"2db4ee3e-2ac7-4fc3-8739-ecf53416459e\"" + + " }" + + " ]," + + " \"related-to-property\": [" + + " {" + + " \"property-key\": \"l3-network.network-name\"," + + " \"property-value\": \"Mobisupport-FN-27099-T-02_int_apn_dns_net_1\"" + + " }" + + " ]" + + " }," + + " {" + + " \"related-to\": \"volume-group\"," + + " \"relationship-label\": \"org.onap.relationships.inventory.Uses\"," + + " \"related-link\": \"/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/" + lcpRegionId + "/volume-groups/volume-group/66013ebe-0c81-44b9-a24f-7c6acba73a39\"," + + " \"relationship-data\": [" + + " {" + + " \"relationship-key\": \"cloud-region.cloud-owner\"," + + " \"relationship-value\": \"irma-aic\"" + + " }," + + " {" + + " \"relationship-key\": \"cloud-region.cloud-region-id\"," + + " \"relationship-value\": \"" + lcpRegionId + "\"" + + " }," + + " {" + + " \"relationship-key\": \"volume-group.volume-group-id\"," + + " \"relationship-value\": \"66013ebe-0c81-44b9-a24f-7c6acba73a39\"" + + " }" + + " ]" + + " }," + + " {" + + " \"related-to\": \"vserver\"," + + " \"relationship-label\": \"org.onap.relationships.inventory.Uses\"," + + " \"related-link\": \"/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/" + lcpRegionId + "/tenants/tenant/" + tenantId+ "/vservers/vserver/5eef9f6d-9933-4bc6-9a1a-862d61309437\"," + + " \"relationship-data\": [" + + " {" + + " \"relationship-key\": \"cloud-region.cloud-owner\"," + + " \"relationship-value\": \"irma-aic\"" + + " }," + + " {" + + " \"relationship-key\": \"cloud-region.cloud-region-id\"," + + " \"relationship-value\": \"" + lcpRegionId + "\"" + + " }," + + " {" + + " \"relationship-key\": \"tenant.tenant-id\"," + + " \"relationship-value\": \"" + tenantId + "\"" + + " }," + + " {" + + " \"relationship-key\": \"vserver.vserver-id\"," + + " \"relationship-value\": \"5eef9f6d-9933-4bc6-9a1a-862d61309437\"" + + " }" + + " ]," + + " \"related-to-property\": [" + + " {" + + " \"property-key\": \"vserver.vserver-name\"," + + " \"property-value\": \"zolson5bfapn01dns002\"" + + " }" + + " ]" + + " }" + + " ]" + + " }" + + "}"; + } + + @Override + public HttpMethod getReqMethod() { + return HttpMethod.GET; + } + + @Override + public String getReqPath() { + return getRootPath() + "/network/generic-vnfs/generic-vnf/" + this.vnfInstanceId + "/vf-modules/vf-module/" + this.vfModuleId; + } + + +} diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetInstanceGroupsByCloudRegion.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetInstanceGroupsByCloudRegion.java index a50462a3d..9435dcd2b 100644 --- a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetInstanceGroupsByCloudRegion.java +++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetInstanceGroupsByCloudRegion.java @@ -44,7 +44,7 @@ public class PresetAAIGetInstanceGroupsByCloudRegion extends BaseAAIPreset { public Object getRequestBody() { return ImmutableMap.of( "start", ImmutableList.of("cloud-infrastructure/cloud-regions/cloud-region/" + getCloudOwner() + "/" + getCloudRegionId()), - "query", "query/instance-group-byCloudRegion?type=" + type + "&role=" + role + "&function=" + getNetworkFunction() + "query", "query/instance-groups-byCloudRegion?type=" + type + "&role=" + role + "&function=" + getNetworkFunction() ); } diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetInstanceGroupsByCloudRegionInvalidRequest.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetInstanceGroupsByCloudRegionInvalidRequest.java index 9dae89be5..b20ef5a6e 100644 --- a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetInstanceGroupsByCloudRegionInvalidRequest.java +++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetInstanceGroupsByCloudRegionInvalidRequest.java @@ -44,7 +44,7 @@ public class PresetAAIGetInstanceGroupsByCloudRegionInvalidRequest extends BaseA public Object getRequestBody() { return ImmutableMap.of( "start", ImmutableList.of("cloud-infrastructure/cloud-regions/cloud-region/" + getCloudOwner() + "/" + getCloudRegionId()), - "query", "query/instance-group-byCloudRegion?type=" + type + "&role=" + role + "&function=" + getNetworkFunction() + "query", "query/instance-groups-byCloudRegion?type=" + type + "&role=" + role + "&function=" + getNetworkFunction() ); } @@ -62,124 +62,124 @@ public class PresetAAIGetInstanceGroupsByCloudRegionInvalidRequest extends BaseA @Override public Object getResponseBody() { - return "{\n" + - " \"results\": [\n" + - " {\n" + - " \"instance-group\": {\n" + - " \"instance-group-role\": \"JZmha7QSS4tJ\",\n" + - " \"some-filed\": \"some-data\",\n" + //extra field - " \"model-invariant-id\": \"model-id3\",\n" + - " \"model-version-id\": \"a0efd5fc-f7be-4502-936a-a6c6392b958f\",\n" + - " \"id\": \"AAI-12002-test3-vm230w\",\n" + - " \"description\": \"a9DEa0kpY\",\n" + - " \"instance-group-type\": \"type\",\n" + - " \"resource-version\": \"1520888659539\",\n" + - " \"instance-group-name\": \"wKmBXiO1xm8bK\",\n" + - " \"instance-group-function\": \"testfunction2\",\n" + - " \"relationship-list\": {\n" + - " \"relationship\": [\n" + - " {\n" + - " \"related-to\": \"cloud-region\",\n" + - " \"some-filed\": \"some-data\",\n" + //extra field - " \"relationship-label\": \"org.onap.relationships.inventory.Uses\",\n" + - " \"related-link\": \"/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/AAI-12002-vm230w/AAI-region-vm230w\",\n" + - " \"relationship-data\": [\n" + - " {\n" + - " \"relationship-key\": \"cloud-region.cloud-owner\",\n" + - " \"relationship-value\": \"AAI-12002-vm230w\"\n" + - " },\n" + - " {\n" + - " \"relationship-key\": \"cloud-region.cloud-region-id\",\n" + - " \"relationship-value\": \"AAI-region-vm230w\"\n" + - " }\n" + - " ],\n" + - " \"related-to-property\": [\n" + - " {\n" + - " \"property-key\": \"cloud-region.owner-defined-type\"\n" + - " }\n" + - " ]\n" + - " }\n" + - " ]\n" + - " }\n" + - " }\n" + - " },\n" + - " {\n" + - " \"instance-group\": {\n" + - " \"instance-group-role\": \"JZmha7QSS4tJ\",\n" + - " \"model-invariant-id\": \"model-id1\",\n" + - " \"model-version-id\": \"a0efd5fc-f7be-4502-936a-a6c6392b958f\",\n" + - " \"id\": \"AAI-12002-test1-vm230w\",\n" + - " \"description\": \"a9DEa0kpY\",\n" + - " \"instance-group-type\": \"type\",\n" + - " \"resource-version\": \"1520886467989\",\n" + - " \"instance-group-name\": \"wKmBXiO1xm8bK\",\n" + - " \"instance-group-function\": \"testfunction2\",\n" + - " \"relationship-list\": {\n" + - " \"relationship\": [\n" + - " {\n" + - " \"related-to\": \"cloud-region\",\n" + - " \"relationship-label\": \"org.onap.relationships.inventory.Uses\",\n" + - " \"related-link\": \"/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/AAI-12002-vm230w/AAI-region-vm230w\",\n" + - " \"relationship-data\": [\n" + - " {\n" + - " \"relationship-key\": \"cloud-region.cloud-owner\",\n" + - " \"some-filed\": \"some-data\",\n" + //extra field - " \"relationship-value\": \"AAI-12002-vm230w\"\n" + - " },\n" + - " {\n" + - " \"relationship-key\": \"cloud-region.cloud-region-id\",\n" + - " \"relationship-value\": \"AAI-region-vm230w\"\n" + - " }\n" + - " ],\n" + - " \"related-to-property\": [\n" + - " {\n" + - " \"property-key\": \"cloud-region.owner-defined-type\"\n" + - " }\n" + - " ]\n" + - " }\n" + - " ]\n" + - " }\n" + - " }\n" + - " },\n" + - " {\n" + - " \"instance-group\": {\n" + - " \"instance-group-role\": \"JZmha7QSS4tJ\",\n" + - " \"model-invariant-id\": \"model-id2\",\n" + - " \"model-version-id\": \"version2\",\n" + - " \"id\": \"AAI-12002-test2-vm230w\",\n" + - " \"description\": \"a9DEa0kpY\",\n" + - " \"instance-group-type\": \"type\",\n" + - " \"resource-version\": \"1520888629970\",\n" + - " \"instance-group-name\": \"wKmBXiO1xm8bK\",\n" + - " \"instance-group-function\": \"testfunction2\",\n" + - " \"relationship-list\": {\n" + - " \"relationship\": [\n" + - " {\n" + - " \"related-to\": \"cloud-region\",\n" + - " \"relationship-label\": \"org.onap.relationships.inventory.Uses\",\n" + - " \"related-link\": \"/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/AAI-12002-vm230w/AAI-region-vm230w\",\n" + - " \"relationship-data\": [\n" + - " {\n" + - " \"relationship-key\": \"cloud-region.cloud-owner\",\n" + - " \"relationship-value\": \"AAI-12002-vm230w\"\n" + - " },\n" + - " {\n" + - " \"relationship-key\": \"cloud-region.cloud-region-id\",\n" + - " \"relationship-value\": \"AAI-region-vm230w\"\n" + - " }\n" + - " ],\n" + - " \"related-to-property\": [\n" + - " {\n" + - " \"property-key\": \"cloud-region.owner-defined-type\"\n" + - " }\n" + - " ]\n" + - " }\n" + - " ]\n" + - " }\n" + - " }\n" + - " }\n" + - " ]\n" + - "}\n"; + return "{" + + " \"results\": [" + + " {" + + " \"instance-group\": {" + + " \"instance-group-role\": \"JZmha7QSS4tJ\"," + + " \"some-filed\": \"some-data\"," + //extra field + " \"model-invariant-id\": \"model-id3\"," + + " \"model-version-id\": \"a0efd5fc-f7be-4502-936a-a6c6392b958f\"," + + " \"id\": \"AAI-12002-test3-vm230w\"," + + " \"description\": \"a9DEa0kpY\"," + + " \"instance-group-type\": \"type\"," + + " \"resource-version\": \"1520888659539\"," + + " \"instance-group-name\": \"wKmBXiO1xm8bK\"," + + " \"instance-group-function\": \"testfunction2\"," + + " \"relationship-list\": {" + + " \"relationship\": [" + + " {" + + " \"related-to\": \"cloud-region\"," + + " \"some-filed\": \"some-data\"," + //extra field + " \"relationship-label\": \"org.onap.relationships.inventory.Uses\"," + + " \"related-link\": \"/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/AAI-12002-vm230w/AAI-region-vm230w\"," + + " \"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\"" + + " }" + + " ]" + + " }" + + " ]" + + " }" + + " }" + + " }," + + " {" + + " \"instance-group\": {" + + " \"instance-group-role\": \"JZmha7QSS4tJ\"," + + " \"model-invariant-id\": \"model-id1\"," + + " \"model-version-id\": \"a0efd5fc-f7be-4502-936a-a6c6392b958f\"," + + " \"id\": \"AAI-12002-test1-vm230w\"," + + " \"description\": \"a9DEa0kpY\"," + + " \"instance-group-type\": \"type\"," + + " \"resource-version\": \"1520886467989\"," + + " \"instance-group-name\": \"wKmBXiO1xm8bK\"," + + " \"instance-group-function\": \"testfunction2\"," + + " \"relationship-list\": {" + + " \"relationship\": [" + + " {" + + " \"related-to\": \"cloud-region\"," + + " \"relationship-label\": \"org.onap.relationships.inventory.Uses\"," + + " \"related-link\": \"/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/AAI-12002-vm230w/AAI-region-vm230w\"," + + " \"relationship-data\": [" + + " {" + + " \"relationship-key\": \"cloud-region.cloud-owner\"," + + " \"some-filed\": \"some-data\"," + //extra field + " \"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\"" + + " }" + + " ]" + + " }" + + " ]" + + " }" + + " }" + + " }," + + " {" + + " \"instance-group\": {" + + " \"instance-group-role\": \"JZmha7QSS4tJ\"," + + " \"model-invariant-id\": \"model-id2\"," + + " \"model-version-id\": \"version2\"," + + " \"id\": \"AAI-12002-test2-vm230w\"," + + " \"description\": \"a9DEa0kpY\"," + + " \"instance-group-type\": \"type\"," + + " \"resource-version\": \"1520888629970\"," + + " \"instance-group-name\": \"wKmBXiO1xm8bK\"," + + " \"instance-group-function\": \"testfunction2\"," + + " \"relationship-list\": {" + + " \"relationship\": [" + + " {" + + " \"related-to\": \"cloud-region\"," + + " \"relationship-label\": \"org.onap.relationships.inventory.Uses\"," + + " \"related-link\": \"/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/AAI-12002-vm230w/AAI-region-vm230w\"," + + " \"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\"" + + " }" + + " ]" + + " }" + + " ]" + + " }" + + " }" + + " }" + + " ]" + + "}"; } } diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetInstanceGroupsByCloudRegionRequiredMissing.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetInstanceGroupsByCloudRegionRequiredMissing.java index 4d596e527..eb4a22889 100644 --- a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetInstanceGroupsByCloudRegionRequiredMissing.java +++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetInstanceGroupsByCloudRegionRequiredMissing.java @@ -44,7 +44,7 @@ public class PresetAAIGetInstanceGroupsByCloudRegionRequiredMissing extends Base public Object getRequestBody() { return ImmutableMap.of( "start", ImmutableList.of("cloud-infrastructure/cloud-regions/cloud-region/" + getCloudOwner() + "/" + getCloudRegionId()), - "query", "query/instance-group-byCloudRegion?type=" + type + "&role=" + role + "&function=" + getNetworkFunction() + "query", "query/instance-groups-byCloudRegion?type=" + type + "&role=" + role + "&function=" + getNetworkFunction() ); } diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetModelsByOwningEntity.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetModelsByOwningEntity.java index 610ab6b48..41c35b8a5 100644 --- a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetModelsByOwningEntity.java +++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetModelsByOwningEntity.java @@ -1,12 +1,11 @@ package org.onap.simulator.presetGenerator.presets.aai; 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; +import org.onap.simulator.presetGenerator.presets.BasePresets.BaseAAIPreset; +import org.springframework.http.HttpMethod; public class PresetAAIGetModelsByOwningEntity extends BaseAAIPreset { String oeName; @@ -45,11 +44,11 @@ public class PresetAAIGetModelsByOwningEntity extends BaseAAIPreset { " {" + " \"related-to\": \"service-instance\"," + " \"relationship-label\": \"org.onap.relationships.inventory.BelongsTo\"," + - " \"related-link\": \"/aai/v12/business/customers/customer/MSO_1610_ST/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/af9d52f9-13b2-4657-a198-463677f82dc0\"," + + " \"related-link\": \"/aai/v12/business/customers/customer/CAR_2020_ER/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/af9d52f9-13b2-4657-a198-463677f82dc0\"," + " \"relationship-data\": [" + " {" + " \"relationship-key\": \"customer.global-customer-id\"," + - " \"relationship-value\": \"MSO_1610_ST\"" + + " \"relationship-value\": \"CAR_2020_ER\"" + " }," + " {" + " \"relationship-key\": \"service-subscription.service-type\"," + @@ -70,11 +69,11 @@ public class PresetAAIGetModelsByOwningEntity extends BaseAAIPreset { " {" + " \"related-to\": \"service-instance\"," + " \"relationship-label\": \"org.onap.relationships.inventory.BelongsTo\"," + - " \"related-link\": \"/aai/v12/business/customers/customer/MSO_1610_ST/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/49769492-5def-4c89-8e73-b236f958fa40\"," + + " \"related-link\": \"/aai/v12/business/customers/customer/CAR_2020_ER/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/49769492-5def-4c89-8e73-b236f958fa40\"," + " \"relationship-data\": [" + " {" + " \"relationship-key\": \"customer.global-customer-id\"," + - " \"relationship-value\": \"MSO_1610_ST\"" + + " \"relationship-value\": \"CAR_2020_ER\"" + " }," + " {" + " \"relationship-key\": \"service-subscription.service-type\"," + @@ -120,7 +119,7 @@ public class PresetAAIGetModelsByOwningEntity extends BaseAAIPreset { " {" + " \"related-to\": \"service-instance\"," + " \"relationship-label\": \"org.onap.relationships.inventory.BelongsTo\"," + - " \"related-link\": \"/aai/v12/business/customers/customer/a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb/service-subscriptions/service-subscription/Mobility/service-instances/service-instance/7e4f8130-5dee-47c4-8770-1abc5f5ded83\"," + + " \"related-link\": \"/aai/v12/business/customers/customer/a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb/service-subscriptions/service-subscription/Emanuel/service-instances/service-instance/7e4f8130-5dee-47c4-8770-1abc5f5ded83\"," + " \"relationship-data\": [" + " {" + " \"relationship-key\": \"customer.global-customer-id\"," + @@ -128,7 +127,7 @@ public class PresetAAIGetModelsByOwningEntity extends BaseAAIPreset { " }," + " {" + " \"relationship-key\": \"service-subscription.service-type\"," + - " \"relationship-value\": \"Mobility\"" + + " \"relationship-value\": \"Emanuel\"" + " }," + " {" + " \"relationship-key\": \"service-instance.service-instance-id\"," + @@ -145,7 +144,7 @@ public class PresetAAIGetModelsByOwningEntity extends BaseAAIPreset { " {" + " \"related-to\": \"service-instance\"," + " \"relationship-label\": \"org.onap.relationships.inventory.BelongsTo\"," + - " \"related-link\": \"/aai/v12/business/customers/customer/a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb/service-subscriptions/service-subscription/Mobility/service-instances/service-instance/d849b312-03f6-4fa3-a923-a469b850ec73\"," + + " \"related-link\": \"/aai/v12/business/customers/customer/a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb/service-subscriptions/service-subscription/Emanuel/service-instances/service-instance/d849b312-03f6-4fa3-a923-a469b850ec73\"," + " \"relationship-data\": [" + " {" + " \"relationship-key\": \"customer.global-customer-id\"," + @@ -153,7 +152,7 @@ public class PresetAAIGetModelsByOwningEntity extends BaseAAIPreset { " }," + " {" + " \"relationship-key\": \"service-subscription.service-type\"," + - " \"relationship-value\": \"Mobility\"" + + " \"relationship-value\": \"Emanuel\"" + " }," + " {" + " \"relationship-key\": \"service-instance.service-instance-id\"," + diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetModelsByProject.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetModelsByProject.java index 96372abb4..cb80fd6ce 100644 --- a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetModelsByProject.java +++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetModelsByProject.java @@ -1,13 +1,12 @@ package org.onap.simulator.presetGenerator.presets.aai; 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; import java.util.UUID; +import org.onap.simulator.presetGenerator.presets.BasePresets.BaseAAIPreset; +import org.springframework.http.HttpMethod; public class PresetAAIGetModelsByProject extends BaseAAIPreset { private String projectName; @@ -49,7 +48,7 @@ public class PresetAAIGetModelsByProject extends BaseAAIPreset { " {" + " \"related-to\": \"service-instance\"," + " \"relationship-label\": \"org.onap.relationships.inventory.Uses\"," + - " \"related-link\": \"/aai/v12/business/customers/customer/a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb/service-subscriptions/service-subscription/Mobility/service-instances/service-instance/3f826016-3ac9-4928-9561-beee75fd91d5\"," + + " \"related-link\": \"/aai/v12/business/customers/customer/a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb/service-subscriptions/service-subscription/Emanuel/service-instances/service-instance/3f826016-3ac9-4928-9561-beee75fd91d5\"," + " \"relationship-data\": [" + " {" + " \"relationship-key\": \"customer.global-customer-id\"," + @@ -57,7 +56,7 @@ public class PresetAAIGetModelsByProject extends BaseAAIPreset { " }," + " {" + " \"relationship-key\": \"service-subscription.service-type\"," + - " \"relationship-value\": \"Mobility\"" + + " \"relationship-value\": \"Emanuel\"" + " }," + " {" + " \"relationship-key\": \"service-instance.service-instance-id\"," + @@ -124,7 +123,7 @@ public class PresetAAIGetModelsByProject extends BaseAAIPreset { " {" + " \"related-to\": \"service-instance\"," + " \"relationship-label\": \"org.onap.relationships.inventory.Uses\"," + - " \"related-link\": \"/aai/v12/business/customers/customer/a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb/service-subscriptions/service-subscription/Mobility/service-instances/service-instance/ff2d9326-1ef5-4760-aba0-0eaf372ae675\"," + + " \"related-link\": \"/aai/v12/business/customers/customer/a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb/service-subscriptions/service-subscription/Emanuel/service-instances/service-instance/ff2d9326-1ef5-4760-aba0-0eaf372ae675\"," + " \"relationship-data\": [" + " {" + " \"relationship-key\": \"customer.global-customer-id\"," + @@ -132,7 +131,7 @@ public class PresetAAIGetModelsByProject extends BaseAAIPreset { " }," + " {" + " \"relationship-key\": \"service-subscription.service-type\"," + - " \"relationship-value\": \"Mobility\"" + + " \"relationship-value\": \"Emanuel\"" + " }," + " {" + " \"relationship-key\": \"service-instance.service-instance-id\"," + diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetMultipleVersion.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetMultipleVersion.java deleted file mode 100644 index a9c63196a..000000000 --- a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetMultipleVersion.java +++ /dev/null @@ -1,59 +0,0 @@ -package org.onap.simulator.presetGenerator.presets.aai; - -public class PresetAAIGetMultipleVersion extends BasePresetAAIGetVersion { - public String modelVersionId2; - public String modelVersionId3; - public PresetAAIGetMultipleVersion(String modelVersionId1, - String modelVersionId2, - String modelVersionId3, - String modelInvariantId) { - super( modelVersionId1, modelInvariantId); - this.modelVersionId2 = modelVersionId2; - this.modelVersionId3 = modelVersionId3; - } - public String getModelVersionId2() { - return modelVersionId2; - } - public String getModelVersionId3() { - return modelVersionId3; - } - - @Override - public Object getResponseBody() { - return "{\"results\": [" + - " {" + - " \"model\": {" + - " \"model-invariant-id\": \"" + getModelInvariantId() + "\"," + - " \"model-type\": \"resource\"," + - " \"resource-version\": \"1500138206526\"," + - " \"model-vers\": {" + - " \"model-ver\": [" + - " {" + - " \"model-version-id\": \"" + getModelVersionId1() + "\"," + - " \"model-name\": \"action-data\"," + - " \"model-version\": \"1.0\"," + - " \"model-description\": \"decontamination arm circus ammonia hump edge\"," + - " \"resource-version\": \"1500137463984\"" + - " }," + - " {" + - " \"model-version-id\": \"" + getModelVersionId3() + "\"," + - " \"model-name\": \"action-data\"," + - " \"model-version\": \"3.0\"," + - " \"model-description\": \"Non decontamination arm circus ammonia hump edge\"," + - " \"resource-version\": \"1500137463986\"" + - " }," + - " {" + - " \"model-version-id\": \"" + getModelVersionId2() + "\"," + - " \"model-name\": \"action-data\"," + - " \"model-version\": \"2.0\"," + - " \"model-description\": \"The oldest one\"," + - " \"resource-version\": \"1500137463980\"" + - " }" + - " ]" + - " }" + - " }" + - " }" + - " ]}"; - } - - }
\ No newline at end of file diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetNetworkCollectionDetails.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetNetworkCollectionDetails.java index e1fa74ec8..b99f58bda 100644 --- a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetNetworkCollectionDetails.java +++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetNetworkCollectionDetails.java @@ -2,12 +2,11 @@ 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; +import org.onap.simulator.presetGenerator.presets.BasePresets.BaseAAIPreset; +import org.springframework.http.HttpMethod; public class PresetAAIGetNetworkCollectionDetails extends BaseAAIPreset { @@ -219,10 +218,11 @@ public class PresetAAIGetNetworkCollectionDetails extends BaseAAIPreset { " \"network-id\": \"l3network-id-rs804s\",\n" + " \"network-name\": \"oam-net\",\n" + " \"network-type\": \"Tenant_Layer_3\",\n" + - " \"network-role\": \"HngwProtectedOam.OAM\",\n" + + " \"network-role\": \"RosemaProtectedOam.OAM\",\n" + " \"network-technology\": \"Contrail\",\n" + " \"is-bound-to-vpn\": false,\n" + " \"resource-version\": \"1521662814627\",\n" + + " \"orchestration-status\": \"Created\",\n" + " \"is-provider-network\": false,\n" + " \"is-shared-network\": false,\n" + " \"is-external-network\": false,\n" + @@ -258,10 +258,11 @@ public class PresetAAIGetNetworkCollectionDetails extends BaseAAIPreset { " \"network-id\": \"l3network-id-3-rs804s\",\n" + " \"network-name\": \"oam-net\",\n" + " \"network-type\": \"Tenant_Layer_3\",\n" + - " \"network-role\": \"HngwProtectedOam.OAM\",\n" + + " \"network-role\": \"RosemaProtectedOam.OAM\",\n" + " \"network-technology\": \"Contrail\",\n" + " \"is-bound-to-vpn\": false,\n" + " \"resource-version\": \"1521662816043\",\n" + + " \"orchestration-status\": \"Created\",\n" + " \"is-provider-network\": false,\n" + " \"is-shared-network\": false,\n" + " \"is-external-network\": false,\n" + @@ -297,10 +298,11 @@ public class PresetAAIGetNetworkCollectionDetails extends BaseAAIPreset { " \"network-id\": \"l3network-id-2-rs804s\",\n" + " \"network-name\": \"oam-net\",\n" + " \"network-type\": \"Tenant_Layer_3\",\n" + - " \"network-role\": \"HngwProtectedOam.OAM\",\n" + + " \"network-role\": \"RosemaProtectedOam.OAM\",\n" + " \"network-technology\": \"Contrail\",\n" + " \"is-bound-to-vpn\": false,\n" + " \"resource-version\": \"1521662815304\",\n" + + " \"orchestration-status\": \"Created\",\n" + " \"is-provider-network\": false,\n" + " \"is-shared-network\": false,\n" + " \"is-external-network\": false,\n" + diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetNetworkCollectionDetailsInvalidRequest.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetNetworkCollectionDetailsInvalidRequest.java index d0e4baf60..0d447c2c2 100644 --- a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetNetworkCollectionDetailsInvalidRequest.java +++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetNetworkCollectionDetailsInvalidRequest.java @@ -2,12 +2,11 @@ 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; +import org.onap.simulator.presetGenerator.presets.BasePresets.BaseAAIPreset; +import org.springframework.http.HttpMethod; public class PresetAAIGetNetworkCollectionDetailsInvalidRequest extends BaseAAIPreset { @@ -221,11 +220,12 @@ public class PresetAAIGetNetworkCollectionDetailsInvalidRequest extends BaseAAIP " \"network-id\": \"l3network-id-rs804s\",\n" + " \"network-name\": \"oam-net\",\n" + " \"network-type\": \"Tenant_Layer_3\",\n" + - " \"network-role\": \"HngwProtectedOam.OAM\",\n" + - " \"network-roles\": \"HngwProtectedOam.OAM\",\n" +//extra field + " \"network-role\": \"RosemaProtectedOam.OAM\",\n" + + " \"network-roles\": \"RosemaProtectedOam.OAM\",\n" +//extra field " \"network-technology\": \"Contrail\",\n" + " \"is-bound-to-vpn\": false,\n" + " \"resource-version\": \"1521662814627\",\n" + + " \"orchestration-status\": \"Created\",\n" + " \"is-provider-network\": false,\n" + " \"is-shared-network\": false,\n" + " \"is-external-network\": false,\n" + @@ -261,10 +261,11 @@ public class PresetAAIGetNetworkCollectionDetailsInvalidRequest extends BaseAAIP " \"network-id\": \"l3network-id-3-rs804s\",\n" + " \"network-name\": \"oam-net\",\n" + " \"network-type\": \"Tenant_Layer_3\",\n" + - " \"network-role\": \"HngwProtectedOam.OAM\",\n" + + " \"network-role\": \"RosemaProtectedOam.OAM\",\n" + " \"network-technology\": \"Contrail\",\n" + " \"is-bound-to-vpn\": false,\n" + " \"resource-version\": \"1521662816043\",\n" + + " \"orchestration-status\": \"Created\",\n" + " \"is-provider-network\": false,\n" + " \"is-shared-network\": false,\n" + " \"is-external-network\": false,\n" + @@ -300,10 +301,11 @@ public class PresetAAIGetNetworkCollectionDetailsInvalidRequest extends BaseAAIP " \"network-id\": \"l3network-id-2-rs804s\",\n" + " \"network-name\": \"oam-net\",\n" + " \"network-type\": \"Tenant_Layer_3\",\n" + - " \"network-role\": \"HngwProtectedOam.OAM\",\n" + + " \"network-role\": \"RosemaProtectedOam.OAM\",\n" + " \"network-technology\": \"Contrail\",\n" + " \"is-bound-to-vpn\": false,\n" + " \"resource-version\": \"1521662815304\",\n" + + " \"orchestration-status\": \"Created\",\n" + " \"is-provider-network\": false,\n" + " \"is-shared-network\": false,\n" + " \"is-external-network\": false,\n" + diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetNetworkCollectionDetailsRequiredMissing.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetNetworkCollectionDetailsRequiredMissing.java index c32a3b563..23b35d204 100644 --- a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetNetworkCollectionDetailsRequiredMissing.java +++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetNetworkCollectionDetailsRequiredMissing.java @@ -2,12 +2,11 @@ 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; +import org.onap.simulator.presetGenerator.presets.BasePresets.BaseAAIPreset; +import org.springframework.http.HttpMethod; public class PresetAAIGetNetworkCollectionDetailsRequiredMissing extends BaseAAIPreset { @@ -218,7 +217,7 @@ public class PresetAAIGetNetworkCollectionDetailsRequiredMissing extends BaseAAI " \"network-id\": \"l3network-id-rs804s\",\n" + " \"network-name\": \"oam-net\",\n" + " \"network-type\": \"Tenant_Layer_3\",\n" + - " \"network-role\": \"HngwProtectedOam.OAM\",\n" + + " \"network-role\": \"RosemaProtectedOam.OAM\",\n" + " \"network-technology\": \"Contrail\",\n" + " \"is-bound-to-vpn\": false,\n" + " \"resource-version\": \"1521662814627\",\n" + @@ -257,7 +256,7 @@ public class PresetAAIGetNetworkCollectionDetailsRequiredMissing extends BaseAAI " \"network-id\": \"l3network-id-3-rs804s\",\n" + " \"network-name\": \"oam-net\",\n" + " \"network-type\": \"Tenant_Layer_3\",\n" + - " \"network-role\": \"HngwProtectedOam.OAM\",\n" + + " \"network-role\": \"RosemaProtectedOam.OAM\",\n" + " \"network-technology\": \"Contrail\",\n" + " \"is-bound-to-vpn\": false,\n" + " \"resource-version\": \"1521662816043\",\n" + @@ -296,7 +295,7 @@ public class PresetAAIGetNetworkCollectionDetailsRequiredMissing extends BaseAAI " \"network-id\": \"l3network-id-2-rs804s\",\n" + " \"network-name\": \"oam-net\",\n" + " \"network-type\": \"Tenant_Layer_3\",\n" + - " \"network-role\": \"HngwProtectedOam.OAM\",\n" + + " \"network-role\": \"RosemaProtectedOam.OAM\",\n" + " \"network-technology\": \"Contrail\",\n" + " \"is-bound-to-vpn\": false,\n" + " \"resource-version\": \"1521662815304\",\n" + diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetNetworkZones.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetNetworkZones.java index e8449b320..93f8ad8ab 100644 --- a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetNetworkZones.java +++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetNetworkZones.java @@ -721,8 +721,8 @@ public class PresetAAIGetNetworkZones extends BaseAAIPreset { " \"zone-name\": \"QWERTYUI-NUM1\"" + " }," + " {" + - " \"zone-id\": \"MTN32\"," + - " \"zone-name\": \"MDTWNJ21-MTN32\"" + + " \"zone-id\": \"hvf32\"," + + " \"zone-name\": \"MDTWNJ21-hvf32\"" + " }," + " {" + " \"zone-id\": \"RTZ4\"," + @@ -773,8 +773,8 @@ public class PresetAAIGetNetworkZones extends BaseAAIPreset { " \"zone-name\": \"ATLSECIA-ABC12\"" + " }," + " {" + - " \"zone-id\": \"MTN20\"," + - " \"zone-name\": \"MDTWNJ21-MTN20\"" + + " \"zone-id\": \"hvf20\"," + + " \"zone-name\": \"MDTWNJ21-hvf20\"" + " }," + " {" + " \"zone-id\": \"ABC15\"," + diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetOneVersion.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetOneVersion.java deleted file mode 100644 index 74e2102f1..000000000 --- a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetOneVersion.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.onap.simulator.presetGenerator.presets.aai; - -public class PresetAAIGetOneVersion extends BasePresetAAIGetVersion { - - public PresetAAIGetOneVersion(String modelVersionId1, - String modelInvariantId) { - super(modelVersionId1, modelInvariantId); - } - - @Override - public Object getResponseBody() { - return "{\"results\": [" + - " {" + - " \"model\": {" + - " \"model-invariant-id\": \"" + getModelInvariantId() + "\"," + - " \"model-type\": \"resource\"," + - " \"resource-version\": \"1500138206526\"," + - " \"model-vers\": {" + - " \"model-ver\": [" + - " {" + - " \"model-version-id\": \"" + getModelVersionId1() + "\"," + - " \"model-name\": \"action-data\"," + - " \"model-version\": \"1.0\"," + - " \"model-description\": \"decontamination arm circus ammonia hump edge\"," + - " \"resource-version\": \"1500137463984\"" + - " }" + - " ]" + - " }" + - " }" + - " }" + - " ]}"; - } -} diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetPNFByRegionErrorPut.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetPNFByRegionErrorPut.java index d363619e5..0676217a1 100644 --- a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetPNFByRegionErrorPut.java +++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetPNFByRegionErrorPut.java @@ -12,7 +12,7 @@ public class PresetAAIGetPNFByRegionErrorPut extends BaseAAIPreset { public Object getResponseBody() { return "{" + " \"start\": \"/business/customers/customer/e433710f-9217-458d-a79d-1c7aff376d89/service-subscriptions/service-subscription/VIRTUAL%20USP/service-instances?model-version-id=8a84e59b-45fe-4851-8ff1-34225a0b32c3&model-invariant-id=83b458fd-5dd3-419b-a9e3-7335814a0911\"," + - " \"query\": \"query/pnf-fromModel-byRegion?cloudRegionId=AAIAIC25&equipVendor=Cisco&equipModel=Nexus%203048-TP\"" + + " \"query\": \"query/pnf-fromModel-byRegion?cloudRegionId=JANET25&equipVendor=Cisco&equipModel=Nexus%203048-TP\"" + " }"; } diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetPortMirroringSourcePorts.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetPortMirroringSourcePorts.java index a95df4592..fdb387d71 100644 --- a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetPortMirroringSourcePorts.java +++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetPortMirroringSourcePorts.java @@ -1,12 +1,11 @@ package org.onap.simulator.presetGenerator.presets.aai; 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; +import org.onap.simulator.presetGenerator.presets.BasePresets.BaseAAIPreset; +import org.springframework.http.HttpMethod; public class PresetAAIGetPortMirroringSourcePorts extends BaseAAIPreset { public PresetAAIGetPortMirroringSourcePorts(String configurationId, String interfaceId, String interfaceName, boolean isPortMirrored) { @@ -64,10 +63,10 @@ public class PresetAAIGetPortMirroringSourcePorts extends BaseAAIPreset { " {\n" + " \"id\": \"4876980240\",\n" + " \"node-type\": \"l-interface\",\n" + - " \"url\": \"/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/att-aic/rdm5b/tenants/tenant/460f35aeb53542dc9f77105066483e83/vservers/vserver/15e46e2f-4b98-4e06-9644-f0e6e35cc79a/l-interfaces/l-interface/zrdm5bfprbVLBA005-vlbagent_aff_int_pktmirror_1_port-dr5jhyxva5ib\",\n" + + " \"url\": \"/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/olson5b/tenants/tenant/460f35aeb53542dc9f77105066483e83/vservers/vserver/15e46e2f-4b98-4e06-9644-f0e6e35cc79a/l-interfaces/l-interface/zolson5bfprbVLBA005-vlbagent_aff_int_pktmirror_1_port-dr5jhyxva5ib\",\n" + " \"properties\": {\n" + " \"interface-name\": " + doubleQuoteIfNotNull(getInterfaceName()) + ",\n" + - " \"selflink\": \"https://network-aic.rdm5b.cci.att.com:9696/v2.0/ports/6de7bf87-6faa-4984-9492-18d1188b3d4a\",\n" + + " \"selflink\": \"https://netw.onap.org:9696/v2.0/ports/6de7bf87-6faa-4984-9492-18d1188b3d4a\",\n" + " \"interface-id\": " + doubleQuoteIfNotNull(getInterfaceId()) + ",\n" + " \"macaddr\": \"02:6d:e7:bf:87:6f\",\n" + " \"network-name\": \"APP-C-24595-D-T001-vprobe_int_pktmirror_net_1\",\n" + @@ -81,7 +80,7 @@ public class PresetAAIGetPortMirroringSourcePorts extends BaseAAIPreset { " \"id\": \"4999893128\",\n" + " \"relationship-label\": \"org.onap.relationships.inventory.BelongsTo\",\n" + " \"node-type\": \"l3-interface-ipv4-address-list\",\n" + - " \"url\": \"/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/att-aic/rdm5b/tenants/tenant/460f35aeb53542dc9f77105066483e83/vservers/vserver/15e46e2f-4b98-4e06-9644-f0e6e35cc79a/l-interfaces/l-interface/zrdm5bfprbVLBA005-vlbagent_aff_int_pktmirror_1_port-dr5jhyxva5ib/l3-interface-ipv4-address-list/107.244.46.254\"\n" + + " \"url\": \"/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/olson5b/tenants/tenant/460f35aeb53542dc9f77105066483e83/vservers/vserver/15e46e2f-4b98-4e06-9644-f0e6e35cc79a/l-interfaces/l-interface/zolson5bfprbVLBA005-vlbagent_aff_int_pktmirror_1_port-dr5jhyxva5ib/l3-interface-ipv4-address-list/107.244.46.254\"\n" + " },\n" + " {\n" + " \"id\": \"6150074384\",\n" + @@ -111,7 +110,7 @@ public class PresetAAIGetPortMirroringSourcePorts extends BaseAAIPreset { " \"id\": \"5491453960\",\n" + " \"relationship-label\": \"tosca.relationships.network.BindsTo\",\n" + " \"node-type\": \"vserver\",\n" + - " \"url\": \"/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/att-aic/rdm5b/tenants/tenant/460f35aeb53542dc9f77105066483e83/vservers/vserver/15e46e2f-4b98-4e06-9644-f0e6e35cc79a\"\n" + + " \"url\": \"/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/olson5b/tenants/tenant/460f35aeb53542dc9f77105066483e83/vservers/vserver/15e46e2f-4b98-4e06-9644-f0e6e35cc79a\"\n" + " }\n" + " ]\n" + " }\n" + diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetRelatedInstanceGroupsByVnfId.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetRelatedInstanceGroupsByVnfId.java index 97186c9da..da1a120b4 100644 --- a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetRelatedInstanceGroupsByVnfId.java +++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetRelatedInstanceGroupsByVnfId.java @@ -1,12 +1,11 @@ package org.onap.simulator.presetGenerator.presets.aai; 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; +import org.onap.simulator.presetGenerator.presets.BasePresets.BaseAAIPreset; +import org.springframework.http.HttpMethod; public class PresetAAIGetRelatedInstanceGroupsByVnfId extends BaseAAIPreset { @@ -47,7 +46,7 @@ public class PresetAAIGetRelatedInstanceGroupsByVnfId extends BaseAAIPreset { public Object getResponseBody() { return "{\n" + " \"vnf-id\": \"vnf-id-3\",\n" + - " \"vnf-name\": \"zmtn6nf-code-110\",\n" + + " \"vnf-name\": \"zhvf6nf-code-110\",\n" + " \"vnf-type\": \"vnf-type\",\n" + " \"prov-status\": \"NVTPROV\",\n" + " \"operational-status\": \"out-of-service-path\",\n" + @@ -106,15 +105,15 @@ public class PresetAAIGetRelatedInstanceGroupsByVnfId extends BaseAAIPreset { " {\n" + " \"related-to\": \"availability-zone\",\n" + " \"relationship-label\": \"org.onap.relationships.inventory.Uses\",\n" + - " \"related-link\": \"/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6/availability-zones/availability-zone/AZ-MN02\",\n" + + " \"related-link\": \"/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/hvf6/availability-zones/availability-zone/AZ-MN02\",\n" + " \"relationship-data\": [\n" + " {\n" + " \"relationship-key\": \"cloud-region.cloud-owner\",\n" + - " \"relationship-value\": \"att-aic\"\n" + + " \"relationship-value\": \"irma-aic\"\n" + " },\n" + " {\n" + " \"relationship-key\": \"cloud-region.cloud-region-id\",\n" + - " \"relationship-value\": \"mtn6\"\n" + + " \"relationship-value\": \"hvf6\"\n" + " },\n" + " {\n" + " \"relationship-key\": \"availability-zone.availability-zone-name\",\n" + diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetServiceInstancesByInvariantId.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetServiceInstancesByInvariantId.java new file mode 100644 index 000000000..8f7b6d0fb --- /dev/null +++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetServiceInstancesByInvariantId.java @@ -0,0 +1,90 @@ +package org.onap.simulator.presetGenerator.presets.aai; + +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.Multimap; +import org.onap.simulator.presetGenerator.presets.BasePresets.BaseAAIPreset; +import org.springframework.http.HttpMethod; + +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +public class PresetAAIGetServiceInstancesByInvariantId extends BaseAAIPreset { + + private String globalCustomerId; + private String serviceType; + private String invariantId; + private Map<String, Multimap<String, String>> servicesWithRelationships; + + public PresetAAIGetServiceInstancesByInvariantId(String globalCustomerId, String serviceType, String invariantId, + Map<String, Multimap<String, String>> servicesWithRelationships) { + this.globalCustomerId = globalCustomerId; + this.serviceType = serviceType; + this.invariantId = invariantId; + this.servicesWithRelationships = servicesWithRelationships; + } + + @Override + public String getResponseBody() { + return "{" + + " \"service-instance\":[" + + servicesWithRelationships.entrySet().stream().map( + entry -> buildServiceInstance(entry.getKey(), entry.getValue()) + ).collect(Collectors.joining(",")) + + " ]" + + "}"; + } + + private String buildServiceInstance(String serviceInstanceId, Multimap<String, String> relationships) { + return " {" + + " \"service-instance-id\":\"" + serviceInstanceId + "\"," + + " \"service-instance-name\":\"service-instance-name\"," + + " \"service-instance-type\":\"service-instance-type\"," + + " \"service-instance-role\":\"service-instance-role\"," + + " \"model-invariant-id\":\"" + invariantId + "\"," + + " \"model-version-id\":\"7a6ee536-f052-46fa-aa7e-2fca9d674c44\"," + + " \"resource-version\":\"GARBAGE DATA\"," + + " \"orchestration-status\":\"GARBAGE DATA\"," + + " \"relationship-list\":{" + + " \"relationship\":[" + + relationships.entries().stream().map( + entry -> buildRelationship(entry.getKey(), entry.getValue()) + ).collect(Collectors.joining(",")) + + " ]" + + " }" + + " }"; + } + + private String buildRelationship(String relatedTo, final String relatedLink) { + return "" + + "{ " + + " \"related-to\": \"" + relatedTo + "\", " + + " \"relationship-label\": \"org.onap.relationships.inventory.ComposedOf\", " + + " \"related-link\": \"" + relatedLink + "\", " + + " \"relationship-data\": [" + + " { " + + " \"relationship-key\": \"GARBAGE DATA\", " + + " \"relationship-value\": \"GARBAGE DATA\" " + + " } " + + " ] " + + "}"; + } + + @Override + public HttpMethod getReqMethod() { + return HttpMethod.GET; + } + + @Override + public String getReqPath() { + return getRootPath() + "/business/customers/customer/" + + globalCustomerId + "/service-subscriptions/service-subscription/" + + serviceType + "/service-instances"; + } + + @Override + public Map<String, List> getQueryParams() { + return ImmutableMap.of("model-invariant-id", ImmutableList.of(invariantId)); + } +} diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetServiceModelList.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetServiceModelList.java deleted file mode 100644 index e99630639..000000000 --- a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetServiceModelList.java +++ /dev/null @@ -1,80 +0,0 @@ -package org.onap.simulator.presetGenerator.presets.aai; - -public class PresetAAIGetServiceModelList extends BasePresetAAIGetVersion { - - public String modelInvariant2; - public String modelInvariant3; - public PresetAAIGetServiceModelList(String modelVersionId1, - String modelInvariantId1, String modelInvariant2, String modelInvariant3) { - super(modelVersionId1, modelInvariantId1); - this.modelInvariant2 = modelInvariant2; - this.modelInvariant3 = modelInvariant3; - } - - public String getModelInvariant2() { - return modelInvariant2; - } - - public void setModelInvariant2(String modelInvariant2) { - this.modelInvariant2 = modelInvariant2; - } - - public String getModelInvariant3() { - return modelInvariant3; - } - - public void setModelInvariant3(String modelInvariant3) { - this.modelInvariant3 = modelInvariant3; - } - - @Override - public Object getResponseBody() { - return "{\n" + - "\"results\": [\n" + - " {\"model\": { \n" + - " \"model-invariant-id\": \"" + getModelInvariantId() + "\"," + - " \"model-type\": \"service\",\n" + - " \"resource-version\": \"1515103312329\",\n" + - " \"model-vers\": {\"model-ver\": [\n" + - " {\n" + - " \"model-version-id\": \"" + getModelVersionId1() + "\"," + - " \"model-name\": \"AAAvIRC_mm779p_Service\",\n" + - " \"model-version\": \"1.0\",\n" + - " \"distribution-status\": \"DISTRIBUTION_COMPLETE_OK\",\n" + - " \"model-description\": \"tbd\",\n" + - " \"resource-version\": \"1516206395612\"\n" + - " }\n" + - " ]}\n" + - " }},\n" + - " {\"model\": { \n" + - " \"model-invariant-id\": \"" + getModelInvariant2() + "\"," + - " \"model-type\": \"service\",\n" + - " \"resource-version\": \"1515103312329\",\n" + - " \"model-vers\": {\"model-ver\": [\n" + - " {\n" + - " \"model-version-id\": \"1dae721c-a1ef-435f-b811-760c23f467bf\",\n" + - " \"model-name\": \"BBBvIRC_mm779p_Service\",\n" + - " \"model-version\": \"3.0\",\n" + - " \"model-description\": \"tbd\",\n" + - " \"resource-version\": \"1516025197086\"\n" + - " }\n" + - " ]}\n" + - " }},\n" + - " {\"model\": { \n" + - " \"model-invariant-id\": \"" + getModelInvariant3() + "\"," + - " \"model-type\": \"service\",\n" + - " \"resource-version\": \"1515103312329\",\n" + - " \"model-vers\": {\"model-ver\": [\n" + - "{\n" + - " \"model-version-id\": \"29236d45-e790-4c17-a115-1533cc09b7b1\",\n" + - " \"model-name\": \"CCCvIRC_mm779p_Service\",\n" + - " \"model-version\": \"4.0\",\n" + - " \"distribution-status\": \"DISTRIBUTION_COMPLETE_ERROR\",\n" + - " \"model-description\": \"tbd\",\n" + - " \"resource-version\": \"1517319724440\"\n" + - " }\n" + - " ]}\n" + - " }}\n" + - "]}\n"; - } -} diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetServicesGet.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetServicesGet.java index 04cef06ad..615879e18 100644 --- a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetServicesGet.java +++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetServicesGet.java @@ -29,18 +29,18 @@ public class PresetAAIGetServicesGet extends PresetAAIBaseGetServicesGet { " \"resource-version\":\"1494001980153\"" + " }," + " {" + - " \"service-id\":\"vRRaaS\"," + - " \"service-description\":\"vRRaaS\"," + + " \"service-id\":\"vTerrance\"," + + " \"service-description\":\"vTerrance\"," + " \"resource-version\":\"1484865266\"" + " }," + " {" + " \"service-id\":\"323d69d9-2efe-4r45-ay0a-89ea7ard4e6f\"," + - " \"service-description\":\"vSCP\"," + + " \"service-description\":\"vEsmeralda\"," + " \"resource-version\":\"1494001903012\"" + " }," + " {" + " \"service-id\":\"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\"," + - " \"service-description\":\"Mobility\"," + + " \"service-description\":\"Emanuel\"," + " \"resource-version\":\"1503954056794\"" + " }," + " {" + @@ -59,18 +59,18 @@ public class PresetAAIGetServicesGet extends PresetAAIBaseGetServicesGet { " \"resource-version\":\"1494001863930\"" + " }," + " {" + - " \"service-id\":\"vHNGWaas\"," + + " \"service-id\":\"vRosemarie\"," + " \"service-description\":\"HNGATEWAY\"," + " \"resource-version\":\"1501192849249\"" + " }," + " {" + " \"service-id\":\"vHNPaas\"," + - " \"service-description\":\"HNPORTAL\"," + + " \"service-description\":\"WILKINS\"," + " \"resource-version\":\"1501192982895\"" + " }," + " {" + " \"service-id\":\"e433710f-9217-458d-a79d-1c7aff376d89\"," + - " \"service-description\":\"VIRTUAL USP\"," + + " \"service-description\":\"TYLER SILVIA\"," + " \"resource-version\":\"1494001802638\"" + " }," + " {" + @@ -79,8 +79,8 @@ public class PresetAAIGetServicesGet extends PresetAAIBaseGetServicesGet { " \"resource-version\":\"1492533254036\"" + " }," + " {" + - " \"service-id\":\"VIPRaaS\"," + - " \"service-description\":\"vIPRaaS\"," + + " \"service-id\":\"vMuriel\"," + + " \"service-description\":\"vMuriel\"," + " \"resource-version\":\"1490910058887\"" + " }," + " {" + @@ -99,8 +99,8 @@ public class PresetAAIGetServicesGet extends PresetAAIBaseGetServicesGet { " \"resource-version\":\"1506361785997\"" + " }," + " {" + - " \"service-id\":\"vVIGaaS\"," + - " \"service-description\":\"vVIGaaS\"," + + " \"service-id\":\"vSalvatore\"," + + " \"service-description\":\"vSalvatore\"," + " \"resource-version\":\"1494001900545\"" + " }," + " {" + @@ -109,8 +109,8 @@ public class PresetAAIGetServicesGet extends PresetAAIBaseGetServicesGet { " \"resource-version\":\"1494001941772\"" + " }," + " {" + - " \"service-id\":\"vPEaaS\"," + - " \"service-description\":\"vPEaaS\"," + + " \"service-id\":\"vHubbard\"," + + " \"service-description\":\"vHubbard\"," + " \"resource-version\":\"1494001988229\"" + " }," + " {" + diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetSubDetailsGet.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetSubDetailsGet.java index 3033c027f..db41b9518 100644 --- a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetSubDetailsGet.java +++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetSubDetailsGet.java @@ -1,13 +1,13 @@ package org.onap.simulator.presetGenerator.presets.aai; -import org.onap.simulator.presetGenerator.presets.BasePresets.BaseAAIPreset; -import org.springframework.http.HttpMethod; +import static vid.automation.test.utils.ReadFile.loadResourceAsString; +import com.google.common.collect.ImmutableMap; import java.util.Collections; import java.util.List; import java.util.Map; - -import static vid.automation.test.utils.ReadFile.loadResourceAsString; +import org.onap.simulator.presetGenerator.presets.BasePresets.BaseAAIPreset; +import org.springframework.http.HttpMethod; public class PresetAAIGetSubDetailsGet extends BaseAAIPreset { private String subscriberId; @@ -15,14 +15,23 @@ public class PresetAAIGetSubDetailsGet extends BaseAAIPreset { private static final String baseResponseBody = loadResourceAsString("presets_templates/PresetAAIGetSubDetailsGet.json"); private static final String GLOBAL_CUSTOMER_ID = "GLOBAL_CUSTOMER_ID"; + private static final String ORCH_STATUS = "<ORCH_STATUS>"; public PresetAAIGetSubDetailsGet(String subscriberId) { this.subscriberId = subscriberId == null ? "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb" : subscriberId; this.responseBody = baseResponseBody.replace(GLOBAL_CUSTOMER_ID, this.subscriberId); } - public void mapQueryParams(Map<String, List> map) { - map.put("depth", Collections.singletonList("2")); + public PresetAAIGetSubDetailsGet(String subscriberId, String orchStatus) { + this.subscriberId = subscriberId == null ? "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb" : subscriberId; + this.responseBody = baseResponseBody.replace(GLOBAL_CUSTOMER_ID, this.subscriberId); + this.responseBody = this.responseBody.replace("\"subscriber-name\":\"Emanuel\"", "\"subscriber-name\":\"SILVIA ROBBINS\""); + this.responseBody = this.responseBody.replaceAll(ORCH_STATUS, orchStatus); + } + + @Override + public Map<String, List> getQueryParams() { + return ImmutableMap.of("depth", Collections.singletonList("2")); } @Override diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetSubDetailsGetSpecificService.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetSubDetailsGetSpecificService.java new file mode 100644 index 000000000..615c196a9 --- /dev/null +++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetSubDetailsGetSpecificService.java @@ -0,0 +1,114 @@ +package org.onap.simulator.presetGenerator.presets.aai; + +import static vid.automation.test.infra.ModelInfo.serviceFabricSriovService; + +import com.google.common.collect.ImmutableMap; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import org.onap.simulator.presetGenerator.presets.BasePresets.BaseAAIPreset; +import org.springframework.http.HttpMethod; +import vid.automation.test.infra.ModelInfo; + +public class PresetAAIGetSubDetailsGetSpecificService extends BaseAAIPreset { + private String subscriberId; + private String subscriberName = "Emanuel"; + private String orchStatus; + + private String serviceInstanceId = "c187e9fe-40c3-4862-b73e-84ff056205f61234"; + private String serviceInstanceName = "test_fabric_config"; + private ModelInfo modelInfo = serviceFabricSriovService; + + public PresetAAIGetSubDetailsGetSpecificService(String subscriberId) { + this.subscriberId = subscriberId == null ? "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb" : subscriberId; + } + + public PresetAAIGetSubDetailsGetSpecificService(String subscriberId, String subscriberName, String orchStatus, ModelInfo modelInfo, String serviceInstanceId) { + this(subscriberId); + this.subscriberName = subscriberName; + this.orchStatus = orchStatus; + this.modelInfo = modelInfo; + this.serviceInstanceId = serviceInstanceId; + } + + @Override + public Map<String, List> getQueryParams() { + return ImmutableMap.of("depth", Collections.singletonList("2")); + } + + @Override + public HttpMethod getReqMethod() { + return HttpMethod.GET; + } + + @Override + public String getReqPath() { + return getRootPath() + "/business/customers/customer/" + getSubscriberId(); + } + + public String getSubscriberId() { + return subscriberId; + } + + @Override + public Object getResponseBody() { + return "{" + + " \"global-customer-id\":\""+this.subscriberId+"\"," + + " \"subscriber-name\":\""+this.subscriberName+"\"," + + " \"subscriber-type\":\"INFRA\"," + + " \"resource-version\":\"1494255056308\"," + + " \"service-subscriptions\":{" + + " \"service-subscription\":[" + + " {" + + " \"service-type\":\"vFlowLogic\"," + + " \"resource-version\":\"1501700976809\"," + + " \"service-instances\":{" + + " \"service-instance\":[" + + " {" + + " \"service-instance-id\":\"414db2d4-18d0-415e-aac2-f255b586cfb5\"," + + " \"service-instance-name\":\"vFlowLogic-vflf_080117\"," + + " \"persona-model-id\":null," + + " \"persona-model-version\":null," + + " \"resource-version\":\"1502391806301\"," + + " \"orchestration-status\":\"Active\"," + + " \"model-invariant-id\":\"64dbe153-48c6-4d6f-95e7-12ff4cce9871\"," + + " \"model-version-id\":\"4e8b6372-dea3-4028-81d0-16eba59c94fb\"" + + " }," + + " {" + + " \"service-instance-id\":\"769be44e-981a-4da8-af3b-ca5fa76b7fb1\"," + + " \"service-instance-name\":\"vFlowLogic-vflp_080117\"," + + " \"persona-model-id\":null," + + " \"persona-model-version\":null," + + " \"resource-version\":\"1501712783617\"," + + " \"orchestration-status\":\"Active\"," + + " \"model-invariant-id\":\"14a99b56-dfb6-4300-97e1-ef10198ec936\"," + + " \"model-version-id\":\"9c6eee3b-8bd6-4a01-8afc-39441b63ecc9\"" + + " }" + + " ]" + + " }," + + " \"is-permitted\":false" + + " }," + + " {" + + " \"service-type\":\"TYLER SILVIA\"," + + " \"resource-version\":\"1501700976809\"," + + " \"service-instances\":{" + + " \"service-instance\":[" + + " {" + + " \"service-instance-id\": \""+this.serviceInstanceId+"\"," + + " \"service-instance-name\": \""+this.serviceInstanceName+"\"," + + " \"model-invariant-id\": \""+this.modelInfo.modelInvariantId+"\"," + + " \"model-version-id\": \""+this.modelInfo.modelVersionId+"\"," + + " \"resource-version\": \"1500789244674\"," + + " \"orchestration-status\": \""+this.orchStatus+"\"" + + " }" + + " ]" + + " }," + + " \"is-permitted\":false" + + " }" + + " ]" + + " }" + + "}"; + } + +} + diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetSubDetailsWithoutInstancesGet.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetSubDetailsWithoutInstancesGet.java new file mode 100644 index 000000000..f6ce3e86d --- /dev/null +++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetSubDetailsWithoutInstancesGet.java @@ -0,0 +1,153 @@ +package org.onap.simulator.presetGenerator.presets.aai; + +import com.google.common.collect.ImmutableMap; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import org.onap.simulator.presetGenerator.presets.BasePresets.BaseAAIPreset; +import org.springframework.http.HttpMethod; + +public class PresetAAIGetSubDetailsWithoutInstancesGet extends BaseAAIPreset { + private String subscriberId; + private String subscriberName = "Emanuel"; + + + public PresetAAIGetSubDetailsWithoutInstancesGet(String subscriberId) { + this.subscriberId = subscriberId == null ? "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb" : subscriberId; + } + + public PresetAAIGetSubDetailsWithoutInstancesGet(String subscriberId, boolean isSubscriberUspVoice) { + this(subscriberId); + if (isSubscriberUspVoice) { + this.subscriberName = "SILVIA ROBBINS"; + } + } + + @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(); + } + + public String getSubscriberId() { + return subscriberId; + } + + @Override + public Object getResponseBody() { + return "{" + + " \"global-customer-id\":\"" + subscriberId + "\"," + + " \"subscriber-name\":\" " + subscriberName + "\"," + + " \"subscriber-type\":\"INFRA\"," + + " \"resource-version\":\"1494255056308\"," + + " \"service-subscriptions\":{" + + " \"service-subscription\":[" + + " {" + + " \"service-type\":\"vFlowLogic\"," + + " \"resource-version\":\"1501700976809\"," + + " \"is-permitted\":false" + + " }," + + " {" + + " \"service-type\":\"TYLER SILVIA\"," + + " \"resource-version\":\"1501700976809\"," + + " \"is-permitted\":true" + + " }," + + " {" + + " \"service-type\":\"Emanuel\"," + + " \"resource-version\":\"1505402148533\"," + + " \"is-permitted\":false" + + " }," + + " {" + + " \"service-type\":\"vBNG\"," + + " \"resource-version\":\"1498068165053\"," + + " \"is-permitted\":false" + + " }," + + " {" + + " \"service-type\":\"vVoiceMail\"," + + " \"resource-version\":\"1494254889686\"," + + " \"is-permitted\":false" + + " }," + + " {" + + " \"service-type\":\"Kennedy\"," + + " \"resource-version\":\"1509369877126\"," + + " \"is-permitted\":true" + + " }," + + " {" + + " \"service-type\":\"vSEGW\"," + + " \"resource-version\":\"1494254851983\"," + + " \"is-permitted\":false" + + " }," + + " {" + + " \"service-type\":\"vVM\"," + + " \"resource-version\":\"1494255049530\"," + + " \"is-permitted\":false" + + " }," + + " {" + + " \"service-type\":\"vOTA\"," + + " \"resource-version\":\"1501692006937\"," + + " \"is-permitted\":false" + + " }," + + " {" + + " \"service-type\":\"vMME\"," + + " \"resource-version\":\"1497729820723\"," + + " \"is-permitted\":false" + + " }," + + " {" + + " \"service-type\":\"vMNS\"," + + " \"resource-version\":\"1509391084129\"," + + " \"is-permitted\":false" + + " }," + + " {" + + " \"service-type\":\"vEsmeralda\"," + + " \"resource-version\":\"1501532104695\"," + + " \"is-permitted\":false" + + " }," + + " {" + + " \"service-type\":\"VPMS\"," + + " \"resource-version\":\"1509738154248\"," + + " \"is-permitted\":false" + + " }," + + " {" + + " \"service-type\":\"vWINIFRED\"," + + " \"resource-version\":\"1498752217386\"," + + " \"is-permitted\":false" + + " }," + + " {" + + " \"service-type\":\"SSD\"," + + " \"resource-version\":\"1494254866295\"," + + " \"is-permitted\":false" + + " }," + + " {" + + " \"service-type\":\"vMOG\"," + + " \"resource-version\":\"1500675745252\"," + + " \"is-permitted\":false" + + " }," + + " {" + + " \"service-type\":\"FIRSTNET\"," + + " \"resource-version\":\"1509387060781\"," + + " \"is-permitted\":false" + + " }," + + " {" + + " \"service-type\":\"ACTIVE_CHARGE\"," + + " \"resource-version\":\"1494255101364\"," + + " \"is-permitted\":false" + + " }," + + " {" + + " \"service-type\":\"vHSS\"," + + " \"resource-version\":\"1494254877333\"," + + " \"is-permitted\":false" + + " }" + + " ]" + + " }" + + "}"; + } +} diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetSubDetailsWithoutInstancesGetSpecificService.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetSubDetailsWithoutInstancesGetSpecificService.java new file mode 100644 index 000000000..62a587001 --- /dev/null +++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetSubDetailsWithoutInstancesGetSpecificService.java @@ -0,0 +1,67 @@ +package org.onap.simulator.presetGenerator.presets.aai; + +import com.google.common.collect.ImmutableMap; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import org.onap.simulator.presetGenerator.presets.BasePresets.BaseAAIPreset; +import org.springframework.http.HttpMethod; + +public class PresetAAIGetSubDetailsWithoutInstancesGetSpecificService extends BaseAAIPreset { + private String subscriberId; + private String subscriberName = "Emanuel"; + + public PresetAAIGetSubDetailsWithoutInstancesGetSpecificService(String subscriberId) { + this.subscriberId = subscriberId == null ? "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb" : subscriberId; + } + + public PresetAAIGetSubDetailsWithoutInstancesGetSpecificService(String subscriberId, String subscriberName) { + this(subscriberId); + this.subscriberName = subscriberName; + } + + @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(); + } + + public String getSubscriberId() { + return subscriberId; + } + + @Override + public Object getResponseBody() { + return "{" + + " \"global-customer-id\":\""+this.subscriberId+"\"," + + " \"subscriber-name\":\""+this.subscriberName+"\"," + + " \"subscriber-type\":\"INFRA\"," + + " \"resource-version\":\"1494255056308\"," + + " \"service-subscriptions\":{" + + " \"service-subscription\":[" + + " {" + + " \"service-type\":\"vFlowLogic\"," + + " \"resource-version\":\"1501700976809\"," + + " \"is-permitted\":false" + + " }," + + " {" + + " \"service-type\":\"TYLER SILVIA\"," + + " \"resource-version\":\"1501700976809\"," + + " \"is-permitted\":false" + + " }" + + " ]" + + " }" + + "}"; + } + +} + diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetSubscribersGet.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetSubscribersGet.java index b21e9de27..0517fd788 100644 --- a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetSubscribersGet.java +++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetSubscribersGet.java @@ -3,14 +3,13 @@ package org.onap.simulator.presetGenerator.presets.aai; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; import com.google.common.collect.ImmutableMap; -import org.onap.simulator.presetGenerator.presets.BasePresets.BaseAAIPreset; -import org.onap.simulator.presetGenerator.presets.model.Subscriber; -import org.springframework.http.HttpMethod; - import java.io.IOException; import java.util.Collections; import java.util.List; import java.util.Map; +import org.onap.simulator.presetGenerator.presets.BasePresets.BaseAAIPreset; +import org.onap.simulator.presetGenerator.presets.model.Subscriber; +import org.springframework.http.HttpMethod; public class PresetAAIGetSubscribersGet extends BaseAAIPreset { @@ -29,26 +28,26 @@ public class PresetAAIGetSubscribersGet extends BaseAAIPreset { String subscribersString = "" + "[ " + " { " + - " \"global-customer-id\":\"MSO_1610_ST\", " + - " \"subscriber-name\":\"MSO_1610_ST\", " + + " \"global-customer-id\":\"CAR_2020_ER\", " + + " \"subscriber-name\":\"CAR_2020_ER\", " + " \"subscriber-type\":\"INFRA\", " + " \"resource-version\":\"1494001902987\" " + " }, " + " { " + " \"global-customer-id\":\"21014aa2-526b-11e6-beb8-9e71128cae77\", " + - " \"subscriber-name\":\"PACKET CORE\", " + + " \"subscriber-name\":\"JULIO ERICKSON\", " + " \"subscriber-type\":\"INFRA\", " + " \"resource-version\":\"1494001776295\" " + " }, " + " { " + " \"global-customer-id\":\"DHV1707-TestSubscriber-2\", " + - " \"subscriber-name\":\"ICORE CORE\", " + + " \"subscriber-name\":\"DALE BRIDGES\", " + " \"subscriber-type\":\"INFRA\", " + " \"resource-version\":\"1498751754450\" " + " }, " + " { " + " \"global-customer-id\":\"DHV1707-TestSubscriber-1\", " + - " \"subscriber-name\":\"PACKET1 CORE\", " + + " \"subscriber-name\":\"LLOYD BRIDGES\", " + " \"subscriber-type\":\"INFRA\", " + " \"resource-version\":\"1498595633607\" " + " }, " + @@ -65,59 +64,90 @@ public class PresetAAIGetSubscribersGet extends BaseAAIPreset { " \"resource-version\":\"1494001970225\" " + " }, " + " { " + - " \"global-customer-id\":\"DHV1802-TestSub-PWT-102\", " + - " \"subscriber-name\":\"DHV1802-TestSub-PWT-102\", " + + " \"global-customer-id\":\"ERICA5779-TestSub-PWT-102\", " + + " \"subscriber-name\":\"ERICA5779-TestSub-PWT-102\", " + " \"subscriber-type\":\"INFRA\", " + " \"resource-version\":\"1508852495058\" " + " }, " + " { " + - " \"global-customer-id\":\"DHV1802-TestSub-PWT-101\", " + - " \"subscriber-name\":\"DHV1802-TestSub-PWT-101\", " + + " \"global-customer-id\":\"ERICA5779-TestSub-PWT-101\", " + + " \"subscriber-name\":\"ERICA5779-TestSub-PWT-101\", " + " \"subscriber-type\":\"INFRA\", " + " \"resource-version\":\"1508179953733\" " + " }, " + " { " + " \"global-customer-id\":\"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\", " + - " \"subscriber-name\":\"Mobility\", " + + " \"subscriber-name\":\"Emanuel\", " + " \"subscriber-type\":\"INFRA\", " + " \"resource-version\":\"1494001894192\" " + " }, " + " { " + - " \"global-customer-id\":\"DHV1802-Subscriber-4\", " + - " \"subscriber-name\":\"DHV1802-Subscriber-5\", " + + " \"global-customer-id\":\"ERICA5779-Subscriber-4\", " + + " \"subscriber-name\":\"ERICA5779-Subscriber-5\", " + " \"subscriber-type\":\"INFRA\", " + " \"resource-version\":\"1509134064531\" " + " }, " + " { " + - " \"global-customer-id\":\"DHV1802-TestSub-PWT-103\", " + - " \"subscriber-name\":\"DHV1802-TestSub-PWT-103\", " + + " \"global-customer-id\":\"ERICA5779-TestSub-PWT-103\", " + + " \"subscriber-name\":\"ERICA5779-TestSub-PWT-103\", " + " \"subscriber-type\":\"INFRA\", " + " \"resource-version\":\"1509045503736\" " + " }, " + " { " + - " \"global-customer-id\":\"DHV1802-Subscriber-2\", " + - " \"subscriber-name\":\"DHV1802-Subscriber-2\", " + + " \"global-customer-id\":\"ERICA5779-Subscriber-2\", " + + " \"subscriber-name\":\"ERICA5779-Subscriber-2\", " + " \"subscriber-type\":\"INFRA\", " + " \"resource-version\":\"1509122065439\" " + " }, " + " { " + " \"global-customer-id\":\"e433710f-9217-458d-a79d-1c7aff376d89\", " + - " \"subscriber-name\":\"USP VOICE\", " + + " \"subscriber-name\":\"SILVIA ROBBINS\", " + " \"subscriber-type\":\"INFRA\", " + " \"resource-version\":\"1494001938080\" " + " }, " + " { " + - " \"global-customer-id\":\"DHV1802-Subscriber-3\", " + - " \"subscriber-name\":\"DHV1802-Subscriber-3\", " + + " \"global-customer-id\":\"ERICA5779-Subscriber-3\", " + + " \"subscriber-name\":\"ERICA5779-Subscriber-3\", " + " \"subscriber-type\":\"INFRA\", " + " \"resource-version\":\"1509122759407\" " + " }, " + " { " + " \"global-customer-id\":\"31739f3e-526b-11e6-beb8-9e71128cae77\", " + - " \"subscriber-name\":\"FIREWALL/MISC\", " + + " \"subscriber-name\":\"CRAIG/ROBERTS\", " + " \"subscriber-type\":\"INFRA\", " + " \"resource-version\":\"1494001772223\" " + - " } " + + " }, " + + " { " + + " \"global-customer-id\":\"global-customer-id\", " + + " \"subscriber-name\":\"global-customer-id\", " + + " \"subscriber-type\":\"INFRA\", " + + " \"resource-version\":\"1494001772226\", " + + " \"relationship-list\":{ " + + " \"relationship\":[ " + + " { " + + " \"related-to\":\"vpn-binding\", " + + " \"relationship-label\":\"org.onap.relationships.inventory.Uses\", " + + " \"related-link\":\"/aai/v14/network/vpn-bindings/vpn-binding/3e7834fb-a8e0-4243-a837-5352ccab4602\", " + + " \"relationship-data\":[ " + + " { " + + " \"relationship-key\":\"vpn-binding.vpn-id\", " + + " \"relationship-value\":\"3e7834fb-a8e0-4243-a837-5352ccab4602\" " + + " } " + + " ], " + + " \"related-to-property\":[ " + + " { " + + " \"property-key\":\"vpn-binding.vpn-name\", " + + " \"property-value\":\"LPPVPN\" " + + " }, " + + " { " + + " \"property-key\":\"vpn-binding.vpn-type\", " + + " \"property-value\":\"CUSTOMER\" " + + " } " + + " ] " + + " } " + + " ] " + + " } " + + " }" + " ] "; try { this.subscriberList = objectMapper.readValue(subscribersString, typeRef); diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetTenants.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetTenants.java index ed370cf15..638cc3911 100644 --- a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetTenants.java +++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetTenants.java @@ -1,11 +1,28 @@ package org.onap.simulator.presetGenerator.presets.aai; +import static vid.automation.test.utils.ReadFile.loadResourceAsString; + import org.onap.simulator.presetGenerator.presets.BasePresets.BaseAAIPreset; import org.springframework.http.HttpMethod; -import static vid.automation.test.utils.ReadFile.loadResourceAsString; - public class PresetAAIGetTenants extends BaseAAIPreset { + private final String subscriberId; + private final String serviceType; + private String responseBody; + + public PresetAAIGetTenants(String subscriberId, String serviceType, String responseBodyResource) { + this.subscriberId = subscriberId; + this.serviceType = serviceType; + this.responseBody = loadResourceAsString(responseBodyResource); + } + + public PresetAAIGetTenants() { + this( + "e433710f-9217-458d-a79d-1c7aff376d89", + "TYLER SILVIA", + "presets_templates/PresetAAIGetTenants.json" + ); + } @Override public Object getResponseBody() { @@ -19,9 +36,8 @@ public class PresetAAIGetTenants extends BaseAAIPreset { @Override public String getReqPath() { - return getRootPath() + "/business/customers/customer/e433710f-9217-458d-a79d-1c7aff376d89/service-subscriptions/service-subscription/VIRTUAL USP"; + return getRootPath() + "/business/customers/customer/" + this.subscriberId + "/service-subscriptions/service-subscription/" + this.serviceType; } - private String responseBody = loadResourceAsString("presets_templates/PresetAAIGetTenants.json"); } diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetVfModulesByVnf.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetVfModulesByVnf.java new file mode 100644 index 000000000..798a02642 --- /dev/null +++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetVfModulesByVnf.java @@ -0,0 +1,83 @@ +package org.onap.simulator.presetGenerator.presets.aai; + +import org.onap.simulator.presetGenerator.presets.BasePresets.BaseAAIPreset; +import org.springframework.http.HttpMethod; + +public class PresetAAIGetVfModulesByVnf extends BaseAAIPreset { + private final String vnfInstanceId; + + public PresetAAIGetVfModulesByVnf(String vnfInstanceId) { + this.vnfInstanceId = vnfInstanceId; + } + + @Override + public HttpMethod getReqMethod() { + return HttpMethod.GET; + } + + @Override + public String getReqPath() { + return getRootPath() + "/network/generic-vnfs/generic-vnf/" + this.vnfInstanceId + "/vf-modules"; + } + + @Override + public Object getResponseBody() { + return "" + + "{" + + " \"vf-module\": [{" + + " \"vf-module-id\": \"2c1ca484-cbc2-408b-ab86-25a2c15ce280\"," + + " \"vf-module-name\": \"ss820f_0918_db\"," + + " \"orchestration-status\": \"deleted\"," + + " \"is-base-vf-module\": false," + + " \"in-maint\": true," + + " \"automated-assignment\": false," + + " \"resource-version\": \"1537396469591\"," + + " \"model-invariant-id\": \"09edc9ef-85d0-4b26-80de-1f569d49e750\"," + + " \"model-version-id\": \"522159d5-d6e0-4c2a-aa44-5a542a12a830\"," + + " \"model-customization-id\": \"55b1be94-671a-403e-a26c-667e9c47d091\"," + + " \"module-index\": 0," + + " \"relationship-list\": {" + + " \"relationship\": [{" + + " \"related-to\": \"vnfc\"," + + " \"relationship-label\": \"org.onap.relationships.inventory.Uses\"," + + " \"related-link\": \"/aai/v13/network/vnfcs/vnfc/ss820f_0918_refvnf_vnfinstancem002mmb001\"," + + " \"relationship-data\": [{" + + " \"relationship-key\": \"vnfc.vnfc-name\"," + + " \"relationship-value\": \"ss820f_0918_refvnf_vnfinstancem002mmb001\"" + + " }" + + " ]" + + " }" + + " ]" + + " }" + + " }, {" + + " \"vf-module-id\": \"3ef042c4-259f-45e0-9aba-0989bd8d1cc5\"," + + " \"vf-module-name\": \"ss820f_0918_base\"," + + " \"heat-stack-id\": \"\"," + + " \"orchestration-status\": \"Assigned\"," + + " \"is-base-vf-module\": true," + + " \"automated-assignment\": false," + + " \"resource-version\": \"1537310272044\"," + + " \"model-invariant-id\": \"1e463c9c-404d-4056-ba56-28fd102608de\"," + + " \"model-version-id\": \"dc229cd8-c132-4455-8517-5c1787c18b14\"," + + " \"model-customization-id\": \"8ad8670b-0541-4499-8101-275bbd0e8b6a\"," + + " \"module-index\": 0," + + " \"relationship-list\": {" + + " \"relationship\": [{" + + " \"related-to\": \"vnfc\"," + + " \"relationship-label\": \"org.onap.relationships.inventory.Uses\"," + + " \"related-link\": \"/aai/v13/network/vnfcs/vnfc/ss820f_0918_refvnf_vnfinstancem001mmb001\"," + + " \"relationship-data\": [{" + + " \"relationship-key\": \"vnfc.vnfc-name\"," + + " \"relationship-value\": \"ss820f_0918_refvnf_vnfinstancem001mmb001\"" + + " }" + + " ]" + + " }" + + " ]" + + " }" + + " }" + + " ]" + + "}"; + } + + +} diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIModelsByInvariantIdGet.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIModelsByInvariantIdGet.java new file mode 100644 index 000000000..429d17647 --- /dev/null +++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIModelsByInvariantIdGet.java @@ -0,0 +1,394 @@ +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.List; +import java.util.Map; + +import static java.util.stream.Collectors.joining; + +public class PresetAAIModelsByInvariantIdGet extends BaseAAIPreset { + private final ImmutableList<String> modelInvariantIds; + + public PresetAAIModelsByInvariantIdGet(ImmutableList<String> modelInvariantIds) { + this.modelInvariantIds = modelInvariantIds; + } + + @Override + public HttpMethod getReqMethod() { + return HttpMethod.GET; + } + + @Override + public String getReqPath() { + return getRootPath() + "/service-design-and-creation/models"; + } + + @Override + public Map<String, List> getQueryParams() { + return ImmutableMap.<String, List>builder() + .put("depth", ImmutableList.of("2")) + .put("model-invariant-id", modelInvariantIds) + .build(); + } + + @Override + public Object getResponseBody() { + // based on aai_get_model_by_2_invariant_ids.json + // should be refined to match input + return "" + + "{" + + " \"model\": [" + + modelInvariantIds.stream().map(modelInvariantId -> + " {" + + " \"model-invariant-id\": \""+modelInvariantId+"\"," + + " \"model-type\": \"resource\"," + + " \"resource-version\": \"1507472057666\"," + + " \"model-vers\": {" + + " \"model-ver\": [" + + " {" + + " \"model-version-id\": \"7a6ee536-f052-46fa-aa7e-2fca9d674c44\"," + + " \"model-name\": \"vf_vEPDG\"," + + " \"model-version\": \"2.0\"," + + " \"model-description\": \"vEPDG\"," + + " \"distribution-status\": \"DISTRIBUTION_COMPLETE_ERROR\"," + + " \"resource-version\": \"1507649620979\"," + + " \"model-elements\": {" + + " \"model-element\": [" + + " {" + + " \"model-element-uuid\": \"ccbc6dc9-58ad-4082-a81f-630114d99a70\"," + + " \"new-data-del-flag\": \"T\"," + + " \"cardinality\": \"unbounded\"," + + " \"resource-version\": \"1507649620982\"," + + " \"relationship-list\": {" + + " \"relationship\": [" + + " {" + + " \"related-to\": \"model-ver\"," + + " \"related-link\": \"/aai/v11/service-design-and-creation/models/model/acc6edd8-a8d4-4b93-afaa-0994068be14c/model-vers/model-ver/93a6166f-b3d5-4f06-b4ba-aed48d009ad9\"," + + " \"relationship-data\": [" + + " {" + + " \"relationship-key\": \"model.model-invariant-id\"," + + " \"relationship-value\": \"acc6edd8-a8d4-4b93-afaa-0994068be14c\"" + + " }," + + " {" + + " \"relationship-key\": \"model-ver.model-version-id\"," + + " \"relationship-value\": \"93a6166f-b3d5-4f06-b4ba-aed48d009ad9\"" + + " }" + + " ]," + + " \"related-to-property\": [" + + " {" + + " \"property-key\": \"model-ver.model-name\"," + + " \"property-value\": \"generic-vnf\"" + + " }" + + " ]" + + " }" + + " ]" + + " }" + + " }" + + " ]" + + " }," + + " \"relationship-list\": {" + + " \"relationship\": [" + + " {" + + " \"related-to\": \"model-element\"," + + " \"related-link\": \"/aai/v11/service-design-and-creation/models/model/d661b5fd-e0be-457e-a5ca-e345621af761/model-vers/model-ver/6019af4d-1902-47b1-a7ee-4609c198bf37/model-elements/model-element/8cf71918-6cce-4e01-8049-3f980f8f2b00/model-elements/model-element/4703eeb3-7200-4546-aff2-6e942ac0c0e1\"," + + " \"relationship-data\": [" + + " {" + + " \"relationship-key\": \"model.model-invariant-id\"," + + " \"relationship-value\": \"d661b5fd-e0be-457e-a5ca-e345621af761\"" + + " }," + + " {" + + " \"relationship-key\": \"model-ver.model-version-id\"," + + " \"relationship-value\": \"6019af4d-1902-47b1-a7ee-4609c198bf37\"" + + " }," + + " {" + + " \"relationship-key\": \"model-element.model-element-uuid\"," + + " \"relationship-value\": \"8cf71918-6cce-4e01-8049-3f980f8f2b00\"" + + " }," + + " {" + + " \"relationship-key\": \"model-element.model-element-uuid\"," + + " \"relationship-value\": \"4703eeb3-7200-4546-aff2-6e942ac0c0e1\"" + + " }" + + " ]" + + " }" + + " ]" + + " }" + + " }," + + " {" + + " \"model-version-id\": \"eb5f56bf-5855-4e61-bd00-3e19a953bf02\"," + + " \"model-name\": \"vf_vEPDG\"," + + " \"model-version\": \"1.0\"," + + " \"model-description\": \"vEPDG\"," + + " \"resource-version\": \"1507472057702\"," + + " \"model-elements\": {" + + " \"model-element\": [" + + " {" + + " \"model-element-uuid\": \"18881687-8dab-4ec8-ab65-ebf8f95a6599\"," + + " \"new-data-del-flag\": \"T\"," + + " \"cardinality\": \"unbounded\"," + + " \"resource-version\": \"1507472057707\"," + + " \"relationship-list\": {" + + " \"relationship\": [" + + " {" + + " \"related-to\": \"model-ver\"," + + " \"related-link\": \"/aai/v11/service-design-and-creation/models/model/acc6edd8-a8d4-4b93-afaa-0994068be14c/model-vers/model-ver/93a6166f-b3d5-4f06-b4ba-aed48d009ad9\"," + + " \"relationship-data\": [" + + " {" + + " \"relationship-key\": \"model.model-invariant-id\"," + + " \"relationship-value\": \"acc6edd8-a8d4-4b93-afaa-0994068be14c\"" + + " }," + + " {" + + " \"relationship-key\": \"model-ver.model-version-id\"," + + " \"relationship-value\": \"93a6166f-b3d5-4f06-b4ba-aed48d009ad9\"" + + " }" + + " ]," + + " \"related-to-property\": [" + + " {" + + " \"property-key\": \"model-ver.model-name\"," + + " \"property-value\": \"generic-vnf\"" + + " }" + + " ]" + + " }" + + " ]" + + " }" + + " }" + + " ]" + + " }," + + " \"relationship-list\": {" + + " \"relationship\": [" + + " {" + + " \"related-to\": \"model-element\"," + + " \"related-link\": \"/aai/v11/service-design-and-creation/models/model/d661b5fd-e0be-457e-a5ca-e345621af761/model-vers/model-ver/de6f879b-37a9-44a5-97ed-cd52cc14bc47/model-elements/model-element/7a074be4-fcf1-46a5-88ee-41a7c7a6faab/model-elements/model-element/72f0adb5-5294-46f7-8085-a8aee9cb5f49\"," + + " \"relationship-data\": [" + + " {" + + " \"relationship-key\": \"model.model-invariant-id\"," + + " \"relationship-value\": \"d661b5fd-e0be-457e-a5ca-e345621af761\"" + + " }," + + " {" + + " \"relationship-key\": \"model-ver.model-version-id\"," + + " \"relationship-value\": \"de6f879b-37a9-44a5-97ed-cd52cc14bc47\"" + + " }," + + " {" + + " \"relationship-key\": \"model-element.model-element-uuid\"," + + " \"relationship-value\": \"7a074be4-fcf1-46a5-88ee-41a7c7a6faab\"" + + " }," + + " {" + + " \"relationship-key\": \"model-element.model-element-uuid\"," + + " \"relationship-value\": \"72f0adb5-5294-46f7-8085-a8aee9cb5f49\"" + + " }" + + " ]" + + " }" + + " ]" + + " }" + + " }," + + " {" + + " \"model-version-id\": \"b7f2e8fb-ac71-4ea0-a801-06ef1479ea84\"," + + " \"model-name\": \"vf_vEPDG\"," + + " \"model-version\": \"4.0\"," + + " \"model-description\": \"vEPDG_Up\"," + + " \"resource-version\": \"1508954433176\"," + + " \"model-elements\": {" + + " \"model-element\": [" + + " {" + + " \"model-element-uuid\": \"4ed7025a-d37b-444f-8008-5c7c41d76d47\"," + + " \"new-data-del-flag\": \"T\"," + + " \"cardinality\": \"unbounded\"," + + " \"resource-version\": \"1508954433179\"," + + " \"relationship-list\": {" + + " \"relationship\": [" + + " {" + + " \"related-to\": \"model-ver\"," + + " \"related-link\": \"/aai/v11/service-design-and-creation/models/model/acc6edd8-a8d4-4b93-afaa-0994068be14c/model-vers/model-ver/93a6166f-b3d5-4f06-b4ba-aed48d009ad9\"," + + " \"relationship-data\": [" + + " {" + + " \"relationship-key\": \"model.model-invariant-id\"," + + " \"relationship-value\": \"acc6edd8-a8d4-4b93-afaa-0994068be14c\"" + + " }," + + " {" + + " \"relationship-key\": \"model-ver.model-version-id\"," + + " \"relationship-value\": \"93a6166f-b3d5-4f06-b4ba-aed48d009ad9\"" + + " }" + + " ]," + + " \"related-to-property\": [" + + " {" + + " \"property-key\": \"model-ver.model-name\"," + + " \"property-value\": \"generic-vnf\"" + + " }" + + " ]" + + " }" + + " ]" + + " }" + + " }" + + " ]" + + " }," + + " \"relationship-list\": {" + + " \"relationship\": [" + + " {" + + " \"related-to\": \"model-element\"," + + " \"related-link\": \"/aai/v11/service-design-and-creation/models/model/d661b5fd-e0be-457e-a5ca-e345621af761/model-vers/model-ver/0e3f3390-48dd-4640-aed7-0eb873d40a97/model-elements/model-element/106d11a5-2b8c-4586-a56d-ee387e822757/model-elements/model-element/3d7e724a-6f05-4111-8b22-78d024c53081\"," + + " \"relationship-data\": [" + + " {" + + " \"relationship-key\": \"model.model-invariant-id\"," + + " \"relationship-value\": \"d661b5fd-e0be-457e-a5ca-e345621af761\"" + + " }," + + " {" + + " \"relationship-key\": \"model-ver.model-version-id\"," + + " \"relationship-value\": \"0e3f3390-48dd-4640-aed7-0eb873d40a97\"" + + " }," + + " {" + + " \"relationship-key\": \"model-element.model-element-uuid\"," + + " \"relationship-value\": \"106d11a5-2b8c-4586-a56d-ee387e822757\"" + + " }," + + " {" + + " \"relationship-key\": \"model-element.model-element-uuid\"," + + " \"relationship-value\": \"3d7e724a-6f05-4111-8b22-78d024c53081\"" + + " }" + + " ]" + + " }" + + " ]" + + " }" + + " }," + + " {" + + " \"model-version-id\": \"4117a0b6-e234-467d-b5b9-fe2f68c8b0fc\"," + + " \"model-name\": \"Grouping Service for Test\"," + + " \"model-version\": \"1.0\"," + + " \"model-description\": \"vEPDG_Up\"," + + " \"resource-version\": \"1508954433176\"," + + " \"model-elements\": {" + + " \"model-element\": [" + + " {" + + " \"model-element-uuid\": \"4ed7025a-d37b-444f-8008-5c7c41d76d47\"," + + " \"new-data-del-flag\": \"T\"," + + " \"cardinality\": \"unbounded\"," + + " \"resource-version\": \"1508954433179\"," + + " \"relationship-list\": {" + + " \"relationship\": [" + + " {" + + " \"related-to\": \"model-ver\"," + + " \"related-link\": \"/aai/v11/service-design-and-creation/models/model/acc6edd8-a8d4-4b93-afaa-0994068be14c/model-vers/model-ver/93a6166f-b3d5-4f06-b4ba-aed48d009ad9\"," + + " \"relationship-data\": [" + + " {" + + " \"relationship-key\": \"model.model-invariant-id\"," + + " \"relationship-value\": \"acc6edd8-a8d4-4b93-afaa-0994068be14c\"" + + " }," + + " {" + + " \"relationship-key\": \"model-ver.model-version-id\"," + + " \"relationship-value\": \"93a6166f-b3d5-4f06-b4ba-aed48d009ad9\"" + + " }" + + " ]," + + " \"related-to-property\": [" + + " {" + + " \"property-key\": \"model-ver.model-name\"," + + " \"property-value\": \"generic-vnf\"" + + " }" + + " ]" + + " }" + + " ]" + + " }" + + " }" + + " ]" + + " }," + + " \"relationship-list\": {" + + " \"relationship\": [" + + " {" + + " \"related-to\": \"model-element\"," + + " \"related-link\": \"/aai/v11/service-design-and-creation/models/model/d661b5fd-e0be-457e-a5ca-e345621af761/model-vers/model-ver/0e3f3390-48dd-4640-aed7-0eb873d40a97/model-elements/model-element/106d11a5-2b8c-4586-a56d-ee387e822757/model-elements/model-element/3d7e724a-6f05-4111-8b22-78d024c53081\"," + + " \"relationship-data\": [" + + " {" + + " \"relationship-key\": \"model.model-invariant-id\"," + + " \"relationship-value\": \"d661b5fd-e0be-457e-a5ca-e345621af761\"" + + " }," + + " {" + + " \"relationship-key\": \"model-ver.model-version-id\"," + + " \"relationship-value\": \"0e3f3390-48dd-4640-aed7-0eb873d40a97\"" + + " }," + + " {" + + " \"relationship-key\": \"model-element.model-element-uuid\"," + + " \"relationship-value\": \"106d11a5-2b8c-4586-a56d-ee387e822757\"" + + " }," + + " {" + + " \"relationship-key\": \"model-element.model-element-uuid\"," + + " \"relationship-value\": \"3d7e724a-6f05-4111-8b22-78d024c53081\"" + + " }" + + " ]" + + " }" + + " ]" + + " }" + + " }," + + " {" + + " \"model-version-id\": \"6e59c5de-f052-46fa-aa7e-2fca9d674c44\"," + + " \"model-name\": \"vf_vEPDG\"," + + " \"model-version\": \"5.0\"," + + " \"model-description\": \"vEPDG_Up\"," + + " \"resource-version\": \"1509570916147\"," + + " \"model-elements\": {" + + " \"model-element\": [" + + " {" + + " \"model-element-uuid\": \"49899999-076d-456b-915c-078d1b2a05b3\"," + + " \"new-data-del-flag\": \"T\"," + + " \"cardinality\": \"unbounded\"," + + " \"resource-version\": \"1509570916150\"," + + " \"relationship-list\": {" + + " \"relationship\": [" + + " {" + + " \"related-to\": \"model-ver\"," + + " \"related-link\": \"/aai/v11/service-design-and-creation/models/model/acc6edd8-a8d4-4b93-afaa-0994068be14c/model-vers/model-ver/93a6166f-b3d5-4f06-b4ba-aed48d009ad9\"," + + " \"relationship-data\": [" + + " {" + + " \"relationship-key\": \"model.model-invariant-id\"," + + " \"relationship-value\": \"acc6edd8-a8d4-4b93-afaa-0994068be14c\"" + + " }," + + " {" + + " \"relationship-key\": \"model-ver.model-version-id\"," + + " \"relationship-value\": \"93a6166f-b3d5-4f06-b4ba-aed48d009ad9\"" + + " }" + + " ]," + + " \"related-to-property\": [" + + " {" + + " \"property-key\": \"model-ver.model-name\"," + + " \"property-value\": \"generic-vnf\"" + + " }" + + " ]" + + " }" + + " ]" + + " }" + + " }" + + " ]" + + " }," + + " \"relationship-list\": {" + + " \"relationship\": [" + + " {" + + " \"related-to\": \"model-element\"," + + " \"related-link\": \"/aai/v11/service-design-and-creation/models/model/d661b5fd-e0be-457e-a5ca-e345621af761/model-vers/model-ver/03655348-0148-4482-b0b7-a5de71ab6264/model-elements/model-element/e97f008f-fc19-4b6e-8842-e54ec6eafb6e/model-elements/model-element/cfc574f2-6869-41d3-bfae-42b54b711568\"," + + " \"relationship-data\": [" + + " {" + + " \"relationship-key\": \"model.model-invariant-id\"," + + " \"relationship-value\": \"d661b5fd-e0be-457e-a5ca-e345621af761\"" + + " }," + + " {" + + " \"relationship-key\": \"model-ver.model-version-id\"," + + " \"relationship-value\": \"03655348-0148-4482-b0b7-a5de71ab6264\"" + + " }," + + " {" + + " \"relationship-key\": \"model-element.model-element-uuid\"," + + " \"relationship-value\": \"e97f008f-fc19-4b6e-8842-e54ec6eafb6e\"" + + " }," + + " {" + + " \"relationship-key\": \"model-element.model-element-uuid\"," + + " \"relationship-value\": \"cfc574f2-6869-41d3-bfae-42b54b711568\"" + + " }" + + " ]" + + " }" + + " ]" + + " }" + + " }" + + " ]" + + " }" + + " }").collect(joining(", ")) + + " ]" + + " }"; + } +} diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIPostNamedQueryForViewEdit.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIPostNamedQueryForViewEdit.java index e098a576d..0d143b50c 100644 --- a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIPostNamedQueryForViewEdit.java +++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIPostNamedQueryForViewEdit.java @@ -6,15 +6,20 @@ import org.springframework.http.HttpMethod; public class PresetAAIPostNamedQueryForViewEdit extends BaseAAIPreset { private final String serviceInstanceId; - private final boolean hasConfigurationInstance; + private final boolean hasProxyConfigurationInstance; + private final boolean hasFabricConfigurationInstance; + private String serviceInstanceName; + public static final String DEFAULT_SERVICE_INSTANCE_NAME = "test_sssdad"; - public PresetAAIPostNamedQueryForViewEdit(String serviceInstanceId) { - this(serviceInstanceId, true); + public PresetAAIPostNamedQueryForViewEdit(String serviceInstanceId, boolean hasProxyConfigurationInstance, boolean hasFabricConfigurationInstance) { + this(serviceInstanceId, DEFAULT_SERVICE_INSTANCE_NAME, hasProxyConfigurationInstance, hasFabricConfigurationInstance); } - public PresetAAIPostNamedQueryForViewEdit(String serviceInstanceId, boolean hasConfigurationInstance) { + public PresetAAIPostNamedQueryForViewEdit(String serviceInstanceId, String serviceInstanceName, boolean hasProxyConfigurationInstance, boolean hasFabricConfigurationInstance) { this.serviceInstanceId = serviceInstanceId; - this.hasConfigurationInstance = hasConfigurationInstance; + this.serviceInstanceName = serviceInstanceName; + this.hasProxyConfigurationInstance = hasProxyConfigurationInstance; + this.hasFabricConfigurationInstance = hasFabricConfigurationInstance; } // inspired by @@ -44,7 +49,7 @@ public class PresetAAIPostNamedQueryForViewEdit extends BaseAAIPreset { " \"service-instance-id\": \"" + serviceInstanceId + "\"" + " }," + " \"service-subscription\": {" + - " \"service-type\": \"VIRTUAL USP\"" + + " \"service-type\": \"TYLER SILVIA\"" + " }" + " }" + " ]" + @@ -65,10 +70,10 @@ public class PresetAAIPostNamedQueryForViewEdit extends BaseAAIPreset { " \"model-name\": \"0eOHz2Yh8WJcBYzKy079\"," + " \"service-instance\": {" + " \"service-instance-id\": \"" + serviceInstanceId + "\"," + - " \"service-instance-name\": \"test_sssdad\"" + + " \"service-instance-name\": \"" + serviceInstanceName + "\"" + " }," + " \"extra-properties\": {}"; - if(hasConfigurationInstance) { + if(hasProxyConfigurationInstance) { response += "," + " \"inventory-response-items\": {" + " \"inventory-response-item\": [{" + @@ -92,6 +97,29 @@ public class PresetAAIPostNamedQueryForViewEdit extends BaseAAIPreset { " ]" + " }"; } + else if(hasFabricConfigurationInstance) { + response += "," + + " \"inventory-response-items\": {" + + " \"inventory-response-item\": [{" + + " \"model-name\": \"Fabric-Configuration-Instance\"," + + " \"configuration\": {" + + " \"configuration-id\": \"1234-fabric-config-LB1113\"," + + " \"configuration-name\": \"dummy_instance\"," + + " \"configuration-type\": \"fabric-configuration-type-1234\"," + + " \"configuration-sub-type\": \"fabric-configuration-sub-type-1234\"," + + " \"model-invariant-id\": \"model-invariant-id-1234\"," + + " \"model-version-id\": \"model-version-id-1234\"," + + " \"orchestration-status\": \"Assigned\"," + + " \"operational-status\": \"\"," + + " \"configuration-selflink\": \"\"," + + " \"model-customization-id\": \"model-customization-id-1234\"," + + " \"resource-version\": \"1504038855716\"" + + " }," + + " \"extra-properties\": {}" + + " }" + + " ]" + + " }"; + } response += " }" + " ]" + "}"; diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAISearchNodeQueryEmptyResult.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAISearchNodeQueryEmptyResult.java deleted file mode 100644 index f5ab2d1f7..000000000 --- a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAISearchNodeQueryEmptyResult.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.onap.simulator.presetGenerator.presets.aai; - -public class PresetAAISearchNodeQueryEmptyResult extends PresetAAIBaseSearchNodeQuery { - - @Override - public Object getResponseBody() { - return "{}"; - } - - @Override - public int getResponseCode() { - return 200; - } -} diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAISearchNodeQueryNonEmptyResult.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAISearchNodeQueryNonEmptyResult.java new file mode 100644 index 000000000..29e7d5092 --- /dev/null +++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAISearchNodeQueryNonEmptyResult.java @@ -0,0 +1,46 @@ +package org.onap.simulator.presetGenerator.presets.aai; + +import com.google.common.collect.ImmutableMap; + +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public class PresetAAISearchNodeQueryNonEmptyResult extends PresetAAIBaseSearchNodeQuery { + + private final String type; + private final String name; + + public PresetAAISearchNodeQueryNonEmptyResult(String type, String name) { + this.type = type; + this.name = name; + } + + @Override + public Object getResponseBody() { + return "{ \"something\": [] }"; + } + + @Override + public int getResponseCode() { + return 200; + } + + @Override + public String getReqPath() { + return getRootPath() + "/nodes/" + searchPath(); + } + + @Override + public Map<String, List> getQueryParams() { + return ImmutableMap.of(searchKey(), Collections.singletonList(name)); + } + + private String searchPath() { + return type + "s"; + } + + private String searchKey() { + return type + "-name"; + } +} diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIServiceDesignAndCreationPut.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIServiceDesignAndCreationPut.java index 6a97e1159..180685282 100644 --- a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIServiceDesignAndCreationPut.java +++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIServiceDesignAndCreationPut.java @@ -4,40 +4,34 @@ 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 vid.automation.test.infra.ModelInfo; +import vid.automation.test.test.BrowseASDCTest; import java.util.Collections; import java.util.List; import java.util.Map; import java.util.stream.Collectors; +import static vid.automation.test.infra.ModelInfo.ModelInfoWithMultipleVersions.modelInfoWithMultipleVersions; + public class PresetAAIServiceDesignAndCreationPut extends BaseAAIPreset { public PresetAAIServiceDesignAndCreationPut(boolean emptyList) { - serviceModelIdentifiers = ImmutableList.of(); + modelInfos = ImmutableList.of(); this.emptyList = emptyList; } - public PresetAAIServiceDesignAndCreationPut(String modelVersionId, String modelInvariantId) { - serviceModelIdentifiers = ImmutableList.of(new ServiceModelIdentifiers(modelVersionId, modelInvariantId)); - } - public PresetAAIServiceDesignAndCreationPut(List<ServiceModelIdentifiers> serviceModelIdentifiers) { - this.serviceModelIdentifiers = serviceModelIdentifiers; - } + private List<ModelInfo> modelInfos; + boolean emptyList; - public static class ServiceModelIdentifiers { - public final String modelVersionId; - public final String modelInvariantId; - public ServiceModelIdentifiers(String modelVersionId, String modelInvariantId) { - this.modelVersionId = modelVersionId; - this.modelInvariantId = modelInvariantId; - } + //Constructor that use the super set of model infos as response + //all test should be migrated to use this constructor + public PresetAAIServiceDesignAndCreationPut() { + this.modelInfos = ModelInfo.superSetOfModelInfos; } - private List<ServiceModelIdentifiers> serviceModelIdentifiers; - boolean emptyList; - @Override public HttpMethod getReqMethod() { return HttpMethod.PUT; @@ -62,16 +56,16 @@ public class PresetAAIServiceDesignAndCreationPut extends BaseAAIPreset { private String presetModels() { return - serviceModelIdentifiers.stream().map(identifiers -> + modelInfos.stream().map(modelInfo -> " {" + " \"model\": {" + - " \"model-invariant-id\": \"" + identifiers.modelInvariantId + "\"," + + " \"model-invariant-id\": \"" + modelInfo.modelInvariantId + "\"," + " \"model-type\": \"resource\"," + " \"resource-version\": \"1500138206526\"," + " \"model-vers\": {" + " \"model-ver\": [" + " {" + - " \"model-version-id\": \"" + identifiers.modelVersionId + "\"," + + " \"model-version-id\": \"" + modelInfo.modelVersionId + "\"," + " \"model-name\": \"action-data\"," + " \"model-version\": \"1.0\"," + " \"model-description\": \"lustre settler sideways volcanic eight cellular\"," + @@ -112,6 +106,89 @@ public class PresetAAIServiceDesignAndCreationPut extends BaseAAIPreset { } + private String serviceWithMultipleVersions() { + return + " {" + + " \"model\": {" + + " \"model-invariant-id\": \"" + modelInfoWithMultipleVersions.modelInvariantId + "\"," + + " \"model-type\": \"resource\"," + + " \"resource-version\": \"1500138206526\"," + + " \"model-vers\": {" + + " \"model-ver\": [" + + " {" + + " \"model-version-id\": \"" + modelInfoWithMultipleVersions.modelVersionId1 + "\"," + + " \"model-name\": \""+modelInfoWithMultipleVersions.modelName+"\"," + + " \"model-version\": \"1.0\"," + + " \"model-description\": \"decontamination arm circus ammonia hump edge\"," + + " \"resource-version\": \"1500137463984\"" + + " }," + + " {" + + " \"model-version-id\": \"" + modelInfoWithMultipleVersions.modelVersionId3 + "\"," + + " \"model-name\": \""+modelInfoWithMultipleVersions.modelName+"\"," + + " \"model-version\": \"3.0\"," + + " \"model-description\": \"Non decontamination arm circus ammonia hump edge\"," + + " \"resource-version\": \"1500137463986\"" + + " }," + + " {" + + " \"model-version-id\": \"" + modelInfoWithMultipleVersions.modelVersionId2 + "\"," + + " \"model-name\": \""+modelInfoWithMultipleVersions.modelName+"\"," + + " \"model-version\": \"2.0\"," + + " \"model-description\": \"The oldest one\"," + + " \"resource-version\": \"1500137463980\"" + + " }" + + " ]" + + " }" + + " }" + + " }," ; + } + + public String modelsForBrowseSDCServiceModelListCheckAAIResponse() { + return " {\"model\": { " + + " \"model-invariant-id\": \"" + BrowseASDCTest.modelInvariantUUID1 + "\"," + + " \"model-type\": \"service\"," + + " \"resource-version\": \"1515103312329\"," + + " \"model-vers\": {\"model-ver\": [" + + " {" + + " \"model-version-id\": \"" + BrowseASDCTest.modelUuid + "\"," + + " \"model-name\": \"CheckAAIResponse_AAAvIRC_mm779p_Service\"," + + " \"model-version\": \"1.0\"," + + " \"distribution-status\": \"DISTRIBUTION_COMPLETE_OK\"," + + " \"model-description\": \"tbd\"," + + " \"resource-version\": \"1516206395612\"" + + " }" + + " ]}" + + " }}," + + " {\"model\": { " + + " \"model-invariant-id\": \"" + BrowseASDCTest.modelInvariantUUID2 + "\"," + + " \"model-type\": \"service\"," + + " \"resource-version\": \"1515103312329\"," + + " \"model-vers\": {\"model-ver\": [" + + " {" + + " \"model-version-id\": \"1dae721c-a1ef-435f-b811-760c23f467bf\"," + + " \"model-name\": \"CheckAAIResponse_BBBvIRC_mm779p_Service\"," + + " \"model-version\": \"3.0\"," + + " \"model-description\": \"tbd\"," + + " \"resource-version\": \"1516025197086\"" + + " }" + + " ]}" + + " }}," + + " {\"model\": { " + + " \"model-invariant-id\": \"" + BrowseASDCTest.modelInvariantUUID3 + "\"," + + " \"model-type\": \"service\"," + + " \"resource-version\": \"1515103312329\"," + + " \"model-vers\": {\"model-ver\": [" + + " {" + + " \"model-version-id\": \"29236d45-e790-4c17-a115-1533cc09b7b1\"," + + " \"model-name\": \"CheckAAIResponse_CCCvIRC_mm779p_Service\"," + + " \"model-version\": \"4.0\"," + + " \"distribution-status\": \"DISTRIBUTION_COMPLETE_ERROR\"," + + " \"model-description\": \"tbd\"," + + " \"resource-version\": \"1517319724440\"" + + " }" + + " ]}" + + " }},"; + } + @Override public Object getResponseBody() { if(emptyList) { @@ -119,6 +196,8 @@ public class PresetAAIServiceDesignAndCreationPut extends BaseAAIPreset { } return "{\"results\": [" + presetModels()+ + serviceWithMultipleVersions() + + modelsForBrowseSDCServiceModelListCheckAAIResponse() + " {" + " \"model\": {" + " \"model-invariant-id\": \"00beb8f9-6d39-452f-816d-c709b9cbb87d\"," + diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIStandardQueryGet.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIStandardQueryGet.java new file mode 100644 index 000000000..13ee91e2b --- /dev/null +++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIStandardQueryGet.java @@ -0,0 +1,239 @@ +package org.onap.simulator.presetGenerator.presets.aai; + +import static org.apache.commons.lang3.ObjectUtils.defaultIfNull; +import static org.apache.commons.text.StringEscapeUtils.escapeJson; + +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableMultimap; +import com.google.common.collect.Multimap; +import java.util.UUID; +import java.util.stream.Collectors; +import org.apache.commons.lang3.RandomStringUtils; +import org.apache.commons.text.StrSubstitutor; +import org.onap.simulator.presetGenerator.presets.BasePresets.BaseAAIPreset; +import org.springframework.http.HttpMethod; + +public class PresetAAIStandardQueryGet extends BaseAAIPreset { + private final String instanceId; + private final String instanceName; + private final String instanceType; + private final String instanceRole; + private final String additionalProperties; + private final String uri; + private final String typeInResponse; + private final Multimap<String, String> relationshipsUris; + + private PresetAAIStandardQueryGet(String typeInResponse, String instanceId, String instanceName, String instanceType, String instanceRole, String uri, Multimap<String, String> relationshipsUris, String additionalProperties) { + this.instanceId = defaultIfNull(instanceId, randomUUID()); + this.instanceName = defaultIfNull(instanceName, randomAlphanumeric()); + this.instanceType = defaultIfNull(instanceType, randomAlphanumeric()); + this.instanceRole = defaultIfNull(instanceRole, randomAlphanumeric()); + this.uri = uri; + this.typeInResponse = typeInResponse; + this.additionalProperties = additionalProperties; + this.relationshipsUris = relationshipsUris; + } + + private PresetAAIStandardQueryGet(String typeInResponse, String instanceId, String uri, Multimap<String, String> relationshipsUris, String additionalProperties) { + this(typeInResponse, instanceId, randomAlphanumeric(), randomAlphanumeric(), randomAlphanumeric(), uri, relationshipsUris, additionalProperties); + } + + public static PresetAAIStandardQueryGet ofServiceInstance(String instanceId, final String modelVersionId, final String modelInvariantId, String subscriberId, String serviceType, Multimap<String, String> relationshipsUris) { + return new PresetAAIStandardQueryGet( + "service-instance", instanceId, + new StrSubstitutor(ImmutableMap.of( + "global-customer-id", subscriberId, + "service-type", serviceType, + "service-instance-id", instanceId + )).replace("" + + "/business/customers/customer/${global-customer-id}" + + "/service-subscriptions/service-subscription/${service-type}" + + "/service-instances/service-instance/${service-instance-id}"), + relationshipsUris, "" + + "\"model-invariant-id\": \"" + modelInvariantId + "\", " + + "\"model-version-id\": \"" + modelVersionId + "\", " + + "\"resource-version\": \"GARBAGE DATA\", " + + "\"orchestration-status\": \"GARBAGE DATA\", " + ); + } + + public static PresetAAIStandardQueryGet ofInstanceGroup(String groupType, String groupRole, Multimap<String, String> relationshipsUris) { + final String instanceId = randomUUID(); + return new PresetAAIStandardQueryGet( + "instance-group", instanceId, randomAlphanumeric(), groupType, groupRole, + "/network/instance-groups/instance-group/" + instanceId, + relationshipsUris, "" + + " \"id\": \"" + instanceId + "\"," + + " \"model-invariant-id\": \"4bb2e27e-ddab-4790-9c6d-1f731bc14a45\"," + + " \"model-version-id\": \"daeb6568-cef8-417f-9075-ed259ce59f48\"," + + " \"description\": \"vTSBC Customer Landing Network Collection Desc\"," + + " \"resource-version\": \"1536169790853\"," + + " \"instance-group-function\": \"vTSBC Customer Landing Network Collection\"," + ); + } + + public static PresetAAIStandardQueryGet ofVnf(String instanceId, Multimap<String, String> relationshipsUris) { + return ofVnf(instanceId, "vnf-instance-model-version-id", "vnf-instance-model-customization-id", "", relationshipsUris); + } + + public static PresetAAIStandardQueryGet ofVnf(String instanceId, String modelVersionId,String modelCustomizationId, String additionalProperties, Multimap<String, String> relationshipsUris) { + return new PresetAAIStandardQueryGet( + "vnf", instanceId, + "/network/generic-vnfs/generic-vnf/" + instanceId, + relationshipsUris, additionalProperties + + "\"model-invariant-id\": \"vnf-instance-model-invariant-id\", " + + "\"model-customization-id\": \"" + modelCustomizationId + "\", "+ + "\"model-version-id\": \"" + modelVersionId + "\", " + ); + } + + public static PresetAAIStandardQueryGet ofRelatedVnf(String instanceId, String modelVersionId, String additionalProperties, Multimap<String, String> relationshipsUris) { + return new PresetAAIStandardQueryGet( + "vnf", instanceId, + "/network/generic-vnfs/generic-vnf/" + instanceId, + relationshipsUris, additionalProperties + + "\"model-invariant-id\": \"vnf-instance-model-invariant-id\", " + + "\"model-version-id\": \"" + modelVersionId + "\", " + ); + } + + private static String randomAlphanumeric() { + return RandomStringUtils.randomAlphanumeric(17); + } + + private static String randomUUID() { + return UUID.randomUUID().toString(); + } + + public static PresetAAIStandardQueryGet ofL3Network(String instanceType, String orchStatus, Multimap<String, String> relationshipsUris) { + return ofL3Network(randomUUID(), randomAlphanumeric(), instanceType, relationshipsUris, orchStatus, "prov", "network-instance-model-version-id", "network-instance-model-customization-id"); + } + + public static PresetAAIStandardQueryGet ofL3Network(String instanceType, String orchStatus, String provStatus, String modelVersionId, String modelCustomizationId,Multimap<String, String> relationshipsUris) { + return ofL3Network(randomUUID(), randomAlphanumeric(), instanceType, relationshipsUris, orchStatus, provStatus, modelVersionId, modelCustomizationId); + } + + public static PresetAAIStandardQueryGet ofL3Network(String instanceId, String instanceName, String instanceType, Multimap<String, String> relationshipsUris, String orchStatus) { + return ofL3Network(instanceId, instanceName, instanceType, relationshipsUris, orchStatus, "prov", "network-instance-model-version-id", "94fdd893-4a36-4d70-b16a-ec29c54c184f"); + } + + public static PresetAAIStandardQueryGet ofL3Network(String instanceId, String instanceName, String instanceType, Multimap<String, String> relationshipsUris, String orchStatus, String provStatus, String modelVersionId, String modelCustomizationId) { + return new PresetAAIStandardQueryGet( + "network", instanceId, instanceName, instanceType, randomAlphanumeric(), + "/network/l3-networks/l3-network/" + instanceId, + relationshipsUris, "" + + "\"orchestration-status\": \"" + orchStatus + "\"," + + "\"prov-status\": \"" + provStatus + "\"," + + "\"network-technology\": \"contrail\", " + + "\"neutron-network-id\": \"66ee6123-1c45-4e71-b6c0-a748ae0fee88\", " + + "\"is-bound-to-vpn\": true, " + + "\"is-external-network\": true, " + + "\"model-invariant-id\": \"network-instance-model-invariant-id\", " + + "\"model-customization-id\": \"" + modelCustomizationId + "\", " + + "\"model-version-id\": \"" + modelVersionId + "\", " + ); + } + + public static PresetAAIStandardQueryGet ofVolumeGroup(String instanceType, Multimap<String, String> relationshipsUris) { + final String instanceId = randomUUID(); + return new PresetAAIStandardQueryGet( + "volume-group", instanceId, randomAlphanumeric(), instanceType, randomAlphanumeric(), + "/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/olson5b/volume-groups/volume-group/" + instanceId, + relationshipsUris, "" + + " \"vnf-type\": \"vSON_test_ap7145/vSON_test_ap7145 0\"," + + " \"orchestration-status\": \"Active\"," + + " \"model-customization-id\": \"bc3bbdcc-42f3-4682-b151-99c308d15255\"," + + " \"vf-module-model-customization-id\": \"bc3bbdcc-42f3-4682-b151-99c308d15255\"," + + " \"resource-version\": \"1533679899735\"," + ); + } + + public static PresetAAIStandardQueryGet ofCollectionResource(String orchStatus, Multimap<String, String> relationshipsUris) { + final String instanceId = randomUUID(); + return new PresetAAIStandardQueryGet( + "collection", instanceId, randomAlphanumeric(), "L3-NETWORK", randomAlphanumeric(), + "/network/collections/collection/" + instanceId, + relationshipsUris, "" + + "\"orchestration-status\": \"" + orchStatus + "\", " + + "\"model-invariant-id\": \"081ceb56-eb71-4566-a72d-3e7cbee5cdf1\", " + + "\"model-version-id\": \"ce8c98bc-4691-44fb-8ff0-7a47487c11c4\", " + ); + } + + public static PresetAAIStandardQueryGet ofVlanTag(int vlanIdOuter) { + final String instanceId = randomUUID(); + return new PresetAAIStandardQueryGet( + "vlan-tag", instanceId, + "/this is an invented link/tag/vlan-tags/vlan-tag/" + instanceId, + ImmutableMultimap.of(), "" + + "\"vlan-interface\": \"US-10688-genvnf-vlan-interface1\", " + + "\"vlan-id-inner\": " + 123456789 + ", " + + "\"vlan-id-outer\": " + vlanIdOuter + ", " + + "\"resource-version\": \"1518934744675\", " + + "\"in-maint\": false, " + + "\"is-ip-unnumbered\": false, " + ); + } + + public String getInstanceId() { + return instanceId; + } + + public String getInstanceName() { + return instanceName; + } + + public String getInstanceType() { + return instanceType; + } + + public String getInstanceRole() { + return instanceRole; + } + + @Override + public Object getResponseBody() { + return "" + + "{ " + + " \"" + typeInResponse + "-id\": \"" + getInstanceId() + "\", " + + " \"" + typeInResponse + "-name\": \"" + escapeJson(getInstanceName()) + "\", " + + " \"" + typeInResponse + "-type\": \"" + escapeJson(getInstanceType()) + "\", " + + " \"" + typeInResponse + "-role\": \"" + escapeJson(getInstanceRole()) + "\", " + + additionalProperties + + " \"relationship-list\": { " + + " \"relationship\": [ " + + relationshipsUris.entries().stream().map( + entry -> buildRelationship(entry.getKey(), entry.getValue()) + ).collect(Collectors.joining(",")) + + " ] " + + " } " + + "} "; + } + + private String buildRelationship(String relatedTo, final String relatedLink) { + return "" + + "{ " + + " \"related-to\": \"" + relatedTo + "\", " + + " \"relationship-label\": \"org.onap.relationships.inventory.ComposedOf\", " + + " \"related-link\": \"" + relatedLink + "\", " + + " \"relationship-data\": [" + + " { " + + " \"relationship-key\": \"GARBAGE DATA\", " + + " \"relationship-value\": \"GARBAGE DATA\" " + + " } " + + " ] " + + "}"; + } + + @Override + public HttpMethod getReqMethod() { + return HttpMethod.GET; + } + + @Override + public String getReqPath() { + return getRootPath() + uri; + } + + +} |