Merge automation from ECOMP's repository
[vid.git] / vid-automation / src / main / java / org / onap / simulator / presetGenerator / presets / aai / PresetAAIGetInstanceGroupsByCloudRegionInvalidRequest.java
1 package org.onap.simulator.presetGenerator.presets.aai;
2
3 import com.google.common.collect.ImmutableList;
4 import com.google.common.collect.ImmutableMap;
5 import org.onap.simulator.presetGenerator.presets.BasePresets.BaseAAIPreset;
6 import org.springframework.http.HttpMethod;
7
8 import java.util.Collections;
9 import java.util.List;
10 import java.util.Map;
11
12 public class PresetAAIGetInstanceGroupsByCloudRegionInvalidRequest extends BaseAAIPreset {
13
14     private String cloudOwner;
15     private String cloudRegionId;
16     private String networkFunction;
17     private final String type = "L3-NETWORK";
18     private final String role = "SUB-INTERFACE";
19
20     public PresetAAIGetInstanceGroupsByCloudRegionInvalidRequest(String cloudOwner, String cloudRegionId, String networkFunction) {
21         this.cloudOwner = cloudOwner;
22         this.cloudRegionId = cloudRegionId;
23         this.networkFunction = networkFunction;
24     }
25
26     @Override
27     public HttpMethod getReqMethod() {
28         return HttpMethod.PUT;
29     }
30
31     @Override
32     public String getReqPath() {
33         return getRootPath() + "/query";
34     }
35
36     @Override
37     public Map<String, List> getQueryParams() {
38         return ImmutableMap.of(
39                 "format", Collections.singletonList("resource")
40         );
41     }
42
43     @Override
44     public Object getRequestBody() {
45         return ImmutableMap.of(
46                 "start", ImmutableList.of("cloud-infrastructure/cloud-regions/cloud-region/" + getCloudOwner() + "/" + getCloudRegionId()),
47                 "query", "query/instance-groups-byCloudRegion?type=" + type + "&role=" + role + "&function=" + getNetworkFunction()
48         );
49     }
50
51     public String getCloudOwner() {
52         return cloudOwner;
53     }
54
55     public String getCloudRegionId() {
56         return cloudRegionId;
57     }
58
59     public String getNetworkFunction() {
60         return networkFunction;
61     }
62
63     @Override
64     public Object getResponseBody() {
65         return "{" +
66                 "    \"results\": [" +
67                 "        {" +
68                 "            \"instance-group\": {" +
69                 "                \"instance-group-role\": \"JZmha7QSS4tJ\"," +
70                 "               \"some-filed\": \"some-data\"," + //extra field
71                 "                \"model-invariant-id\": \"model-id3\"," +
72                 "                \"model-version-id\": \"a0efd5fc-f7be-4502-936a-a6c6392b958f\"," +
73                 "                \"id\": \"AAI-12002-test3-vm230w\"," +
74                 "                \"description\": \"a9DEa0kpY\"," +
75                 "                \"instance-group-type\": \"type\"," +
76                 "                \"resource-version\": \"1520888659539\"," +
77                 "                \"instance-group-name\": \"wKmBXiO1xm8bK\"," +
78                 "                \"instance-group-function\": \"testfunction2\"," +
79                 "                \"relationship-list\": {" +
80                 "                    \"relationship\": [" +
81                 "                        {" +
82                 "                            \"related-to\": \"cloud-region\"," +
83                 "                            \"some-filed\": \"some-data\"," + //extra field
84                 "                            \"relationship-label\": \"org.onap.relationships.inventory.Uses\"," +
85                 "                            \"related-link\": \"/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/AAI-12002-vm230w/AAI-region-vm230w\"," +
86                 "                            \"relationship-data\": [" +
87                 "                                {" +
88                 "                                    \"relationship-key\": \"cloud-region.cloud-owner\"," +
89                 "                                    \"relationship-value\": \"AAI-12002-vm230w\"" +
90                 "                                }," +
91                 "                                {" +
92                 "                                    \"relationship-key\": \"cloud-region.cloud-region-id\"," +
93                 "                                    \"relationship-value\": \"AAI-region-vm230w\"" +
94                 "                                }" +
95                 "                            ]," +
96                 "                            \"related-to-property\": [" +
97                 "                                {" +
98                 "                                    \"property-key\": \"cloud-region.owner-defined-type\"" +
99                 "                                }" +
100                 "                            ]" +
101                 "                        }" +
102                 "                    ]" +
103                 "                }" +
104                 "            }" +
105                 "        }," +
106                 "        {" +
107                 "            \"instance-group\": {" +
108                 "                \"instance-group-role\": \"JZmha7QSS4tJ\"," +
109                 "                \"model-invariant-id\": \"model-id1\"," +
110                 "                \"model-version-id\": \"a0efd5fc-f7be-4502-936a-a6c6392b958f\"," +
111                 "                \"id\": \"AAI-12002-test1-vm230w\"," +
112                 "                \"description\": \"a9DEa0kpY\"," +
113                 "                \"instance-group-type\": \"type\"," +
114                 "                \"resource-version\": \"1520886467989\"," +
115                 "                \"instance-group-name\": \"wKmBXiO1xm8bK\"," +
116                 "                \"instance-group-function\": \"testfunction2\"," +
117                 "                \"relationship-list\": {" +
118                 "                    \"relationship\": [" +
119                 "                        {" +
120                 "                            \"related-to\": \"cloud-region\"," +
121                 "                            \"relationship-label\": \"org.onap.relationships.inventory.Uses\"," +
122                 "                            \"related-link\": \"/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/AAI-12002-vm230w/AAI-region-vm230w\"," +
123                 "                            \"relationship-data\": [" +
124                 "                                {" +
125                 "                                    \"relationship-key\": \"cloud-region.cloud-owner\"," +
126                 "                                    \"some-filed\": \"some-data\"," + //extra field
127                 "                                    \"relationship-value\": \"AAI-12002-vm230w\"" +
128                 "                                }," +
129                 "                                {" +
130                 "                                    \"relationship-key\": \"cloud-region.cloud-region-id\"," +
131                 "                                    \"relationship-value\": \"AAI-region-vm230w\"" +
132                 "                                }" +
133                 "                            ]," +
134                 "                            \"related-to-property\": [" +
135                 "                                {" +
136                 "                                    \"property-key\": \"cloud-region.owner-defined-type\"" +
137                 "                                }" +
138                 "                            ]" +
139                 "                        }" +
140                 "                    ]" +
141                 "                }" +
142                 "            }" +
143                 "        }," +
144                 "        {" +
145                 "            \"instance-group\": {" +
146                 "                \"instance-group-role\": \"JZmha7QSS4tJ\"," +
147                 "                \"model-invariant-id\": \"model-id2\"," +
148                 "                \"model-version-id\": \"version2\"," +
149                 "                \"id\": \"AAI-12002-test2-vm230w\"," +
150                 "                \"description\": \"a9DEa0kpY\"," +
151                 "                \"instance-group-type\": \"type\"," +
152                 "                \"resource-version\": \"1520888629970\"," +
153                 "                \"instance-group-name\": \"wKmBXiO1xm8bK\"," +
154                 "                \"instance-group-function\": \"testfunction2\"," +
155                 "                \"relationship-list\": {" +
156                 "                    \"relationship\": [" +
157                 "                        {" +
158                 "                            \"related-to\": \"cloud-region\"," +
159                 "                            \"relationship-label\": \"org.onap.relationships.inventory.Uses\"," +
160                 "                            \"related-link\": \"/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/AAI-12002-vm230w/AAI-region-vm230w\"," +
161                 "                            \"relationship-data\": [" +
162                 "                                {" +
163                 "                                    \"relationship-key\": \"cloud-region.cloud-owner\"," +
164                 "                                    \"relationship-value\": \"AAI-12002-vm230w\"" +
165                 "                                }," +
166                 "                                {" +
167                 "                                    \"relationship-key\": \"cloud-region.cloud-region-id\"," +
168                 "                                    \"relationship-value\": \"AAI-region-vm230w\"" +
169                 "                                }" +
170                 "                            ]," +
171                 "                            \"related-to-property\": [" +
172                 "                                {" +
173                 "                                    \"property-key\": \"cloud-region.owner-defined-type\"" +
174                 "                                }" +
175                 "                            ]" +
176                 "                        }" +
177                 "                    ]" +
178                 "                }" +
179                 "            }" +
180                 "        }" +
181                 "    ]" +
182                 "}";
183     }
184
185 }