from rest_framework import serializers
-from lcm.ns.serializers.ns_serializers import IpAddress
-from lcm.ns.serializers.common_Link import LinkSerializer
+from lcm.ns.serializers.pub_serializers import Links, IpAddressSerialzier, ipAddressesSerializer
class ContextSerializer(serializers.Serializer):
class IpOverEthernetAddressDataSerializer(serializers.Serializer):
macAddress = serializers.CharField(help_text="Mac address", required=False, allow_null=True)
- ipAddresses = serializers.ListField(help_text="List of IP addresses to assign to the extCP instance.",
- child=IpAddress(
- help_text="List of IP addresses to assign to the extCP instance.",
- required=True), required=False, allow_null=True, )
+ ipAddresses = IpAddressSerialzier(help_text="List of IP addresses to assign to the extCP instance.",
+ required=False, allow_null=True, many=True)
class cpProtocolDataSerializer(serializers.Serializer):
required=True, allow_null=False, many=True)
-class AddressRange(serializers.Serializer):
- minAddress = serializers.IPAddressField(help_text="Lowest IP address belonging to the range.",
- required=True)
- maxAddress = serializers.IPAddressField(help_text="Highest IP address belonging to the range.",
- required=True)
-
-
-class ipAddressesSerializer(serializers.Serializer):
- type = serializers.ChoiceField(help_text="The type of the IP addresses.",
- choices=["IPV4", "IPV6"], required=True)
- addresses = serializers.ListField(help_text="Fixed addresses assigned (from the subnet defined by "
- "subnetId if provided)",
- child=serializers.CharField(help_text="An IPV4 or IPV6 address."),
- required=False, allow_null=True)
-# question
- isDynamic = serializers.BooleanField(help_text="Indicates whether this set of addresses was assigned "
- "dynamically (true) or based on address information "
- "provided as input from the API consumer (false).",
- required=False, default=True)
- addressRange = AddressRange(help_text="An IP address range used", required=False, allow_null=True)
- subnetId = serializers.CharField(help_text="Subnet defined by the identifier of the subnet"
- "resource in the VIM", required=False, allow_null=True)
-
-
class IpOverEthernetAddressInfoSerializer(serializers.Serializer):
macAddress = serializers.CharField(help_text="Assigned MAC address", required=True)
ipAddresses = ipAddressesSerializer(help_text="Addresses assigned to the CP or SAP instance.",
choices=["NFVI_POP", "ZONE", "ZONE_GROUP", "NFVI_NODE"], required=True)
-class Links(serializers.Serializer):
- self = LinkSerializer(help_text="URI of this resource.", required=True)
- nestedNsInstances = LinkSerializer(help_text="Links to the nested NS instances of the present NS"
- "instance.", required=False, allow_null=True)
- instantiate = LinkSerializer(help_text="Link to the 'instantiate' task resource", required=False,
- allow_null=True)
- terminate = LinkSerializer(help_text="Link to the 'terminate' task resource", required=False, allow_null=True)
- update = LinkSerializer(help_text="Link to the 'update' task resource", required=False, allow_null=True)
- scale = LinkSerializer(help_text="Link to the 'scale' task resource", required=False, allow_null=True)
- heal = LinkSerializer(help_text="Link to the 'heal' task resource", required=False, allow_null=True)
-
-
class CreateNsRespSerializer(serializers.Serializer):
nsInstanceId = serializers.CharField(help_text="ID of NS instance", required=True)
nsInstanceName = serializers.CharField(help_text="Human readable name of the NS instance.", required=True)