1 # Copyright (c) 2019, CMCC Technologies Co., Ltd.
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 from rest_framework import serializers
17 class ProblemDetailsSerializer(serializers.Serializer):
18 type = serializers.CharField(
19 help_text="A URI reference according to IETF RFC 3986 [5] that identifies the problem type.",
24 title = serializers.CharField(
25 help_text="A short, human-readable summary of the problem type.",
30 status = serializers.IntegerField(
31 help_text="The HTTP status code for this occurrence of the problem.",
34 detail = serializers.CharField(
35 help_text="A human-readable explanation specific to this occurrence of the problem.",
38 instance = serializers.CharField(
39 help_text="A URI reference that identifies the specific occurrence of the problem.",
44 additional_details = serializers.ListField(
45 help_text="Any number of additional attributes, as defined in a specification or by an"
52 class LinkSerializer(serializers.Serializer):
53 href = serializers.CharField(
54 help_text="URI of the referenced resource.", required=True, allow_null=False, allow_blank=False)
57 class AffinityOrAntiAffinityRuleSerializer(serializers.Serializer):
58 vnfdId = serializers.ListField(
59 child=serializers.CharField(),
60 help_text="Identifier of the VNFD on which the VNF instance is based.",
63 vnfProfileId = serializers.ListField(
64 child=serializers.CharField(),
65 help_text="Identifier of (Reference to) a vnfProfile defined in the NSD which the existing VNF instance shall be matched with.",
68 vnfInstanceId = serializers.ListField(
69 child=serializers.CharField(),
70 help_text="Identifier of the existing VNF instance to be used in the NS.",
73 affinityOrAntiAffiinty = serializers.ChoiceField(
74 help_text="The type of the constraint.",
75 choices=["AFFINITY", "ANTI_AFFINITY"],
79 scope = serializers.ChoiceField(
80 help_text="Specifies the scope of the rule where the placement constraint applies.",
81 choices=["NFVI_POP", "ZONE", "ZONE_GROUP", "NFVI_NODE"],