update MSO volume group URL
[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         String trailer = isVolumeGroupPreset ? "/volumeGroups" : "/vfModules";
32         return getRootPath() + "/serviceInstantiation/v./serviceInstances/" + serviceInstanceId + "/vnfs/" + vnfInstanceId + trailer;
33     }
34
35     @Override
36     public Object getRequestBody() {
37         return "" +
38                 "{" +
39                 "  \"requestDetails\":{" +
40                 "    \"modelInfo\":{" +
41                 "      \"modelType\":\"" + select("volumeGroup", "vfModule") + "\"," +
42                 "      \"modelInvariantId\":\"7253ff5c-97f0-4b8b-937c-77aeb4d79aa1\"," +
43                 "      \"modelVersionId\":\"25284168-24bb-4698-8cb4-3f509146eca5\"," +
44                 "      \"modelName\":\"2017488PasqualeVpe..PASQUALE_vRE_BV..module-1\"," +
45                 "      \"modelVersion\":\"6\"," +
46                 "      \"modelCustomizationId\":\"f7e7c365-60cf-49a9-9ebf-a1aa11b9d401\"," +
47                 "      \"modelCustomizationName\":\"2017488PasqualeVpe..PASQUALE_vRE_BV..module-1\"" +
48                 "    }," +
49                 "    \"cloudConfiguration\":{" +
50                 "      \"lcpCloudRegionId\":\"my region\"," +
51                        addCloudOwnerIfNeeded() +
52                 "      \"tenantId\":\"092eb9e8e4b7412e8787dd091bc58e86\"" +
53                 "    }," +
54                 "    \"requestInfo\":{" +
55                 "      \"instanceName\":\"" + select("puwesovabe_vol", "puwesovabe") + "\"," +
56                 "      \"source\":\"VID\"," +
57                 "      \"suppressRollback\":false," +
58                 "      \"requestorId\":\"us16807000\"" +
59                 "    }," +
60                 "    \"relatedInstanceList\":[{" +
61                 "        \"relatedInstance\":{" +
62                 "          \"instanceId\":\"" + serviceInstanceId + "\"," +
63                 "          \"modelInfo\":{" +
64                 "            \"modelType\":\"service\"," +
65                 "            \"modelName\":\"action-data\"," +
66                 "            \"modelInvariantId\":\"e49fbd11-e60c-4a8e-b4bf-30fbe8f4fcc0\"," +
67                 "            \"modelVersion\":\"1.0\"," +
68                 "            \"modelVersionId\":\"2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd\"" +
69                 "          }" +
70                 "        }" +
71                 "     }, {" +
72                 "        \"relatedInstance\":{" +
73                 "          \"instanceId\":\"" + vnfInstanceId + "\"," +
74                 "          \"modelInfo\":{" +
75                 "            \"modelType\":\"vnf\"," +
76                 "            \"modelName\":\"2017-488_PASQUALE-vPE\"," +
77                 "            \"modelInvariantId\":\"72e465fe-71b1-4e7b-b5ed-9496118ff7a8\"," +
78                 "            \"modelVersion\":\"5.0\"," +
79                 "            \"modelVersionId\":\"69e09f68-8b63-4cc9-b9ff-860960b5db09\"," +
80                 "            \"modelCustomizationId\":\"1da7b585-5e61-4993-b95e-8e6606c81e45\"," +
81                 "            \"modelCustomizationName\":\"2017-488_PASQUALE-vPE 0\"" +
82                 "          }" +
83                 "        }" +
84                 select("", "      }, {" +
85                 "        \"relatedInstance\":{" +
86                 "          \"modelInfo\":{" +
87                 "            \"modelType\":\"volumeGroup\"" +
88                 "          }," +
89                 "          \"instanceId\":\"" + volumeGroupInstanceId + "\"," +
90                 "          \"instanceName\":\"puwesovabe_vol\"" +
91                 "        } ") +
92                 "      }" +
93                 "    ]," +
94                 "    \"requestParameters\":{" +
95                addTestApi()+
96                 "       \"userParams\":[{" +
97                 "          \"2017488_pasqualevpe0_vnf_instance_name\":\"mtnj309me6\"," +
98                 "          \"2017488_pasqualevpe0_vnf_config_template_version\":\"17.2\"," +
99                 "          \"pasqualevpe0_bandwidth\":\"10\"," +
100                 "          \"2017488_pasqualevpe0_AIC_CLLI\":\"ATLMY8GA\"," +
101                 "          \"pasqualevpe0_bandwidth_units\":\"Gbps\"" +
102                 "        }" +
103                 "      ]," +
104                 "      \"usePreload\":true" +
105                 "    }" +
106                 "  }" +
107                 "}";
108     }
109
110     private String select(String ofVolumeGroup, String ofVfModule) {
111         return isVolumeGroupPreset ? ofVolumeGroup : ofVfModule;
112     }
113 }