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
a173e1ab
Commit
a173e1ab
authored
3 years ago
by
Lluis Gifre Renom
Browse files
Options
Downloads
Patches
Plain Diff
Common:
- improved object factory tools for links
parent
402ed56b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!54
Release 2.0.0
,
!16
DLT component (and related) improvements
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/common/tools/object_factory/Link.py
+12
-6
12 additions, 6 deletions
src/common/tools/object_factory/Link.py
with
12 additions
and
6 deletions
src/common/tools/object_factory/Link.py
+
12
−
6
View file @
a173e1ab
...
@@ -13,15 +13,21 @@
...
@@ -13,15 +13,21 @@
# limitations under the License.
# limitations under the License.
import
copy
import
copy
from
typing
import
Dict
,
List
from
typing
import
Dict
,
List
,
Tuple
def
get_link_uuid
(
a_
device_id
:
Dict
,
a_endpoint_id
:
Dict
,
z_device
_id
:
Dict
,
z_endpoint_id
:
Dict
)
->
str
:
def
get_link_uuid
(
a_
endpoint
_id
:
Dict
,
z_endpoint_id
:
Dict
)
->
str
:
return
'
{:s}/{:s}=={:s}/{:s}
'
.
format
(
return
'
{:s}/{:s}=={:s}/{:s}
'
.
format
(
a_device_id
[
'
device_uuid
'
][
'
uuid
'
],
a_endpoint_id
[
'
endpoint_uuid
'
][
'
uuid
'
],
a_
endpoint_id
[
'
device_id
'
]
[
'
device_uuid
'
][
'
uuid
'
],
a_endpoint_id
[
'
endpoint_uuid
'
][
'
uuid
'
],
z_
device_id
[
'
device_uuid
'
][
'
uuid
'
],
z_endpoint_id
[
'
endpoint_uuid
'
][
'
uuid
'
])
a_endpoint_id
[
'
device_id
'
]
[
'
device_uuid
'
][
'
uuid
'
],
z_endpoint_id
[
'
endpoint_uuid
'
][
'
uuid
'
])
def
json_link_id
(
link_uuid
:
str
):
def
json_link_id
(
link_uuid
:
str
)
->
Dict
:
return
{
'
link_uuid
'
:
{
'
uuid
'
:
link_uuid
}}
return
{
'
link_uuid
'
:
{
'
uuid
'
:
link_uuid
}}
def
json_link
(
link_uuid
:
str
,
endpoint_ids
:
List
[
Dict
]):
def
json_link
(
link_uuid
:
str
,
endpoint_ids
:
List
[
Dict
])
->
Dict
:
return
{
'
link_id
'
:
json_link_id
(
link_uuid
),
'
link_endpoint_ids
'
:
copy
.
deepcopy
(
endpoint_ids
)}
return
{
'
link_id
'
:
json_link_id
(
link_uuid
),
'
link_endpoint_ids
'
:
copy
.
deepcopy
(
endpoint_ids
)}
def
compose_link
(
endpoint_a
,
endpoint_z
)
->
Tuple
[
Dict
,
Dict
]:
link_uuid
=
get_link_uuid
(
endpoint_a
[
'
endpoint_id
'
],
endpoint_z
[
'
endpoint_id
'
])
link_id
=
json_link_id
(
link_uuid
)
link
=
json_link
(
link_uuid
,
[
endpoint_a
[
'
endpoint_id
'
],
endpoint_z
[
'
endpoint_id
'
]])
return
link_id
,
link
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