summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryunlong ying <ying.yunlong@zte.com.cn>2019-04-03 01:02:05 +0000
committerGerrit Code Review <gerrit@onap.org>2019-04-03 01:02:05 +0000
commitbeedfac1cf7e7c0ad5d127dcdd32b779a214c950 (patch)
treee9489a1958389a172a5f5291cab2cac400aacb39
parentbab594a77d838838b071d6c402c72ead8cbccd09 (diff)
parent8eb82aa3245fcfc77490a8f23bc580b7f292765c (diff)
Merge changes Id32773c0,Id876742f
* changes: fix NS Subscription url error fix NS Subscription serializer error
-rw-r--r--lcm/ns/biz/create_subscription.py2
-rw-r--r--lcm/ns/const.py3
-rw-r--r--lcm/ns/serializers/sol/lccn_filter_data.py33
-rw-r--r--lcm/ns/serializers/sol/lccn_subscription.py13
-rw-r--r--lcm/ns/serializers/sol/lccn_subscription_request.py17
-rw-r--r--lcm/ns/serializers/sol/ns_instance_subscription_filter.py30
-rw-r--r--lcm/ns/urls.py6
7 files changed, 56 insertions, 48 deletions
diff --git a/lcm/ns/biz/create_subscription.py b/lcm/ns/biz/create_subscription.py
index 907353a9..76f478ba 100644
--- a/lcm/ns/biz/create_subscription.py
+++ b/lcm/ns/biz/create_subscription.py
@@ -135,7 +135,7 @@ class CreateSubscription:
"%s to the database" % self.subscription_id)
links = {
"self": {
- "href": const.ROOT_URI + self.subscription_id
+ "href": const.SUBSCRIPTION_ROOT_URI % self.subscription_id
}
}
SubscriptionModel.objects.create(subscription_id=self.subscription_id,
diff --git a/lcm/ns/const.py b/lcm/ns/const.py
index 53f49308..c0293598 100644
--- a/lcm/ns/const.py
+++ b/lcm/ns/const.py
@@ -106,8 +106,6 @@ IPADDRESSES_TYPES = enum(
IPV6='IPV6'
)
-ROOT_URI = "api/nslcm/v1/subscriptions/"
-
LCCNNOTIFICATION = "NsLcmOperationOccurrenceNotification"
NOTIFICATION_TYPES = [
@@ -175,3 +173,4 @@ CHANGE_RESULT = [
NS_INSTANCE_BASE_URI = MSB_BASE_URL + '/api/nslcm/v1/ns_instances/%s'
NS_OCC_BASE_URI = MSB_BASE_URL + '/api/nslcm/v1/ns_lcm_op_occs/%s'
+SUBSCRIPTION_ROOT_URI = MSB_BASE_URL + "/api/nslcm/v1/subscriptions/%s"
diff --git a/lcm/ns/serializers/sol/lccn_filter_data.py b/lcm/ns/serializers/sol/lccn_filter_data.py
index fe4c8304..dd259051 100644
--- a/lcm/ns/serializers/sol/lccn_filter_data.py
+++ b/lcm/ns/serializers/sol/lccn_filter_data.py
@@ -1,4 +1,5 @@
# Copyright (c) 2019, CMCC Technologies Co., Ltd.
+# Copyright 2019 ZTE Corporation.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -22,27 +23,35 @@ from lcm.ns.const import NOTIFICATION_TYPES, NS_LCM_OP_TYPES, LCM_OPERATION_STAT
class LifeCycleChangeNotificationsFilter(serializers.Serializer):
nsInstanceSubscriptionFilter = NsInstanceSubscriptionFilter(
help_text="Filter criteria to select NS instances about which to notify.",
- required=False, allow_null=False)
+ required=False,
+ allow_null=False)
notificationTypes = serializers.ListField(
+ help_text="Match particular notification types.",
child=serializers.ChoiceField(required=True, choices=NOTIFICATION_TYPES),
- help_text="Match particular notification types", allow_null=False, required=False)
+ required=False,
+ allow_null=False)
operationTypes = serializers.ListField(
+ help_text="Match particular NS lifecycle operation types for the notification of type NsLcmOperationOccurrenceNotification.",
child=serializers.ChoiceField(required=True, choices=NS_LCM_OP_TYPES),
- help_text="Match particular NS lifecycle operation types for the notification of type "
- "NsLcmOperationOccurrenceNotification.", allow_null=False, required=False)
+ required=False,
+ allow_null=False)
operationStates = serializers.ListField(
+ help_text="Match particular LCM operation state values as reported in notifications of type NsLcmOperationOccurrenceNotification.",
child=serializers.ChoiceField(required=True, choices=LCM_OPERATION_STATE_TYPES),
- help_text="Match particular LCM operation state values as reported in notifications of type "
- "NsLcmOperationOccurrenceNotification.", allow_null=False, required=False)
+ required=False,
+ allow_null=False)
nsComponentTypes = serializers.ListField(
- child=serializers.ChoiceField(required=True, choices=NS_COMPOMENT_TYPE),
help_text="Match particular NS component types for the notification of type NsChangeNotification. ",
- required=False, allow_null=False)
+ child=serializers.ChoiceField(required=True, choices=NS_COMPOMENT_TYPE),
+ required=False,
+ allow_null=False)
lcmOpNameImpactingNsComponent = serializers.ListField(
+ help_text="Match particular LCM operation names for the notification of type NsChangeNotification.",
child=serializers.ChoiceField(required=True, choices=LCM_OPName_For_Change_Notification_Type),
- help_text="Match particular LCM operation names for the notification of type NsChangeNotification. ",
- required=False, allow_null=False)
+ required=False,
+ allow_null=False)
lcmOpOccStatusImpactingNsComponent = serializers.ListField(
+ help_text="Match particular LCM operation status values as reported in notifications of type NsChangeNotification.",
child=serializers.ChoiceField(required=True, choices=LCM_OpOcc_Status_For_ChangeNotification_Type),
- help_text="Match particular LCM operation status values as reported in notifications of type "
- "NsChangeNotification.", required=False, allow_null=False)
+ required=False,
+ allow_null=False)
diff --git a/lcm/ns/serializers/sol/lccn_subscription.py b/lcm/ns/serializers/sol/lccn_subscription.py
index 42a9eb1c..d25de474 100644
--- a/lcm/ns/serializers/sol/lccn_subscription.py
+++ b/lcm/ns/serializers/sol/lccn_subscription.py
@@ -1,4 +1,5 @@
# Copyright (c) 2019, CMCC Technologies Co., Ltd.
+# Copyright 2019 ZTE Corporation.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -28,20 +29,18 @@ class LccnSubscriptionLinkSerializer(serializers.Serializer):
class LccnSubscriptionSerializer(serializers.Serializer):
id = serializers.CharField(
help_text="Identifier of this subscription resource.",
- max_length=255,
required=True,
allow_null=False)
+ filter = LifeCycleChangeNotificationsFilter(
+ help_text="Filter settings for this subscription, to define the of all notifications this subscription relates to.",
+ required=False)
callbackUri = serializers.CharField(
help_text="The URI of the endpoint to send the notification to.",
- max_length=255,
required=True,
allow_null=False)
- filter = LifeCycleChangeNotificationsFilter(
- help_text="Filter settings for this subscription, to define the of all notifications this "
- "subscription relates to A particular notification is sent to the subscriber if the filter"
- " matches, or if there is no filter.", required=False)
_links = LccnSubscriptionLinkSerializer(
- help_text="Links to resources related to this resource.", required=True)
+ help_text="Links to resources related to this resource.",
+ required=True)
class LccnSubscriptionsSerializer(serializers.ListSerializer):
diff --git a/lcm/ns/serializers/sol/lccn_subscription_request.py b/lcm/ns/serializers/sol/lccn_subscription_request.py
index 9c119295..d821a2f9 100644
--- a/lcm/ns/serializers/sol/lccn_subscription_request.py
+++ b/lcm/ns/serializers/sol/lccn_subscription_request.py
@@ -1,4 +1,5 @@
# Copyright (c) 2019, CMCC Technologies Co., Ltd.
+# Copyright 2019 ZTE Corporation.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -19,16 +20,12 @@ from lcm.ns.serializers.sol.subscription_auth_data import SubscriptionAuthentica
class LccnSubscriptionRequestSerializer(serializers.Serializer):
+ filter = LifeCycleChangeNotificationsFilter(
+ help_text="Filter settings for this subscription, to define the subset of all notifications this subscription relates to.",
+ required=False)
callbackUri = serializers.CharField(
help_text="The URI of the endpoint to send the notification to.",
- required=True,
- allow_null=False)
- filter = LifeCycleChangeNotificationsFilter(
- help_text="Filter settings for this subscription, to define the subset of all notifications this"
- " subscription relates to A particular notification is sent to the subscriber if the "
- "filter matches, or if there is no filter.", required=False, allow_null=True)
+ required=True)
authentication = SubscriptionAuthenticationSerializer(
- help_text="Authentication parameters to conFigure the use of Authorization when sending "
- "notifications corresponding to this subscription, as defined in clause 4.5.3 This"
- " attribute shall only be present if the subscriber requires authorization of"
- " notifications.", required=False, allow_null=True)
+ help_text="Authentication parameters to conFigure the use of Authorization when sending notifications corresponding to this subscription.",
+ required=False)
diff --git a/lcm/ns/serializers/sol/ns_instance_subscription_filter.py b/lcm/ns/serializers/sol/ns_instance_subscription_filter.py
index eb1d040e..2072fc11 100644
--- a/lcm/ns/serializers/sol/ns_instance_subscription_filter.py
+++ b/lcm/ns/serializers/sol/ns_instance_subscription_filter.py
@@ -1,4 +1,5 @@
# Copyright (c) 2019, CMCC Technologies Co., Ltd.
+# Copyright 2019 ZTE Corporation.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -17,26 +18,29 @@ from rest_framework import serializers
class NsInstanceSubscriptionFilter(serializers.Serializer):
nsdIds = serializers.ListField(
- child=serializers.UUIDField(),
- help_text="If present, match NS instances that were created based on a NSD identified by one of the"
- " nsdId values listed in this attribute.", required=False, allow_null=False)
+ help_text="Match NS instances that were created based on a NSD identified by one of the nsdId values listed in this attribute.",
+ child=serializers.CharField(),
+ required=False,
+ allow_null=False)
vnfdIds = serializers.ListField(
- child=serializers.UUIDField(),
- help_text="If present, match NS instances that contain VNF instances that were created based on"
+ help_text="Match NS instances that contain VNF instances that were created based on"
" identified by one of the vnfdId values listed in this attribute.",
- required=False, allow_null=False)
+ child=serializers.CharField(),
+ required=False,
+ allow_null=False)
pnfdIds = serializers.ListField(
- child=serializers.UUIDField(),
- help_text="If present, match NS instances that contain PNFs that are represented by a PNFD"
+ help_text="Match NS instances that contain PNFs that are represented by a PNFD"
" identified by one of the pnfdId values listed in this attribute",
- required=False, allow_null=False)
+ child=serializers.CharField(),
+ required=False,
+ allow_null=False)
nsInstanceIds = serializers.ListField(
- child=serializers.UUIDField(),
- help_text="If present, match NS instances with an instance identifier listed in this attribute",
+ help_text="Match NS instances with an instance identifier listed in this attribute",
+ child=serializers.CharField(),
required=False,
allow_null=False)
nsInstanceNames = serializers.ListField(
- child=serializers.CharField(max_length=255, required=True),
- help_text="If present, match NS instances with a NS Instance Name listed in this attribute.",
+ help_text="Match NS instances with a NS Instance Name listed in this attribute.",
+ child=serializers.CharField(),
required=False,
allow_null=False)
diff --git a/lcm/ns/urls.py b/lcm/ns/urls.py
index d24ad6c2..1e859d3d 100644
--- a/lcm/ns/urls.py
+++ b/lcm/ns/urls.py
@@ -49,13 +49,13 @@ urlpatterns = [
# SOL005 URL API definition
url(r'^api/nslcm/v1/ns_instances$', NSInstancesView.as_view()),
+ url(r'^api/nslcm/v1/ns_instances/(?P<ns_instance_id>[0-9a-zA-Z_-]+)$', IndividualNsInstanceView.as_view()),
url(r'^api/nslcm/v1/ns_instances/(?P<ns_instance_id>[0-9a-zA-Z_-]+)/instantiate$', InstantiateNsView.as_view()),
- url(r'^api/nslcm/v1/ns_instances/(?P<ns_instance_id>[0-9a-zA-Z_-]+)/terminate$', TerminateNsView.as_view()),
- url(r'^api/nslcm/v1/ns_lcm_op_occs/(?P<lcmopoccid>[0-9a-zA-Z_-]+)$', QuerySingleNsLcmOpOcc.as_view()),
url(r'^api/nslcm/v1/ns_instances/(?P<ns_instance_id>[0-9a-zA-Z_-]+)/update$', UpdateNSView.as_view()),
url(r'^api/nslcm/v1/ns_instances/(?P<ns_instance_id>[0-9a-zA-Z_-]+)/scale$', ScaleNSView.as_view()),
url(r'^api/nslcm/v1/ns_instances/(?P<ns_instance_id>[0-9a-zA-Z_-]+)/heal$', HealNSView.as_view()),
- url(r'^api/nslcm/v1/ns_instances/(?P<ns_instance_id>[0-9a-zA-Z_-]+)$', IndividualNsInstanceView.as_view()),
+ url(r'^api/nslcm/v1/ns_instances/(?P<ns_instance_id>[0-9a-zA-Z_-]+)/terminate$', TerminateNsView.as_view()),
+ url(r'^api/nslcm/v1/ns_lcm_op_occs/(?P<lcmopoccid>[0-9a-zA-Z_-]+)$', QuerySingleNsLcmOpOcc.as_view()),
url(r'^api/nslcm/v1/subscriptions$', SubscriptionsView.as_view()),
url(r'^api/nslcm/v1/ns_lcm_op_occs$', QueryMultiNsLcmOpOccs.as_view()),