764237e18a393c878664a31d006913d334e9855d
[vid.git] / vid-automation / src / main / java / org / onap / simulator / presetGenerator / presets / mso / PresetMSOCreateVfModuleWithVolumeGroupALaCarteCypress.java
1 package org.onap.simulator.presetGenerator.presets.mso;
2
3 public class PresetMSOCreateVfModuleWithVolumeGroupALaCarteCypress extends PresetMSOBaseCreateInstancePost {
4     private final String serviceInstanceId;
5     private final String vnfInstanceId;
6     private final String volumeGroupInstanceId;
7     private final boolean isVolumeGroupPreset;
8     private PresetMSOCreateVfModuleWithVolumeGroupALaCarteCypress(Boolean isVolumeGroupPreset, String requestId, String serviceInstanceId, String vnfInstanceId, String volumeGroupInstanceId, String testApi, boolean withTestApi) {
9         super(requestId, isVolumeGroupPreset ? volumeGroupInstanceId : DEFAULT_INSTANCE_ID, testApi, withTestApi);
10         this.serviceInstanceId = serviceInstanceId;
11         this.vnfInstanceId = vnfInstanceId;
12         this.isVolumeGroupPreset = isVolumeGroupPreset;
13         this.volumeGroupInstanceId = volumeGroupInstanceId;
14     }
15
16     public static PresetMSOCreateVfModuleWithVolumeGroupALaCarteCypress forVfModule(String requestId, String serviceInstanceId, String vnfInstanceId, String volumeGroupInstanceId, String testApi, boolean withTestApi) {
17         return new PresetMSOCreateVfModuleWithVolumeGroupALaCarteCypress(false, requestId, serviceInstanceId, vnfInstanceId, volumeGroupInstanceId, testApi, withTestApi);
18     }
19
20     public static PresetMSOCreateVfModuleWithVolumeGroupALaCarteCypress forVolumeGroup(String requestId, String serviceInstanceId, String vnfInstanceId, String testApi, boolean withTestApi) {
21         return new PresetMSOCreateVfModuleWithVolumeGroupALaCarteCypress(true, requestId, serviceInstanceId, vnfInstanceId, requestId,testApi, withTestApi);
22     }
23
24     @Override
25     public boolean isStrictMatch() {
26         return true;
27     }
28
29     @Override
30     public String getReqPath() {
31         if (isVolumeGroupPreset) {
32             return getRootPath() + "/serviceInstances/v./" + serviceInstanceId + "/vnfs/" + vnfInstanceId + "/volumeGroups";
33         } else {
34             return getRootPath() + "/serviceInstantiation/v./serviceInstances/" + serviceInstanceId + "/vnfs/" + vnfInstanceId + "/vfModules";
35         }
36     }
37
38     @Override
39     public Object getRequestBody() {
40         return "" +
41                 "{" +
42                 "  \"requestDetails\":{" +
43                 "    \"modelInfo\":{" +
44                 "      \"modelType\":\"" + select("volumeGroup", "vfModule") + "\"," +
45                 "      \"modelInvariantId\":\"7253ff5c-97f0-4b8b-937c-77aeb4d79aa1\"," +
46                 "      \"modelVersionId\":\"25284168-24bb-4698-8cb4-3f509146eca5\"," +
47                 "      \"modelName\":\"2017488PasqualeVpe..PASQUALE_vRE_BV..module-1\"," +
48                 "      \"modelVersion\":\"6\"," +
49                 "      \"modelCustomizationId\":\"f7e7c365-60cf-49a9-9ebf-a1aa11b9d401\"," +
50                 "      \"modelCustomizationName\":\"2017488PasqualeVpe..PASQUALE_vRE_BV..module-1\"" +
51                 "    }," +
52                 "    \"cloudConfiguration\":{" +
53                 "      \"lcpCloudRegionId\":\"my region\"," +
54                        addCloudOwnerIfNeeded() +
55                 "      \"tenantId\":\"092eb9e8e4b7412e8787dd091bc58e86\"" +
56                 "    }," +
57                 "    \"requestInfo\":{" +
58                 "      \"instanceName\":\"" + select("puwesovabe_vol", "puwesovabe") + "\"," +
59                 "      \"source\":\"VID\"," +
60                 "      \"suppressRollback\":false," +
61                 "      \"requestorId\":\"us16807000\"" +
62                 "    }," +
63                 "    \"relatedInstanceList\":[{" +
64                 "        \"relatedInstance\":{" +
65                 "          \"instanceId\":\"" + serviceInstanceId + "\"," +
66                 "          \"modelInfo\":{" +
67                 "            \"modelType\":\"service\"," +
68                 "            \"modelName\":\"action-data\"," +
69                 "            \"modelInvariantId\":\"e49fbd11-e60c-4a8e-b4bf-30fbe8f4fcc0\"," +
70                 "            \"modelVersion\":\"1.0\"," +
71                 "            \"modelVersionId\":\"2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd\"" +
72                 "          }" +
73                 "        }" +
74                 "     }, {" +
75                 "        \"relatedInstance\":{" +
76                 "          \"instanceId\":\"" + vnfInstanceId + "\"," +
77                 "          \"modelInfo\":{" +
78                 "            \"modelType\":\"vnf\"," +
79                 "            \"modelName\":\"2017-488_PASQUALE-vPE\"," +
80                 "            \"modelInvariantId\":\"72e465fe-71b1-4e7b-b5ed-9496118ff7a8\"," +
81                 "            \"modelVersion\":\"5.0\"," +
82                 "            \"modelVersionId\":\"69e09f68-8b63-4cc9-b9ff-860960b5db09\"," +
83                 "            \"modelCustomizationId\":\"1da7b585-5e61-4993-b95e-8e6606c81e45\"," +
84                 "            \"modelCustomizationName\":\"2017-488_PASQUALE-vPE 0\"" +
85                 "          }" +
86                 "        }" +
87                 select("", "      }, {" +
88                 "        \"relatedInstance\":{" +
89                 "          \"modelInfo\":{" +
90                 "            \"modelType\":\"volumeGroup\"" +
91                 "          }," +
92                 "          \"instanceId\":\"" + volumeGroupInstanceId + "\"," +
93                 "          \"instanceName\":\"puwesovabe_vol\"" +
94                 "        } ") +
95                 "      }" +
96                 "    ]," +
97                 "    \"requestParameters\":{" +
98                addTestApi()+
99                 "       \"userParams\":[{" +
100                 "          \"2017488_pasqualevpe0_vnf_instance_name\":\"mtnj309me6\"," +
101                 "          \"2017488_pasqualevpe0_vnf_config_template_version\":\"17.2\"," +
102                 "          \"pasqualevpe0_bandwidth\":\"10\"," +
103                 "          \"2017488_pasqualevpe0_AIC_CLLI\":\"ATLMY8GA\"," +
104                 "          \"pasqualevpe0_bandwidth_units\":\"Gbps\"" +
105                 "        }" +
106                 "      ]," +
107                 "      \"usePreload\":true" +
108                 "    }" +
109                 "  }" +
110                 "}";
111     }
112
113     private String select(String ofVolumeGroup, String ofVfModule) {
114         return isVolumeGroupPreset ? ofVolumeGroup : ofVfModule;
115     }
116 }