f05a22f95eb5070d98edd27768852eb8cbe1b562
[vnfsdk/refrepo.git] /
1 /**
2  * Copyright 2017 Huawei Technologies Co., Ltd.
3  *
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
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 package org.onap.vnfsdk.marketplace.wrapper;
18
19 import java.io.BufferedInputStream;
20 import java.io.File;
21 import java.io.FileInputStream;
22 import java.io.IOException;
23 import java.io.InputStream;
24 import java.util.ArrayList;
25 import java.util.Arrays;
26 import java.util.List;
27 import java.util.concurrent.Callable;
28 import java.util.concurrent.ExecutorService;
29 import java.util.concurrent.Executors;
30
31 import javax.ws.rs.core.HttpHeaders;
32 import javax.ws.rs.core.MediaType;
33 import javax.ws.rs.core.Response;
34 import javax.ws.rs.core.Response.Status;
35
36 import org.apache.commons.io.IOUtils;
37 import org.apache.commons.lang3.StringUtils;
38 import org.eclipse.jetty.http.HttpStatus;
39 import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
40 import org.onap.vnfsdk.marketplace.common.CommonConstant;
41 import org.onap.vnfsdk.marketplace.common.CommonErrorResponse;
42 import org.onap.vnfsdk.marketplace.common.FileUtil;
43 import org.onap.vnfsdk.marketplace.common.RestUtil;
44 import org.onap.vnfsdk.marketplace.common.ToolUtil;
45 import org.onap.vnfsdk.marketplace.db.entity.PackageData;
46 import org.onap.vnfsdk.marketplace.db.exception.ErrorCodeException;
47 import org.onap.vnfsdk.marketplace.db.exception.MarketplaceResourceException;
48 import org.onap.vnfsdk.marketplace.db.resource.PackageManager;
49 import org.onap.vnfsdk.marketplace.db.util.MarketplaceDbUtil;
50 import org.onap.vnfsdk.marketplace.entity.request.PackageBasicInfo;
51 import org.onap.vnfsdk.marketplace.entity.response.PackageMeta;
52 import org.onap.vnfsdk.marketplace.entity.response.UploadPackageResponse;
53 import org.onap.vnfsdk.marketplace.filemanage.FileManagerFactory;
54 import org.onap.vnfsdk.marketplace.onboarding.entity.OnBoardingOperResult;
55 import org.onap.vnfsdk.marketplace.onboarding.entity.OnBoardingResult;
56 import org.onap.vnfsdk.marketplace.onboarding.entity.OnBoardingSteps;
57 import org.onap.vnfsdk.marketplace.onboarding.entity.OnBoradingRequest;
58 import org.onap.vnfsdk.marketplace.onboarding.hooks.functiontest.FunctionTestExceutor;
59 import org.onap.vnfsdk.marketplace.onboarding.hooks.functiontest.FunctionTestHook;
60 import org.onap.vnfsdk.marketplace.onboarding.hooks.validatelifecycle.ValidateLifecycleTestResponse;
61 import org.onap.vnfsdk.marketplace.onboarding.onboardmanager.OnBoardingHandler;
62 import org.open.infc.grpc.Result;
63 import org.open.infc.grpc.client.OpenRemoteCli;
64 import org.slf4j.Logger;
65 import org.slf4j.LoggerFactory;
66
67 public class PackageWrapper {
68
69     private static PackageWrapper packageWrapper;
70
71     private static final Logger LOG = LoggerFactory.getLogger(PackageWrapper.class);
72
73     private static final boolean DISABLE_VALIDATION = true;
74
75     private static final String fileFormat = ".csar";
76
77     /**
78      * get PackageWrapper instance.
79      *
80      * @return package wrapper instance
81      */
82     public static PackageWrapper getInstance() {
83         if(packageWrapper == null) {
84             packageWrapper = new PackageWrapper();
85         }
86         return packageWrapper;
87     }
88
89     public Response updateValidateStatus(InputStream inputStream) throws IOException {
90         String reqParam = IOUtils.toString(inputStream);
91         LOG.info("updateValidateStatus request param:" + reqParam);
92         if(StringUtils.isBlank(reqParam)) {
93             LOG.error("The updateValidateStatus request params can't be null");
94             return Response.status(Status.EXPECTATION_FAILED).build();
95         }
96
97         ValidateLifecycleTestResponse lyfValidateResp = null;
98         // TBD - Use Gson - jackson has security issue/
99
100         if(!checkOperationSucess(lyfValidateResp)) {
101             return Response.status(Status.EXPECTATION_FAILED).build();
102         }
103
104         String funcTestResponse = FunctionTestExceutor.executeFunctionTest(reqParam);
105         if(null == funcTestResponse) {
106             return Response.status(Status.EXPECTATION_FAILED).build();
107         }
108
109         if(!funcTestResponse.contains(CommonConstant.SUCCESS_STR)) {
110             return Response.status(Status.EXPECTATION_FAILED).build();
111         }
112
113         return Response.ok().build();
114     }
115
116     private boolean checkOperationSucess(ValidateLifecycleTestResponse lyfValidateResp) {
117         boolean bOperStatus = false;
118         if(null == lyfValidateResp) {
119             LOG.error("ValidateLifecycleTestResponse  is NUll !!!");
120             return bOperStatus;
121         }
122         if(lyfValidateResp.getLifecycleStatus().equalsIgnoreCase(CommonConstant.SUCCESS_STR)
123                 && lyfValidateResp.getValidateStatus().equalsIgnoreCase(CommonConstant.SUCCESS_STR)) {
124             LOG.error("Lifecycle/Validation Response failed :" + lyfValidateResp.getLifecycleStatus() + File.separator
125                     + lyfValidateResp.getValidateStatus());
126             bOperStatus = true;
127         }
128         return bOperStatus;
129     }
130
131     /**
132      * query package list by condition.
133      *
134      * @param name package name
135      * @param provider package provider
136      * @param version package version
137      * @param deletionPending package deletionPending
138      * @param type package type
139      * @return Response
140      */
141     public Response queryPackageListByCond(String name, String provider, String version, String deletionPending,
142             String type) {
143         List<PackageData> dbresult = new ArrayList<>();
144         List<PackageMeta> result = new ArrayList<>();
145         LOG.info("query package info.name:" + name + " provider:" + provider + " version" + version + " deletionPending"
146                 + deletionPending + " type:" + type);
147         try {
148             dbresult = PackageManager.getInstance().queryPackage(name, provider, version, deletionPending, type);
149             result = PackageWrapperUtil.packageDataList2PackageMetaList(dbresult);
150             return Response.ok(ToolUtil.objectToString(result)).build();
151         } catch(MarketplaceResourceException e1) {
152             LOG.error("query package by csarId from db error ! ", e1);
153             return RestUtil.getRestException(e1.getMessage());
154         }
155     }
156
157     /**
158      * query package by id.
159      *
160      * @param csarId package id
161      * @return Response
162      */
163     public Response queryPackageById(String csarId) {
164         PackageData dbResult = PackageWrapperUtil.getPackageInfoById(csarId);
165         PackageMeta result = PackageWrapperUtil.packageData2PackageMeta(dbResult);
166         return Response.ok(ToolUtil.objectToString(result)).build();
167     }
168
169     /**
170      * upload package.
171      *
172      * @param uploadedInputStream inputStream
173      * @param fileDetail package detail
174      * @param head http header
175      * @return Response
176      * @throws Exception e
177      */
178     public Response uploadPackage(InputStream uploadedInputStream, FormDataContentDisposition fileDetail,
179             String details, HttpHeaders head) {
180         LOG.info("Upload/Reupload request Received !!!!");
181         try {
182             String packageId = MarketplaceDbUtil.generateId();
183             return handlePackageUpload(packageId, uploadedInputStream, fileDetail, details, head);
184         } catch(IOException e) {
185             LOG.error("can't get package id", e);
186         }
187         return Response.status(Status.INTERNAL_SERVER_ERROR).build();
188     }
189
190     private UploadPackageResponse manageUpload(String packageId, String fileName, String fileLocation, String details,
191             String contentRange) throws ErrorCodeException {
192         String localDirName = ToolUtil.getTempDir(CommonConstant.CATALOG_CSAR_DIR_NAME, fileName);
193         PackageBasicInfo basicInfo = PackageWrapperUtil.getPacageBasicInfo(fileLocation);
194         UploadPackageResponse result = new UploadPackageResponse();
195         Boolean isEnd = PackageWrapperUtil.isUploadEnd(contentRange);
196         if(isEnd) {
197             PackageMeta packageMeta =
198                     PackageWrapperUtil.getPackageMeta(packageId, fileName, fileLocation, basicInfo, details);
199             try {
200                 String path = basicInfo.getType().toString() + File.separator + basicInfo.getProvider() + File.separator
201                         + packageMeta.getCsarId() + File.separator + fileName.replace(fileFormat, "") + File.separator
202                         + basicInfo.getVersion();
203
204                 String dowloadUri = File.separator + path + File.separator;
205                 packageMeta.setDownloadUri(dowloadUri);
206
207                 LOG.info("dest path is : " + path);
208                 LOG.info("packageMeta = " + ToolUtil.objectToString(packageMeta));
209
210                 PackageData packageData = PackageWrapperUtil.getPackageData(packageMeta);
211
212                 List<PackageData> lstPkgData =
213                         PackageManager.getInstance().queryPackage(packageMeta.getName(), "", "", "", "");
214                 if(!lstPkgData.isEmpty()) {
215                     LOG.error("Package name is not unique");
216                     throw new ErrorCodeException(HttpStatus.INTERNAL_SERVER_ERROR_500, "Package name already exists");
217                 }
218
219                 String destPath = File.separator + path + File.separator + File.separator;
220                 boolean uploadResult = FileManagerFactory.createFileManager().upload(localDirName, destPath);
221                 if(uploadResult) {
222                     OnBoradingRequest oOnboradingRequest = new OnBoradingRequest();
223                     oOnboradingRequest.setCsarId(packageId);
224                     oOnboradingRequest.setPackageName(fileName);
225                     oOnboradingRequest.setPackagePath(localDirName);
226
227                     packageData.setCsarId(packageId);
228                     packageData.setDownloadCount(-1);
229                     PackageData packateDbData = PackageManager.getInstance().addPackage(packageData);
230
231                     LOG.info("Store package data to database succed ! packateDbData = "
232                             + ToolUtil.objectToString(packateDbData));
233                     LOG.info("upload package file end, fileName:" + fileName);
234
235                     result.setCsarId(packateDbData.getCsarId());
236
237                     addOnBoardingRequest(oOnboradingRequest);
238
239                     LOG.info("OnboradingRequest Data : " + ToolUtil.objectToString(oOnboradingRequest));
240                 }
241             } catch(NullPointerException e) {
242                 LOG.error("Package basicInfo is incorrect ! basicIonfo = " + ToolUtil.objectToString(basicInfo), e);
243                 return null;
244             }
245         }
246         return result;
247     }
248
249     /**
250      * Interface for Uploading package
251      *
252      * @param packageId
253      * @param uploadedInputStream
254      * @param fileDetail
255      * @param details
256      * @param head
257      * @return
258      * @throws IOException
259      * @throws MarketplaceResourceException
260      */
261     private Response handlePackageUpload(String packageId, InputStream uploadedInputStream,
262             FormDataContentDisposition fileDetail, String details, HttpHeaders head) throws IOException {
263         boolean bResult = handleDataValidate(packageId, uploadedInputStream, fileDetail);
264         if(!bResult) {
265             LOG.error("Validation of Input received for Package Upload failed !!!");
266             return Response.status(Status.EXPECTATION_FAILED)
267                     .entity(new CommonErrorResponse("Input package is empty or exception happened during validation"))
268                     .build();
269         }
270
271         String fileName = "temp_" + packageId + fileFormat;
272         if(null != fileDetail) {
273             LOG.info("the fileDetail = " + ToolUtil.objectToString(fileDetail));
274
275             fileName = ToolUtil.processFileName(fileDetail.getFileName());
276         }
277
278         String localDirName = ToolUtil.getTempDir(CommonConstant.CATALOG_CSAR_DIR_NAME, fileName);
279
280         String contentRange = null;
281         if(head != null) {
282             contentRange = head.getHeaderString(CommonConstant.HTTP_HEADER_CONTENT_RANGE);
283         }
284         LOG.info("store package chunk file, fileName:" + fileName + ",contentRange:" + contentRange);
285         if(ToolUtil.isEmptyString(contentRange)) {
286             int fileSize = uploadedInputStream.available();
287             contentRange = "0-" + fileSize + "/" + fileSize;
288         }
289
290         String fileLocation = ToolUtil.storeChunkFileInLocal(localDirName, fileName, uploadedInputStream);
291         LOG.info("the fileLocation when upload package is :" + fileLocation);
292
293         uploadedInputStream.close();
294
295         if (!DISABLE_VALIDATION) {
296             try {
297                 Result result = OpenRemoteCli.run("localhost", 50051, null, Arrays.asList(new String[] { "--product", "onap-vtp", "csar-validate", "--csar", fileLocation, "--format", "json" }));
298                 LOG.info("CSAR validation is successful" + result.getOutput());
299
300                 int exitCode = result.getExitCode();
301                 String output = result.getOutput();
302
303                 if((exitCode != 0) ||  !output.contains("\"error\":\"SUCCESS\"")) {
304                   LOG.error("Could not validate failed");
305                   return Response.status(Status.EXPECTATION_FAILED).entity(new CommonErrorResponse(output))
306                           .build();
307                 }
308             } catch (Exception e) {
309                 LOG.error("CSAR validation panicked", e);
310                 return Response.serverError().entity(
311                         new CommonErrorResponse("Exception occurred while validating csar package:" + e.getMessage()))
312                         .build();
313             }
314         }
315
316         UploadPackageResponse result = null;
317         try {
318             result = manageUpload(packageId, fileName, fileLocation, details, contentRange);
319         } catch(ErrorCodeException e) {
320             return Response.status(Status.EXPECTATION_FAILED)
321                     .entity(new CommonErrorResponse("Package Name already exists")).build();
322         }
323         if(null != result) {
324             return Response.ok(ToolUtil.objectToString(result), MediaType.APPLICATION_JSON).build();
325         } else {
326             return Response.serverError().build();
327         }
328     }
329
330     /**
331      * Execute OnBarding request
332      *
333      * @param oOnboradingRequest
334      */
335     private void addOnBoardingRequest(final OnBoradingRequest oOnboradingRequest) {
336         ExecutorService es = Executors.newFixedThreadPool(CommonConstant.ONBOARDING_THREAD_COUNT);
337         Callable<Integer> callableInteger = () -> {
338             new OnBoardingHandler().handleOnBoardingReq(oOnboradingRequest);
339             return CommonConstant.SUCESS;
340         };
341         es.submit(callableInteger);
342     }
343
344     /**
345      * delete package by package id.
346      *
347      * @param csarId package id
348      * @return Response
349      */
350     public Response delPackage(String csarId) {
351         LOG.info("delete package  info.csarId:" + csarId);
352         if(ToolUtil.isEmptyString(csarId)) {
353             LOG.error("delete package  fail, csarid is null");
354             return Response.serverError().build();
355         }
356         deletePackageDataById(csarId);
357         return Response.ok().build();
358     }
359
360     /**
361      * Delete Package by CSAR ID
362      *
363      * @param csarId
364      */
365     private void deletePackageDataById(String csarId) {
366         String packagePath = PackageWrapperUtil.getPackagePath(csarId);
367         if(packagePath == null) {
368             LOG.error("package path is null! ");
369         }
370
371         // Delete Package
372         FileManagerFactory.createFileManager().delete(packagePath);
373         // Delete Results Data
374         FileManagerFactory.createFileManager().delete(File.separator + csarId);
375
376         // delete package data from database
377         try {
378             PackageManager.getInstance().deletePackage(csarId);
379         } catch(MarketplaceResourceException e1) {
380             LOG.error("delete package  by csarId from db error ! " + e1.getMessage(), e1);
381         }
382     }
383
384     /**
385      * download package by package id.
386      *
387      * @param csarId package id
388      * @return Response
389      */
390     public Response downloadCsarPackagesById(String csarId) {
391         PackageData packageData = PackageWrapperUtil.getPackageInfoById(csarId);
392
393         String packageName = packageData.getName();
394         String path = org.onap.vnfsdk.marketplace.filemanage.http.ToolUtil.getHttpServerAbsolutePath()
395                 + File.separatorChar + packageData.getType() + File.separatorChar + packageData.getProvider()
396                 + File.separatorChar + packageData.getCsarId() + File.separator + packageName + File.separatorChar
397                 + packageData.getVersion() + File.separator + packageName + fileFormat;
398
399         LOG.info("downloadCsarPackagesById path is :  " + path);
400
401         File csarFile = new File(path);
402         if(!csarFile.exists()) {
403             return Response.status(Status.INTERNAL_SERVER_ERROR).build();
404         }
405
406         LOG.info("downloadCsarPackagesById ABS path is :  " + csarFile.getAbsolutePath());
407
408         try {
409             InputStream fis = new BufferedInputStream(new FileInputStream(csarFile.getAbsolutePath()));
410             return Response.ok(fis).header("Content-Disposition", "attachment; filename=\"" + csarFile.getName() + "\"")
411                     .build();
412         } catch(Exception e1) {
413             LOG.error("download vnf package fail.", e1);
414             return RestUtil.getRestException(e1.getMessage());
415         }
416     }
417
418     /**
419      * get package file uri.
420      *
421      * @param csarId package id
422      * @param relativePath file relative path
423      * @return Response
424      */
425     public Response getCsarFileUri(String csarId) {
426         return downloadCsarPackagesById(csarId);
427     }
428
429     /**
430      * Interface to Update Download count for CSAR ID
431      *
432      * @param csarId
433      * @return
434      */
435     public Response updateDwonloadCount(String csarId) {
436         return handleDownladCountUpdate(csarId) ? Response.ok().build()
437                 : Response.status(Status.EXPECTATION_FAILED).build();
438     }
439
440     /**
441      * Handle downlowa count update
442      *
443      * @param csarId
444      * @return
445      */
446     private boolean handleDownladCountUpdate(String csarId) {
447         boolean bupdateSucess = false;
448         try {
449             PackageManager.getInstance().updateDownloadCount(csarId);
450             bupdateSucess = true;
451         } catch(Exception exp) {
452             LOG.error("Updating Donwload count failed for Package with ID !!! : " + exp.getMessage(), exp);
453         }
454         return bupdateSucess;
455     }
456
457     /**
458      * Interface to Re upload Package
459      *
460      * @param csarId
461      * @param uploadedInputStream
462      * @param fileDetail
463      * @param details
464      * @param head
465      * @return
466      * @throws Exception
467      */
468     public Response reUploadPackage(String csarId, InputStream uploadedInputStream,
469             FormDataContentDisposition fileDetail, String details, HttpHeaders head)
470             {
471         LOG.info("Reupload request Received !!!!");
472
473         // STEP 1: Validate Input Data
474         // ----------------------------
475         boolean bResult = handleDataValidate(csarId, uploadedInputStream, fileDetail);
476         if(!bResult) {
477             LOG.error("Validation of Input received for Package Upload failed during Reload!!!");
478             return Response.status(Status.EXPECTATION_FAILED).build();
479         }
480
481         try {
482             // STEP 2: Delete All Package Data based on package id
483             // ----------------------------------------------------
484             deletePackageDataById(csarId);
485
486             // STEP 3: upload package with same package id
487             // -------------------------------------------
488             return handlePackageUpload(csarId, uploadedInputStream, fileDetail, details, head);
489         } catch(IOException e) {
490             LOG.error("delete package failed", e);
491         }
492         return Response.status(Status.INTERNAL_SERVER_ERROR).build();
493     }
494
495     /**
496      * Interface to get OnBoarding Result by Operation Type
497      *
498      * @param csarId
499      * @param operTypeId
500      * @param operId
501      * @return
502      */
503     public Response getOnBoardingResult(String csarId, String operTypeId, String operId) {
504         LOG.info("getOnBoardingResult request : csarId:" + csarId + " operTypeId:" + operTypeId + " operId:" + operId);
505         try {
506             PackageData packageData = PackageWrapperUtil.getPackageInfoById(csarId);
507             if(null == packageData) {
508                 return Response.status(Response.Status.PRECONDITION_FAILED).build();
509             }
510
511             handleDelayExec(operId);
512
513             OnBoardingResult oOnBoardingResult = FunctionTestHook.getOnBoardingResult(packageData);
514             if(null == oOnBoardingResult) {
515                 return Response.status(Response.Status.PRECONDITION_FAILED).build();
516             }
517             filterOnBoardingResultByOperId(oOnBoardingResult, operId);
518
519             String strResult = ToolUtil.objectToString(oOnBoardingResult);
520             LOG.info("getOnBoardingResult response : " + strResult);
521             return Response.ok(strResult, "application/json").build();
522         } catch(NullPointerException e) {
523             LOG.error("Null param in getOnBoardingResult", e);
524             return Response.status(Response.Status.BAD_REQUEST).build();
525         }
526     }
527
528     private void filterOnBoardingResultByOperId(OnBoardingResult oOnBoardingResult, String operId) {
529         if(0 == operId.compareToIgnoreCase("all")) {
530             return;
531         }
532         if(0 == operId.compareToIgnoreCase("download")) {
533             List<OnBoardingOperResult> operResultListTemp = new ArrayList<>();
534             OnBoardingOperResult operResultListTmp = new OnBoardingOperResult();
535             operResultListTmp.setOperId("download");
536             operResultListTmp.setStatus(0);
537             operResultListTemp.add(operResultListTmp);
538             oOnBoardingResult.setOperResult(operResultListTemp);
539             return;
540         }
541         List<OnBoardingOperResult> operResultListOut = new ArrayList<>();
542         List<OnBoardingOperResult> operResultList = oOnBoardingResult.getOperResult();
543         for(OnBoardingOperResult operResult : operResultList) {
544             if(0 == operResult.getOperId().compareToIgnoreCase(operId)) {
545                 operResultListOut.add(operResult);
546             }
547         }
548         oOnBoardingResult.setOperResult(operResultListOut);
549     }
550
551     /**
552      * Interface to get OnBoarding Status by Operation ID
553      *
554      * @param csarId
555      * @param operTypeId
556      * @return
557      */
558     public Response getOperResultByOperTypeId(String csarId, String operTypeId) {
559         LOG.error("getOnBoardingResult request : csarId:" + csarId + " operTypeId:" + operTypeId);
560         if(null == csarId || null == operTypeId || csarId.isEmpty() || operTypeId.isEmpty()) {
561             return Response.status(Status.BAD_REQUEST).build();
562         }
563
564         PackageData packageData = PackageWrapperUtil.getPackageInfoById(csarId);
565         if(null == packageData) {
566             LOG.error("Failed to find package for PackageID:" + csarId);
567             return Response.status(Status.PRECONDITION_FAILED).build();
568         }
569
570         // Get result key to fetch Function Test Results
571         // ---------------------------------------------
572         String strResult = FunctionTestHook.getFuncTestResults(packageData);
573         if(null == strResult) {
574             LOG.error("NULL reponse for getOperResultByOperTypeId response :" + strResult);
575             return Response.status(Status.INTERNAL_SERVER_ERROR).build();
576         }
577         LOG.info("getOperResultByOperTypeId response :" + strResult);
578         return Response.ok(strResult, MediaType.APPLICATION_JSON).build();
579     }
580
581     private boolean handleDataValidate(String packageId, InputStream uploadedInputStream,
582             FormDataContentDisposition fileDetail) {
583         boolean bvalidateOk = false;
584         if((null != uploadedInputStream) && (fileDetail != null) && !ToolUtil.isEmptyString(packageId)) {
585             bvalidateOk = true;
586         }
587         return bvalidateOk;
588     }
589
590     /**
591      * Interface to get OnBoarding Steps
592      *
593      * @return
594      */
595     public Response getOnBoardingSteps() {
596         LOG.info("Get OnBoarding Steps request Received !!!");
597
598         String filePath = org.onap.vnfsdk.marketplace.filemanage.http.ToolUtil.getAppDeployPath() + File.separator
599                 + "generalconfig/OnBoardingSteps.json";
600         LOG.info("Onboarding Steps Json file Path  :" + filePath);
601
602         OnBoardingSteps oOnBoardingSteps =
603                 (OnBoardingSteps)FileUtil.readJsonDatafFromFile(filePath, OnBoardingSteps.class);
604         if(null == oOnBoardingSteps) {
605             return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build();
606         }
607         String strResult = ToolUtil.objectToString(oOnBoardingSteps);
608         LOG.info("getOnBoardingSteps response :" + strResult);
609         return Response.ok(strResult, MediaType.APPLICATION_JSON).build();
610     }
611
612     private void handleDelayExec(String operId) {
613         if(0 == operId.compareToIgnoreCase(CommonConstant.FunctionTest.FUNCTEST_EXEC)) {
614             try {
615                 Thread.sleep(8000);
616             } catch(InterruptedException e) {
617                 LOG.info("handleDelayExex response : ", e);
618                 Thread.currentThread().interrupt();
619             }
620         }
621     }
622 }