summaryrefslogtreecommitdiffstats
path: root/lcm/lcm/nf/serializers
diff options
context:
space:
mode:
authorBharath Thiruveedula <bharath.thiruveedula@verizon.com>2018-09-04 19:16:05 +0530
committerbharath <bharath_ves@hotmail.com>2018-09-05 08:14:36 +0530
commit5b075b9740c4d57e219df38ae4fb7446fbdf5833 (patch)
tree8685a9aee7d91654f57dae2943d726f67e04851b /lcm/lcm/nf/serializers
parent0b8b410f563039cfc8879631bcb2587974de7875 (diff)
Add GET /vnf_lcm_op_occs API in GVNFM
Signed-off-by: Bharath Thiruveedula <bharath.thiruveedula@verizon.com> Change-Id: I73f6be2d4c1ff130576ff3c0de2a6de0eb123a81 Issue-ID: VFC-997
Diffstat (limited to 'lcm/lcm/nf/serializers')
-rw-r--r--lcm/lcm/nf/serializers/affected_storages.py51
-rw-r--r--lcm/lcm/nf/serializers/affected_vls.py52
-rw-r--r--lcm/lcm/nf/serializers/affected_vnfcs.py68
-rw-r--r--lcm/lcm/nf/serializers/response.py5
-rw-r--r--lcm/lcm/nf/serializers/vnf_info_modifications.py99
-rw-r--r--lcm/lcm/nf/serializers/vnf_lcm_op_occ.py200
-rw-r--r--lcm/lcm/nf/serializers/vnf_lcm_op_occs.py20
7 files changed, 495 insertions, 0 deletions
diff --git a/lcm/lcm/nf/serializers/affected_storages.py b/lcm/lcm/nf/serializers/affected_storages.py
new file mode 100644
index 00000000..de66f288
--- /dev/null
+++ b/lcm/lcm/nf/serializers/affected_storages.py
@@ -0,0 +1,51 @@
+# Copyright (C) 2018 Verizon. All Rights Reserved.
+#
+# 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 resource_handle import ResourceHandleSerializer
+
+CHANGE_TYPES = [
+ "ADDED",
+ "REMOVED",
+ "MODIFIED",
+ "TEMPORARY"
+]
+
+
+class AffectedStoragesSerializer(serializers.Serializer):
+ id = serializers.UUIDField(
+ help_text="Identifier of the Storage instance, identifying the " +
+ "applicable 'virtualStorageResourceInfo' entry in the 'VnfInstance' data type",
+ required=True
+ )
+ virtualStorageDescId = serializers.UUIDField(
+ help_text="Identifier of the related VirtualStorage descriptor " +
+ "in the VNFD. ",
+ required=True
+ )
+ changeType = serializers.ChoiceField(
+ help_text="Signals the type of change",
+ required=True,
+ choices=CHANGE_TYPES
+ )
+ metadata = serializers.DictField(
+ help_text="Metadata about this resource. ",
+ required=False,
+ allow_null=True)
+ storageResource = ResourceHandleSerializer(
+ help_text="Reference to the VirtualStorage resource.",
+ required=True,
+ allow_null=False)
diff --git a/lcm/lcm/nf/serializers/affected_vls.py b/lcm/lcm/nf/serializers/affected_vls.py
new file mode 100644
index 00000000..7bd362ec
--- /dev/null
+++ b/lcm/lcm/nf/serializers/affected_vls.py
@@ -0,0 +1,52 @@
+# Copyright (C) 2018 Verizon. All Rights Reserved.
+#
+# 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 resource_handle import ResourceHandleSerializer
+
+CHANGE_TYPES = [
+ "ADDED",
+ "REMOVED",
+ "MODIFIED",
+ "TEMPORARY",
+ "LINK_PORT_ADDED",
+ "LINK_PORT_REMOVED"
+]
+
+
+class AffectedVLsSerializer(serializers.Serializer):
+ id = serializers.UUIDField(
+ help_text="Identifier of the virtual link instance, identifying " +
+ "the applicable 'vnfVirtualLinkResourceInfo' ",
+ required=True
+ )
+ virtualLinkDescId = serializers.UUIDField(
+ help_text="Identifier of the related VLD in the VNFD.",
+ required=True
+ )
+ changeType = serializers.ChoiceField(
+ help_text="Signals the type of change",
+ required=True,
+ choices=CHANGE_TYPES
+ )
+ metadata = serializers.DictField(
+ help_text="Metadata about this resource. ",
+ required=False,
+ allow_null=True)
+ networkResource = ResourceHandleSerializer(
+ help_text="Reference to the VirtualNetwork resource.",
+ required=True,
+ allow_null=False)
diff --git a/lcm/lcm/nf/serializers/affected_vnfcs.py b/lcm/lcm/nf/serializers/affected_vnfcs.py
new file mode 100644
index 00000000..85b83641
--- /dev/null
+++ b/lcm/lcm/nf/serializers/affected_vnfcs.py
@@ -0,0 +1,68 @@
+# Copyright (C) 2018 Verizon. All Rights Reserved.
+#
+# 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 resource_handle import ResourceHandleSerializer
+
+CHANGE_TYPES = [
+ "ADDED",
+ "REMOVED",
+ "MODIFIED",
+ "TEMPORARY"
+]
+
+
+class AffectedVnfcsSerializer(serializers.Serializer):
+ id = serializers.UUIDField(
+ help_text="Identifier of the Vnfc instance, identifying the " +
+ "applicable 'vnfcResourceInfo' entry in the 'VnfInstance' data type",
+ required=True
+ )
+ vduId = serializers.UUIDField(
+ help_text="Identifier of the related VDU in the VNFD.",
+ required=True
+ )
+ changeType = serializers.ChoiceField(
+ help_text="Signals the type of change",
+ required=True,
+ choices=CHANGE_TYPES
+ )
+ affectedVnfcCpIds = serializers.ListField(
+ help_text="Identifiers of CP(s) of the VNFC instance that " +
+ "were affected by the change",
+ required=False,
+ child=serializers.UUIDField(required=True)
+ )
+ addedStorageResourceIds = serializers.ListField(
+ help_text="References to VirtualStorage resources that " +
+ "have been added",
+ required=False,
+ child=serializers.UUIDField()
+ )
+ removedStorageResourceIds = serializers.ListField(
+ help_text="References to VirtualStorage resources that " +
+ "have been removed.",
+ required=False,
+ child=serializers.UUIDField()
+ )
+ metadata = serializers.DictField(
+ help_text="Metadata about this resource. ",
+ required=False,
+ allow_null=True)
+ computeResource = ResourceHandleSerializer(
+ help_text="Reference to the VirtualCompute resource.",
+ required=True,
+ allow_null=False)
diff --git a/lcm/lcm/nf/serializers/response.py b/lcm/lcm/nf/serializers/response.py
index 81f5ed54..132788ac 100644
--- a/lcm/lcm/nf/serializers/response.py
+++ b/lcm/lcm/nf/serializers/response.py
@@ -21,3 +21,8 @@ class ProblemDetailsSerializer(serializers.Serializer):
status = serializers.IntegerField(help_text="Status", required=True)
detail = serializers.CharField(help_text="Detail", required=True, allow_null=True)
instance = serializers.CharField(help_text="Instance", required=False, allow_null=True)
+ additional_details = serializers.ListField(
+ help_text="Any number of additional attributes, as defined in a " +
+ "specification or by an implementation.",
+ required=False,
+ allow_null=True)
diff --git a/lcm/lcm/nf/serializers/vnf_info_modifications.py b/lcm/lcm/nf/serializers/vnf_info_modifications.py
new file mode 100644
index 00000000..8098a6ca
--- /dev/null
+++ b/lcm/lcm/nf/serializers/vnf_info_modifications.py
@@ -0,0 +1,99 @@
+# Copyright (C) 2018 Verizon. All Rights Reserved.
+#
+# 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 vim_connection_info import VimConnectionInfoSerializer
+
+
+class VnfInfoModificationsSerializer(serializers.Serializer):
+ vnfInstanceName = serializers.CharField(
+ help_text="If present, this attribute signals modifications of the " +
+ "'vnfInstanceName' attribute in 'VnfInstance'",
+ max_length=255,
+ required=False,
+ allow_null=True,
+ allow_blank=True)
+ vnfInstanceDescription = serializers.CharField(
+ help_text="If present, this attribute signals modifications of the " +
+ "'vnfInstanceDescription' attribute in 'VnfInstance'",
+ required=False,
+ allow_null=True,
+ allow_blank=True)
+ vnfdId = serializers.CharField(
+ help_text="If present, this attribute signals modifications of the " +
+ "'vnfdId' attribute in 'VnfInstance'",
+ max_length=255,
+ required=False,
+ allow_null=True,
+ allow_blank=True)
+ vnfProvider = serializers.CharField(
+ help_text="If present, this attribute signals modifications of the " +
+ "'vnfProvider' attribute in 'VnfInstance'",
+ max_length=255,
+ required=False,
+ allow_null=True)
+ vnfProductName = serializers.CharField(
+ help_text="If present, this attribute signals modifications of the " +
+ "'vnfProductName' attribute in 'vnfInstance'",
+ max_length=255,
+ required=False,
+ allow_null=True,
+ allow_blank=True)
+ vnfSoftwareVersion = serializers.CharField(
+ help_text="If present, this attribute signals modifications of the " +
+ "'vnfSoftwareVersion' attribute in 'VnfInstance'.",
+ max_length=255,
+ required=False,
+ allow_null=True,
+ allow_blank=True)
+ vnfdVersion = serializers.CharField(
+ help_text="If present, this attribute signals modifications of the " +
+ "'vnfdVersion' attribute in 'VnfInstance'. ",
+ max_length=255,
+ required=False,
+ allow_null=True,
+ allow_blank=False)
+ vnfPkgId = serializers.CharField(
+ help_text="If present, this attribute signals modifications of the " +
+ "'vnfPkgId' attribute in 'VnfInstance'.",
+ max_length=255,
+ required=False,
+ allow_null=True,
+ allow_blank=False)
+ vnfConfigurableProperties = serializers.DictField(
+ help_text="If present, this attribute signals modifications of the " +
+ "'vnfConfigurableProperties' attribute in 'VnfInstance'. ",
+ child=serializers.CharField(help_text="KeyValue Pairs", allow_blank=True),
+ required=False,
+ allow_null=True,)
+ vimConnectionInfo = VimConnectionInfoSerializer(
+ help_text="If present, this attribute signals modifications of certain" +
+ "entries in the 'vimConnectionInfo'",
+ required=False,
+ many=True,
+ allow_null=True)
+ metadata = serializers.DictField(
+ help_text="If present, this attribute signals modifications of certain" +
+ "'metadata' attribute in 'vnfInstance'.",
+ child=serializers.CharField(help_text="KeyValue Pairs", allow_blank=True),
+ required=False,
+ allow_null=True)
+ extensions = serializers.DictField(
+ help_text="If present, this attribute signals modifications of certain" +
+ "'extensions' attribute in 'vnfInstance'.",
+ child=serializers.CharField(help_text="KeyValue Pairs", allow_blank=True),
+ required=False,
+ allow_null=True)
diff --git a/lcm/lcm/nf/serializers/vnf_lcm_op_occ.py b/lcm/lcm/nf/serializers/vnf_lcm_op_occ.py
new file mode 100644
index 00000000..f2ef664d
--- /dev/null
+++ b/lcm/lcm/nf/serializers/vnf_lcm_op_occ.py
@@ -0,0 +1,200 @@
+# Copyright (C) 2018 Verizon. All Rights Reserved.
+#
+# 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 affected_vnfcs import AffectedVnfcsSerializer
+from affected_vls import AffectedVLsSerializer
+from affected_storages import AffectedStoragesSerializer
+from response import ProblemDetailsSerializer
+from ext_virtual_link_info import ExtVirtualLinkInfoSerializer
+from vnf_info_modifications import VnfInfoModificationsSerializer
+
+
+LCM_OPERATION_TYPES = [
+ "INSTANTIATE",
+ "SCALE",
+ "SCALE_TO_LEVEL",
+ "CHANGE_FLAVOUR",
+ "TERMINATE",
+ "HEAL",
+ "OPERATE",
+ "CHANGE_EXT_CONN",
+ "MODIFY_INFO"
+]
+
+LCM_OPERATION_STATE_TYPES = [
+ "STARTING",
+ "PROCESSING",
+ "COMPLETED",
+ "FAILED_TEMP",
+ "FAILED",
+ "ROLLING_BACK",
+ "ROLLED_BACK"
+]
+
+
+class ResourceChangesSerializer(serializers.Serializer):
+ affectedVnfcs = AffectedVnfcsSerializer(
+ help_text="Information about VNFC instances that were affected " +
+ "during the lifecycle operation.",
+ required=False,
+ many=True
+ )
+ affectedVirtualLinks = AffectedVLsSerializer(
+ help_text="Information about VL instances that were affected " +
+ "during the lifecycle operation. ",
+ required=False,
+ many=True
+ )
+ affectedVirtualStorages = AffectedStoragesSerializer(
+ help_text="Information about virtualised storage instances that " +
+ "were affected during the lifecycle operation",
+ required=False,
+ many=True
+ )
+
+
+class LcmOpLinkSerializer(serializers.Serializer):
+ self = serializers.CharField(
+ help_text="URI of this resource.",
+ max_length=255,
+ required=True,
+ allow_null=False)
+ vnfInstance = serializers.CharField(
+ help_text="Link to the VNF instance that the operation applies to.",
+ required=True)
+ grant = serializers.CharField(
+ help_text="Link to the grant for this operation, if one exists.",
+ required=False)
+ cancel = serializers.CharField(
+ help_text="Link to the task resource that represents the 'cancel' " +
+ "operation for this VNF LCM operation occurrence.",
+ required=False)
+ retry = serializers.CharField(
+ help_text="Link to the task resource that represents the 'retry' " +
+ "operation for this VNF LCM operation occurrence, if" +
+ " retrying is currently allowed",
+ required=False)
+ rollback = serializers.CharField(
+ help_text="Link to the task resource that represents the 'cancel' " +
+ "operation for this VNF LCM operation occurrence.",
+ required=False)
+ fail = serializers.CharField(
+ help_text="Link to the task resource that represents the 'fail' " +
+ "operation for this VNF LCM operation occurrence.",
+ required=False)
+
+
+class VNFLCMOpOccSerializer(serializers.Serializer):
+ id = serializers.CharField(
+ help_text="Identifier of this VNF lifecycle management operation" +
+ "occurrence,",
+ max_length=255,
+ required=True,
+ allow_null=False
+ )
+ operationState = serializers.ChoiceField(
+ help_text="The state of the VNF LCM operation occurrence. ",
+ required=True,
+ choices=LCM_OPERATION_STATE_TYPES
+ )
+ stateEnteredTime = serializers.CharField(
+ help_text="Date-time when the current state was entered.",
+ max_length=50
+ )
+ startTime = serializers.CharField(
+ help_text="Date-time of the start of the operation.",
+ max_length=50
+ )
+ vnfInstanceId = serializers.UUIDField(
+ help_text="Identifier of the VNF instance to which the operation" +
+ "applies"
+ )
+ grantId = serializers.UUIDField(
+ help_text="Identifier of the grant related to this VNF LCM operation " +
+ "occurrence, if such grant exists.",
+ allow_null=True
+ )
+ operation = serializers.ChoiceField(
+ help_text="The lifecycle management operation",
+ required=True,
+ choices=LCM_OPERATION_TYPES
+ )
+ isAutomaticInvocation = serializers.BooleanField(
+ help_text="Set to true if this VNF LCM operation occurrence has " +
+ "been triggered by an automated procedure inside the VNFM. " +
+ "Set to False otherwise.",
+ default=False
+ )
+ operationParams = serializers.DictField(
+ help_text="Input parameters of the LCM operation. This attribute " +
+ "shall be formatted according to the request data type of the " +
+ "related LCM operation. The following mapping between operationType and the " +
+ "data type of this attribute shall apply: " +
+ "1. INSTANTIATE: InstantiateVnfRequest" +
+ "2. SCALE: ScaleVnfRequest " +
+ "3. SCALE_TO_LEVEL: ScaleVnfToLevelRequest " +
+ "4. CHANGE_FLAVOUR: ChangeVnfFlavourRequest " +
+ "5. OPERATE: OperateVnfRequest " +
+ "6. HEAL: HealVnfRequest " +
+ "7. CHANGE_EXT_CONN: ChangeExtVnfConnectivityRequest " +
+ "8. TERMINATE: TerminateVnfRequest " +
+ "9. MODIFY_INFO: VnfInfoModifications",
+ required=True,
+ allow_null=False
+ )
+ isCancelPending = serializers.BooleanField(
+ help_text="If the VNF LCM operation occurrence is in 'STARTING'" +
+ "'PROCESSING' or 'ROLLING_BACK' state and the operation is being" +
+ " cancelled, this attribute shall be set to True. Otherwise, " +
+ " it shall be set to False.",
+ required=True
+ )
+ cancelMode = serializers.CharField(
+ help_text="The mode of an ongoing cancellation. Shall be present " +
+ "when isCancelPending=true, and shall be None otherwise.",
+ allow_null=True,
+ required=False
+ )
+ error = ProblemDetailsSerializer(
+ help_text="If 'operationState' is 'FAILED_TEMP' or 'FAILED' or " +
+ "'PROCESSING' or 'ROLLING_BACK' and previous value of 'operationState' " +
+ "was 'FAILED_TEMP' this attribute shall be present ",
+ allow_null=True,
+ required=False
+ )
+ resourceChanges = ResourceChangesSerializer(
+ help_text="It contains information about the cumulative changes " +
+ "to virtualised resources that were performed so far by the LCM " +
+ "operation since its start, if applicable.",
+ required=False,
+ allow_null=True)
+ changedInfo = VnfInfoModificationsSerializer(
+ help_text="Information about the changed VNF instance information, " +
+ "including VNF configurable properties",
+ required=False,
+ allow_null=True)
+ changedExtConnectivity = ExtVirtualLinkInfoSerializer(
+ help_text="Information about changed external connectivity, if this " +
+ "notification represents the result of a lifecycle operation occurrence. " +
+ "Shall be present if the 'notificationStatus' is set to 'RESULT' and the " +
+ "'operation' is set to 'CHANGE_EXT_CONN'. Shall be absent otherwise.",
+ many=True,
+ required=False,
+ allow_null=True)
+ _links = LcmOpLinkSerializer(
+ help_text="Links to resources related to this resource.",
+ required=True)
diff --git a/lcm/lcm/nf/serializers/vnf_lcm_op_occs.py b/lcm/lcm/nf/serializers/vnf_lcm_op_occs.py
new file mode 100644
index 00000000..6cb70906
--- /dev/null
+++ b/lcm/lcm/nf/serializers/vnf_lcm_op_occs.py
@@ -0,0 +1,20 @@
+# Copyright (C) 2018 Verizon. All Rights Reserved.
+#
+# 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 vnf_lcm_op_occ import VNFLCMOpOccSerializer
+
+
+class VNFLCMOpOccsSerializer(serializers.ListSerializer):
+ child = VNFLCMOpOccSerializer()