Merge automation from ECOMP's repository
[vid.git] / vid-automation / src / main / java / org / onap / simulator / presetGenerator / presets / mso / PresetMSOCreateVfModuleALaCarteCypress.java
1 package org.onap.simulator.presetGenerator.presets.mso;
2
3 import com.google.common.collect.ImmutableMap;
4 import java.util.Map;
5
6 public class PresetMSOCreateVfModuleALaCarteCypress extends PresetMSOBaseCreateInstancePost {
7     private String serviceInstanceId;
8     private String vnfInstanceId;
9     protected final Map<Keys, String> names;
10
11     public enum Keys {
12         modelVersionId, modelName, modelVersion, modelCustomizationId, modelCustomizationName, instanceName, modelInvariantId
13     }
14
15     public static final Map<Keys, String> module0Names = ImmutableMap.<Keys, String>builder()
16             .put(Keys.instanceName, "mimazepubi")
17             .put(Keys.modelInvariantId, "b34833bb-6aa9-4ad6-a831-70b06367a091")
18             .put(Keys.modelVersionId, "f8360508-3f17-4414-a2ed-6bc71161e8db")
19             .put(Keys.modelName, "2017488PASQUALEVpe..PASQUALE_base_vPE_BV..module-0")
20             .put(Keys.modelVersion, "5")
21             .put(Keys.modelCustomizationId, "a55961b2-2065-4ab0-a5b7-2fcee1c227e3")
22             .put(Keys.modelCustomizationName, "2017488PASQUALEVpe..PASQUALE_base_vPE_BV..module-0")
23             .build();
24
25     public static final Map<Keys, String> module2Names = ImmutableMap.<Keys, String>builder()
26             .put(Keys.instanceName, "bnmgtrx")
27             .put(Keys.modelInvariantId, "eff8cc59-53a1-4101-aed7-8cf24ecf8339")
28             .put(Keys.modelVersionId, "0a0dd9d4-31d3-4c3a-ae89-a02f383e6a9a")
29             .put(Keys.modelName, "2017488PASQUALEVpe..PASQUALE_vPFE_BV..module-2")
30             .put(Keys.modelVersion, "6")
31             .put(Keys.modelCustomizationId, "3cd946bb-50e0-40d8-96d3-c9023520b557")
32             .put(Keys.modelCustomizationName, "2017488PASQUALEVpe..PASQUALE_vPFE_BV..module-2")
33             .build();
34
35     public PresetMSOCreateVfModuleALaCarteCypress(String overrideRequestId, String serviceInstanceId, String vnfInstanceId, Map<Keys, String> names, String testApi, boolean withTestApi) {
36         super(overrideRequestId);
37         this.vnfInstanceId = vnfInstanceId;
38         this.serviceInstanceId = serviceInstanceId;
39         this.names = names;
40         this.msoTestApi = testApi;
41         this.withTestApi = withTestApi;
42     }
43
44     @Override
45     public boolean isStrictMatch() {
46         return true;
47     }
48
49     @Override
50     public String getReqPath() {
51         return getRootPath() + "/serviceInstantiation/v./serviceInstances/" + serviceInstanceId + "/vnfs/" + vnfInstanceId + "/vfModules";
52     }
53
54     @Override
55     public Object getRequestBody() {
56         return "" +
57                 "{" +
58                 "  \"requestDetails\":{" +
59                 "    \"modelInfo\":{" +
60                 "      \"modelType\":\"vfModule\"," +
61                 "      \"modelInvariantId\":\"" + names.get(Keys.modelInvariantId) + "\"," +
62                 "      \"modelVersionId\":\"" + names.get(Keys.modelVersionId) + "\"," +
63                 "      \"modelName\":\"" + names.get(Keys.modelName) + "\"," +
64                 "      \"modelVersion\":\"" + names.get(Keys.modelVersion) + "\"," +
65                 "      \"modelCustomizationId\":\"" + names.get(Keys.modelCustomizationId) + "\"," +
66                 "      \"modelCustomizationName\":\"" + names.get(Keys.modelCustomizationName) + "\"" +
67                 "    }," +
68                 "    \"cloudConfiguration\":{" +
69                 "      \"lcpCloudRegionId\":\"hvf6\"," +
70                       addCloudOwnerIfNeeded() +
71                 "      \"tenantId\":\"624eb554b0d147c19ff8885341760481\"" +
72
73                 "    }," +
74                 "    \"requestInfo\":{" +
75                 "      \"instanceName\":\"" + names.get(Keys.instanceName) + "\"," +
76                 "      \"source\":\"VID\"," +
77                 "      \"suppressRollback\":true," +
78                 "      \"requestorId\":\"us16807000\"" +
79                 "    }," +
80                 "    \"relatedInstanceList\":[{" +
81                 "        \"relatedInstance\":{" +
82                 "          \"instanceId\":\"" + serviceInstanceId + "\"," +
83                 "          \"modelInfo\":{" +
84                 "            \"modelType\":\"service\"," +
85                 "            \"modelName\":\"action-data\"," +
86                 "            \"modelInvariantId\":\"e49fbd11-e60c-4a8e-b4bf-30fbe8f4fcc0\"," +
87                 "            \"modelVersion\":\"1.0\"," +
88                 "            \"modelVersionId\":\"2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd\"" +
89                 "          }" +
90                 "        }" +
91                 "      }, {" +
92                 "        \"relatedInstance\":{" +
93                 "          \"instanceId\":\"" + vnfInstanceId + "\"," +
94                 "          \"modelInfo\":{" +
95                 "            \"modelType\":\"vnf\"," +
96                 "            \"modelName\":\"2017-488_PASQUALE-vPE\"," +
97                 "            \"modelInvariantId\":\"72e465fe-71b1-4e7b-b5ed-9496118ff7a8\"," +
98                 "            \"modelVersion\":\"5.0\"," +
99                 "            \"modelVersionId\":\"69e09f68-8b63-4cc9-b9ff-860960b5db09\"," +
100                 "            \"modelCustomizationId\":\"1da7b585-5e61-4993-b95e-8e6606c81e45\"," +
101                 "            \"modelCustomizationName\":\"2017-488_PASQUALE-vPE 0\"" +
102                 "          }" +
103                 "        }" +
104                 "      }" +
105                 "    ]," +
106                 "    \"requestParameters\":{" +
107                         addTestApi()+
108                 "      \"userParams\":[" +
109                 "      ]," +
110                 "      \"usePreload\":false" +
111                 "    }" +
112                 "  }" +
113                 "}";
114     }
115 }