aboutsummaryrefslogtreecommitdiffstats
path: root/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/AAIBaseGetL3NetworksByCloudRegionPreset.java
blob: e20c09ba1173a4f2fe6f9deae4038df8d9dac9d4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
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.*;

public class AAIBaseGetL3NetworksByCloudRegionPreset extends BaseAAIPreset {

    public static final String DEFAULT_TENANT_ID = "b530fc990b6d4334bd45518bebca6a51";
    public static final String DEFAULT_TENANT_NAME = "ecomp_ispt";
    public static final String DEFAULT_CLOUD_REGION_ID = PresetAAIGetCloudOwnersByCloudRegionId.AUK51A;
    private static final String DEFAULT_CLOUD_OWNER = PresetAAIGetCloudOwnersByCloudRegionId.ATT_NC;
    protected String tenantId;
    protected String tenantName;
    protected String cloudRegionId;
    protected String cloudOwner;
    protected String networkRole;

    public AAIBaseGetL3NetworksByCloudRegionPreset(String tenentId, String tenantName, String cloudRegionId, String cloudOwner, String networkRole) {
        this.tenantId = tenentId;
        this.tenantName = tenantName;
        this.cloudRegionId = cloudRegionId;
        this.cloudOwner = cloudOwner;
        this.networkRole = networkRole;
    }

    public AAIBaseGetL3NetworksByCloudRegionPreset() {
        this.tenantId = DEFAULT_TENANT_ID;
        this.tenantName = DEFAULT_TENANT_NAME;
        this.cloudRegionId = DEFAULT_CLOUD_REGION_ID;
        this.cloudOwner = DEFAULT_CLOUD_OWNER;
    }

    public String getTenantName() {
        return tenantName;
    }

    public String getTenantId() {
        return tenantId;
    }

    public String getCloudRegionId() {
        return cloudRegionId;
    }

    public String getCloudOwner() {
        return cloudOwner;
    }

    @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 ImmutableMap.of(
                "start", "/cloud-infrastructure/cloud-regions/cloud-region/" + cloudOwner + "/" + cloudRegionId,
                "query", "query/l3-networks-by-cloud-region?tenantId=" + tenantId + (networkRole == null ? "" : "&networkRole=" + networkRole)
        );
    }
}