summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryangyan <yangyanyj@chinamobile.com>2019-11-28 09:56:33 +0800
committeryangyan <yangyanyj@chinamobile.com>2019-11-28 10:26:31 +0800
commit3ee9298ba721307c226d0f9af8d36a1dc982d226 (patch)
treede4d9b7da80c09e68feb826a95734e2dc61a5d3e
parent92a787ea2788c91670760cd33950d9a20f42be62 (diff)
Update nf_pm serializer in vnflcm
Change-Id: Icaa588d6a9f72274b65e258ab23c19d0c4f74773 Issue-ID: VFC-1590 Signed-off-by: yangyan <yangyanyj@chinamobile.com>
-rw-r--r--lcm/lcm/nf_pm/counst.py9
-rw-r--r--lcm/lcm/nf_pm/serializers/Link.py30
-rw-r--r--lcm/lcm/nf_pm/serializers/create_pm_job_request.py40
-rw-r--r--lcm/lcm/nf_pm/serializers/create_thresho_id_request.py34
-rw-r--r--lcm/lcm/nf_pm/serializers/performance_information_available_aotification.py31
-rw-r--r--lcm/lcm/nf_pm/serializers/performance_report.py20
-rw-r--r--lcm/lcm/nf_pm/serializers/pm_job.py28
-rw-r--r--lcm/lcm/nf_pm/serializers/pm_subscription.py32
-rw-r--r--lcm/lcm/nf_pm/serializers/threshold.py28
-rw-r--r--lcm/lcm/nf_pm/serializers/threshold_crossed_notification.py42
10 files changed, 294 insertions, 0 deletions
diff --git a/lcm/lcm/nf_pm/counst.py b/lcm/lcm/nf_pm/counst.py
index 3d3ce508..f8c39a86 100644
--- a/lcm/lcm/nf_pm/counst.py
+++ b/lcm/lcm/nf_pm/counst.py
@@ -24,3 +24,12 @@ AUTH_TYPE = enum(
OAUTH2_CLIENT_CREDENTIALS="OAUTH2_CLIENT_CREDENTIALS",
TLS_CERT="TLS_CERT"
)
+
+CrossingDirectionType = enum(
+ UP="UP",
+ DOWN="DOWN"
+)
+
+THRESHOLDTYPE = enum(
+ SIMPLE="SIMPLE"
+)
diff --git a/lcm/lcm/nf_pm/serializers/Link.py b/lcm/lcm/nf_pm/serializers/Link.py
new file mode 100644
index 00000000..bc9a1d16
--- /dev/null
+++ b/lcm/lcm/nf_pm/serializers/Link.py
@@ -0,0 +1,30 @@
+# Copyright (c) 2019, CMCC Technologies Co., Ltd.
+#
+# Licensed under the Apache License, Version 2.0 (the "License")
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+from rest_framework import serializers
+
+
+class linkSerializer(serializers.Serializer):
+ href = serializers.CharField(
+ help_text="URI of the referenced resource.",
+ required=True,
+ allow_null=False,
+ allow_blank=False)
+
+
+class LinkSerializer(serializers.Serializer):
+ self = linkSerializer(
+ help_text="URI of this resource.",
+ required=True,
+ allow_null=False)
diff --git a/lcm/lcm/nf_pm/serializers/create_pm_job_request.py b/lcm/lcm/nf_pm/serializers/create_pm_job_request.py
new file mode 100644
index 00000000..3e7ca190
--- /dev/null
+++ b/lcm/lcm/nf_pm/serializers/create_pm_job_request.py
@@ -0,0 +1,40 @@
+# Copyright (c) 2019, CMCC Technologies Co., Ltd.
+#
+# Licensed under the Apache License, Version 2.0 (the "License")
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+from rest_framework import serializers
+
+
+class PmJobCriteriaSerializer(serializers.Serializer):
+ performanceMetric = serializers.ListField(help_text="This defines the types of performance metrics "
+ "for the specified object instances, as specified "
+ "in an external measurement specification",
+ required=False, allow_null=True)
+ performanceMetricGroup = serializers.ListField(help_text="Group of performance metrics",
+ required=False, allow_null=True)
+ collectionPeriod = serializers.CharField(help_text="Specifies the periodicity at which the producer "
+ "will collect performance information",
+ required=True, allow_null=False)
+ reportingPeriod = serializers.CharField(help_text="Specifies the periodicity at which the producer "
+ "will report to the consumer",
+ required=True, allow_null=False)
+ reportingBoundary = serializers.DateField(help_text="dentifies a time boundary after which the reporting "
+ "will stop.", required=False, allow_null=True)
+
+
+class CreatePmJobRequestSerializer(serializers.Serializer):
+ objectInstanceIds = serializers.ListField(help_text="Identifiers of the VNF instances for which "
+ "performance information is requested to be "
+ "collected.", required=True, allow_null=False)
+ criteria = PmJobCriteriaSerializer(help_text="Criteria of the collection of performance information",
+ required=True, allow_null=False)
diff --git a/lcm/lcm/nf_pm/serializers/create_thresho_id_request.py b/lcm/lcm/nf_pm/serializers/create_thresho_id_request.py
new file mode 100644
index 00000000..84c03be8
--- /dev/null
+++ b/lcm/lcm/nf_pm/serializers/create_thresho_id_request.py
@@ -0,0 +1,34 @@
+# Copyright (c) 2019, CMCC Technologies Co., Ltd.
+#
+# Licensed under the Apache License, Version 2.0 (the "License")
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+from rest_framework import serializers
+
+from lcm.nf_pm.counst import THRESHOLDTYPE
+
+
+class ThresholdCriteriaSerializer(serializers.Serializer):
+ performanceMetric = serializers.CharField(help_text="Defines the performance metric associated with the"
+ "threshold, as specified in an external measurement"
+ "specification.", required=True, allow_null=False)
+ thresholdType = serializers.ChoiceField(help_text="Type of threshold", required=True, allow_null=False,
+ choices=THRESHOLDTYPE)
+ simpleThresholdDetails = serializers.CharField(help_text="Details of a simple threshold",
+ required=False, allow_null=True)
+
+
+class CreateThresholdRequestSerializer(serializers.Serializer):
+ objectInstanceId = serializers.CharField(help_text="Identifier of the VNF instance associated with this "
+ "threshold.", required=True, allow_null=False)
+ criteria = ThresholdCriteriaSerializer(help_text="Criteria that define this threshold.",
+ required=True, allow_null=False)
diff --git a/lcm/lcm/nf_pm/serializers/performance_information_available_aotification.py b/lcm/lcm/nf_pm/serializers/performance_information_available_aotification.py
new file mode 100644
index 00000000..276e1d0b
--- /dev/null
+++ b/lcm/lcm/nf_pm/serializers/performance_information_available_aotification.py
@@ -0,0 +1,31 @@
+# Copyright (c) 2019, CMCC Technologies Co., Ltd.
+#
+# Licensed under the Apache License, Version 2.0 (the "License")
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+from rest_framework import serializers
+
+from lcm.nf_pm.serializers.Link import LinkSerializer
+
+
+class PerformanceInformationAvailableNotificationSerializer(serializers.Serializer):
+ id = serializers.CharField(help_text="Identifier of this notification.", required=True, allow_null=False)
+ notificationType = serializers.CharField(help_text="Discriminator for the different notification types.",
+ required=True, allow_null=False)
+ subscriptionId = serializers.CharField(help_text="Identifier of the subscription that this notification "
+ "relates to.", required=True, allow_null=False)
+ timeStamp = serializers.DateField(help_text="Date and time of the generation of thenotification.",
+ required=True, allow_null=False)
+ objectInstanceId = serializers.CharField(help_text="Identifier that identifies a VNF instance.",
+ required=True, allow_null=False)
+ _links = LinkSerializer(help_text="Links to resources related to this notification",
+ required=True, allow_null=False)
diff --git a/lcm/lcm/nf_pm/serializers/performance_report.py b/lcm/lcm/nf_pm/serializers/performance_report.py
new file mode 100644
index 00000000..e79756e6
--- /dev/null
+++ b/lcm/lcm/nf_pm/serializers/performance_report.py
@@ -0,0 +1,20 @@
+# Copyright (c) 2019, CMCC Technologies Co., Ltd.
+#
+# Licensed under the Apache License, Version 2.0 (the "License")
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+from rest_framework import serializers
+
+
+class PerformanceReportSerializer(serializers.Serializer):
+ entries = serializers.ListField(help_text="List of performance information entries",
+ required=True, allow_null=False)
diff --git a/lcm/lcm/nf_pm/serializers/pm_job.py b/lcm/lcm/nf_pm/serializers/pm_job.py
new file mode 100644
index 00000000..a9006b70
--- /dev/null
+++ b/lcm/lcm/nf_pm/serializers/pm_job.py
@@ -0,0 +1,28 @@
+# Copyright (c) 2019, CMCC Technologies Co., Ltd.
+#
+# Licensed under the Apache License, Version 2.0 (the "License")
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+from rest_framework import serializers
+
+from lcm.nf_pm.serializers.create_pm_job_request import PmJobCriteriaSerializer
+
+
+class PmJob(serializers.Serializer):
+ id = serializers.CharField(help_text="Identifier of this PM job.", required=True, allow_null=False)
+ objectInstanceIds = serializers.ListField(help_text="Identifiers of the VNF instances for which "
+ "performance information is collected",
+ required=True, allow_null=False)
+ criteria = PmJobCriteriaSerializer(help_text="Criteria of the collection of performance information.",
+ required=True, allow_null=False)
+ reports = serializers.ListField(help_text="Information about available reports collected by this PM job.",
+ required=False, allow_null=True)
diff --git a/lcm/lcm/nf_pm/serializers/pm_subscription.py b/lcm/lcm/nf_pm/serializers/pm_subscription.py
new file mode 100644
index 00000000..e330dbc2
--- /dev/null
+++ b/lcm/lcm/nf_pm/serializers/pm_subscription.py
@@ -0,0 +1,32 @@
+# Copyright (c) 2019, CMCC Technologies Co., Ltd.
+#
+# Licensed under the Apache License, Version 2.0 (the "License")
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+from rest_framework import serializers
+
+from lcm.nf_pm.serializers.Link import LinkSerializer
+from lcm.nf_pm.serializers.pm_subscription_request import PmNotificationsFilterSerializer
+
+
+class PmSubscriptionSerializer(serializers.Serializer):
+ id = serializers.CharField(help_text="Identifier that identifies the subscription",
+ required=True, allow_null=False)
+ filter = PmNotificationsFilterSerializer(help_text="Filter settings for this subscription, to define the"
+ " subset of all notifications this subscription "
+ "relates to.", required=False, allow_null=True)
+ callbackUri = serializers.CharField(help_text="The URI of the endpoint to send the notification to",
+ required=True, allow_null=False)
+ _links = LinkSerializer(
+ help_text="Links to resources related to this resource.",
+ required=True,
+ allow_null=False)
diff --git a/lcm/lcm/nf_pm/serializers/threshold.py b/lcm/lcm/nf_pm/serializers/threshold.py
new file mode 100644
index 00000000..1fc87fb9
--- /dev/null
+++ b/lcm/lcm/nf_pm/serializers/threshold.py
@@ -0,0 +1,28 @@
+# Copyright (c) 2019, CMCC Technologies Co., Ltd.
+#
+# Licensed under the Apache License, Version 2.0 (the "License")
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+from rest_framework import serializers
+
+from lcm.nf_pm.serializers.Link import LinkSerializer
+from lcm.nf_pm.serializers.create_thresho_id_request import ThresholdCriteriaSerializer
+
+
+class ThresholdSerializer(serializers.Serializer):
+ id = serializers.CharField(help_text="Identifier of this threshold resource.",
+ required=True, allow_null=False)
+ objectInstanceId = serializers.CharField(help_text="Identifier of the VNF instance associated with the"
+ "threshold.", required=True, allow_null=False)
+ criteria = ThresholdCriteriaSerializer(help_text="Criteria that define this threshold.",
+ required=True, allow_null=False)
+ _links = LinkSerializer(help_text="Links for this resource.", required=True, allow_null=False)
diff --git a/lcm/lcm/nf_pm/serializers/threshold_crossed_notification.py b/lcm/lcm/nf_pm/serializers/threshold_crossed_notification.py
new file mode 100644
index 00000000..2eecc1ff
--- /dev/null
+++ b/lcm/lcm/nf_pm/serializers/threshold_crossed_notification.py
@@ -0,0 +1,42 @@
+# Copyright (c) 2019, CMCC Technologies Co., Ltd.
+#
+# Licensed under the Apache License, Version 2.0 (the "License")
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+from rest_framework import serializers
+
+from lcm.nf_pm.counst import CrossingDirectionType
+from lcm.nf_pm.serializers.Link import LinkSerializer
+
+
+class ThresholdCrossedNotificationSerializer(serializers.Serializer):
+ id = serializers.CharField(help_text="Identifier of this notification.", required=True, allow_null=False)
+ notificationType = serializers.CharField(help_text="Discriminator for the different notification types.",
+ required=True, allow_null=False)
+ subscriptionId = serializers.CharField(help_text="Identifier of the subscription that this notification "
+ "relates to", required=True, allow_null=False)
+ timeStamp = serializers.DateField(help_text="Date and time of the generation of the notification",
+ required=True, allow_null=False)
+ thresholdId = serializers.CharField(help_text="Identifier of the threshold which has been crossed.",
+ required=True, allow_null=False)
+ crossingDirection = serializers.ChoiceField(help_text="An indication of whether the threshold was "
+ "crossed in upward or downward direction.",
+ required=True, allow_null=False,
+ choices=CrossingDirectionType)
+ objectInstanceId = serializers.CharField(help_text="Identifier that identifies a VNF instance.",
+ required=True, allow_null=False)
+ performanceMetric = serializers.CharField(help_text="Performance metric associated with the threshold.",
+ required=True, allow_null=False)
+ performanceValue = serializers.CharField(help_text="Value of the metric that resulted in threshold "
+ "crossing.", required=True, allow_null=False)
+ _links = LinkSerializer(help_text="Links to resources related to this notification",
+ required=True, allow_null=False)