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 StringType, URLType, IntType, FloatType
21 from schematics.types.compound import ModelType, ListType
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 optimizer = ListType(StringType())
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()
50 operationalStatus = StringType()
53 class ExistingLicenseInfo(OSDFModel):
54 entitlementPoolUUID = ListType(StringType())
55 licenseKeyGroupUUID = ListType(StringType())
58 class LicenseDemand(OSDFModel):
59 resourceInstanceType = StringType(required=True)
60 serviceResourceId = StringType(required=True)
61 resourceModuleName = StringType(required=True)
62 resourceModelInfo = ModelType(ResourceModelInfo)
63 existingLicense = ModelType(ExistingLicenseInfo)
66 class PlacementDemand(OSDFModel):
67 resourceInstanceType = StringType(required=True)
68 serviceResourceId = StringType(required=True)
69 resourceModuleName = StringType(required=True)
70 exclusionCandidateInfo = ListType(ModelType(CandidateInfo))
71 requiredCandidateInfo = ListType(ModelType(CandidateInfo))
72 resourceModelInfo = ModelType(ResourceModelInfo)
73 tenantId = StringType()
74 tenantName = StringType()
77 class ExistingPlacementInfo(OSDFModel):
78 serviceInstanceId = StringType(required=True)
81 class DemandInfo(OSDFModel):
82 """Requested resources (sent as part of a request from client)"""
83 placementDemand = ListType(ModelType(PlacementDemand))
84 licenseDemand = ListType(ModelType(LicenseDemand))
87 class SubscriberInfo(OSDFModel):
88 """Details on the customer that subscribes to the VNFs"""
89 globalSubscriberId = StringType(required=True)
90 subscriberName = StringType()
91 subscriberCommonSiteId = StringType()
94 class ServiceModelInfo(OSDFModel):
95 """ASDC Service model information"""
96 modelType = StringType(required=True)
97 modelInvariantId = StringType(required=True)
98 modelVersionId = StringType(required=True)
99 modelName = StringType(required=True)
100 modelVersion = StringType(required=True)
103 class Location(OSDFModel):
104 latitude = FloatType(required=True)
105 longitude = FloatType(required=True)
108 class PlacementInfo(OSDFModel):
109 """Information specific to placement optimization"""
110 serviceModelInfo = ModelType(ServiceModelInfo)
111 subscriberInfo = ModelType(SubscriberInfo)
112 demandInfo = ModelType(DemandInfo, required=True)
113 orderInfo = StringType()
114 policyId = ListType(StringType())
115 serviceInstanceId = StringType()
116 existingPlacement = ModelType(ExistingPlacementInfo)
117 location = ModelType(Location)
118 serviceType = StringType()
121 class PlacementAPI(OSDFModel):
122 """Request for placement optimization (specific to optimization and additional metadata"""
123 requestInfo = ModelType(RequestInfo, required=True)
124 placementInfo = ModelType(PlacementInfo, required=True)