summaryrefslogtreecommitdiffstats
path: root/genericparser/packages
diff options
context:
space:
mode:
Diffstat (limited to 'genericparser/packages')
-rw-r--r--genericparser/packages/biz/sdc_vnf_package.py4
-rw-r--r--genericparser/packages/biz/vnf_package.py2
-rw-r--r--genericparser/packages/biz/vnf_pkg_artifacts.py5
-rw-r--r--genericparser/packages/tests/const.py2
4 files changed, 8 insertions, 5 deletions
diff --git a/genericparser/packages/biz/sdc_vnf_package.py b/genericparser/packages/biz/sdc_vnf_package.py
index afd219a..5028709 100644
--- a/genericparser/packages/biz/sdc_vnf_package.py
+++ b/genericparser/packages/biz/sdc_vnf_package.py
@@ -130,14 +130,14 @@ class NfDistributeThread(threading.Thread):
vnfd = json.JSONDecoder().decode(vnfd_json)
if not vnfd.get("vnf"):
- raise GenericparserException("VNF propeties and metadata in VNF Package(id=%s) are empty." % self.csar_id)
+ raise GenericparserException("VNF properties and metadata in VNF Package(id=%s) are empty." % self.csar_id)
vnfd_id = vnfd["vnf"]["properties"].get("descriptor_id", "")
if VnfPackageModel.objects.filter(vnfdId=vnfd_id):
logger.error("VNF package(%s) already exists.", vnfd_id)
raise GenericparserException("VNF package(%s) already exists." % vnfd_id)
JobUtil.add_job_status(self.job_id, 30, "Save CSAR(%s) to database." % self.csar_id)
- vnfd_ver = vnfd["vnf"]["properties"].get("descriptor_verison", "")
+ vnfd_ver = vnfd["vnf"]["properties"].get("descriptor_version", "")
vnf_provider = vnfd["vnf"]["properties"].get("provider", "")
vnf_software_version = vnfd["vnf"]["properties"].get("software_version", "")
vnfd_product_name = vnfd["vnf"]["properties"].get("product_name", "")
diff --git a/genericparser/packages/biz/vnf_package.py b/genericparser/packages/biz/vnf_package.py
index b655f1f..7186082 100644
--- a/genericparser/packages/biz/vnf_package.py
+++ b/genericparser/packages/biz/vnf_package.py
@@ -201,7 +201,7 @@ def parse_vnfd_and_save(vnf_pkg_id, vnf_pkg_path):
logger.error("VNF package(%s,%s) already exists.", other_pkg[0].vnfPackageId, vnfd_id)
raise GenericparserException("VNF package(%s) already exists." % vnfd_id)
vnf_provider = vnfd["vnf"]["properties"].get("provider", "")
- vnfd_ver = vnfd["vnf"]["properties"].get("descriptor_verison", "")
+ vnfd_ver = vnfd["vnf"]["properties"].get("descriptor_version", "")
vnf_software_version = vnfd["vnf"]["properties"].get("software_version", "")
vnfd_product_name = vnfd["vnf"]["properties"].get("product_name", "")
vnf_pkg.update(
diff --git a/genericparser/packages/biz/vnf_pkg_artifacts.py b/genericparser/packages/biz/vnf_pkg_artifacts.py
index f2506da..3a54f02 100644
--- a/genericparser/packages/biz/vnf_pkg_artifacts.py
+++ b/genericparser/packages/biz/vnf_pkg_artifacts.py
@@ -36,5 +36,8 @@ class FetchVnfPkgArtifact(object):
artifact_path = fileutil.get_artifact_path(vnf_extract_path, artifactPath)
if not artifact_path:
raise ArtifactNotFoundException("Couldn't artifact %s" % artifactPath)
- file_content = open(artifact_path, 'rb').read()
+ with open(artifact_path, 'rb') as f:
+ file_content = f.read()
+ else:
+ raise ArtifactNotFoundException("NF Package format is not csar or zip")
return file_content
diff --git a/genericparser/packages/tests/const.py b/genericparser/packages/tests/const.py
index a98ccb6..991c87c 100644
--- a/genericparser/packages/tests/const.py
+++ b/genericparser/packages/tests/const.py
@@ -218,7 +218,7 @@ vnfd_data = {
"vnf": {
"properties": {
"descriptor_id": "zte-hss-1.0",
- "descriptor_verison": "1.0.0",
+ "descriptor_version": "1.0.0",
"software_version": "1.0.0",
"provider": "zte"
},