update for change to etsicatalog
[modeling/etsicatalog.git] / catalog / packages / biz / sdc_service_package.py
@@ -17,13 +17,13 @@ import traceback
 
 from coverage.xmlreport import os
 
-from genericparser.packages.biz.service_descriptor import ServiceDescriptor
-from genericparser.pub.config.config import GENERICPARSER_ROOT_PATH, REG_TO_MSB_REG_PARAM, GENERICPARSER_URL_PATH
-from genericparser.pub.database.models import ServicePackageModel, VnfPackageModel, PnfPackageModel
-from genericparser.pub.exceptions import GenericparserException, PackageNotFoundException, \
+from catalog.packages.biz.service_descriptor import ServiceDescriptor
+from catalog.pub.config.config import CATALOG_ROOT_PATH, REG_TO_MSB_REG_PARAM, CATALOG_URL_PATH
+from catalog.pub.database.models import ServicePackageModel, VnfPackageModel, PnfPackageModel
+from catalog.pub.exceptions import CatalogException, PackageNotFoundException, \
     PackageHasExistsException
-from genericparser.pub.msapi import sdc
-from genericparser.pub.utils import fileutil, toscaparsers
+from catalog.pub.msapi import sdc
+from catalog.pub.utils import fileutil, toscaparser
 
 logger = logging.getLogger(__name__)
 
@@ -49,10 +49,10 @@ class ServicePackage(object):
                     if not VnfPackageModel.objects.filter(vnfPackageId=resource['resourceUUID']) and \
                             not PnfPackageModel.objects.filter(pnfPackageId=resource['resourceUUID']):
                         logger.error("Resource [%s] is not distributed.", resource['resourceUUID'])
-                        raise GenericparserException("Resource (%s) is not distributed." % resource['resourceUUID'])
+                        raise CatalogException("Resource (%s) is not distributed." % resource['resourceUUID'])
 
             # download csar package
-            local_path = os.path.join(GENERICPARSER_ROOT_PATH, csar_id)
+            local_path = os.path.join(CATALOG_ROOT_PATH, csar_id)
             csar_name = "%s.csar" % service.get("name", csar_id)
             local_file_name = sdc.download_artifacts(service["toscaModelURL"], local_path, csar_name)
             if local_file_name.endswith(".csar") or local_file_name.endswith(".zip"):
@@ -96,7 +96,7 @@ class ServicePackage(object):
             package_info["downloadUrl"] = "http://%s:%s/%s/%s/%s" % (
                 REG_TO_MSB_REG_PARAM[0]["nodes"][0]["ip"],
                 REG_TO_MSB_REG_PARAM[0]["nodes"][0]["port"],
-                GENERICPARSER_URL_PATH,
+                CATALOG_URL_PATH,
                 csar_id,
                 csars[0].servicePackageUri)
         else:
@@ -113,9 +113,9 @@ class ServicePackage(object):
 
         try:
             csar_path = service_pkg[0].localFilePath
-            ret = {"model": toscaparsers.parse_sd(csar_path, inputs)}
+            ret = {"model": toscaparser.parse_sd(csar_path, inputs)}
             return ret
-        except GenericparserException as e:
+        except CatalogException as e:
             logger.error(e.args[0])
             raise e
         except Exception as e: