Add functionality to support NSI selection
[optf/osdf.git] / apps / slice_selection / models / api / nsi_selection_request.py
1 # -------------------------------------------------------------------------
2 #   Copyright (C) 2020 Wipro Limited.
3 #
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
7 #
8 #       http://www.apache.org/licenses/LICENSE-2.0
9 #
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.
15 #
16 # -------------------------------------------------------------------------
17 #
18
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
22
23
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     timeout = IntType()
32
33
34 class NSTInfo(OSDFModel):
35     """Preferred candidate for a resource (sent as part of a request from client)"""
36     modelInvariantId = StringType(required=True)
37     modelVersionId = StringType(required=True)
38     modelName = StringType()
39     modelType = StringType()
40     modelVersion = StringType()
41     modelCustomizationName = StringType()
42
43
44 class ServiceInfo(OSDFModel):
45     serviceInstanceId = StringType(required=True)
46     serviceName = StringType(required=True)
47
48
49 class NSISelectionAPI(OSDFModel):
50     """Request for nsi selection (specific to optimization and additional metadata"""
51     requestInfo = ModelType(RequestInfo, required=True)
52     NSTInfoList = ListType(ModelType(NSTInfo), required=True)
53     serviceInfo = ModelType(ServiceInfo, required=True)
54     serviceProfile = DictType(BaseType, required=True)