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, 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 unique = BooleanType() # to be implemented on the policy level
75 resourceModelInfo = ModelType(ModelMetaData, required=True)
76 existingCandidates = ListType(ModelType(Candidates))
77 excludedCandidates = ListType(ModelType(Candidates))
78 requiredCandidates = ListType(ModelType(Candidates))
81 class ServiceInfo(OSDFModel):
82 serviceInstanceId = StringType(required=True)
83 modelInfo = ModelType(ModelMetaData, required=True)
84 serviceName = StringType(required=True)
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 PlacementInfo(OSDFModel):
95 """Information specific to placement optimization"""
96 requestParameters = DictType(BaseType)
97 placementDemands = ListType(ModelType(PlacementDemand), min_size=1)
98 subscriberInfo = ModelType(SubscriberInfo)
101 class PlacementAPI(OSDFModel):
102 """Request for placement optimization (specific to optimization and additional metadata"""
103 requestInfo = ModelType(RequestInfo, required=True)
104 placementInfo = ModelType(PlacementInfo, required=True)
105 licenseInfo = ModelType(LicenseInfo)
106 serviceInfo = ModelType(ServiceInfo, required=True)