Modify notification endpoint interface definition in swagger 36/99636/1
authorhongyuzhao <zhao.hongyu@zte.com.cn>
Sat, 14 Dec 2019 05:29:36 +0000 (13:29 +0800)
committerhongyuzhao <zhao.hongyu@zte.com.cn>
Sat, 14 Dec 2019 05:56:40 +0000 (13:56 +0800)
Change-Id: I4e31d2ad533a5971e748931240e4eac9e43ed96d
Issue-ID: MODELING-288
Signed-off-by: hongyuzhao <zhao.hongyu@zte.com.cn>
catalog/packages/biz/notificationsutil.py
catalog/packages/biz/vnf_pkg_subscription.py
catalog/packages/serializers/vnf_pkg_notifications.py
catalog/packages/tests/const.py
catalog/packages/tests/test_vnf_pkg_subscription.py
catalog/packages/urls.py

index 4fa8e79..8a653b4 100644 (file)
@@ -25,6 +25,7 @@ from catalog.pub.config import config as pub_config
 import traceback
 from django.db.models import Q
 
+
 logger = logging.getLogger(__name__)
 
 
@@ -108,8 +109,6 @@ def prepare_vnfpkg_notification(vnf_pkg_id, notification_type, pkg_change_type,
         'timeStamp': catalog.pub.utils.timeutil.now_time(),
         'vnfPkgId': vnf_pkg_id,
         'vnfdId': vnfd_id,
-        'changeType': pkg_change_type,
-        'operationalState': operational_state,
         '_links': {
             'vnfPackage': {
                 'href': 'http://%s:%s/%s/vnf_packages/%s' % (pub_config.MSB_SERVICE_IP,
@@ -119,6 +118,11 @@ def prepare_vnfpkg_notification(vnf_pkg_id, notification_type, pkg_change_type,
             }
         }
     }
+
+    if notification_type == "VnfPackageChangeNotification":
+        notification_content['changeType'] = pkg_change_type
+        notification_content['operationalState'] = operational_state
+
     return notification_content
 
 
index 29ef92e..69ce2e8 100644 (file)
@@ -57,7 +57,7 @@ class CreateSubscription(object):
         self.vnfd_id = ignore_case_get(self.filter, "vnfdId", [])
         self.vnf_pkg_id = ignore_case_get(self.filter, "vnfPkgId", [])
         self.vnf_products_from_provider = \
-            ignore_case_get(self.filter, "vnfProductsFromProviders", {})
+            ignore_case_get(self.filter, "vnfProductsFromProviders", [])
 
     def check_callbackuri_connection(self):
         logger.debug("SubscribeNotification-post::> Sending GET request "
index 0c1b395..2a73aa3 100644 (file)
@@ -77,7 +77,8 @@ class PkgmNotificationsFilter(serializers.Serializer):
         allow_null=False,
         required=False
     )
-    vnfProductsFromProviders = vnfProductsProvidersSerializer(
+    vnfProductsFromProviders = serializers.ListField(
+        child=vnfProductsProvidersSerializer(),
         help_text="Match VNF packages that contain "
                   "VNF products from certain providers.",
         allow_null=False,
index 233f3ee..a67dbef 100644 (file)
@@ -559,7 +559,7 @@ vnf_subscription_data = {
         "notificationTypes": [
             "VnfPackageOnboardingNotification"
         ],
-        "vnfProductsFromProviders": {
+        "vnfProductsFromProviders": [{
             "vnfProvider": "string",
             "vnfProducts": {
                 "vnfProductName": "string",
@@ -570,7 +570,7 @@ vnf_subscription_data = {
                     ]
                 }
             }
-        },
+        }],
         "vnfdId": [
             "00342b18-a5c7-11e8-998c-bf1755941f12"
         ],
index e78e1ca..f00e2ac 100644 (file)
@@ -229,8 +229,6 @@ class TestNfPackageSubscription(TestCase):
             'timeStamp': "nowtime()",
             'vnfPkgId': uuid_vnfPackageId,
             'vnfdId': uuid_vnfdid,
-            'changeType': const.PKG_CHANGE_TYPE.OP_STATE_CHANGE,
-            'operationalState': None,
             "subscriptionId": uuid_subscriptid,
             '_links': {
                 'subscription': {
index 26a5fa9..410df80 100644 (file)
@@ -62,7 +62,7 @@ urlpatterns = [
     url(r'^api/vnfpkgm/v1/subscriptions/(?P<subscriptionId>[0-9a-zA-Z\-\_]+)$', QueryTerminateSubscriptionView.as_view(), name='subscriptions_query_terminate'),
     url(r'^api/vnfpkgm/v1/vnf_packages/(?P<vnfPkgId>[0-9a-zA-Z\-\_]+)/artifacts/(?P<artifactPath>[0-9a-zA-Z\-\_]+)$', FetchVnfPkgmArtifactsView.as_view(), name="fetch_vnf_artifacts"),
     url(r'^URI-is-provided-by-the-client-when-creating-the-subscription-VnfPackageOnboardingNotification$', PkgOnboardingNotificationView.as_view()),
-    url(r'^URI-is-provided-by-the-client-when-creating-the-sbuscription-VnfPackageChangeNotification$', PkgChangeNotificationView.as_view()),
+    url(r'^URI-is-provided-by-the-client-when-creating-the-subscription-VnfPackageChangeNotification$', PkgChangeNotificationView.as_view()),
 
     # health check
     url(r'^api/vnfpkgm/v1/health_check$', HealthCheckView.as_view()),