aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFu Jinhua <fu.jinhua@zte.com.cn>2018-08-22 07:51:49 +0000
committerGerrit Code Review <gerrit@onap.org>2018-08-22 07:51:49 +0000
commit9ad40e4ab531750872089025d9ebd511f89f5c3a (patch)
treeb84a7578c49e2395a985821b43141bc4b49d6b3c
parenta7d4d56f05f0e44f6fa96edac629a870331ee1db (diff)
parent6ea9f472873e76a17a623f4254e810db9124c54d (diff)
Merge "Deal with nfPackage"
-rw-r--r--catalog/packages/biz/nf_package.py18
-rw-r--r--catalog/packages/serializers/vnf_pkg_info.py2
2 files changed, 19 insertions, 1 deletions
diff --git a/catalog/packages/biz/nf_package.py b/catalog/packages/biz/nf_package.py
index 9f0eae01..b660d07b 100644
--- a/catalog/packages/biz/nf_package.py
+++ b/catalog/packages/biz/nf_package.py
@@ -19,6 +19,7 @@ import sys
import threading
import traceback
import urllib2
+import uuid
from catalog.pub.config.config import CATALOG_ROOT_PATH, CATALOG_URL_PATH, MSB_SERVICE_IP
from catalog.pub.config.config import REG_TO_MSB_REG_PARAM
@@ -78,6 +79,23 @@ def parse_vnfd(csar_id, inputs):
return [0, ret]
+def create_vnf_pkg(data):
+ user_defined_data = ignore_case_get(data, "userDefinedData")
+ vnfPkgId = str(uuid.uuid4())
+ VnfPackageModel.objects.create(
+ vnfPackageId=vnfPkgId
+ )
+ data = {
+ "id": vnfPkgId,
+ "onboardingState": "CREATED",
+ "operationalState": "DISABLED",
+ "usageState": "NOT_IN_USE",
+ "userDefinedData": user_defined_data,
+ "_links": None
+ }
+ return data
+
+
class NfDistributeThread(threading.Thread):
"""
Sdc NF Package Distribute
diff --git a/catalog/packages/serializers/vnf_pkg_info.py b/catalog/packages/serializers/vnf_pkg_info.py
index c6f72735..4c63a463 100644
--- a/catalog/packages/serializers/vnf_pkg_info.py
+++ b/catalog/packages/serializers/vnf_pkg_info.py
@@ -103,5 +103,5 @@ class VnfPkgInfoSerializer(serializers.Serializer):
_links = _LinkSerializer(
help_text='Links to resources related to this resource.',
required=True,
- allow_null=False
+ allow_null=True # TODO supposed to be False
)