aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFu Jinhua <fu.jinhua@zte.com.cn>2019-04-01 11:48:01 +0000
committerGerrit Code Review <gerrit@onap.org>2019-04-01 11:48:01 +0000
commit122d25716fce2efbdd94a28b022b24095fe2648d (patch)
tree151db3624f934d46dbc02a17722d7e7912623fd7
parent157e45729088806093a3b29e7ab66a6954222c21 (diff)
parentc368422f7a1c50bbbe417feb73d314e02f0bc3a6 (diff)
Merge "fix cp related error"
-rw-r--r--lcm/ns/const.py5
-rw-r--r--lcm/ns/serializers/sol/cp_serializers.py131
2 files changed, 95 insertions, 41 deletions
diff --git a/lcm/ns/const.py b/lcm/ns/const.py
index 7fd0fc9f..53f49308 100644
--- a/lcm/ns/const.py
+++ b/lcm/ns/const.py
@@ -101,6 +101,10 @@ CHANGE_RESULTS = enum(
PARTIALLY_COMPLETED='PARTIALLY_COMPLETED'
)
+IPADDRESSES_TYPES = enum(
+ IPV4='IPV4',
+ IPV6='IPV6'
+)
ROOT_URI = "api/nslcm/v1/subscriptions/"
@@ -168,5 +172,6 @@ CHANGE_RESULT = [
CHANGE_RESULTS.FAILED
]
+
NS_INSTANCE_BASE_URI = MSB_BASE_URL + '/api/nslcm/v1/ns_instances/%s'
NS_OCC_BASE_URI = MSB_BASE_URL + '/api/nslcm/v1/ns_lcm_op_occs/%s'
diff --git a/lcm/ns/serializers/sol/cp_serializers.py b/lcm/ns/serializers/sol/cp_serializers.py
index 8e541ae5..c15166d4 100644
--- a/lcm/ns/serializers/sol/cp_serializers.py
+++ b/lcm/ns/serializers/sol/cp_serializers.py
@@ -13,68 +13,117 @@
# limitations under the License.
from rest_framework import serializers
+from lcm.ns.const import IPADDRESSES_TYPES
+
+IPADDRESSES_TYPE = [
+ IPADDRESSES_TYPES.IPV4,
+ IPADDRESSES_TYPES.IPV6
+]
+LAYER_PROTOCOL = [
+ "IP_OVER_ETHERNET"
+]
class AddressRangeSerializer(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)
+ 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 IpAddressesDataSerialzier(serializers.Serializer):
- type = serializers.ChoiceField(help_text="The type of the IP addresses.",
- required=True, choices=["IPV4", "IPV6"])
- fixedAddresses = serializers.ListField(child=serializers.CharField(help_text="Fixed addresses to assign.",
- required=False, allow_null=True))
- numDynamicAddresses = serializers.IntegerField(help_text="Number of dynamic addresses to assign.",
- required=False)
- addressRange = AddressRangeSerializer(help_text="An IP address range to be used.", required=False)
- subnetId = serializers.CharField(help_text="Subnet defined by the identifier of the subnet resource"
- " in the VIM.", required=False, allow_null=True,
- allow_blank=True)
+ type = serializers.ChoiceField(
+ help_text="The type of the IP addresses.",
+ required=True,
+ choices=IPADDRESSES_TYPE)
+ fixedAddresses = serializers.ListField(
+ child=serializers.CharField(
+ help_text="Fixed addresses to assign.",
+ required=False,
+ allow_null=True))
+ numDynamicAddresses = serializers.IntegerField(
+ help_text="Number of dynamic addresses to assign.",
+ required=False)
+ addressRange = AddressRangeSerializer(
+ help_text="An IP address range to be used.",
+ required=False)
+ subnetId = serializers.CharField(
+ help_text="Subnet defined by the identifier of the subnet resource in the VIM.",
+ required=False,
+ allow_null=True,
+ allow_blank=True)
class IpAddressesInfoSerialzier(serializers.Serializer):
- type = serializers.ChoiceField(help_text="The type of the IP addresses.",
- required=True, choices=["IPV4", "IPV6"])
- addresses = serializers.ListField(help_text="An IPV4 or IPV6 address", required=False, allow_null=True)
- 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)
- addressRange = AddressRangeSerializer(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)
+ type = serializers.ChoiceField(
+ help_text="The type of the IP addresses.",
+ required=True,
+ choices=IPADDRESSES_TYPE)
+ addresses = serializers.ListField(
+ help_text="An IPV4 or IPV6 address",
+ required=False,
+ allow_null=True)
+ 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)
+ addressRange = AddressRangeSerializer(
+ 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 IpOverEthernetAddressDataSerializer(serializers.Serializer):
- macAddress = serializers.CharField(help_text="Mac address", required=False, allow_null=True)
- ipAddresses = IpAddressesDataSerialzier(help_text="List of IP addresses to assign to the extCP instance.",
- required=False, allow_null=True, many=True)
+ macAddress = serializers.CharField(
+ help_text="Mac address",
+ required=False,
+ allow_null=True)
+ ipAddresses = IpAddressesDataSerialzier(
+ help_text="List of IP addresses to assign to the extCP instance.",
+ required=False,
+ allow_null=True,
+ many=True)
class IpOverEthernetAddressInfoSerializer(serializers.Serializer):
- macAddress = serializers.CharField(help_text="Mac address", required=False, allow_null=True)
- ipAddresses = IpAddressesInfoSerialzier(help_text="List of IP addresses to assign to the extCP instance.",
- required=False, allow_null=True, many=True)
+ macAddress = serializers.CharField(
+ help_text="Mac address",
+ required=False,
+ allow_null=True)
+ ipAddresses = IpAddressesInfoSerialzier(
+ help_text="List of IP addresses to assign to the extCP instance.",
+ required=False,
+ allow_null=True,
+ many=True)
class CpProtocolDataSerializer(serializers.Serializer):
- layerProtocol = serializers.ChoiceField(help_text="Identifier of layer(s) and protocol(s)",
- choices=["IP_OVER_ETHERNET"], required=True)
- ipOverEthernet = IpOverEthernetAddressDataSerializer(help_text="Network address data for IP over Ethernet"
- "to assign to the extCP instance.",
- required=False, allow_null=True)
+ layerProtocol = serializers.ChoiceField(
+ help_text="Identifier of layer(s) and protocol(s)",
+ choices=LAYER_PROTOCOL,
+ required=True)
+ ipOverEthernet = IpOverEthernetAddressDataSerializer(
+ help_text="Network address data for IP over Ethernet to assign to the extCP instance.",
+ required=False,
+ allow_null=True)
class CpProtocolInfoSerializer(serializers.Serializer):
- layerProtocol = serializers.ChoiceField(help_text="Identifier of layer(s) and protocol(s)",
- choices=["IP_OVER_ETHERNET"], required=True)
- ipOverEthernet = IpOverEthernetAddressInfoSerializer(help_text="Network address data for IP over Ethernet"
- "to assign to the extCP instance.",
- required=False, allow_null=True)
+ layerProtocol = serializers.ChoiceField(
+ help_text="Identifier of layer(s) and protocol(s)",
+ choices=LAYER_PROTOCOL,
+ required=True)
+ ipOverEthernet = IpOverEthernetAddressInfoSerializer(
+ help_text="Network address data for IP over Ethernet to assign to the extCP instance.",
+ required=False,
+ allow_null=True)
class VnfExtCpInfoSerializer(serializers.Serializer):