aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--catalog/packages/tests/test_servicepackage.py8
-rw-r--r--catalog/pub/utils/toscaparser/sdmodel.py10
2 files changed, 16 insertions, 2 deletions
diff --git a/catalog/packages/tests/test_servicepackage.py b/catalog/packages/tests/test_servicepackage.py
index dc6f3574..8030d924 100644
--- a/catalog/packages/tests/test_servicepackage.py
+++ b/catalog/packages/tests/test_servicepackage.py
@@ -18,6 +18,7 @@ from mock import mock
from rest_framework import status
from catalog.packages.biz.sdc_service_package import ServicePackage
+from catalog.packages.const import PKG_STATUS
from catalog.pub.database.models import ServicePackageModel, VnfPackageModel, PnfPackageModel
from catalog.pub.exceptions import PackageNotFoundException, PackageHasExistsException, CatalogException
from catalog.pub.msapi import sdc
@@ -319,6 +320,13 @@ class TestServicePackage(TestCase):
PnfPackageModel(pnfPackageId="1", pnfdId="m6000_s").save()
ServicePackage().on_distribute(csar_id="1")
+ service_package = ServicePackageModel.objects.filter(servicePackageId="1").first()
+ self.assertEqual("5de07996-7ff0-4ec1-b93c-e3a00bb3f207", service_package.invariantId)
+ self.assertEqual("Enhance_Service", service_package.servicedName)
+ self.assertEqual(PKG_STATUS.ONBOARDED, service_package.onboardingState)
+ self.assertEqual(PKG_STATUS.ENABLED, service_package.operationalState)
+ self.assertEqual(PKG_STATUS.NOT_IN_USE, service_package.usageState)
+
def test_api_service_pkg_distribute_when_pkg_exists(self):
ServicePackageModel(servicePackageId="1", servicedId="2").save()
resp = self.client.post(
diff --git a/catalog/pub/utils/toscaparser/sdmodel.py b/catalog/pub/utils/toscaparser/sdmodel.py
index ac49d445..d7e1c3ad 100644
--- a/catalog/pub/utils/toscaparser/sdmodel.py
+++ b/catalog/pub/utils/toscaparser/sdmodel.py
@@ -48,7 +48,7 @@ class SdInfoModel(BaseInfoModel):
type = input.schema.type
if type.__eq__('list') or type.__eq__('map'):
complex_input = []
- entry_schema = input.schema.schema['entry_schema']
+ entry_schema = self.get_entry_schema(input.schema.schema['entry_schema'])
self.get_child_input_repeat(complex_input, entry_schema, input)
result_inputs[input.schema.name] = complex_input
@@ -67,7 +67,7 @@ class SdInfoModel(BaseInfoModel):
for key, value in properties.iteritems():
if value['type'].__eq__('list'):
child_complex_input = []
- child_entry_schema = value['entry_schema']
+ child_entry_schema = self.get_entry_schema(value['entry_schema'])
self.get_child_input_repeat(child_complex_input, child_entry_schema, input)
complex_input.append({key: child_complex_input})
else:
@@ -85,3 +85,9 @@ class SdInfoModel(BaseInfoModel):
"required": value['required'],
}
complex_input.append(simple_input)
+
+ def get_entry_schema(self, entry_schema):
+ if isinstance(entry_schema, dict):
+ if 'type' in entry_schema.keys():
+ entry_schema = entry_schema['type']
+ return entry_schema