aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFu Jinhua <fu.jinhua@zte.com.cn>2018-08-21 06:03:44 +0000
committerGerrit Code Review <gerrit@onap.org>2018-08-21 06:03:44 +0000
commit0d5dd05a49f25084494445dfaa86627675beb9d4 (patch)
tree4d05b1c392e4b2c437d660d68ea40b0a3bfeab96
parent361cb54d3e53aa5fb1c7814f1d51653ddf87b8c6 (diff)
parent3ca9763a89dc9ad9f6108b12b4a751247f6ef110 (diff)
Merge "Deal with nfPackage"
-rw-r--r--catalog/packages/serializers/vnf_pkg_artifact_info.py33
-rw-r--r--catalog/packages/serializers/vnf_pkg_software_image_info.py82
2 files changed, 115 insertions, 0 deletions
diff --git a/catalog/packages/serializers/vnf_pkg_artifact_info.py b/catalog/packages/serializers/vnf_pkg_artifact_info.py
new file mode 100644
index 00000000..eb29a7f8
--- /dev/null
+++ b/catalog/packages/serializers/vnf_pkg_artifact_info.py
@@ -0,0 +1,33 @@
+# Copyright 2018 ZTE Corporation.
+#
+# 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 checksum import ChecksumSerializer
+
+
+class VnfPackageArtifactInfoSerializer(serializers.Serializer):
+ artifactPath = serializers.CharField(
+ help_text="Path in the VNF package.",
+ required=True,
+ allow_null=False,
+ allow_blank=False)
+ checksum = ChecksumSerializer(
+ help_text="Checksum of the artifact file.",
+ required=True,
+ allow_null=False,)
+ metadata = serializers.DictField(
+ help_text="The metadata of the artifact that are available in the VNF package",
+ child=serializers.CharField(help_text="KeyValue Pairs", allow_blank=True),
+ required=False,
+ allow_null=True)
diff --git a/catalog/packages/serializers/vnf_pkg_software_image_info.py b/catalog/packages/serializers/vnf_pkg_software_image_info.py
new file mode 100644
index 00000000..e251a77a
--- /dev/null
+++ b/catalog/packages/serializers/vnf_pkg_software_image_info.py
@@ -0,0 +1,82 @@
+# Copyright 2018 ZTE Corporation.
+#
+# 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 checksum import ChecksumSerializer
+
+
+class VnfPackageSoftwareImageInfoSerializer(serializers.Serializer):
+ id = serializers.CharField(
+ help_text="Identifier of the software image.",
+ required=True,
+ allow_null=False,
+ allow_blank=False)
+ name = serializers.CharField(
+ help_text="Name of the software image.",
+ required=True,
+ allow_null=True,
+ allow_blank=False)
+ provider = serializers.CharField(
+ help_text="Provider of the software image.",
+ required=True,
+ allow_null=True,
+ allow_blank=False)
+ version = serializers.CharField(
+ help_text="Version of the software image.",
+ required=True,
+ allow_null=True,
+ allow_blank=False)
+ checksum = ChecksumSerializer(
+ help_text="Checksum of the software image file.",
+ required=True,
+ allow_null=False, )
+ containerFormat = serializers.ChoiceField(
+ help_text="terminationType: Indicates whether forceful or graceful termination is requested.",
+ choices=["AKI", "AMI", "ARI", "BARE", "DOCKER", "OVA", "OVF"],
+ required=True,
+ allow_null=True)
+ diskFormat = serializers.ChoiceField(
+ help_text="Disk format of a software image is the format of the underlying disk image.",
+ choices=["AKI", "AMI", "ARI", "ISO", "QCOW2", "RAW", "VDI", "VHD", "VHDX", "VMDK"],
+ required=True,
+ allow_null=True)
+ createdAt = serializers.DateTimeField(
+ help_text="Time when this software image was created.",
+ required=True,
+ format=None,
+ input_formats=None)
+ minDisk = serializers.IntegerField(
+ help_text="The minimal disk for this software image in bytes.",
+ required=True,
+ allow_null=True)
+ minRam = serializers.IntegerField(
+ help_text="The minimal RAM for this software image in bytes.",
+ required=True,
+ allow_null=True
+ )
+ size = serializers.IntegerField(
+ help_text="Size of this software image in bytes.",
+ required=True,
+ allow_null=True
+ )
+ userMetadata = serializers.DictField(
+ help_text="User-defined data.",
+ child=serializers.CharField(help_text="KeyValue Pairs", allow_blank=True),
+ required=False,
+ allow_null=True)
+ imagePath = serializers.CharField(
+ help_text="Path in the VNF package.",
+ required=True,
+ allow_null=True,
+ allow_blank=False)