fix serializer bug
[vfc/nfvo/lcm.git] / lcm / ns / serializers / sol / ext_managed_virtual_link_info.py
1 # Copyright 2019 ZTE Corporation.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #         http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 from rest_framework import serializers
16 from lcm.ns.serializers.sol.resource_handle import ResourceHandleSerializer
17
18
19 class VnfLinkPortInfo(serializers.Serializer):
20     id = serializers.CharField(
21         help_text="Identifier of this link port as provided by the entity that has created the link port.",
22         max_length=255,
23         required=True,
24         allow_null=False,
25         allow_blank=False)
26     resourceHandle = ResourceHandleSerializer(
27         help_text="Reference to the virtualised network resource realizing this link port.",
28         required=True,
29         allow_null=False)
30     cpInstanceId = serializers.CharField(
31         help_text="When the link port is used for external connectivity by the VNF, \
32         this attribute represents the identifier of the external CP of the VNF to be connected to this \
33         link port.",
34         max_length=255,
35         required=False,
36         allow_null=True,
37         allow_blank=True)
38     cpInstanceType = serializers.ChoiceField(
39         required=False,
40         choices=['VNFC_CP', 'EXT_CP'],
41         help_text="Type of the CP instance that is identified by cpInstanceId.")
42
43
44 class ExtManagedVirtualLinkInfo(serializers.Serializer):
45     id = serializers.CharField(
46         help_text="Identifier of the externally-managed inner VL and the related externally-managed VL information instance.",
47         max_length=255,
48         required=True)
49     vnfVirtualLinkDescId = serializers.CharField(
50         help_text="Identifier of the VNF Virtual Link Descriptor (VLD) in the VNFD.",
51         max_length=255,
52         required=True)
53     networkResource = ResourceHandleSerializer(
54         help_text="ResourceHandle,reference to the VirtualNetwork resource.",
55         required=True,
56         allow_null=False)
57     vnfLinkPorts = VnfLinkPortInfo(
58         help_text="VnfLinkPortInfo, Link ports of this VL.",
59         many=True,
60         required=False)