1 # ============LICENSE_START=======================================================
2 # Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved.
3 # Contribution (C) 2022 Aarna Networks, Inc. All rights reserved.
4 # ================================================================================
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 # ============LICENSE_END=========================================================
20 from .utils import getLogger
23 logger = getLogger("NssManager")
26 class NssError(ValueError):
30 def allocateNssi(requestBody):
31 sliceProfile = requestBody["attributeListIn"]
32 sliceProfileId = sliceProfile["sliceProfileId"]
34 nSSId = uuid.uuid4().hex
37 "attributeListOut": {},
41 logger.info("Allocate NSSI for sliceProfileId %s success, nSSId: %s" % (sliceProfileId, nSSId))
45 def deallocateNssi(sliceProfileId, requestBody):
46 nSSId = requestBody["nSSId"]
48 logger.info("Deallocate NSSI for sliceProfileId %s success, nSSId: %s" % (sliceProfileId, nSSId))
51 def activateNssi(snssai, requestBody):
54 This method is internal and invoked from handleActivateNssi()
55 callflow. As part of this, it logs the activate snssai, nssiId
56 values from incoming request.
57 Arguments: snssai, requestBody
58 snssai represents below:
59 'sst': Identifies the service (e.g eMBB, URLLC,...)
60 'sd' : service differentiator within sst.
61 requestBody: Incoming http request payload.
64 nssiId = requestBody["nssiId"]
65 #nsiId = requestBody["nsiId"]
67 logger.info("Activate NSSI for snssai %s successful, nssiId: %s" % (snssai, nssiId))
70 def deactivateNssi(snssai, requestBody):
72 Method: deactivateNssi
73 This method is internal and invoked from handleDeActivateNssi()
74 callflow. As part of this, it logs the deactivate snssai, nssiId
75 values from incoming request.
76 Argument: snssai, requestBody
77 snssai represents below:
78 'sst': Identifies the service (e.g eMBB, URLLC,...)
79 'sd' : service differentiator within sst.
80 requestBody: Incoming http request payload.
83 nssiId = requestBody["nssiId"]
84 #nsiId = requestBody["nsiId"]
86 logger.info("DeActivate NSSI for snssai %s successful, nssiId: %s" % (snssai, nssiId))