vfclcm upgrade from python2 to python3
[vfc/gvnfm/vnflcm.git] / lcm / lcm / nf / serializers / ip_addresse.py
1 # you may not use this file except in compliance with the License.
2 # You may obtain a copy of the License at
3 #
4 #         http://www.apache.org/licenses/LICENSE-2.0
5 #
6 # Unless required by applicable law or agreed to in writing, software
7 # distributed under the License is distributed on an "AS IS" BASIS,
8 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9 # See the License for the specific language governing permissions and
10 # limitations under the License.
11
12 from rest_framework import serializers
13 from .address_range import AddressRangeSerializer
14
15
16 class IpAddresseSerializer(serializers.Serializer):
17     type = serializers.ChoiceField(
18         help_text="The type of the IP addresses.",
19         choices=["IPV4", "IPV6"],
20         required=True,
21         allow_null=False,
22         allow_blank=False)
23     fixedAddresses = serializers.ListSerializer(
24         help_text="Fixed addresses to assign.",
25         child=serializers.CharField(help_text="IpAddress"),
26         required=False,
27         allow_null=True)
28     numDynamicAddresses = serializers.IntegerField(
29         help_text="Number of dynamic addresses to assign.",
30         required=False,
31         allow_null=True)
32     addressRange = AddressRangeSerializer(
33         help_text="An IP address range to be used, e.g. in case of egress connections. \
34         In case this attribute is present, IP addresses from the range will be used.",
35         required=False,
36         allow_null=True, )
37     subnetId = serializers.CharField(
38         help_text="Subnet defined by the identifier of the subnet resource in the VIM. \
39         In case this attribute is present, IP addresses from that subnet will be assigned; \
40         otherwise, IP addresses not bound to a subnet will be assigned.",
41         max_length=255,
42         required=False,
43         allow_null=True,
44         allow_blank=True)