diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/common/CommonConstant.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/common/CommonConstant.java
index e167ae1..c9ea194 100644
--- a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/common/CommonConstant.java
+++ b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/common/CommonConstant.java
@@ -13,125 +13,143 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.onap.vnfsdk.marketplace.common;
 
 public class CommonConstant {
 
-  // Package Status
-  public static final String PACKAGE_STATUS_DELETING = "deleting";
+    // Package Status
+    public static final String PACKAGE_STATUS_DELETING = "deleting";
 
-  public static final String PACKAGE_STATUS_DELETE_FAIL = "deleteFailed";
+    public static final String PACKAGE_STATUS_DELETE_FAIL = "deleteFailed";
 
-  public static final String PACKAGE_XML_FORMAT = "xml";
+    public static final String PACKAGE_XML_FORMAT = "xml";
 
+    public static final String PACKAGE_YAML_FORMAT = "yaml";
 
-  public static final String PACKAGE_YAML_FORMAT = "yaml";
+    // host image progress
 
-  // host image progress
+    public static final String TOSCA_METADATA = "TOSCA-Metadata";
 
-  public static final String TOSCA_METADATA = "TOSCA-Metadata";
+    public static final String CSAR_VERSION_META = "Version";
 
-  public static final String CSAR_VERSION_META = "Version";
+    public static final String CSAR_TYPE_META = "Type";
 
-  public static final String CSAR_TYPE_META = "Type";
+    public static final String CSAR_PROVIDER_META = "Provider";
 
-  public static final String CSAR_PROVIDER_META = "Provider";
+    public static final String DEFINITIONS = "Definitions";
 
-  public static final String DEFINITIONS = "Definitions";
+    public static final String CSAR_META = "csar.meta";
 
-  public static final String CSAR_META = "csar.meta";
+    public static final String MANIFEST = ".mf";
 
-  public static final String MANIFEST = ".mf";
+    public static final String MF_VERSION_META = "vnf_package_version";
 
-  public static final String MF_VERSION_META = "vnf_package_version";
+    public static final String MF_PRODUCT_NAME = "vnf_product_name";
 
-  public static final String MF_PRODUCT_NAME = "vnf_product_name";
+    public static final String MF_PROVIDER_META = "vnf_provider_id";
 
-  public static final String MF_PROVIDER_META = "vnf_provider_id";
+    public static final String MF_RELEASE_DATETIME = "vnf_release_date_time";
 
-  public static final String MF_RELEASE_DATETIME = "vnf_release_date_time";
+    public static final String CSAR_SUFFIX = ".csar";
 
-  public static final String CSAR_SUFFIX = ".csar";
+    public static final String HTTP_HEADER_CONTENT_RANGE = "Content-Range";
 
-  public static final String HTTP_HEADER_CONTENT_RANGE = "Content-Range";
+    public static final String CATALOG_CSAR_DIR_NAME = "/csar";
 
-  public static final  String CATALOG_CSAR_DIR_NAME = "/csar";
+    public static final String REPORT_CSAR_DIR_NAME = "/reports";
 
-  public static final  String REPORT_CSAR_DIR_NAME = "/reports";
+    public static final String COMETD_CHANNEL_PACKAGE_DELETE = "/package/delete";
 
-  public static final String COMETD_CHANNEL_PACKAGE_DELETE = "/package/delete";
+    public static final String SUCCESS_STR = "SUCCESS";
 
-  public static final String SUCCESS_STR = "SUCCESS";
+    public static final int ONBOARDING_THREAD_COUNT = 1;
 
-  public static final int ONBOARDING_THREAD_COUNT = 1;
-  public static final int SUCESS = 0;
-  public static final int FAILED = -1;
+    public static final int SUCESS = 0;
 
-  public static final  String CATALOUGE_UPLOAD_URL = "/onapapi/catalog/v1/csars";
+    public static final int FAILED = -1;
 
-  private CommonConstant (){
-      // Cannot create instance of the class
-  }
+    public static final int HTTP_PORT = 8702;
 
-  public static class functionTest
-  {
-      public static final String FUNCTEST_URL = "/onapapi/vnfsdk/v1/functest/";
-      public static final String FUNCTEST_RESULT_URL = "/onapapi/vnfsdk/v1/functest/download/";
-      public static final String FUNCTEST_OPERTYPE_ID = "functiontest";
-      public static final String FUNCTEST_PACKAGE_EXISTS = "packageExists";
-      public static final String FUNCTEST_EXEC = "functestexec";
+    public static final int HTTPS_PORT = 8702;
 
-      private functionTest() {
-      }
-  }
+    public static final String BASE_URL = "/onapui/vnfmarket";
 
-  public static class HttpContext {
+    public static final String CATALOUGE_UPLOAD_URL = "/onapapi/catalog/v1/csars";
 
-      public static final String CONTENT_TYPE = "Content-Type";
+    private CommonConstant() {
+        // Cannot create instance of the class
+    }
 
-      public static final String MEDIA_TYPE_JSON = "application/json;charset=UTF-8";
+    public static class functionTest {
 
-      public static final String URL = "url";
+        public static final String FUNCTEST_URL = "/onapapi/vnfsdk/v1/functest/";
 
-      public static final String METHOD_TYPE = "methodType";
+        public static final String FUNCTEST_RESULT_URL = "/onapapi/vnfsdk/v1/functest/download/";
 
-      private HttpContext() {
-      }
-  }
+        public static final String FUNCTEST_OPERTYPE_ID = "functiontest";
 
-  public static class LifeCycleTest
-  {
-      public static final String LIFECYCLE_TEST_URL = "/onapapi/nslcm/v1/vnfpackage";
-      public static final String LIFECYCLE_TEST_OPERTYPE_ID = "lifecycletest";
-      public static final String LIFECYCLE_TEST_EXEC = "lifecycleTestexec";
-      private LifeCycleTest() {
-      }
-  }
+        public static final String FUNCTEST_PACKAGE_EXISTS = "packageExists";
 
-  public static class MethodType {
+        public static final String FUNCTEST_EXEC = "functestexec";
 
-      public static final String POST = "post";
+        private functionTest() {
+        }
+    }
 
-      public static final String DELETE = "delete";
+    public static class HttpContext {
 
-      public static final String PUT = "put";
+        public static final String CONTENT_TYPE = "Content-Type";
 
-      public static final String GET = "get";
+        public static final String MEDIA_TYPE_JSON = "application/json;charset=UTF-8";
 
-      private MethodType() {
-      }
-  }
+        public static final String URL = "url";
 
-  public static class MsbRegisterCode {
+        public static final String METHOD_TYPE = "methodType";
 
-      public static final int MSDB_REGISTER_RETRIES = 12;
-      public static final int MSDB_REGISTER_RETRY_SLEEP = 10000;
+        private HttpContext() {
+        }
+    }
 
-      public static final int MSDB_REGISTER_FILE_NOT_EXISTS = 2;
-      public static final int MSDB_REGISTER_SUCESS = 0;
-      public static final int MSDB_REGISTER_FAILED = -1;
-      private MsbRegisterCode() {
-      }
-  }
+    public static class LifeCycleTest {
+
+        public static final String LIFECYCLE_TEST_URL = "/onapapi/nslcm/v1/vnfpackage";
+
+        public static final String LIFECYCLE_TEST_OPERTYPE_ID = "lifecycletest";
+
+        public static final String LIFECYCLE_TEST_EXEC = "lifecycleTestexec";
+
+        private LifeCycleTest() {
+        }
+    }
+
+    public static class MethodType {
+
+        public static final String POST = "post";
+
+        public static final String DELETE = "delete";
+
+        public static final String PUT = "put";
+
+        public static final String GET = "get";
+
+        private MethodType() {
+        }
+    }
+
+    public static class MsbRegisterCode {
+
+        public static final int MSDB_REGISTER_RETRIES = 12;
+
+        public static final int MSDB_REGISTER_RETRY_SLEEP = 10000;
+
+        public static final int MSDB_REGISTER_FILE_NOT_EXISTS = 2;
+
+        public static final int MSDB_REGISTER_SUCESS = 0;
+
+        public static final int MSDB_REGISTER_FAILED = -1;
+
+        private MsbRegisterCode() {
+        }
+    }
 }
-
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/resource/PackageResource.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/resource/PackageResource.java
index 7e50eab..f8f4f54 100644
--- a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/resource/PackageResource.java
+++ b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/resource/PackageResource.java
@@ -13,6 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.onap.vnfsdk.marketplace.resource;
 
 import java.io.IOException;
@@ -35,11 +36,16 @@
 import org.eclipse.jetty.http.HttpStatus;
 import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
 import org.glassfish.jersey.media.multipart.FormDataParam;
+import org.onap.vnfsdk.marketplace.common.CommonConstant;
 import org.onap.vnfsdk.marketplace.db.exception.MarketplaceResourceException;
+import org.onap.vnfsdk.marketplace.db.resource.PackageManager;
 import org.onap.vnfsdk.marketplace.entity.response.CsarFileUriResponse;
 import org.onap.vnfsdk.marketplace.entity.response.PackageMeta;
 import org.onap.vnfsdk.marketplace.entity.response.UploadPackageResponse;
 import org.onap.vnfsdk.marketplace.onboarding.entity.OnBoardingResult;
+import org.onap.vnfsdk.marketplace.rest.RestConstant;
+import org.onap.vnfsdk.marketplace.rest.RestResponse;
+import org.onap.vnfsdk.marketplace.rest.RestfulClient;
 import org.onap.vnfsdk.marketplace.wrapper.PackageWrapper;
 
 import io.swagger.annotations.Api;
@@ -52,7 +58,6 @@
  * csar package service.
  *
  * @author 10189609
- *
  */
 @Path("/PackageResource")
 @Api(tags = {"Package Resource"})
@@ -64,78 +69,59 @@
     @Consumes(MediaType.APPLICATION_JSON)
     @Produces(MediaType.APPLICATION_JSON)
     @ApiResponses(value = {
-            @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found",
-                    response = String.class),
-            @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415,
-                    message = "Unprocessable MicroServiceInfo Entity ", response = String.class),
-            @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "update  error",
-                    response = String.class)})
-    public Response updateValidateStatus(
-            @ApiParam(value = "http request body") @Context HttpServletRequest request,
-            @ApiParam(value = "http header") @Context HttpHeaders head
-    ) throws IOException {
+                    @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", response = String.class),
+                    @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, message = "Unprocessable MicroServiceInfo Entity ", response = String.class),
+                    @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "update  error", response = String.class)})
+    public Response updateValidateStatus(@ApiParam(value = "http request body") @Context HttpServletRequest request,
+            @ApiParam(value = "http header") @Context HttpHeaders head) throws IOException {
         InputStream input = request.getInputStream();
         return PackageWrapper.getInstance().updateValidateStatus(input);
 
     }
 
-
     @Path("/csars")
     @GET
-    @ApiOperation(value = "get csar package list by condition", response = PackageMeta.class,
-    responseContainer = "List")
+    @ApiOperation(value = "get csar package list by condition", response = PackageMeta.class, responseContainer = "List")
     @Produces(MediaType.APPLICATION_JSON)
     @ApiResponses(value = {
-            @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found",
-                    response = String.class),
-            @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415,
-            message = "Unprocessable MicroServiceInfo Entity ", response = String.class),
-            @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "resource grant error",
-            response = String.class)})
-    public Response queryPackageListByCond(
-            @ApiParam(value = "csar name") @QueryParam("name") String name, @ApiParam(
-                    value = "csar provider") @QueryParam("provider") String provider, @ApiParam(
-                            value = "csar version") @QueryParam("version") String version, @ApiParam(
-                                    value = "delay to delete") @QueryParam("deletionPending") String deletionPending,
+                    @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", response = String.class),
+                    @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, message = "Unprocessable MicroServiceInfo Entity ", response = String.class),
+                    @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "resource grant error", response = String.class)})
+    public Response queryPackageListByCond(@ApiParam(value = "csar name") @QueryParam("name") String name,
+            @ApiParam(value = "csar provider") @QueryParam("provider") String provider,
+            @ApiParam(value = "csar version") @QueryParam("version") String version,
+            @ApiParam(value = "delay to delete") @QueryParam("deletionPending") String deletionPending,
             @ApiParam(value = "csar type") @QueryParam("type") String type) {
-        return PackageWrapper.getInstance().queryPackageListByCond(name, provider, version,
-                deletionPending, type);
+        return PackageWrapper.getInstance().queryPackageListByCond(name, provider, version, deletionPending, type);
     }
 
     @Path("/csars/{csarId}")
     @GET
-    @ApiOperation(value = "get csar package list", response = PackageMeta.class,
-    responseContainer = "List")
+    @ApiOperation(value = "get csar package list", response = PackageMeta.class, responseContainer = "List")
     @Produces(MediaType.APPLICATION_JSON)
     @ApiResponses(value = {
-            @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found",
-                    response = String.class),
-            @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415,
-            message = "Unprocessable MicroServiceInfo Entity ", response = String.class),
-            @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "resource grant error",
-            response = String.class)})
-    public Response queryPackageById(
-            @ApiParam(value = "csar id") @PathParam("csarId") String csarId) {
+                    @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", response = String.class),
+                    @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, message = "Unprocessable MicroServiceInfo Entity ", response = String.class),
+                    @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "resource grant error", response = String.class)})
+    public Response queryPackageById(@ApiParam(value = "csar id") @PathParam("csarId") String csarId) {
         return PackageWrapper.getInstance().queryPackageById(csarId);
     }
+
     @Path("/csars")
     @POST
     @ApiOperation(value = "upload csar package", response = UploadPackageResponse.class)
     @Consumes(MediaType.MULTIPART_FORM_DATA)
     @Produces(MediaType.APPLICATION_JSON)
     @ApiResponses(value = {
-            @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found",
-                    response = String.class),
-            @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415,
-            message = "Unprocessable MicroServiceInfo Entity ", response = String.class),
-            @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "resource grant error",
-            response = String.class)})
+                    @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", response = String.class),
+                    @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, message = "Unprocessable MicroServiceInfo Entity ", response = String.class),
+                    @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "resource grant error", response = String.class)})
     public Response uploadPackage(
-            @ApiParam(value = "file inputstream",
-            required = true) @FormDataParam("file") InputStream uploadedInputStream,@FormDataParam("params") String details,
-            @ApiParam(value = "file detail",
-            required = false) @FormDataParam("file") FormDataContentDisposition fileDetail,
-            @ApiParam(value = "http header") @Context HttpHeaders head) throws IOException, MarketplaceResourceException {
+            @ApiParam(value = "file inputstream", required = true) @FormDataParam("file") InputStream uploadedInputStream,
+            @FormDataParam("params") String details,
+            @ApiParam(value = "file detail", required = false) @FormDataParam("file") FormDataContentDisposition fileDetail,
+            @ApiParam(value = "http header") @Context HttpHeaders head)
+            throws IOException, MarketplaceResourceException {
         return PackageWrapper.getInstance().uploadPackage(uploadedInputStream, fileDetail, details, head);
     }
 
@@ -143,12 +129,9 @@
     @DELETE
     @ApiOperation(value = "delete a package")
     @ApiResponses(value = {
-            @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found",
-                    response = String.class),
-            @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415,
-            message = "Unprocessable MicroServiceInfo Entity ", response = String.class),
-            @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "resource grant error",
-            response = String.class)})
+                    @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", response = String.class),
+                    @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, message = "Unprocessable MicroServiceInfo Entity ", response = String.class),
+                    @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "resource grant error", response = String.class)})
     public Response delPackage(@ApiParam(value = "csar Id") @PathParam("csarId") String csarId) {
         return PackageWrapper.getInstance().delPackage(csarId);
     }
@@ -158,20 +141,16 @@
     @ApiOperation(value = "get csar file uri by csarId", response = CsarFileUriResponse.class)
     @Produces(MediaType.APPLICATION_JSON)
     @ApiResponses(value = {
-            @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found",
-                    response = String.class),
-            @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415,
-            message = "Unprocessable MicroServiceInfo Entity ", response = String.class),
-            @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "resource grant error",
-            response = String.class)})
-    public Response getCsarFileUri(
-            @ApiParam(value = "csar Id", required = true) @PathParam("csarId") String csarId) {
+                    @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", response = String.class),
+                    @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, message = "Unprocessable MicroServiceInfo Entity ", response = String.class),
+                    @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "resource grant error", response = String.class)})
+    public Response getCsarFileUri(@ApiParam(value = "csar Id", required = true) @PathParam("csarId") String csarId) {
         return PackageWrapper.getInstance().getCsarFileUri(csarId);
     }
 
     @Path("/csars/{csarId}/downloaded")
     @GET
-    @ApiOperation(value = "update download count for a package",response = Response.class)
+    @ApiOperation(value = "update download count for a package", response = Response.class)
     public Response updateDwonloadCount(@ApiParam(value = "csar Id") @PathParam("csarId") String csarId) {
         return PackageWrapper.getInstance().updateDwonloadCount(csarId);
     }
@@ -182,30 +161,25 @@
     @Consumes(MediaType.MULTIPART_FORM_DATA)
     @Produces(MediaType.APPLICATION_JSON)
     @ApiResponses(value = {
-            @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found",
-                    response = String.class),
-            @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415,
-            message = "Unprocessable MicroServiceInfo Entity ", response = String.class),
-            @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "resource grant error",
-            response = String.class)})
-    public Response reUploadPackage(
-            @ApiParam(value = "csar Id") @PathParam("csarId") String csarId,
-            @ApiParam(value = "file inputstream",
-            required = true) @FormDataParam("file") InputStream uploadedInputStream,@FormDataParam("params") String details,
-            @ApiParam(value = "file detail",
-            required = false) @FormDataParam("file") FormDataContentDisposition fileDetail,
-            @ApiParam(value = "http header") @Context HttpHeaders head) throws IOException, MarketplaceResourceException {
-        return PackageWrapper.getInstance().reUploadPackage(csarId,uploadedInputStream, fileDetail, details, head);
+                    @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", response = String.class),
+                    @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, message = "Unprocessable MicroServiceInfo Entity ", response = String.class),
+                    @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "resource grant error", response = String.class)})
+    public Response reUploadPackage(@ApiParam(value = "csar Id") @PathParam("csarId") String csarId,
+            @ApiParam(value = "file inputstream", required = true) @FormDataParam("file") InputStream uploadedInputStream,
+            @FormDataParam("params") String details,
+            @ApiParam(value = "file detail", required = false) @FormDataParam("file") FormDataContentDisposition fileDetail,
+            @ApiParam(value = "http header") @Context HttpHeaders head)
+            throws IOException, MarketplaceResourceException {
+        return PackageWrapper.getInstance().reUploadPackage(csarId, uploadedInputStream, fileDetail, details, head);
     }
 
     @Path("/csars/{csarId}/onboardstatus")
     @GET
-    @ApiOperation(value="Get VNF OnBoarding Result", response=OnBoardingResult.class)
+    @ApiOperation(value = "Get VNF OnBoarding Result", response = OnBoardingResult.class)
     @Produces(MediaType.APPLICATION_JSON)
     public Response getOnBoardingResult(@ApiParam("csar Id") @PathParam("csarId") String csarId,
             @ApiParam("operation type") @QueryParam("operTypeId") String operTypeId,
-            @ApiParam("operation id") @QueryParam("operId") String operId)
-    {
+            @ApiParam("operation id") @QueryParam("operId") String operId) {
         return PackageWrapper.getInstance().getOnBoardingResult(csarId, operTypeId, operId);
     }
 
@@ -215,16 +189,36 @@
     @Produces(MediaType.APPLICATION_JSON)
     public Response getOperStatus(@ApiParam(value = "csar Id") @PathParam("csarId") String csarId,
             @ApiParam(value = "operation type") @QueryParam("operTypeId") String operTypeId) {
-        return PackageWrapper.getInstance().getOperResultByOperTypeId(csarId,operTypeId);
+        return PackageWrapper.getInstance().getOperResultByOperTypeId(csarId, operTypeId);
     }
 
     @Path("/csars/onboardsteps")
     @GET
-    @ApiOperation(value="Get VNF OnBoarded Steps", response=Response.class)
+    @ApiOperation(value = "Get VNF OnBoarded Steps", response = Response.class)
     @Produces(MediaType.APPLICATION_JSON)
-    public Response getOnBoardingSteps()
-    {
+    public Response getOnBoardingSteps() {
         return PackageWrapper.getInstance().getOnBoardingSteps();
     }
-}
 
+    @Path("/healthcheck")
+    @GET
+    @ApiOperation(value = "Health for VNF Repository", response = Response.class)
+    @Produces(MediaType.APPLICATION_JSON)
+    public Response healthCheck() {
+
+        // Step 1: Check whether tomcat server is up
+        RestResponse resp = RestfulClient.get("127.0.0.1", CommonConstant.HTTP_PORT, CommonConstant.BASE_URL);
+        if(RestConstant.RESPONSE_CODE_200 != resp.getStatusCode()) {
+            return Response.serverError().build();
+        }
+
+        // Step 2: Check whether postgres database is up
+        try {
+            PackageManager.getInstance().queryPackageByCsarId("01");
+        } catch(Exception e) {
+            return Response.serverError().build();
+        }
+
+        return Response.ok().build();
+    }
+}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/wrapper/PackageWrapperUtil.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/wrapper/PackageWrapperUtil.java
index ab94e98..3fbf584 100644
--- a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/wrapper/PackageWrapperUtil.java
+++ b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/wrapper/PackageWrapperUtil.java
@@ -13,6 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.onap.vnfsdk.marketplace.wrapper;
 
 import java.io.BufferedReader;
@@ -40,400 +41,398 @@
 
 import com.google.gson.internal.LinkedTreeMap;
 
-
 public class PackageWrapperUtil {
-  private static final Logger LOG = LoggerFactory.getLogger(PackageWrapperUtil.class);
 
-  private PackageWrapperUtil() {
-  }
+    private static final Logger LOG = LoggerFactory.getLogger(PackageWrapperUtil.class);
 
-  public static long getPacakgeSize(String fileLocation) {
-    File file = new File(fileLocation);
-    return file.length();
-  }
-
-  /**
-   * change package metadata to fix database.
-   * @param meta package metadata
- * @param details
-   * @return package data in database
-   */
-  public static PackageData getPackageData(PackageMeta meta) {
-    PackageData packageData = new PackageData();
-    packageData.setCreateTime(meta.getCreateTime());
-    packageData.setDeletionPending(String.valueOf(meta.isDeletionPending()));
-    packageData.setDownloadUri(meta.getDownloadUri());
-    packageData.setFormat(meta.getFormat());
-    packageData.setModifyTime(meta.getModifyTime());
-    packageData.setName(meta.getName());
-    packageData.setCsarId(meta.getCsarId());
-    packageData.setProvider(meta.getProvider());
-    String fileSize = meta.getSize();
-    packageData.setSize(fileSize);
-    packageData.setType(meta.getType());
-    packageData.setVersion(meta.getVersion());
-    packageData.setDetails(meta.getDetails());
-    packageData.setShortDesc(meta.getShortDesc());
-    packageData.setRemarks(meta.getRemarks());
-    return packageData;
-  }
-
-  /**
-   * judge wether is the end of upload package.
-   * @param contentRange package sise range
-   * @param csarName package name
-   * @return boolean
-   */
-  public static boolean isUploadEnd(String contentRange) {
-    String range = contentRange;
-    range = range.replace("bytes", "").trim();
-    range = range.substring(0, range.indexOf("/"));
-    String size =
-        contentRange.substring(contentRange.indexOf("/") + 1, contentRange.length()).trim();
-    int fileSize = Integer.parseInt(size);
-    String[] ranges = range.split("-");
-    int endPosition = Integer.parseInt(ranges[1]) + 1;
-    if (endPosition >= fileSize) {
-      return true;
-    }
-    return false;
-  }
-
-  /**
-   * get package detail by package id.
-   * @param csarId package id
-   * @return package detail
-   */
-  public static PackageData getPackageInfoById(String csarId) {
-    PackageData result = new PackageData();
-    List<PackageData> packageDataList = new ArrayList<>();
-    try {
-      packageDataList = PackageManager.getInstance().queryPackageByCsarId(csarId);
-      if (packageDataList != null && ! packageDataList.isEmpty()) {
-        result = PackageManager.getInstance().queryPackageByCsarId(csarId).get(0);
-      }
-    } catch (MarketplaceResourceException e1) {
-      LOG.error("query package by csarId from db error ! " + e1.getMessage(), e1);
-    }
-    return result;
-  }
-
-  /**
-   * get package metadata from basic info.
-   * @param fileName package name
-   * @param fileLocation the location of package
-   * @param basic basic infomation of package. include version, type and provider
-   * @return package metadata
-   */
-  public static PackageMeta getPackageMeta(String packageId, String fileName, String fileLocation,
-    PackageBasicInfo basic, String details) {
-    PackageMeta packageMeta = new PackageMeta();
-    long size = getPacakgeSize(fileLocation);
-    packageMeta.setFormat(basic.getFormat());
-    String usedPackageId = packageId;
-    if(null == packageId)
-    {
-        usedPackageId = ToolUtil.generateId();
+    private PackageWrapperUtil() {
     }
 
-    packageMeta.setCsarId(usedPackageId);
-
-    packageMeta.setName(fileName.replace(CommonConstant.CSAR_SUFFIX, ""));
-    packageMeta.setType(basic.getType().toString());
-    packageMeta.setVersion(basic.getVersion());
-    packageMeta.setProvider(basic.getProvider());
-    packageMeta.setDeletionPending(false);
-    String sizeStr = ToolUtil.getFormatFileSize(size);
-    packageMeta.setSize(sizeStr);
-    SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-    String currentTime = sdf1.format(new Date());
-    packageMeta.setCreateTime(currentTime);
-    packageMeta.setModifyTime(currentTime);
-    if(null != details)
-    {
-    LinkedTreeMap<String,String> csarDetails = ToolUtil.fromJson(details, LinkedTreeMap.class);
-    packageMeta.setDetails(csarDetails.get("details"));
-    packageMeta.setShortDesc(csarDetails.get("shortDesc"));
-    packageMeta.setRemarks(csarDetails.get("remarks"));
+    public static long getPacakgeSize(String fileLocation) {
+        File file = new File(fileLocation);
+        return file.length();
     }
-    return packageMeta;
-  }
 
-  /**
-   * get downloadUri from package metadata.
-   * @param csarId package id
-   * @return download uri
-   */
-  public static String getPackagePath(String csarId) {
-    List<PackageData> packageList = new ArrayList<>();
-    String downloadUri = null;
-    try {
-      packageList = PackageManager.getInstance().queryPackageByCsarId(csarId);
-      downloadUri = packageList.get(0).getDownloadUri();
-    } catch (MarketplaceResourceException e1) {
-      LOG.error("Query CSAR package by ID failed ! csarId = " + csarId, e1);
+    /**
+     * change package metadata to fix database.
+     * 
+     * @param meta package metadata
+     * @param details
+     * @return package data in database
+     */
+    public static PackageData getPackageData(PackageMeta meta) {
+        PackageData packageData = new PackageData();
+        packageData.setCreateTime(meta.getCreateTime());
+        packageData.setDeletionPending(String.valueOf(meta.isDeletionPending()));
+        packageData.setDownloadUri(meta.getDownloadUri());
+        packageData.setFormat(meta.getFormat());
+        packageData.setModifyTime(meta.getModifyTime());
+        packageData.setName(meta.getName());
+        packageData.setCsarId(meta.getCsarId());
+        packageData.setProvider(meta.getProvider());
+        String fileSize = meta.getSize();
+        packageData.setSize(fileSize);
+        packageData.setType(meta.getType());
+        packageData.setVersion(meta.getVersion());
+        packageData.setDetails(meta.getDetails());
+        packageData.setShortDesc(meta.getShortDesc());
+        packageData.setRemarks(meta.getRemarks());
+        return packageData;
     }
-    return downloadUri;
-  }
 
-
-  /**
-   * get package name from ftpUrl.
-   * @param ftpUrl ftp url
-   * @return package name
-   */
-  public static String getPackageName(String ftpUrl) {
-    int index = ftpUrl.lastIndexOf("/");
-   
-    return ftpUrl.substring(index);
-  }
-
-  /**
-   * translate package data from database to package metadata.
-   * @param dbResult data from database
-   * @return package metadata list
-   */
-  public static List<PackageMeta> packageDataList2PackageMetaList(
-      List<PackageData> dbResult) {
-    ArrayList<PackageMeta> metas = new ArrayList<>();
-    if (! dbResult.isEmpty()) {
-      for (int i = 0; i < dbResult.size(); i++) {
-        PackageData data = dbResult.get(i);
-        PackageMeta meta = packageData2PackageMeta(data);
-        metas.add(meta);
-      }
-    }
-    return metas;
-  }
-
-  public static PackageMeta packageData2PackageMeta(PackageData packageData) {
-    PackageMeta meta = new PackageMeta();
-    meta.setCsarId(packageData.getCsarId());
-    meta.setCreateTime(packageData.getCreateTime());
-    meta.setDeletionPending(Boolean.getBoolean(packageData.getDeletionPending()));
-    String packageUri =
-        packageData.getDownloadUri() + packageData.getName() + CommonConstant.CSAR_SUFFIX;
-    String packageUrl = getUrl(packageUri);
-    meta.setDownloadUri(packageUrl);
-    meta.setReport(packageData.getReport());
-    meta.setFormat(packageData.getFormat());
-    meta.setModifyTime(packageData.getModifyTime());
-    meta.setName(packageData.getName());
-    meta.setDetails(packageData.getDetails());
-    meta.setProvider(packageData.getProvider());
-    meta.setSize(packageData.getSize());
-    meta.setType(packageData.getType());
-    meta.setShortDesc(packageData.getShortDesc());
-    meta.setVersion(packageData.getVersion());
-    meta.setRemarks(packageData.getRemarks());
-    meta.setDownloadCount(packageData.getDownloadCount());
-    return meta;
-  }
-
-  /**
-   * add msb address as prefix to uri.
-   * @param uri uri
-   * @return url
-   */
-  public static String getUrl(String uri) {
-    String url = getDownloadUriHead();
-    if (url.endsWith("/") && uri.startsWith("/")) {
-      url += uri.substring(1);
-    } else {
-      url += uri;
-    }
-    return url.replace("\\", "/");
-  }
-
-  public static String getDownloadUriHead() {
-    return MsbAddrConfig.getMsbAddress() + "/files/catalog-http";
-  }
-
-  /**
-   * get local path.
-   * @param uri uri
-   * @return local path
-   */
-  public static String getLocalPath(String uri) {
-    File srcDir = new File(uri);
-    String localPath = srcDir.getAbsolutePath();
-    return localPath.replace("\\", "/");
-  }
-
-  /**
-   * get package basic information.
-   * @param fileLocation package location
-   * @return package basic information
-   */
-  public static PackageBasicInfo getPacageBasicInfo(String fileLocation) {
-    PackageBasicInfo basicInfo = new PackageBasicInfo();
-    String unzipDir = ToolUtil.getUnzipDir(fileLocation);
-    boolean isXmlCsar = false;
-    try {
-      String tempfolder = unzipDir;
-      List<String> unzipFiles = FileUtil.unzip(fileLocation, tempfolder);
-      if (unzipFiles.isEmpty()) {
-        isXmlCsar = true;
-      }
-      for (String unzipFile : unzipFiles) {
-        if (unzipFile.endsWith(CommonConstant.MANIFEST)) {
-          basicInfo = readManifest(unzipFile);
+    /**
+     * judge wether is the end of upload package.
+     * 
+     * @param contentRange package sise range
+     * @param csarName package name
+     * @return boolean
+     */
+    public static boolean isUploadEnd(String contentRange) {
+        String range = contentRange;
+        range = range.replace("bytes", "").trim();
+        range = range.substring(0, range.indexOf("/"));
+        String size = contentRange.substring(contentRange.indexOf("/") + 1, contentRange.length()).trim();
+        int fileSize = Integer.parseInt(size);
+        String[] ranges = range.split("-");
+        int endPosition = Integer.parseInt(ranges[1]) + 1;
+        if(endPosition >= fileSize) {
+            return true;
         }
-        
-        if (unzipFile.endsWith(CommonConstant.CSAR_META)) {
-            basicInfo = readMetaData(unzipFile);
+        return false;
+    }
+
+    /**
+     * get package detail by package id.
+     * 
+     * @param csarId package id
+     * @return package detail
+     */
+    public static PackageData getPackageInfoById(String csarId) {
+        PackageData result = new PackageData();
+        List<PackageData> packageDataList = new ArrayList<>();
+        try {
+            packageDataList = PackageManager.getInstance().queryPackageByCsarId(csarId);
+            if(packageDataList != null && !packageDataList.isEmpty()) {
+                result = packageDataList.get(0);
+            }
+        } catch(MarketplaceResourceException e1) {
+            LOG.error("query package by csarId from db error ! " + e1.getMessage(), e1);
         }
-        
-        if (ToolUtil.isYamlFile(new File(unzipFile))) {
-          isXmlCsar = false;
+        return result;
+    }
+
+    /**
+     * get package metadata from basic info.
+     * 
+     * @param fileName package name
+     * @param fileLocation the location of package
+     * @param basic basic infomation of package. include version, type and provider
+     * @return package metadata
+     */
+    public static PackageMeta getPackageMeta(String packageId, String fileName, String fileLocation,
+            PackageBasicInfo basic, String details) {
+        PackageMeta packageMeta = new PackageMeta();
+        long size = getPacakgeSize(fileLocation);
+        packageMeta.setFormat(basic.getFormat());
+        String usedPackageId = packageId;
+        if(null == packageId) {
+            usedPackageId = ToolUtil.generateId();
         }
-      }
-    } catch (IOException e1) {
-      LOG.error("judge package type error ! " + e1.getMessage(), e1);
-    }
-    if (isXmlCsar) {
-      basicInfo.setFormat(CommonConstant.PACKAGE_XML_FORMAT);
-    } else {
-      basicInfo.setFormat(CommonConstant.PACKAGE_YAML_FORMAT);
-    }
-    return basicInfo;
-  }
 
-  /**
-   * Reads the manifest file in the package and fills the basic infor about package
-   * @param unzipFile
-   * @return basic infor about package
-   */
-  private static PackageBasicInfo readMetaData(String unzipFile) {
+        packageMeta.setCsarId(usedPackageId);
 
-    // Fix the package type to CSAR, temporary
-    PackageBasicInfo basicInfo = new PackageBasicInfo();
-    basicInfo.setType(EnumType.CSAR);
-
-    File file = new File(unzipFile);
-    try (BufferedReader reader = new BufferedReader(new FileReader(file))) {
-
-      for(String tempString; (tempString = reader.readLine()) != null;)
-      {
-          // If line is empty, ignore
-          if ("".equals(tempString)) {
-            continue;
-          }
-
-          int count1 = tempString.indexOf(":");
-          String meta = tempString.substring(0, count1).trim();
-
-          // Check for the package provider name
-          if (meta.equalsIgnoreCase(CommonConstant.CSAR_PROVIDER_META)) {
-            int count = tempString.indexOf(":") + 1;
-            basicInfo.setProvider(tempString.substring(count).trim());
-          }
-
-          // Check for package version
-          if (meta.equalsIgnoreCase(CommonConstant.CSAR_VERSION_META)) {
-            int count = tempString.indexOf(":") + 1;
-            basicInfo.setVersion(tempString.substring(count).trim());
-          }
-          
-       // Check for package type
-          if (meta.equalsIgnoreCase(CommonConstant.CSAR_TYPE_META)) {
-            int count = tempString.indexOf(":") + 1;
-           
-            basicInfo.setType(getEnumType(tempString.substring(count).trim()));
-          }
-      }
-
-      reader.close();
-    } catch (IOException e) {
-      LOG.error("Exception while parsing manifest file" + e, e);
+        packageMeta.setName(fileName.replace(CommonConstant.CSAR_SUFFIX, ""));
+        packageMeta.setType(basic.getType().toString());
+        packageMeta.setVersion(basic.getVersion());
+        packageMeta.setProvider(basic.getProvider());
+        packageMeta.setDeletionPending(false);
+        String sizeStr = ToolUtil.getFormatFileSize(size);
+        packageMeta.setSize(sizeStr);
+        SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        String currentTime = sdf1.format(new Date());
+        packageMeta.setCreateTime(currentTime);
+        packageMeta.setModifyTime(currentTime);
+        if(null != details) {
+            LinkedTreeMap<String, String> csarDetails = ToolUtil.fromJson(details, LinkedTreeMap.class);
+            packageMeta.setDetails(csarDetails.get("details"));
+            packageMeta.setShortDesc(csarDetails.get("shortDesc"));
+            packageMeta.setRemarks(csarDetails.get("remarks"));
+        }
+        return packageMeta;
     }
 
-    return basicInfo;
-  }
-  
-  private static EnumType getEnumType (String type)
-  {
-	  EnumType vnfType = EnumType.CSAR;
-	  if (type == "CSAR")
-	  {
-		  vnfType = EnumType.CSAR;
-	  }
-	  
-	  if (type == "GSAR")
-	  {
-		  vnfType = EnumType.GSAR;
-	  }
-	  
-	  if (type == "NSAR")
-	  {
-		  vnfType = EnumType.NSAR;
-	  }
-	  
-	  if (type == "SSAR")
-	  {
-		  vnfType = EnumType.SSAR;
-	  }
-	  
-	  if (type == "NFAR")
-	  {
-		  vnfType = EnumType.NFAR;
-	  }
-	  
-	  return vnfType;
-  }
-  
-  private static PackageBasicInfo readManifest(String unzipFile) {
-
-	    // Fix the package type to CSAR, temporary
-	    PackageBasicInfo basicInfo = new PackageBasicInfo();
-	    basicInfo.setType(EnumType.CSAR);
-
-	    File file = new File(unzipFile);
-	    try (BufferedReader reader = new BufferedReader(new FileReader(file))) {
-
-	      for(String tempString; (tempString = reader.readLine()) != null;)
-	      {
-	          // If line is empty, ignore
-	          if ("".equals(tempString)) {
-	            continue;
-	          }
-
-	          int count1 = tempString.indexOf(":");
-	          String meta = tempString.substring(0, count1).trim();
-
-	          // Check for the package provider name
-	          if (meta.equalsIgnoreCase(CommonConstant.MF_PROVIDER_META)) {
-	            int count = tempString.indexOf(":") + 1;
-	            basicInfo.setProvider(tempString.substring(count).trim());
-	          }
-
-	          // Check for package version
-	          if (meta.equalsIgnoreCase(CommonConstant.MF_VERSION_META)) {
-	            int count = tempString.indexOf(":") + 1;
-	            basicInfo.setVersion(tempString.substring(count).trim());
-	          }
-	      }
-
-	      reader.close();
-	    } catch (IOException e) {
-	      LOG.error("Exception while parsing manifest file" + e, e);
-	    }
-
-	    return basicInfo;
-	  }
-  /**
-   * get package format enum.
-   * @param format package format
-   * @return package format enum
-   */
-  public static EnumPackageFormat getPackageFormat(String format) {
-    if ("xml".equals(format)) {
-      return EnumPackageFormat.TOSCA_XML;
-    } else if ("yml".equals(format) || "yaml".equals(format)) {
-      return EnumPackageFormat.TOSCA_YAML;
-    } else {
-      return null;
+    /**
+     * get downloadUri from package metadata.
+     * 
+     * @param csarId package id
+     * @return download uri
+     */
+    public static String getPackagePath(String csarId) {
+        List<PackageData> packageList = new ArrayList<>();
+        String downloadUri = null;
+        try {
+            packageList = PackageManager.getInstance().queryPackageByCsarId(csarId);
+            downloadUri = packageList.get(0).getDownloadUri();
+        } catch(MarketplaceResourceException e1) {
+            LOG.error("Query CSAR package by ID failed ! csarId = " + csarId, e1);
+        }
+        return downloadUri;
     }
-  }
+
+    /**
+     * get package name from ftpUrl.
+     * 
+     * @param ftpUrl ftp url
+     * @return package name
+     */
+    public static String getPackageName(String ftpUrl) {
+        int index = ftpUrl.lastIndexOf("/");
+
+        return ftpUrl.substring(index);
+    }
+
+    /**
+     * translate package data from database to package metadata.
+     * 
+     * @param dbResult data from database
+     * @return package metadata list
+     */
+    public static List<PackageMeta> packageDataList2PackageMetaList(List<PackageData> dbResult) {
+        ArrayList<PackageMeta> metas = new ArrayList<>();
+        if(!dbResult.isEmpty()) {
+            for(int i = 0; i < dbResult.size(); i++) {
+                PackageData data = dbResult.get(i);
+                PackageMeta meta = packageData2PackageMeta(data);
+                metas.add(meta);
+            }
+        }
+        return metas;
+    }
+
+    public static PackageMeta packageData2PackageMeta(PackageData packageData) {
+        PackageMeta meta = new PackageMeta();
+        meta.setCsarId(packageData.getCsarId());
+        meta.setCreateTime(packageData.getCreateTime());
+        meta.setDeletionPending(Boolean.getBoolean(packageData.getDeletionPending()));
+        String packageUri = packageData.getDownloadUri() + packageData.getName() + CommonConstant.CSAR_SUFFIX;
+        String packageUrl = getUrl(packageUri);
+        meta.setDownloadUri(packageUrl);
+        meta.setReport(packageData.getReport());
+        meta.setFormat(packageData.getFormat());
+        meta.setModifyTime(packageData.getModifyTime());
+        meta.setName(packageData.getName());
+        meta.setDetails(packageData.getDetails());
+        meta.setProvider(packageData.getProvider());
+        meta.setSize(packageData.getSize());
+        meta.setType(packageData.getType());
+        meta.setShortDesc(packageData.getShortDesc());
+        meta.setVersion(packageData.getVersion());
+        meta.setRemarks(packageData.getRemarks());
+        meta.setDownloadCount(packageData.getDownloadCount());
+        return meta;
+    }
+
+    /**
+     * add msb address as prefix to uri.
+     * 
+     * @param uri uri
+     * @return url
+     */
+    public static String getUrl(String uri) {
+        String url = getDownloadUriHead();
+        if(url.endsWith("/") && uri.startsWith("/")) {
+            url += uri.substring(1);
+        } else {
+            url += uri;
+        }
+        return url.replace("\\", "/");
+    }
+
+    public static String getDownloadUriHead() {
+        return MsbAddrConfig.getMsbAddress() + "/files/catalog-http";
+    }
+
+    /**
+     * get local path.
+     * 
+     * @param uri uri
+     * @return local path
+     */
+    public static String getLocalPath(String uri) {
+        File srcDir = new File(uri);
+        String localPath = srcDir.getAbsolutePath();
+        return localPath.replace("\\", "/");
+    }
+
+    /**
+     * get package basic information.
+     * 
+     * @param fileLocation package location
+     * @return package basic information
+     */
+    public static PackageBasicInfo getPacageBasicInfo(String fileLocation) {
+        PackageBasicInfo basicInfo = new PackageBasicInfo();
+        String unzipDir = ToolUtil.getUnzipDir(fileLocation);
+        boolean isXmlCsar = false;
+        try {
+            String tempfolder = unzipDir;
+            List<String> unzipFiles = FileUtil.unzip(fileLocation, tempfolder);
+            if(unzipFiles.isEmpty()) {
+                isXmlCsar = true;
+            }
+            for(String unzipFile : unzipFiles) {
+                if(unzipFile.endsWith(CommonConstant.MANIFEST)) {
+                    basicInfo = readManifest(unzipFile);
+                }
+
+                if(unzipFile.endsWith(CommonConstant.CSAR_META)) {
+                    basicInfo = readMetaData(unzipFile);
+                }
+
+                if(ToolUtil.isYamlFile(new File(unzipFile))) {
+                    isXmlCsar = false;
+                }
+            }
+        } catch(IOException e1) {
+            LOG.error("judge package type error ! " + e1.getMessage(), e1);
+        }
+        if(isXmlCsar) {
+            basicInfo.setFormat(CommonConstant.PACKAGE_XML_FORMAT);
+        } else {
+            basicInfo.setFormat(CommonConstant.PACKAGE_YAML_FORMAT);
+        }
+        return basicInfo;
+    }
+
+    /**
+     * Reads the manifest file in the package and fills the basic infor about package
+     * 
+     * @param unzipFile
+     * @return basic infor about package
+     */
+    private static PackageBasicInfo readMetaData(String unzipFile) {
+
+        // Fix the package type to CSAR, temporary
+        PackageBasicInfo basicInfo = new PackageBasicInfo();
+        basicInfo.setType(EnumType.CSAR);
+
+        File file = new File(unzipFile);
+        try (BufferedReader reader = new BufferedReader(new FileReader(file))) {
+
+            for(String tempString; (tempString = reader.readLine()) != null;) {
+                // If line is empty, ignore
+                if("".equals(tempString)) {
+                    continue;
+                }
+
+                int count1 = tempString.indexOf(":");
+                String meta = tempString.substring(0, count1).trim();
+
+                // Check for the package provider name
+                if(meta.equalsIgnoreCase(CommonConstant.CSAR_PROVIDER_META)) {
+                    int count = tempString.indexOf(":") + 1;
+                    basicInfo.setProvider(tempString.substring(count).trim());
+                }
+
+                // Check for package version
+                if(meta.equalsIgnoreCase(CommonConstant.CSAR_VERSION_META)) {
+                    int count = tempString.indexOf(":") + 1;
+                    basicInfo.setVersion(tempString.substring(count).trim());
+                }
+
+                // Check for package type
+                if(meta.equalsIgnoreCase(CommonConstant.CSAR_TYPE_META)) {
+                    int count = tempString.indexOf(":") + 1;
+
+                    basicInfo.setType(getEnumType(tempString.substring(count).trim()));
+                }
+            }
+
+            reader.close();
+        } catch(IOException e) {
+            LOG.error("Exception while parsing manifest file" + e, e);
+        }
+
+        return basicInfo;
+    }
+
+    private static EnumType getEnumType(String type) {
+        EnumType vnfType = EnumType.CSAR;
+        if(type == "CSAR") {
+            vnfType = EnumType.CSAR;
+        }
+
+        if(type == "GSAR") {
+            vnfType = EnumType.GSAR;
+        }
+
+        if(type == "NSAR") {
+            vnfType = EnumType.NSAR;
+        }
+
+        if(type == "SSAR") {
+            vnfType = EnumType.SSAR;
+        }
+
+        if(type == "NFAR") {
+            vnfType = EnumType.NFAR;
+        }
+
+        return vnfType;
+    }
+
+    private static PackageBasicInfo readManifest(String unzipFile) {
+
+        // Fix the package type to CSAR, temporary
+        PackageBasicInfo basicInfo = new PackageBasicInfo();
+        basicInfo.setType(EnumType.CSAR);
+
+        File file = new File(unzipFile);
+        try (BufferedReader reader = new BufferedReader(new FileReader(file))) {
+
+            for(String tempString; (tempString = reader.readLine()) != null;) {
+                // If line is empty, ignore
+                if("".equals(tempString)) {
+                    continue;
+                }
+
+                int count1 = tempString.indexOf(":");
+                String meta = tempString.substring(0, count1).trim();
+
+                // Check for the package provider name
+                if(meta.equalsIgnoreCase(CommonConstant.MF_PROVIDER_META)) {
+                    int count = tempString.indexOf(":") + 1;
+                    basicInfo.setProvider(tempString.substring(count).trim());
+                }
+
+                // Check for package version
+                if(meta.equalsIgnoreCase(CommonConstant.MF_VERSION_META)) {
+                    int count = tempString.indexOf(":") + 1;
+                    basicInfo.setVersion(tempString.substring(count).trim());
+                }
+            }
+
+            reader.close();
+        } catch(IOException e) {
+            LOG.error("Exception while parsing manifest file" + e, e);
+        }
+
+        return basicInfo;
+    }
+
+    /**
+     * get package format enum.
+     * 
+     * @param format package format
+     * @return package format enum
+     */
+    public static EnumPackageFormat getPackageFormat(String format) {
+        if("xml".equals(format)) {
+            return EnumPackageFormat.TOSCA_XML;
+        } else if("yml".equals(format) || "yaml".equals(format)) {
+            return EnumPackageFormat.TOSCA_YAML;
+        } else {
+            return null;
+        }
+    }
 }
-
