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
Commits
e8f4bff8
Commit
e8f4bff8
authored
1 year ago
by
Lluis Gifre Renom
Browse files
Options
Downloads
Patches
Plain Diff
Pre-merge cosmetic cleanup
parent
16d9b2f3
No related branches found
No related tags found
2 merge requests
!294
Release TeraFlowSDN 4.0
,
!213
Resolve "(CTTC) Implement NBI connector to manage Network Access Control Lists (ACLs)"
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/nbi/service/rest_server/nbi_plugins/etsi_bwm/Resources.py
+14
-6
14 additions, 6 deletions
...nbi/service/rest_server/nbi_plugins/etsi_bwm/Resources.py
src/nbi/service/rest_server/nbi_plugins/etsi_bwm/Tools.py
+1
-1
1 addition, 1 deletion
src/nbi/service/rest_server/nbi_plugins/etsi_bwm/Tools.py
with
15 additions
and
7 deletions
src/nbi/service/rest_server/nbi_plugins/etsi_bwm/Resources.py
+
14
−
6
View file @
e8f4bff8
...
@@ -13,12 +13,15 @@
...
@@ -13,12 +13,15 @@
# limitations under the License.
# limitations under the License.
import
copy
,
deepmerge
,
json
,
logging
import
copy
,
deepmerge
,
json
,
logging
from
typing
import
Dict
from
flask_restful
import
Resource
,
request
from
werkzeug.exceptions
import
UnsupportedMediaType
from
common.Constants
import
DEFAULT_CONTEXT_NAME
from
common.Constants
import
DEFAULT_CONTEXT_NAME
from
context.client.ContextClient
import
ContextClient
from
context.client.ContextClient
import
ContextClient
from
flask_restful
import
Resource
,
request
from
service.client.ServiceClient
import
ServiceClient
from
service.client.ServiceClient
import
ServiceClient
from
.Tools
import
(
from
.Tools
import
(
format_grpc_to_json
,
grpc_context_id
,
grpc_service_id
,
bwInfo_2_service
,
service_2_bwInfo
)
format_grpc_to_json
,
grpc_context_id
,
grpc_service_id
,
bwInfo_2_service
,
service_2_bwInfo
)
LOGGER
=
logging
.
getLogger
(
__name__
)
LOGGER
=
logging
.
getLogger
(
__name__
)
...
@@ -37,15 +40,20 @@ class BwInfo(_Resource):
...
@@ -37,15 +40,20 @@ class BwInfo(_Resource):
return
bw_allocations
return
bw_allocations
def
post
(
self
):
def
post
(
self
):
bwinfo
=
request
.
get_json
()
if
not
request
.
is_json
:
service
=
bwInfo_2_service
(
self
.
client
,
bwinfo
)
raise
UnsupportedMediaType
(
'
JSON payload is required
'
)
request_data
:
Dict
=
request
.
get_json
()
service
=
bwInfo_2_service
(
self
.
client
,
request_data
)
stripped_service
=
copy
.
deepcopy
(
service
)
stripped_service
=
copy
.
deepcopy
(
service
)
stripped_service
.
ClearField
(
'
service_endpoint_ids
'
)
stripped_service
.
ClearField
(
'
service_endpoint_ids
'
)
stripped_service
.
ClearField
(
'
service_constraints
'
)
stripped_service
.
ClearField
(
'
service_constraints
'
)
stripped_service
.
ClearField
(
'
service_config
'
)
stripped_service
.
ClearField
(
'
service_config
'
)
response
=
format_grpc_to_json
(
self
.
service_client
.
CreateService
(
stripped_service
))
try
:
response
=
format_grpc_to_json
(
self
.
service_client
.
UpdateService
(
service
))
response
=
format_grpc_to_json
(
self
.
service_client
.
CreateService
(
stripped_service
))
response
=
format_grpc_to_json
(
self
.
service_client
.
UpdateService
(
service
))
except
Exception
as
e
:
# pylint: disable=broad-except
return
e
return
response
return
response
...
...
This diff is collapsed.
Click to expand it.
src/nbi/service/rest_server/nbi_plugins/etsi_bwm/Tools.py
+
1
−
1
View file @
e8f4bff8
...
@@ -20,10 +20,10 @@ from common.proto.context_pb2 import (
...
@@ -20,10 +20,10 @@ from common.proto.context_pb2 import (
Service
,
Constraint
,
Constraint_SLA_Capacity
,
ConfigRule
,
ConfigRule_Custom
,
Service
,
Constraint
,
Constraint_SLA_Capacity
,
ConfigRule
,
ConfigRule_Custom
,
ConfigActionEnum
ConfigActionEnum
)
)
from
common.tools.grpc.ConfigRules
import
update_config_rule_custom
from
common.tools.grpc.Tools
import
grpc_message_to_json
from
common.tools.grpc.Tools
import
grpc_message_to_json
from
common.tools.object_factory.Context
import
json_context_id
from
common.tools.object_factory.Context
import
json_context_id
from
common.tools.object_factory.Service
import
json_service_id
from
common.tools.object_factory.Service
import
json_service_id
from
common.tools.grpc.ConfigRules
import
update_config_rule_custom
LOGGER
=
logging
.
getLogger
(
__name__
)
LOGGER
=
logging
.
getLogger
(
__name__
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment