summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlaili <lai.li@zte.com.cn>2018-08-09 11:20:14 +0800
committerlaili <lai.li@zte.com.cn>2018-08-09 11:20:14 +0800
commit795d7d5256fd1d04073d7db21bdce25f612d547f (patch)
tree98c9d01805b0987f0aa6a54c5054a98a8535350a
parentf5a6d2a97522298a1a20e5f2d0d5f5c14f90ef96 (diff)
Modify vnf instantiation related stuffs.
Add address_range.py used by ip_addresse.py to serializers. Add ip_addresse.py used by ip_over_ethernet_address_data.py to serializers. Change-Id: I96cc12f571d87b3d0aa169b307045a8569d18d70 Issue-ID: VFC-1017 Signed-off-by: laili <lai.li@zte.com.cn>
-rw-r--r--lcm/lcm/nf/serializers/address_range.py25
-rw-r--r--lcm/lcm/nf/serializers/ip_addresse.py44
2 files changed, 69 insertions, 0 deletions
diff --git a/lcm/lcm/nf/serializers/address_range.py b/lcm/lcm/nf/serializers/address_range.py
new file mode 100644
index 00000000..20c40a3d
--- /dev/null
+++ b/lcm/lcm/nf/serializers/address_range.py
@@ -0,0 +1,25 @@
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+from rest_framework import serializers
+
+
+class AddressRangeSerializer(serializers.Serializer):
+ minAddress = serializers.CharField(
+ help_text="Lowest IP address belonging to the range.",
+ required=True,
+ allow_null=False,
+ allow_blank=False)
+ maxAddress = serializers.CharField(
+ help_text="Highest IP address belonging to the range.",
+ required=True,
+ allow_null=False,
+ allow_blank=False)
diff --git a/lcm/lcm/nf/serializers/ip_addresse.py b/lcm/lcm/nf/serializers/ip_addresse.py
new file mode 100644
index 00000000..f273c423
--- /dev/null
+++ b/lcm/lcm/nf/serializers/ip_addresse.py
@@ -0,0 +1,44 @@
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+from rest_framework import serializers
+from address_range import AddressRangeSerializer
+
+
+class IpAddresseSerializer(serializers.Serializer):
+ type = serializers.ChoiceField(
+ help_text="The type of the IP addresses.",
+ choices=["IPV4", "IPV6"],
+ required=True,
+ allow_null=False,
+ allow_blank=False)
+ fixedAddresses = serializers.ListSerializer(
+ help_text="Fixed addresses to assign.",
+ child=serializers.CharField(help_text="IpAddress"),
+ required=False,
+ allow_null=True)
+ numDynamicAddresses = serializers.IntegerField(
+ help_text="Number of dynamic addresses to assign.",
+ required=False,
+ allow_null=True)
+ addressRange = AddressRangeSerializer(
+ help_text="An IP address range to be used, e.g. in case of egress connections. \
+ In case this attribute is present, IP addresses from the range will be used.",
+ required=False,
+ allow_null=True, )
+ subnetId = serializers.CharField(
+ help_text="Subnet defined by the identifier of the subnet resource in the VIM. \
+ In case this attribute is present, IP addresses from that subnet will be assigned; \
+ otherwise, IP addresses not bound to a subnet will be assigned.",
+ max_length=255,
+ required=False,
+ allow_null=True,
+ allow_blank=True)