Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
controller
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TFS
controller
Merge requests
!120
Resolve "(CTTC) Implement ETSI MEC Bandwidth Management API in NBI component"
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Resolve "(CTTC) Implement ETSI MEC Bandwidth Management API in NBI component"
feat/compute-etsi_mec_015
into
develop
Overview
1
Commits
7
Pipelines
0
Changes
5
Merged
Carlos Manso
requested to merge
feat/compute-etsi_mec_015
into
develop
1 year ago
Overview
1
Commits
7
Pipelines
0
Changes
5
Expand
Closes
#44 (closed)
Added initial support for the ETSI MEC Bandwidth Management API.
Edited
1 year ago
by
Lluis Gifre Renom
0
0
Merge request reports
Compare
develop
version 8
c9ef5706
1 year ago
version 7
e56acc1f
1 year ago
version 6
f3c69734
1 year ago
version 5
f8bd53bc
1 year ago
version 4
ab2eb457
1 year ago
version 3
1f0b8016
1 year ago
version 2
1f0b8016
1 year ago
version 1
1f0b8016
1 year ago
develop (base)
and
latest version
latest version
0d3549fe
7 commits,
1 year ago
version 8
c9ef5706
6 commits,
1 year ago
version 7
e56acc1f
5 commits,
1 year ago
version 6
f3c69734
4 commits,
1 year ago
version 5
f8bd53bc
3 commits,
1 year ago
version 4
ab2eb457
2 commits,
1 year ago
version 3
1f0b8016
1 commit,
1 year ago
version 2
1f0b8016
1 commit,
1 year ago
version 1
1f0b8016
683 commits,
1 year ago
5 files
+
302
−
1
Side-by-side
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
5
Search (e.g. *.vue) (Ctrl+P)
src/compute/service/rest_server/nbi_plugins/etsi_bwm/Resources.py
0 → 100644
+
75
−
0
Options
# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (https://tfs.etsi.org/)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import
copy
from
common.Constants
import
DEFAULT_CONTEXT_NAME
from
flask_restful
import
Resource
,
request
from
context.client.ContextClient
import
ContextClient
from
service.client.ServiceClient
import
ServiceClient
from
.Tools
import
(
format_grpc_to_json
,
grpc_context_id
,
grpc_service_id
,
bwInfo_2_service
,
service_2_bwInfo
)
class
_Resource
(
Resource
):
def
__init__
(
self
)
->
None
:
super
().
__init__
()
self
.
client
=
ContextClient
()
self
.
service_client
=
ServiceClient
()
class
BwInfo
(
_Resource
):
def
get
(
self
):
service_list
=
self
.
client
.
ListServices
(
grpc_context_id
(
DEFAULT_CONTEXT_NAME
))
bw_allocations
=
[
service_2_bwInfo
(
service
)
for
service
in
service_list
.
services
]
return
bw_allocations
def
post
(
self
):
bwinfo
=
request
.
get_json
()
service
=
bwInfo_2_service
(
self
.
client
,
bwinfo
)
stripped_service
=
copy
.
deepcopy
(
service
)
stripped_service
.
ClearField
(
'
service_endpoint_ids
'
)
stripped_service
.
ClearField
(
'
service_constraints
'
)
stripped_service
.
ClearField
(
'
service_config
'
)
response
=
format_grpc_to_json
(
self
.
service_client
.
CreateService
(
stripped_service
))
response
=
format_grpc_to_json
(
self
.
service_client
.
UpdateService
(
service
))
return
response
class
BwInfoId
(
_Resource
):
def
get
(
self
,
allocationId
:
str
):
service
=
self
.
client
.
GetService
(
grpc_service_id
(
DEFAULT_CONTEXT_NAME
,
allocationId
))
return
service_2_bwInfo
(
service
)
def
put
(
self
,
allocationId
:
str
):
json_data
=
request
.
get_json
()
service
=
bwInfo_2_service
(
self
.
client
,
json_data
)
response
=
self
.
service_client
.
UpdateService
(
service
)
return
format_grpc_to_json
(
response
)
def
patch
(
self
,
allocationId
:
str
):
json_data
=
request
.
get_json
()
if
not
'
appInsId
'
in
json_data
:
json_data
[
'
appInsId
'
]
=
allocationId
service
=
bwInfo_2_service
(
self
.
client
,
json_data
)
response
=
self
.
service_client
.
UpdateService
(
service
)
return
format_grpc_to_json
(
response
)
def
delete
(
self
,
allocationId
:
str
):
self
.
service_client
.
DeleteService
(
grpc_service_id
(
DEFAULT_CONTEXT_NAME
,
allocationId
))
return
Loading