1 # -------------------------------------------------------------------------
2 # Copyright (c) 2015-2017 AT&T Intellectual Property
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
16 # -------------------------------------------------------------------------
19 from osdf.models.api.common import OSDFModel
20 from schematics.types import BaseType, StringType, URLType, IntType, BooleanType
21 from schematics.types.compound import ModelType, ListType, DictType
24 class RequestInfo(OSDFModel):
25 """Info for northbound request from client such as SO"""
26 transactionId = StringType(required=True)
27 requestId = StringType(required=True)
28 callbackUrl = URLType(required=True)
29 callbackHeader = DictType(BaseType)
30 sourceId = StringType(required=True)
31 requestType = StringType(required=True)
32 numSolutions = IntType()
33 optimizers = ListType(StringType(required=True))
37 class Candidates(OSDFModel):
38 """Preferred candidate for a resource (sent as part of a request from client)"""
39 identifierType = StringType(required=True)
40 identifiers = ListType(StringType(required=True))
41 cloudOwner = StringType()
44 class ModelMetaData(OSDFModel):
45 """Model information for a specific resource"""
46 modelInvariantId = StringType(required=True)
47 modelVersionId = StringType(required=True)
48 modelName = StringType()
49 modelType = StringType()
50 modelVersion = StringType()
51 modelCustomizationName = StringType()
54 class LicenseModel(OSDFModel):
55 entitlementPoolUUID = ListType(StringType(required=True))
56 licenseKeyGroupUUID = ListType(StringType(required=True))
59 class LicenseDemands(OSDFModel):
60 resourceModuleName = StringType(required=True)
61 serviceResourceId = StringType(required=True)
62 resourceModelInfo = ModelType(ModelMetaData, required=True)
63 existingLicenses = ModelType(LicenseModel)
66 class LicenseInfo(OSDFModel):
67 licenseDemands = ListType(ModelType(LicenseDemands))
70 class PlacementDemand(OSDFModel):
71 resourceModuleName = StringType(required=True)
72 serviceResourceId = StringType(required=True)
73 tenantId = StringType()
74 resourceModelInfo = ModelType(ModelMetaData, required=True)
75 existingCandidates = ListType(ModelType(Candidates))
76 excludedCandidates = ListType(ModelType(Candidates))
77 requiredCandidates = ListType(ModelType(Candidates))
80 class ServiceInfo(OSDFModel):
81 serviceInstanceId = StringType(required=True)
82 modelInfo = ModelType(ModelMetaData, required=True)
83 serviceName = StringType(required=True)
86 class SubscriberInfo(OSDFModel):
87 """Details on the customer that subscribes to the VNFs"""
88 globalSubscriberId = StringType(required=True)
89 subscriberName = StringType()
90 subscriberCommonSiteId = StringType()
93 class PlacementInfo(OSDFModel):
94 """Information specific to placement optimization"""
95 requestParameters = DictType(BaseType)
96 placementDemands = ListType(ModelType(PlacementDemand), min_size=1)
97 subscriberInfo = ModelType(SubscriberInfo)
100 class PlacementAPI(OSDFModel):
101 """Request for placement optimization (specific to optimization and additional metadata"""
102 requestInfo = ModelType(RequestInfo, required=True)
103 placementInfo = ModelType(PlacementInfo, required=True)
104 licenseInfo = ModelType(LicenseInfo)
105 serviceInfo = ModelType(ServiceInfo, required=True)