Add support to process NSI selection request
[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
21 from schematics.types import BooleanType
22 from schematics.types.compound import DictType
23 from schematics.types.compound import ListType
24 from schematics.types.compound import ModelType
25 from schematics.types import IntType
26 from schematics.types import StringType
27 from schematics.types import URLType
28
29
30 class RequestInfo(OSDFModel):
31     """Info for northbound request from client such as SO"""
32     transactionId = StringType(required=True)
33     requestId = StringType(required=True)
34     callbackUrl = URLType(required=True)
35     sourceId = StringType(required=True)
36     callbackHeader = DictType(BaseType)
37     timeout = IntType()
38     numSolutions = IntType()
39     addtnlArgs = DictType(BaseType)
40
41
42 class NxTInfo(OSDFModel):
43     """Information about NST/NSST model"""
44     invariantUUID = StringType(required=True)
45     UUID = StringType(required=True)
46     name = StringType(required=True)
47
48
49 class SubnetCapability(OSDFModel):
50     """Subnet capability of every subnet"""
51     domainType = StringType(required=True)
52     capabilityDetails = DictType(BaseType, required=True)
53
54
55 class NSISelectionAPI(OSDFModel):
56     """Request for nsi selection (specific to optimization and additional metadata"""
57     requestInfo = ModelType(RequestInfo, required=True)
58     NSTInfo = ModelType(NxTInfo, required=True)
59     NSSTInfo = ListType(ModelType(NxTInfo), required=False)
60     serviceProfile = DictType(BaseType, required=True)
61     subnetCapabilities = ListType(ModelType(SubnetCapability), required=True)
62     preferReuse = BooleanType()