1 package org.onap.simulator.presetGenerator.presets.aai;
3 import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic;
4 import static org.apache.commons.lang3.RandomStringUtils.randomNumeric;
6 import com.google.common.collect.ImmutableMap;
7 import java.util.Collections;
10 import java.util.UUID;
11 import org.onap.simulator.presetGenerator.presets.BasePresets.BaseAAIPreset;
12 import org.springframework.http.HttpMethod;
14 public class PresetAAIGetCloudOwnersByCloudRegionId extends BaseAAIPreset {
15 public static final String SOME_LEGACY_REGION = "some legacy region";
16 public static final String JUST_ANOTHER_REGION = "just another region";
17 public static final String MY_REGION = "my region";
18 public static final String LCP_REGION_TEXT = "lcpRegionText";
19 public static final String ATT_AIC = "irma-aic";
20 public static final String MDT_1 = "mdt1";
21 public static final String ATT_NC = "att-nc";
22 public static final String hvf3 = "hvf3";
23 public static final String olson3 = "olson3";
24 public static final String olson5B = "olson5b";
25 public static final String ATT_SABABA = "att-sababa";
26 public static final String AAIAIC_25 = "JANET25";
27 public static final String ONE = "One";
28 public static final String hvf6 = "hvf6";
29 private final String cloudRegionId;
30 private final String cloudOwner;
32 //Since there is a cache of cloudRegionToCloudOwner, we can't have 2 preset of same cloud region that return different cloud owner.
33 //So all the preset instance must be declared here, for conflicts prevention.
34 public static final PresetAAIGetCloudOwnersByCloudRegionId PRESET_SOME_LEGACY_REGION_TO_ATT_AIC =
35 new PresetAAIGetCloudOwnersByCloudRegionId(SOME_LEGACY_REGION, ATT_AIC);
37 public static final PresetAAIGetCloudOwnersByCloudRegionId PRESET_JUST_ANOTHER_REGION_TO_ATT_AIC =
38 new PresetAAIGetCloudOwnersByCloudRegionId(JUST_ANOTHER_REGION, ATT_AIC);
40 public static final PresetAAIGetCloudOwnersByCloudRegionId PRESET_MDT1_TO_ATT_NC =
41 new PresetAAIGetCloudOwnersByCloudRegionId(MDT_1, ATT_NC);
43 public static final PresetAAIGetCloudOwnersByCloudRegionId PRESET_RDM3_TO_ATT_NC =
44 new PresetAAIGetCloudOwnersByCloudRegionId(olson3, ATT_NC);
46 public static final PresetAAIGetCloudOwnersByCloudRegionId PRESET_MTN3_TO_ATT_SABABA =
47 new PresetAAIGetCloudOwnersByCloudRegionId(hvf3, ATT_SABABA);
49 public static final PresetAAIGetCloudOwnersByCloudRegionId PRESET_AAIAIC25_TO_ATT_AIC =
50 new PresetAAIGetCloudOwnersByCloudRegionId(AAIAIC_25, ATT_AIC);
52 public static final PresetAAIGetCloudOwnersByCloudRegionId PRESET_ONE_TO_ATT_AIC =
53 new PresetAAIGetCloudOwnersByCloudRegionId(ONE, ATT_AIC);
55 public static final PresetAAIGetCloudOwnersByCloudRegionId PRESET_MTN6_TO_ATT_AIC =
56 new PresetAAIGetCloudOwnersByCloudRegionId(hvf6, ATT_AIC);
58 public static final PresetAAIGetCloudOwnersByCloudRegionId PRESET_MY_REGION_TO_ATT_AIC =
59 new PresetAAIGetCloudOwnersByCloudRegionId(MY_REGION, ATT_AIC);
61 public static final PresetAAIGetCloudOwnersByCloudRegionId PRESET_LCP_REGION_TEXT_TO_ATT_AIC =
62 new PresetAAIGetCloudOwnersByCloudRegionId(LCP_REGION_TEXT, ATT_AIC);
64 private PresetAAIGetCloudOwnersByCloudRegionId(String cloudRegionId, String cloudOwnerResult) {
65 this.cloudRegionId = cloudRegionId;
66 this.cloudOwner = cloudOwnerResult;
70 public Object getResponseBody() {
73 " \"cloud-region\": [{" +
74 " \"cloud-owner\": \"" + cloudOwner + "\"," +
75 " \"cloud-region-id\": \"" + cloudRegionId + "\"," +
76 " \"cloud-region-version\": \"2.5\"," +
77 " \"identity-url\": \"http://" + randomAlphabetic(5) + ":5000/v2.0\"," +
78 " \"complex-name\": \"" + cloudRegionId + "\"," +
79 " \"resource-version\": \"" + randomNumeric(5) + "\"," +
80 " \"relationship-list\": {" +
81 " \"relationship\": [{" +
82 " \"related-to\": \"pserver\"," +
83 " \"relationship-label\": \"org.onap.relationships.inventory.LocatedIn\"," +
84 " \"related-link\": \"/aai/v12/cloud-infrastructure/pservers/pserver/" + randomAlphabetic(5) + "\"," +
85 " \"relationship-data\": [{" +
86 " \"relationship-key\": \"pserver.hostname\"," +
87 " \"relationship-value\": \"" + randomAlphabetic(5) + "\"" +
90 " \"related-to-property\": [{" +
91 " \"property-key\": \"pserver.pserver-name2\"" +
95 " \"related-to\": \"l3-network\"," +
96 " \"relationship-label\": \"org.onap.relationships.inventory.Uses\"," +
97 " \"related-link\": \"/aai/v12/network/l3-networks/l3-network/" + UUID.randomUUID() + "\"," +
98 " \"relationship-data\": [{" +
99 " \"relationship-key\": \"l3-network.network-id\"," +
100 " \"relationship-value\": \"" + UUID.randomUUID() + "\"" +
103 " \"related-to-property\": [{" +
104 " \"property-key\": \"l3-network.network-name\"," +
105 " \"property-value\": \"" + randomAlphabetic(5) + "\"" +
117 public HttpMethod getReqMethod() {
118 return HttpMethod.GET;
122 public String getReqPath() {
123 return getRootPath() + "/cloud-infrastructure/cloud-regions";
127 public Map<String, List> getQueryParams() {
128 return ImmutableMap.of("cloud-region-id", Collections.singletonList(cloudRegionId));