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
310c62fa
Commit
310c62fa
authored
4 months ago
by
Lluis Gifre Renom
Browse files
Options
Downloads
Patches
Plain Diff
Moving features outside this issue
parent
8b314e43
No related branches found
No related tags found
1 merge request
!286
Resolve "(CTTC) Implement integration test between E2E-IP-Optical SDN Controllers"
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/context/service/database/Link.py
+1
-4
1 addition, 4 deletions
src/context/service/database/Link.py
src/context/service/database/models/LinkModel.py
+0
-6
0 additions, 6 deletions
src/context/service/database/models/LinkModel.py
with
1 addition
and
10 deletions
src/context/service/database/Link.py
+
1
−
4
View file @
310c62fa
...
...
@@ -28,7 +28,6 @@ from .models.TopologyModel import TopologyLinkModel, TopologyModel
from
.uuids.EndPoint
import
endpoint_get_uuid
from
.uuids.Link
import
link_get_uuid
from
.Events
import
notify_event_context
,
notify_event_link
,
notify_event_topology
from
.models.enums.LinkType
import
grpc_to_enum__link_type_enum
LOGGER
=
logging
.
getLogger
(
__name__
)
...
...
@@ -68,7 +67,7 @@ def link_set(db_engine : Engine, messagebroker : MessageBroker, request : Link)
raw_link_name
=
request
.
name
link_name
=
raw_link_uuid
if
len
(
raw_link_name
)
==
0
else
raw_link_name
link_uuid
=
link_get_uuid
(
request
.
link_id
,
link_name
=
link_name
,
allow_random
=
True
)
link_type
=
grpc_to_enum__link_type_enum
(
request
.
link_type
)
now
=
datetime
.
datetime
.
now
(
datetime
.
timezone
.
utc
)
topology_uuids
:
Set
[
str
]
=
set
()
...
...
@@ -118,7 +117,6 @@ def link_set(db_engine : Engine, messagebroker : MessageBroker, request : Link)
link_data
=
[{
'
link_uuid
'
:
link_uuid
,
'
link_name
'
:
link_name
,
'
link_type
'
:
link_type
,
'
total_capacity_gbps
'
:
total_capacity_gbps
,
'
used_capacity_gbps
'
:
used_capacity_gbps
,
'
created_at
'
:
now
,
...
...
@@ -131,7 +129,6 @@ def link_set(db_engine : Engine, messagebroker : MessageBroker, request : Link)
index_elements
=
[
LinkModel
.
link_uuid
],
set_
=
dict
(
link_name
=
stmt
.
excluded
.
link_name
,
link_type
=
stmt
.
excluded
.
link_type
,
total_capacity_gbps
=
stmt
.
excluded
.
total_capacity_gbps
,
used_capacity_gbps
=
stmt
.
excluded
.
used_capacity_gbps
,
updated_at
=
stmt
.
excluded
.
updated_at
,
...
...
This diff is collapsed.
Click to expand it.
src/context/service/database/models/LinkModel.py
+
0
−
6
View file @
310c62fa
...
...
@@ -18,15 +18,12 @@ from sqlalchemy.dialects.postgresql import UUID
from
sqlalchemy.orm
import
relationship
from
typing
import
Dict
from
._Base
import
_Base
from
common.proto.context_pb2
import
LinkTypeEnum
from
.enums.LinkType
import
ORM_LinkTypeEnum
class
LinkModel
(
_Base
):
__tablename__
=
'
link
'
link_uuid
=
Column
(
UUID
(
as_uuid
=
False
),
primary_key
=
True
)
link_name
=
Column
(
String
,
nullable
=
False
)
link_type
=
Column
(
Enum
(
ORM_LinkTypeEnum
),
nullable
=
False
)
total_capacity_gbps
=
Column
(
Float
,
nullable
=
True
)
used_capacity_gbps
=
Column
(
Float
,
nullable
=
True
)
created_at
=
Column
(
DateTime
,
nullable
=
False
)
...
...
@@ -47,14 +44,11 @@ class LinkModel(_Base):
result
=
{
'
link_id
'
:
self
.
dump_id
(),
'
name
'
:
self
.
link_name
,
'
link_type
'
:
self
.
link_type
.
value
,
'
link_endpoint_ids
'
:
[
link_endpoint
.
endpoint
.
dump_id
()
for
link_endpoint
in
sorted
(
self
.
link_endpoints
,
key
=
operator
.
attrgetter
(
'
position
'
))
],
}
if
self
.
link_type
is
None
:
self
.
link_type
=
LinkTypeEnum
.
LINKTYPE_UNKNOWN
if
self
.
total_capacity_gbps
is
not
None
:
attributes
:
Dict
=
result
.
setdefault
(
'
attributes
'
,
dict
())
attributes
.
setdefault
(
'
total_capacity_gbps
'
,
self
.
total_capacity_gbps
)
...
...
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