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.",
60 class AffinityOrAntiAffinityRuleSerializer(serializers.Serializer):
61 vnfdId = serializers.ListField(
62 child=serializers.CharField(),
63 help_text="Identifier of the VNFD on which the VNF instance is based.",
66 vnfProfileId = serializers.ListField(
67 child=serializers.CharField(),
68 help_text="Identifier of (Reference to) a vnfProfile defined in the NSD which the existing VNF instance shall be matched with.",
71 vnfInstanceId = serializers.ListField(
72 child=serializers.CharField(),
73 help_text="Identifier of the existing VNF instance to be used in the NS.",
76 affinityOrAntiAffiinty = serializers.ChoiceField(
77 help_text="The type of the constraint.",
78 choices=["AFFINITY", "ANTI_AFFINITY"],
82 scope = serializers.ChoiceField(
83 help_text="Specifies the scope of the rule where the placement constraint applies.",
84 choices=["NFVI_POP", "ZONE", "ZONE_GROUP", "NFVI_NODE"],