Change API layer for 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     sourceId = StringType(required=True)
30     callbackHeader = DictType(BaseType)
31     timeout = IntType()
32     numSolutions = IntType()
33     addtnlArgs = DictType(BaseType)
34
35
36 class NxTInfo(OSDFModel):
37     """Information about NST/NSST model"""
38     invariantUUID = StringType(required=True)
39     UUID = StringType(required=True)
40     name = StringType(required=True)
41
42
43 class SubnetCapability(OSDFModel):
44     """Subnet capability of every subnet"""
45     domainType = StringType(required=True)
46     capabilityDetails = DictType(BaseType, 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     NSTInfo = ModelType(NxTInfo, required=True)
53     NSSTInfo = ListType(ModelType(NxTInfo), required=True)
54     serviceProfile = DictType(BaseType, required=True)
55     subnetCapabilities = ListType(ModelType(SubnetCapability), required=True)
56     preferReuse = BooleanType()