1 # you may not use this file except in compliance with the License.
2 # You may obtain a copy of the License at
4 # http://www.apache.org/licenses/LICENSE-2.0
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.
12 from rest_framework import serializers
13 from address_range import AddressRangeSerializer
16 class IpAddresseSerializer(serializers.Serializer):
17 type = serializers.ChoiceField(
18 help_text="The type of the IP addresses.",
19 choices=["IPV4", "IPV6"],
23 fixedAddresses = serializers.ListSerializer(
24 help_text="Fixed addresses to assign.",
25 child=serializers.CharField(help_text="IpAddress"),
28 numDynamicAddresses = serializers.IntegerField(
29 help_text="Number of dynamic addresses to assign.",
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.",
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.",