summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFu Jinhua <fu.jinhua@zte.com.cn>2018-03-06 05:39:41 +0000
committerGerrit Code Review <gerrit@onap.org>2018-03-06 05:39:41 +0000
commit5b7bf2b5c6efbca681686e8ed272dd86e69fd88e (patch)
tree552332b7b70d7cc99a853771cdb7079e95b65fa4
parent052f205dc7f9ecfee5f9bba8a0adfda67c50a6c0 (diff)
parentc6ede2ae9d5c8acd97628accf05150b41e53a53f (diff)
Merge "Add Placement Constraint serializer"
-rw-r--r--lcm/v2/serializers.py45
1 files changed, 45 insertions, 0 deletions
diff --git a/lcm/v2/serializers.py b/lcm/v2/serializers.py
index a2eae1b7..69721cd0 100644
--- a/lcm/v2/serializers.py
+++ b/lcm/v2/serializers.py
@@ -69,6 +69,47 @@ class ResourceDefinitionSerializer(serializers.Serializer):
)
+class ConstraintResourceRefSerializer(serializers.Serializer):
+ idType = serializers.ChoiceField(
+ help_text="The type of the identifier.",
+ choices=["RES_MGMT", "GRANT"],
+ required=True
+ )
+ resourceId = serializers.CharField(
+ help_text="An actual resource-management-level identifier(idType=RES_MGMT), or an identifier that references a ResourceDefinition(idType=GRANT).",
+ required=True
+ )
+ vimConnectionId = serializers.CharField(
+ help_text="",
+ required=False,
+ allow_null=True,
+ allow_blank=True
+ )
+ resourceProviderId = serializers.CharField(
+ help_text="Identifier of the resource provider. It shall only be present when idType = RES_MGMT.",
+ required=False,
+ allow_null=True,
+ allow_blank=True
+ )
+
+
+class PlacementConstraintSerializer(serializers.Serializer):
+ affinityOrAntiAffinity = serializers.ChoiceField(
+ help_text="The type of the constraint.",
+ choices=["AFFINITY", "ANTI_AFFINITY"],
+ required=True
+ )
+ scope = serializers.ChoiceField(
+ help_text="The scope of the placement constraint indicating the category of the place where the constraint applies.",
+ choices=["NFVI_POP", "ZONE", "ZONE_GROUP", "NFVI_NODE"],
+ required=True
+ )
+ resource = ConstraintResourceRefSerializer(
+ help_text="References to resources in the constraint rule.",
+ many=True
+ )
+
+
class GrantRequestSerializer(serializers.Serializer):
vnfInstanceId = serializers.CharField(
help_text="Identifier of the VNF instance which this grant request is related to.",
@@ -123,6 +164,10 @@ class GrantRequestSerializer(serializers.Serializer):
help_text="Provides the definitions of resources to be modified by the LCM operation.",
many=True
)
+ placementConstraints = PlacementConstraintSerializer(
+ help_text="Placement constraints that the VNFM may send to the NFVO in order to influence the resource placement decision.",
+ many=True
+ )
class VimConnectionInfoSerializer(serializers.Serializer):