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 .common import OSDFModel
20 from schematics.types import BaseType, StringType, URLType, IntType
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 sourceId = StringType(required=True)
30 optimizers = ListType(StringType(required=True))
31 numSolutions = IntType()
33 requestType = StringType()
36 class CandidateInfo(OSDFModel):
37 """Preferred candidate for a resource (sent as part of a request from client)"""
38 candidateType = StringType(required=True)
39 candidates = ListType(StringType(required=True))
42 class ResourceModelInfo(OSDFModel):
43 """Model information for a specific resource"""
44 modelCustomizationId = StringType(required=True)
45 modelInvariantId = StringType(required=True)
46 modelName = StringType()
47 modelVersion = StringType()
48 modelVersionId = StringType()
49 modelType = StringType()
52 class ExistingLicenseInfo(OSDFModel):
53 entitlementPoolUUID = ListType(StringType())
54 licenseKeyGroupUUID = ListType(StringType())
57 class LicenseDemand(OSDFModel):
58 resourceInstanceType = StringType(required=True)
59 serviceResourceId = StringType(required=True)
60 resourceModuleName = StringType(required=True)
61 resourceModelInfo = ModelType(ResourceModelInfo)
62 existingLicense = ModelType(ExistingLicenseInfo)
65 class PlacementDemand(OSDFModel):
66 resourceInstanceType = StringType(required=True)
67 serviceResourceId = StringType(required=True)
68 resourceModuleName = StringType(required=True)
69 exclusionCandidateInfo = ListType(ModelType(CandidateInfo))
70 requiredCandidateInfo = ListType(ModelType(CandidateInfo))
71 resourceModelInfo = ModelType(ResourceModelInfo)
72 tenantId = StringType(required=True)
73 tenantName = StringType()
75 class ExistingPlacementInfo(OSDFModel):
76 serviceInstanceId = StringType(required=True)
79 class DemandInfo(OSDFModel):
80 """Requested resources (sent as part of a request from client)"""
81 placementDemand = ListType(ModelType(PlacementDemand))
82 licenseDemand = ListType(ModelType(LicenseDemand))
85 class SubscriberInfo(OSDFModel):
86 """Details on the customer that subscribes to the VNFs"""
87 globalSubscriberId = StringType(required=True)
88 subscriberName = StringType()
89 subscriberCommonSiteId = StringType()
92 class ServiceModelInfo(OSDFModel):
93 """ASDC Service model information"""
94 modelType = StringType(required=True)
95 modelInvariantId = StringType(required=True)
96 modelVersionId = StringType(required=True)
97 modelName = StringType(required=True)
98 modelVersion = StringType(required=True)
101 class PlacementInfo(OSDFModel):
102 """Information specific to placement optimization"""
103 serviceModelInfo = ModelType(ServiceModelInfo, required=True)
104 subscriberInfo = ModelType(SubscriberInfo, required=True)
105 demandInfo = ModelType(DemandInfo, required=True)
106 requestParameters = DictType(BaseType)
107 policyId = ListType(StringType())
108 serviceInstanceId = StringType(required=True)
109 existingPlacement = ModelType(ExistingPlacementInfo)
112 class PlacementAPI(OSDFModel):
113 """Request for placement optimization (specific to optimization and additional metadata"""
114 requestInfo = ModelType(RequestInfo, required=True)
115 placementInfo = ModelType(PlacementInfo, required=True)