Add subscriptions API to GVNFM
[vfc/gvnfm/vnflcm.git] / lcm / lcm / nf / serializers / vnf_instance_subscription_filter.py
1 # Copyright (C) 2018 Verizon. All Rights Reserved
2 #
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
6 #
7 #         http://www.apache.org/licenses/LICENSE-2.0
8 #
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
15 from rest_framework import serializers
16
17
18 class VersionsSerializer(serializers.Serializer):
19     vnfSoftwareVersion = serializers.CharField(
20         max_length=255,
21         help_text="Software version to match.",
22         required=True)
23     vnfdVersions = serializers.ListField(
24         child=serializers.CharField(max_length=255, required=True),
25         required=False,
26         help_text="match VNF instances that belong to VNF products " +
27         "with certain VNFD versions")
28
29
30 class VnfProductsSerializer(serializers.Serializer):
31     vnfProductName = serializers.CharField(
32         max_length=255,
33         help_text="Name of the VNF product to match.",
34         required=True)
35     versions = VersionsSerializer(
36         help_text="match VNF instances that belong to VNF products " +
37         "with certain versions and a certain product name, from one " +
38         "particular provider",
39         required=False,
40         allow_null=False)
41
42
43 class VnfProductsProvidersSerializer(serializers.Serializer):
44     vnfProvider = serializers.CharField(
45         max_length=255,
46         help_text="Name of the VNF provider to match.",
47         required=True)
48     vnfProducts = VnfProductsSerializer(
49         help_text="match VNF instances that belong to VNF products " +
50         "with certain product names, from one particular provider",
51         required=False,
52         allow_null=False)
53
54
55 class VnfInstanceSubscriptionFilter(serializers.Serializer):
56     vnfdIds = serializers.ListField(
57         child=serializers.UUIDField(),
58         help_text="VNF instances that were created based on a " +
59         "VNFD identified by one of the vnfdId values",
60         required=False,
61         allow_null=False)
62     vnfInstanceIds = serializers.ListField(
63         child=serializers.UUIDField(),
64         help_text="VNF instance IDs that has to be matched",
65         required=False,
66         allow_null=False)
67     vnfInstanceNames = serializers.ListField(
68         child=serializers.CharField(max_length=255, required=True),
69         help_text="VNF Instance names that has to be matched",
70         required=False,
71         allow_null=False)
72     vnfProductsFromProviders = VnfProductsProvidersSerializer(
73         help_text="match VNF instances that belong to VNF products " +
74         "from certain providers.",
75         required=False,
76         allow_null=False)