2 * Copyright 2016-2017 Huawei Technologies Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package org.openo.nfvo.vnfmadapter.service.adapter.impl;
19 import java.io.BufferedInputStream;
20 import java.io.FileInputStream;
21 import java.io.FileNotFoundException;
22 import java.io.IOException;
23 import java.io.InputStream;
24 import java.util.HashMap;
27 import org.apache.commons.httpclient.HttpMethod;
28 import org.apache.commons.httpclient.HttpStatus;
29 import org.openo.baseservice.roa.util.restclient.RestfulResponse;
30 import org.openo.baseservice.util.impl.SystemEnvVariablesFactory;
31 import org.openo.nfvo.vnfmadapter.common.DownloadCsarManager;
32 import org.openo.nfvo.vnfmadapter.common.VnfmException;
33 import org.openo.nfvo.vnfmadapter.common.servicetoken.VNFRestfulUtil;
34 import org.openo.nfvo.vnfmadapter.service.adapter.inf.IResourceManager;
35 import org.openo.nfvo.vnfmadapter.service.constant.Constant;
36 import org.openo.nfvo.vnfmadapter.service.constant.UrlConstant;
37 import org.openo.nfvo.vnfmadapter.service.csm.connect.ConnectMgrVnfm;
38 import org.openo.nfvo.vnfmadapter.service.csm.connect.HttpRequests;
39 import org.slf4j.Logger;
40 import org.slf4j.LoggerFactory;
42 import net.sf.json.JSONArray;
43 import net.sf.json.JSONException;
44 import net.sf.json.JSONObject;
47 * Resource Manager adapter class.
51 * @version NFVO 0.5 Sep 13, 2016
53 public class AdapterResourceManager implements IResourceManager {
55 private static final Logger LOG = LoggerFactory.getLogger(AdapterResourceManager.class);
58 public JSONObject uploadVNFPackage(JSONObject vnfpkg, Map<String, String> paramsMap) {
59 JSONObject resultObj = new JSONObject();
60 JSONObject csarTempObj = new JSONObject();
63 // if upper layer do not provide vnfpackage info,then get the
64 // vnfpackage info from JSON file.
65 if(vnfpkg == null || vnfpkg.isEmpty()) {
66 String vnfPkgInfo = readVfnPkgInfoFromJson();
67 vnfpkg = JSONObject.fromObject(vnfPkgInfo); // NOSONAR
69 } catch(IOException e) {
70 LOG.error("function=uploadVNFPackage", e);
73 // check if parameters are null.
74 if(paramsMap == null || paramsMap.isEmpty()) {
75 resultObj.put("reason", "csarid and vnfmid are null.");
76 resultObj.put("retCode", Constant.REST_FAIL);
80 String csarid = paramsMap.get("csarid");
81 String vnfmid = paramsMap.get("vnfmid");
83 String vnfDescriptorId = paramsMap.get("vnfDescriptorId");
84 if(null == csarid || "".equals(csarid)) {
85 resultObj.put("reason", "csarid is null.");
86 resultObj.put("retCode", Constant.REST_FAIL);
89 if(null == vnfmid || "".equals(vnfmid)) {
90 resultObj.put("reason", "vnfmid is null.");
91 resultObj.put("retCode", Constant.REST_FAIL);
95 // obtain CSAR package info
96 JSONObject csarobj = getVnfmCsarInfo(csarid);
97 String downloadUri = "";
98 if(Integer.valueOf(csarobj.get("retCode").toString()) == Constant.HTTP_OK) {
99 LOG.info("get CSAR info successful.", csarobj.get("retCode"));
100 downloadUri = csarobj.getString("downloadUri");
102 LOG.error("get CSAR info fail.", csarobj.get("retCode"));
103 resultObj.put("reason", csarobj.get("reason").toString());
104 resultObj.put("retCode", Constant.REST_FAIL);
108 csarTempObj = vnfpkg.getJSONObject("template");
109 String csarfilepath = csarTempObj.getString("csar_file_path");
110 String csarfilename = csarTempObj.getString("csar_file_name");
112 // download csar package and save in location.
113 JSONObject downloadObject =
114 downloadCsar(downloadUri, csarfilepath + System.getProperty("file.separator") + csarfilename);
116 if(Integer.valueOf(downloadObject.get("retCode").toString()) != Constant.REST_SUCCESS) {
117 LOG.error("download CSAR fail.", downloadObject.get("retCode"));
118 resultObj.put("reason", downloadObject.get("reason").toString());
119 resultObj.put("retCode", downloadObject.get("retCode").toString());
122 LOG.info("download CSAR successful.", downloadObject.get("retCode"));
124 // unzip csar package to location.
125 JSONObject unzipObject =
126 unzipCSAR(csarfilepath + System.getProperty("file.separator") + csarfilename, csarfilepath);
128 if(Integer.valueOf(unzipObject.get("retCode").toString()) != Constant.REST_SUCCESS) {
129 LOG.error("unzip CSAR fail.", unzipObject.get("retCode"));
130 resultObj.put("reason", unzipObject.get("reason").toString());
131 resultObj.put("retCode", unzipObject.get("retCode").toString());
134 LOG.info("unzip CSAR successful.", unzipObject.get("retCode"));
136 Map<String, String> vnfmMap = new HashMap<>();
137 vnfmMap.put("url", String.format(UrlConstant.REST_VNFMINFO_GET, vnfmid));
138 vnfmMap.put("methodType", Constant.GET);
140 // get VNFM connection info
141 JSONObject vnfmObject = getVnfmConnInfo(vnfmMap);
142 if(Integer.valueOf(vnfmObject.get("retCode").toString()) != Constant.HTTP_OK) {
143 LOG.error("get Vnfm Connection Info fail.", vnfmObject.get("retCode"));
144 resultObj.put("reason", vnfmObject.get("reason").toString());
145 resultObj.put("retCode", vnfmObject.get("retCode").toString());
148 LOG.info("get Vnfm Connection Info successful.", vnfmObject.get("retCode"));
150 String vnfmUrl = vnfmObject.getString("url");
151 String userName = vnfmObject.getString("userName");
152 String password = vnfmObject.getString("password");
154 // build VNFM connection and get token
155 ConnectMgrVnfm mgrVcmm = new ConnectMgrVnfm();
157 JSONObject connObject = new JSONObject();
158 connObject.put("url", vnfmUrl);
159 connObject.put("userName", userName);
160 connObject.put("password", password);
161 if(Constant.HTTP_OK != mgrVcmm.connect(vnfmObject, Constant.CERTIFICATE)) {
162 LOG.error("get Access Session fail.");
163 resultObj.put(Constant.RETCODE, Constant.HTTP_INNERERROR);
164 resultObj.put("reason", "connect fail.");
167 LOG.info("get Access Session successful.");
168 String connToken = mgrVcmm.getAccessSession();
171 JSONObject cloudObject = getAllCloud(vnfmUrl, connToken);
174 if(!cloudObject.isEmpty() && cloudObject.get(Constant.RETCODE).equals(HttpStatus.SC_OK)) {
175 LOG.info("get all cloud successful.", cloudObject.get(Constant.RETCODE));
176 vimId = cloudObject.getString("vim_id");
178 LOG.error("get all cloud fail.", cloudObject.get(Constant.RETCODE));
182 // upload VNF package
183 csarTempObj.put("vim_id", vimId);
184 vnfpkg.put("template", csarTempObj);
186 JSONObject uploadPkgObject = upload(vnfpkg, vnfmUrl, connToken);
187 LOG.info("uploadPkgObject:" + uploadPkgObject);
188 if(vnfdid == null || "".equals(vnfdid.trim())) {
189 JSONObject vnfdConf = readVnfdIdInfoFromJson();
190 LOG.info("vnfdConf=" + vnfdConf);
191 if(vnfdConf.containsKey(vnfDescriptorId)) {
192 vnfdid = vnfdConf.getString(vnfDescriptorId);
195 LOG.info("set vnfdId=" + vnfdid);
198 String vnfdVersion = "";
200 JSONObject vnfdVerObject =
201 getVnfdVersion(vnfmUrl, String.format(UrlConstant.URL_VNFDINFO_GET, vnfdid), connToken);
202 LOG.info("vnfdVerObject:" + vnfdVerObject);
203 if(!vnfdVerObject.isEmpty() && vnfdVerObject.get(Constant.RETCODE).equals(HttpStatus.SC_OK)) {
204 LOG.info("get vnfd version successful.", vnfdVerObject.get(Constant.RETCODE));
205 JSONArray verArr = vnfdVerObject.getJSONArray("templates");
206 JSONObject verTmpObj = verArr.getJSONObject(0);
208 vnfdVersion = verTmpObj.getString("vnfdVersion");
210 LOG.error("get vnfd version fail.", vnfdVerObject.get(Constant.RETCODE));
211 return vnfdVerObject;
214 // get vnfd plan info
215 String planName = "";
218 JSONObject vnfdPlanInfo = getVNFDPlanInfo(vnfmUrl, vnfdid, connToken);
219 LOG.info("vnfdPlanInfo:" + vnfdPlanInfo);
220 JSONObject inputsObj = new JSONObject();
221 if(!vnfdPlanInfo.isEmpty() && vnfdPlanInfo.get(Constant.RETCODE).equals(HttpStatus.SC_OK)) {
222 LOG.info("get vnfd plan info successful.", vnfdPlanInfo.get(Constant.RETCODE));
223 JSONObject planTmpObj = vnfdPlanInfo.getJSONObject("template");
224 String templateName = planTmpObj.getString("template_name").trim();
225 JSONArray topoTmpObj = planTmpObj.getJSONArray("topology_template");
227 JSONObject planObj = topoTmpObj.getJSONObject(0);
228 if("VNFD_vUGW".equals(templateName)) {
229 for(int i = 0; i < topoTmpObj.size(); i++) {
230 String name = topoTmpObj.getJSONObject(i).getString("plan_name").trim();
231 if("Normal_E9K".equals(name)) {
232 planObj = topoTmpObj.getJSONObject(i);
237 planName = planObj.getString("plan_name");
238 planId = planObj.getString("plan_id");
239 if(planObj.containsKey("inputs")) {
240 JSONArray inputs = planObj.getJSONArray("inputs");
241 for(int i = 0; i < inputs.size(); i++) {
242 JSONObject obj = inputs.getJSONObject(i);
243 obj.put("value", obj.getString("default"));
245 inputsObj.put("inputs", inputs);
246 inputsObj.put("External_network", new JSONArray());
249 LOG.error("get vnfd plan info fail.", vnfdPlanInfo.get(Constant.RETCODE));
254 resultObj.put("retCode", Constant.HTTP_OK);
255 resultObj.put("vnfdId", vnfdid);
256 resultObj.put("vnfdVersion", vnfdVersion);
257 resultObj.put("planName", planName);
258 resultObj.put("planId", planId);
259 resultObj.put("parameters", inputsObj);
260 LOG.info("resultObj:" + resultObj.toString());
265 private JSONObject sendRequest(Map<String, String> paramsMap) {
266 JSONObject resultObj = new JSONObject();
267 RestfulResponse rsp = VNFRestfulUtil.getRemoteResponse(paramsMap, "");
269 LOG.error("function=sendRequest, RestfulResponse is null");
270 resultObj.put("reason", "RestfulResponse is null.");
271 resultObj.put("retCode", Constant.REST_FAIL);
274 String resultCreate = rsp.getResponseContent();
276 if(rsp.getStatus() == Constant.HTTP_OK) {
277 LOG.warn("function=sendRequest, msg= status={}, result={}.", rsp.getStatus(), resultCreate);
278 resultObj = JSONObject.fromObject(resultCreate);
279 resultObj.put("retCode", Constant.HTTP_OK);
282 LOG.error("function=sendRequest, msg=ESR return fail,status={}, result={}.", rsp.getStatus(), resultCreate);
283 resultObj.put("reason", "ESR return fail.");
285 resultObj.put("retCode", Constant.REST_FAIL);
290 public JSONObject getVnfmCsarInfo(String csarid) {
291 JSONObject resultObj = new JSONObject();
293 if(null == csarid || "".equals(csarid)) {
294 resultObj.put("reason", "csarid is null.");
295 resultObj.put("retCode", Constant.REST_FAIL);
299 Map<String, String> paramsMap = new HashMap<String, String>();
301 paramsMap.put("url", String.format(UrlConstant.REST_CSARINFO_GET, csarid));
302 paramsMap.put("methodType", Constant.GET);
304 return this.sendRequest(paramsMap);
308 public JSONObject downloadCsar(String url, String filePath) {
309 JSONObject resultObj = new JSONObject();
311 if(url == null || "".equals(url)) {
312 resultObj.put("reason", "url is null.");
313 resultObj.put("retCode", Constant.REST_FAIL);
316 if(filePath == null || "".equals(filePath)) {
317 resultObj.put("reason", "downloadUrl filePath is null.");
318 resultObj.put("retCode", Constant.REST_FAIL);
322 String status = DownloadCsarManager.download(url, filePath);
324 if(Constant.DOWNLOADCSAR_SUCCESS.equals(status)) {
325 resultObj.put("reason", "download csar file successfully.");
326 resultObj.put("retCode", Constant.REST_SUCCESS);
328 resultObj.put("reason", "download csar file failed.");
329 resultObj.put("retCode", Constant.REST_FAIL);
335 public JSONObject getAllCloud(String url, String conntoken) {
336 JSONObject resultObj = new JSONObject();
337 JSONArray resArray = new JSONArray();
339 if(url == null || url.equals("")) {
340 url = "http://127.0.0.1:31943";
344 HttpMethod httpMethodCloud = null;
347 new HttpRequests.Builder(Constant.CERTIFICATE).setUrl(url.trim(), UrlConstant.URL_ALLCLOUD_NEW_GET)
348 .addHeader(Constant.HEADER_AUTH_TOKEN, conntoken).setParams("").get().execute();
350 int statusCode = httpMethodCloud.getStatusCode();
352 String result = httpMethodCloud.getResponseBodyAsString();
354 if(statusCode == HttpStatus.SC_OK) {
355 JSONObject vimInfo = JSONObject.fromObject(result);
356 resArray = vimInfo.getJSONArray("vim_info");
357 resultObj = resArray.getJSONObject(0);
358 resultObj.put(Constant.RETCODE, statusCode);
360 LOG.error("uploadVNFPackage get allcloud failed, code:" + statusCode + " re:" + result);
361 resultObj.put(Constant.RETCODE, statusCode);
362 resultObj.put("reason", "get allcloud failed. code:" + statusCode + " re:" + result);
365 } catch(JSONException e) {
366 LOG.error("function=uploadVNFPackage, msg=uploadVNFPackage get allcloud JSONException e={}.", e);
367 resultObj.put(Constant.RETCODE, Constant.HTTP_INNERERROR);
368 resultObj.put("reason", "get allcloud failed and JSONException." + e.getMessage());
370 } catch(VnfmException e) {
371 LOG.error("function=uploadVNFPackage, msg=uploadVNFPackage get allcloud VnfmException e={}.", e);
372 resultObj.put(Constant.RETCODE, Constant.HTTP_INNERERROR);
373 resultObj.put("reason", "get allcloud failed and VnfmException." + e.getMessage());
375 } catch(IOException e) {
376 LOG.error("function=uploadVNFPackage, msg=uploadVNFPackage get allcloud IOException e={}.", e);
377 resultObj.put(Constant.RETCODE, Constant.HTTP_INNERERROR);
378 resultObj.put("reason", "get allcloud failed and IOException." + e.getMessage());
385 * Upload vnfpackage<br>
393 public JSONObject upload(JSONObject vnfpackage, String vnfmurl, String conntoken) {
394 JSONObject resultObj = new JSONObject();
395 HttpMethod httpMethodVnf = null;
398 httpMethodVnf = new HttpRequests.Builder(Constant.CERTIFICATE)
399 .setUrl(vnfmurl.trim(), UrlConstant.URL_VNFPACKAGE_POST).setParams(vnfpackage.toString())
400 .addHeader(Constant.HEADER_AUTH_TOKEN, conntoken).post().execute();
402 int statusCodeUp = httpMethodVnf.getStatusCode();
404 String resultUp = httpMethodVnf.getResponseBodyAsString();
406 if(statusCodeUp == HttpStatus.SC_CREATED || statusCodeUp == HttpStatus.SC_OK) {
407 LOG.info("uploadVNFPackage upload VNF package successful, code:" + statusCodeUp + " re:" + resultUp);
408 resultObj = JSONObject.fromObject(resultUp);
409 resultObj.put(Constant.RETCODE, statusCodeUp);
411 LOG.error("uploadVNFPackage upload VNF package failed, code:" + statusCodeUp + " re:" + resultUp);
412 resultObj.put(Constant.RETCODE, statusCodeUp);
413 resultObj.put("data", "upload VNF package failed, code:" + statusCodeUp + " re:" + resultUp);
416 } catch(JSONException e) {
417 LOG.error("function=uploadVNFPackage, msg=uploadVNFPackage upload VNF package JSONException e={}.", e);
418 resultObj.put(Constant.RETCODE, Constant.HTTP_INNERERROR);
419 resultObj.put("reason", "upload VNF package failed and JSONException." + e.getMessage());
421 } catch(VnfmException e) {
422 LOG.error("function=uploadVNFPackage, msg=uploadVNFPackage upload VNF package VnfmException e={}.", e);
423 resultObj.put(Constant.RETCODE, Constant.HTTP_INNERERROR);
424 resultObj.put("reason", "upload VNF package failed and VnfmException." + e.getMessage());
426 } catch(IOException e) {
427 LOG.error("function=uploadVNFPackage, msg=uploadVNFPackage upload VNF package IOException e={}.", e);
428 resultObj.put(Constant.RETCODE, Constant.HTTP_INNERERROR);
429 resultObj.put("reason", "upload VNF package failed and IOException." + e.getMessage());
436 * Find vnfd version.<br>
443 public JSONObject getVnfdVersion(String prefixUrl, String serviceUrl, String conntoken) {
444 JSONObject resultObj = new JSONObject();
445 HttpMethod httpMethodVnfd = null;
447 httpMethodVnfd = new HttpRequests.Builder(Constant.CERTIFICATE).setUrl(prefixUrl.trim(), serviceUrl)
448 .setParams("").addHeader(Constant.HEADER_AUTH_TOKEN, conntoken).get().execute();
450 int statusCodeVnfd = httpMethodVnfd.getStatusCode();
452 String resultVnfd = httpMethodVnfd.getResponseBodyAsString();
453 LOG.info("getVnfdVersion result:" + resultVnfd);
454 if(statusCodeVnfd == HttpStatus.SC_OK) {
455 resultObj = JSONObject.fromObject(resultVnfd);
456 resultObj.put(Constant.RETCODE, statusCodeVnfd);
458 LOG.error("uploadVNFPackage vnfd version failed, code:" + statusCodeVnfd + " re:" + resultVnfd);
459 resultObj.put(Constant.RETCODE, statusCodeVnfd);
460 resultObj.put("data", "get vnfd version failed, code:" + statusCodeVnfd + " re:" + resultVnfd);
463 } catch(JSONException e) {
464 LOG.error("function=uploadVNFPackage, msg=uploadVNFPackage get vnfd version JSONException e={}.", e);
465 resultObj.put(Constant.RETCODE, Constant.HTTP_INNERERROR);
466 resultObj.put("reason", "get vnfd version failed and JSONException." + e.getMessage());
468 } catch(VnfmException e) {
469 LOG.error("function=uploadVNFPackage, msg=uploadVNFPackage get vnfd version VnfmException e={}.", e);
470 resultObj.put(Constant.RETCODE, Constant.HTTP_INNERERROR);
471 resultObj.put("reason", "get vnfd version failed and VnfmException." + e.getMessage());
473 } catch(IOException e) {
474 LOG.error("function=uploadVNFPackage, msg=uploadVNFPackage get vnfd version IOException e={}.", e);
475 resultObj.put(Constant.RETCODE, Constant.HTTP_INNERERROR);
476 resultObj.put("reason", "get vnfd version failed and IOException." + e.getMessage());
483 * Find VNFM connection information.<br>
489 public JSONObject getVnfmConnInfo(Map<String, String> paramsMap) {
490 return this.sendRequest(paramsMap);
494 public JSONObject getVNFDPlanInfo(String url, String vnfdid, String conntoken) {
495 JSONObject resultObj = new JSONObject();
497 HttpMethod httpMethodPlan = null;
499 httpMethodPlan = new HttpRequests.Builder(Constant.CERTIFICATE)
500 .setUrl(url.trim(), String.format(UrlConstant.URL_VNFDPLANINFO_GET, vnfdid)).setParams("")
501 .addHeader(Constant.HEADER_AUTH_TOKEN, conntoken).get().execute();
503 int statusCode = httpMethodPlan.getStatusCode();
505 String result = httpMethodPlan.getResponseBodyAsString();
506 LOG.info("getVNFDPlanInfo result=" + result);
507 if(statusCode == HttpStatus.SC_OK) {
508 resultObj = JSONObject.fromObject(result);
509 resultObj.put(Constant.RETCODE, statusCode);
511 LOG.error("uploadVNFPackage get VNFDPlanInfo failed, code:" + statusCode + " re:" + result);
512 resultObj.put(Constant.RETCODE, statusCode);
513 resultObj.put("reason", "get VNFDPlanInfo failed. code:" + statusCode + " re:" + result);
516 } catch(JSONException e) {
517 LOG.error("function=uploadVNFPackage, msg=uploadVNFPackage get VNFDPlanInfo JSONException e={}.", e);
518 resultObj.put(Constant.RETCODE, Constant.HTTP_INNERERROR);
519 resultObj.put("reason", "get VNFDPlanInfo failed and JSONException." + e.getMessage());
521 } catch(VnfmException e) {
522 LOG.error("function=uploadVNFPackage, msg=uploadVNFPackage get VNFDPlanInfo VnfmException e={}.", e);
523 resultObj.put(Constant.RETCODE, Constant.HTTP_INNERERROR);
524 resultObj.put("reason", "get VNFDPlanInfo failed and VnfmException." + e.getMessage());
526 } catch(IOException e) {
527 LOG.error("function=uploadVNFPackage, msg=uploadVNFPackage get VNFDPlanInfo IOException e={}.", e);
528 resultObj.put(Constant.RETCODE, Constant.HTTP_INNERERROR);
529 resultObj.put("reason", "get VNFDPlanInfo failed and IOException." + e.getMessage());
536 * Get VNF package information.<br>
539 * @throws IOException
542 public static String readVfnPkgInfoFromJson() throws IOException {
543 InputStream ins = null;
544 BufferedInputStream bins = null;
545 String fileContent = "";
547 String fileName = SystemEnvVariablesFactory.getInstance().getAppRoot() + System.getProperty("file.separator")
548 + "etc" + System.getProperty("file.separator") + "vnfpkginfo" + System.getProperty("file.separator")
549 + Constant.VNFPKGINFO;
552 ins = new FileInputStream(fileName);
553 bins = new BufferedInputStream(ins);
555 byte[] contentByte = new byte[ins.available()];
556 int num = bins.read(contentByte);
559 fileContent = new String(contentByte);
561 } catch(FileNotFoundException e) {
562 LOG.error(fileName + "is not found!", e);
575 private static JSONObject readVnfdIdInfoFromJson() {
576 JSONObject jsonObject = new JSONObject();
577 InputStream ins = null;
578 BufferedInputStream bins = null;
579 String fileContent = "";
581 String fileName = SystemEnvVariablesFactory.getInstance().getAppRoot() + System.getProperty("file.separator")
582 + "etc" + System.getProperty("file.separator") + "vnfpkginfo" + System.getProperty("file.separator")
586 ins = new FileInputStream(fileName);
587 bins = new BufferedInputStream(ins);
589 byte[] contentByte = new byte[ins.available()];
590 int num = bins.read(contentByte);
593 fileContent = new String(contentByte);
595 if(fileContent != null) {
596 jsonObject = JSONObject.fromObject(fileContent).getJSONObject("vnfdIds");
604 } catch(Exception e) {
605 LOG.error(fileName + " read error!", e);
615 * @param fileName filePath
618 public JSONObject unzipCSAR(String fileName, String filePath) {
619 JSONObject resultObj = new JSONObject();
621 if(fileName == null || "".equals(fileName)) {
622 resultObj.put("reason", "fileName is null.");
623 resultObj.put("retCode", Constant.REST_FAIL);
626 if(filePath == null || "".equals(filePath)) {
627 resultObj.put("reason", "unzipCSAR filePath is null.");
628 resultObj.put("retCode", Constant.REST_FAIL);
632 int status = DownloadCsarManager.unzipCSAR(fileName, filePath);
634 if(Constant.UNZIP_SUCCESS == status) {
635 resultObj.put("reason", "unzip csar file successfully.");
636 resultObj.put("retCode", Constant.REST_SUCCESS);
638 resultObj.put("reason", "unzip csar file failed.");
639 resultObj.put("retCode", Constant.REST_FAIL);