cb80fd6ce69f4c6fee496e5eddc6f186d479d2a3
[vid.git] / vid-automation / src / main / java / org / onap / simulator / presetGenerator / presets / aai / PresetAAIGetModelsByProject.java
1 package org.onap.simulator.presetGenerator.presets.aai;
2
3 import com.google.common.collect.ImmutableMap;
4 import java.util.Collections;
5 import java.util.List;
6 import java.util.Map;
7 import java.util.UUID;
8 import org.onap.simulator.presetGenerator.presets.BasePresets.BaseAAIPreset;
9 import org.springframework.http.HttpMethod;
10
11 public class PresetAAIGetModelsByProject extends BaseAAIPreset {
12     private String projectName;
13     private String serviceInstanceId;
14
15     public PresetAAIGetModelsByProject(String projectName) {
16         this.projectName = projectName;
17         ImmutableMap servicesPerProject = ImmutableMap.of ("x1","7e4f8130-5dee-47c4-8770-1abc5f5ded83",
18                 "yyy1","13695dfb-db99-4c2f-905e-fe7bf2fc7b9f");
19         this.serviceInstanceId = (servicesPerProject.containsKey(projectName)) ? servicesPerProject.get(projectName).toString(): UUID.randomUUID().toString();
20     }
21
22     @Override
23     public HttpMethod getReqMethod() {
24         return HttpMethod.GET;
25     }
26
27     @Override
28     public String getReqPath() {
29         return getRootPath() + "/business/projects";
30     }
31
32     @Override
33     public Map<String, List> getQueryParams() {
34         return ImmutableMap.of(
35                 "project-name", Collections.singletonList(projectName)
36         );
37     }
38
39     @Override
40     public Object getResponseBody() {
41         return "{" +
42                 "  \"project\": [" +
43                 "    {" +
44                 "      \"project-name\": \"" + projectName + "\"," +
45                 "      \"resource-version\": \"1527026201826\"," +
46                 "      \"relationship-list\": {" +
47                 "        \"relationship\": [" +
48                 "          {" +
49                 "            \"related-to\": \"service-instance\"," +
50                 "            \"relationship-label\": \"org.onap.relationships.inventory.Uses\"," +
51                 "            \"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\"," +
52                 "            \"relationship-data\": [" +
53                 "              {" +
54                 "                \"relationship-key\": \"customer.global-customer-id\"," +
55                 "                \"relationship-value\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\"" +
56                 "              }," +
57                 "              {" +
58                 "                \"relationship-key\": \"service-subscription.service-type\"," +
59                 "                \"relationship-value\": \"Emanuel\"" +
60                 "              }," +
61                 "              {" +
62                 "                \"relationship-key\": \"service-instance.service-instance-id\"," +
63                 "                \"relationship-value\": \"3f826016-3ac9-4928-9561-beee75fd91d5\"" +
64                 "              }" +
65                 "            ]," +
66                 "            \"related-to-property\": [" +
67                 "              {" +
68                 "                \"property-key\": \"service-instance.service-instance-name\"," +
69                 "                \"property-value\": \"Lital_SRIOV2_001\"" +
70                 "              }" +
71                 "            ]" +
72                 "          }," +
73                 "          {" +
74                 "            \"related-to\": \"service-instance\"," +
75                 "            \"relationship-label\": \"org.onap.relationships.inventory.Uses\"," +
76                 "            \"related-link\": \"/aai/v12/business/customers/customer/DHV1707-TestSubscriber-2/service-subscriptions/service-subscription/HNGATEWAY/service-instances/service-instance/45713f81-04b8-4fd0-b824-64536d493984\"," +
77                 "            \"relationship-data\": [" +
78                 "              {" +
79                 "                \"relationship-key\": \"customer.global-customer-id\"," +
80                 "                \"relationship-value\": \"DHV1707-TestSubscriber-2\"" +
81                 "              }," +
82                 "              {" +
83                 "                \"relationship-key\": \"service-subscription.service-type\"," +
84                 "                \"relationship-value\": \"HNGATEWAY\"" +
85                 "              }," +
86                 "              {" +
87                 "                \"relationship-key\": \"service-instance.service-instance-id\"," +
88                 "                \"relationship-value\": \"45713f81-04b8-4fd0-b824-64536d493984\"" +
89                 "              }" +
90                 "            ]," +
91                 "            \"related-to-property\": [" +
92                 "              {" +
93                 "                \"property-key\": \"service-instance.service-instance-name\"," +
94                 "                \"property-value\": \"kkkk\"" +
95                 "              }" +
96                 "            ]" +
97                 "          }," +
98                 "          {" +
99                 "            \"related-to\": \"service-instance\"," +
100                 "            \"relationship-label\": \"org.onap.relationships.inventory.BelongsTo\"," +
101                 "            \"related-link\": \"/aai/v12/business/customers/customer/a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb/service-subscriptions/service-subscription/vMOG/service-instances/service-instance/" + serviceInstanceId + "\"," +
102                 "            \"relationship-data\": [" +
103                 "              {" +
104                 "                \"relationship-key\": \"customer.global-customer-id\"," +
105                 "                \"relationship-value\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\"" +
106                 "              }," +
107                 "              {" +
108                 "                \"relationship-key\": \"service-subscription.service-type\"," +
109                 "                \"relationship-value\": \"vMOG\"" +
110                 "              }," +
111                 "              {" +
112                 "                \"relationship-key\": \"service-instance.service-instance-id\"," +
113                 "                \"relationship-value\": \"" + serviceInstanceId + "\"" +
114                 "              }" +
115                 "            ]," +
116                 "            \"related-to-property\": [" +
117                 "              {" +
118                 "                \"property-key\": \"service-instance.service-instance-name\"," +
119                 "                \"property-value\": \"FIRSTNET_DEMO\"" +
120                 "              }" +
121                 "            ]" +
122                 "          }," +
123                 "          {" +
124                 "            \"related-to\": \"service-instance\"," +
125                 "            \"relationship-label\": \"org.onap.relationships.inventory.Uses\"," +
126                 "            \"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\"," +
127                 "            \"relationship-data\": [" +
128                 "              {" +
129                 "                \"relationship-key\": \"customer.global-customer-id\"," +
130                 "                \"relationship-value\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\"" +
131                 "              }," +
132                 "              {" +
133                 "                \"relationship-key\": \"service-subscription.service-type\"," +
134                 "                \"relationship-value\": \"Emanuel\"" +
135                 "              }," +
136                 "              {" +
137                 "                \"relationship-key\": \"service-instance.service-instance-id\"," +
138                 "                \"relationship-value\": \"ff2d9326-1ef5-4760-aba0-0eaf372ae675\"" +
139                 "              }" +
140                 "            ]," +
141                 "            \"related-to-property\": [" +
142                 "              {" +
143                 "                \"property-key\": \"service-instance.service-instance-name\"," +
144                 "                \"property-value\": \"VNF_INSTANCE_DEMO_THREE\"" +
145                 "              }" +
146                 "            ]" +
147                 "          }" +
148                 "        ]" +
149                 "      }" +
150                 "    }" +
151                 "  ]" +
152                 "}";
153     }
154
155
156 }