From 1f2a7672da12bc91aa7f2c3a1d5cd13fb76d707f Mon Sep 17 00:00:00 2001 From: laili Date: Tue, 7 Aug 2018 21:01:42 +0800 Subject: [PATCH] Modify vnf query related stuffs in vnflcm. add _link.py, instantiated_vnf_info.py, and vim_connection_info.py from whom vnf_instance.py imports serializers. Change-Id: Ib1ad1a25ec19e42aaaa108bda080ed9d8fa260ba Issue-ID: VFC-1016 Signed-off-by: laili --- lcm/lcm/nf/serializers/_links.py | 60 +++++++++++++++++ lcm/lcm/nf/serializers/instantiated_vnf_info.py | 88 +++++++++++++++++++++++++ lcm/lcm/nf/serializers/vim_connection_info.py | 52 +++++++++++++++ 3 files changed, 200 insertions(+) create mode 100644 lcm/lcm/nf/serializers/_links.py create mode 100644 lcm/lcm/nf/serializers/instantiated_vnf_info.py create mode 100644 lcm/lcm/nf/serializers/vim_connection_info.py diff --git a/lcm/lcm/nf/serializers/_links.py b/lcm/lcm/nf/serializers/_links.py new file mode 100644 index 00000000..a8c0261e --- /dev/null +++ b/lcm/lcm/nf/serializers/_links.py @@ -0,0 +1,60 @@ +# 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 link import LinkSerializer + + +class _LinksSerializer(serializers.Serializer): + href = LinkSerializer( + help_text="URI of this resource.", + required=True, + allow_null=False) + indicators = LinkSerializer( + help_text="Indicators related to this VNF instance.", + required=False, + allow_null=True) + instantiate = LinkSerializer( + help_text="Link to the instantiate task resource.", + required=False, + allow_null=True) + termiante = LinkSerializer( + help_text="Link to the terminate task resource.", + required=False, + allow_null=True) + scale = LinkSerializer( + help_text="Link to the scale task resource.", + required=False, + allow_null=True) + scaleToLevel = LinkSerializer( + help_text="Link to the scale_to_level task resource.", + required=False, + allow_null=True) + changeFlavour = LinkSerializer( + help_text="Link to the change_flavour task resource.", + required=False, + allow_null=True) + heal = LinkSerializer( + help_text="Link to the heal task resource.", + required=False, + allow_null=True) + operate = LinkSerializer( + help_text="Link to the operate task resource.", + required=False, + allow_null=True) + changeExtConn = LinkSerializer( + help_text="Link to the change_ext_conn task resource.", + required=False, + allow_null=True) diff --git a/lcm/lcm/nf/serializers/instantiated_vnf_info.py b/lcm/lcm/nf/serializers/instantiated_vnf_info.py new file mode 100644 index 00000000..a61aa202 --- /dev/null +++ b/lcm/lcm/nf/serializers/instantiated_vnf_info.py @@ -0,0 +1,88 @@ +# 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 scale_info import ScaleInfoSerializer +from ext_cp_info import ExtCpInfoSerializer +from ext_virtual_link_info import ExtVirtualLinkInfoSerializer +from ext_managed_virtual_link_info import ExtManagedVirtualLinkInfoSerializer +from vnfc_resource_info import VnfcResourceInfoSerializer +from vnf_virtual_link_resource_info import VnfVirtualLinkResourceInfoSerializer +from virtual_storage_resource_info import VirtualStorageResourceInfoSerializer + + +class InstantiatedVnfInfoSerializer(serializers.Serializer): + flavourId = serializers.CharField( + help_text="Identifier of the VNF deployment flavour applied to this VNF instance.", + max_length=255, + required=True, + allow_null=False, + allow_blank=False) + vnfState = serializers.ChoiceField( + help_text="State of the VNF instance.", + choices=["STARTED", "STOPPED", "NOT_INSTANTIATED", "INSTANTIATED", "FAILED"], + required=True, + allow_null=False, + allow_blank=False) + scaleStatus = ScaleInfoSerializer( + help_text="Scale status of the VNF, one entry per aspect. \ + Represents for every scaling aspect how big the VNF has been scaled w.r.t. that aspect.", + many=True, + required=False, + allow_null=True) + extCpInfo = ExtCpInfoSerializer( + help_text="Information about the external CPs exposed by the VNF instance.", + many=True, + required=True, + allow_null=False) + extVirtualLinkInfo = ExtVirtualLinkInfoSerializer( + help_text="Information about the external VLs the VNF instance is connected to.", + many=True, + required=False, + allow_null=True) + extManagedVirtualLinkInfo = ExtManagedVirtualLinkInfoSerializer( + help_text="Information about the externally-managed internal VLs of the VNF instance.", + many=True, + required=False, + allow_null=True) + monitoringParameters = serializers.DictField( + help_text="Active monitoring parameters.", + child=serializers.CharField(allow_blank=True), + required=False, + allow_null=True) + localizationLanguage = serializers.CharField( + help_text="Information about localization language of the VNF.", + max_length=255, + required=False, + allow_null=True, + allow_blank=True) + vnfcResourceInfo = VnfcResourceInfoSerializer( + help_text="Information about the virtualised compute and storage resources used by the VNFCs of the VNF instance.", + many=True, + required=False, + allow_null=True, + allow_blank=True) + vnfVirtualLinkResourceInfo = VnfVirtualLinkResourceInfoSerializer( + help_text="Information about the virtualised network resources used by the VLs of the VNF instance.", + many=True, + required=False, + allow_null=True, + allow_blank=True) + virtualStorageResourceInfo = VirtualStorageResourceInfoSerializer( + help_text="Information about the virtualised storage resources used as storage for the VNF instance.", + many=True, + required=False, + allow_null=True, + allow_blank=True) diff --git a/lcm/lcm/nf/serializers/vim_connection_info.py b/lcm/lcm/nf/serializers/vim_connection_info.py new file mode 100644 index 00000000..fa397307 --- /dev/null +++ b/lcm/lcm/nf/serializers/vim_connection_info.py @@ -0,0 +1,52 @@ +# 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 + + +class VimConnectionInfoSerializer(serializers.Serializer): + id = serializers.CharField( + help_text="The identifier of the VIM Connection. This identifier is managed by the NFVO.", + max_length=255, + required=True, + allow_null=False, + allow_blank=False) + vimId = serializers.CharField( + help_text="The identifier of the VIM instance. This identifier is managed by the NFVO.", + max_length=255, + required=False, + allow_null=True, + allow_blank=True) + vimType = serializers.CharField( + help_text="Discriminator for the different types of the VIM information.", + max_length=255, + required=True, + allow_null=False, + allow_blank=False) + interfaceInfo = serializers.DictField( + help_text="Information about the interface or interfaces to the VIM", + child=serializers.CharField(allow_blank=True), + required=False, + allow_null=True) + accessInfo = serializers.DictField( + help_text="Authentication credentials for accessing the VIM, and other access-related information", + child=serializers.CharField(allow_blank=True), + required=False, + allow_null=True) + extra = serializers.DictField( + help_text="VIM type specific additional information. \ + The applicable structure, and whether or not this attribute is available, is dependent on the content of vimType.", + child=serializers.CharField(allow_blank=True), + required=False, + allow_null=True) -- 2.16.6