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
75985f1d
Commit
75985f1d
authored
1 year ago
by
Lluis Gifre Renom
Browse files
Options
Downloads
Patches
Plain Diff
Common - Tools - Context Queries:
- Added helper method get_topology_details()
parent
0d0c9081
No related branches found
No related tags found
2 merge requests
!235
Release TeraFlowSDN 3.0
,
!147
Resolve "Notificatoins from Context are incomplete"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/common/tools/context_queries/Topology.py
+19
-1
19 additions, 1 deletion
src/common/tools/context_queries/Topology.py
with
19 additions
and
1 deletion
src/common/tools/context_queries/Topology.py
+
19
−
1
View file @
75985f1d
...
...
@@ -15,7 +15,7 @@
import
grpc
,
logging
from
typing
import
List
,
Optional
from
common.Constants
import
DEFAULT_CONTEXT_NAME
from
common.proto.context_pb2
import
ContextId
,
Topology
,
TopologyId
from
common.proto.context_pb2
import
ContextId
,
Topology
,
TopologyDetails
,
TopologyId
from
common.tools.object_factory.Context
import
json_context_id
from
common.tools.object_factory.Topology
import
json_topology
from
context.client.ContextClient
import
ContextClient
...
...
@@ -61,3 +61,21 @@ def get_topology(
except
grpc
.
RpcError
:
#LOGGER.exception('Unable to get topology({:s} / {:s})'.format(str(context_uuid), str(topology_uuid)))
return
None
def
get_topology_details
(
context_client
:
ContextClient
,
topology_uuid
:
str
,
context_uuid
:
str
=
DEFAULT_CONTEXT_NAME
,
rw_copy
:
bool
=
False
)
->
Optional
[
Topology
]:
try
:
# pylint: disable=no-member
topology_id
=
TopologyId
()
topology_id
.
context_id
.
context_uuid
.
uuid
=
context_uuid
topology_id
.
topology_uuid
.
uuid
=
topology_uuid
ro_topology_details
=
context_client
.
GetTopologyDetails
(
topology_id
)
if
not
rw_copy
:
return
ro_topology_details
rw_topology_details
=
TopologyDetails
()
rw_topology_details
.
CopyFrom
(
ro_topology_details
)
return
rw_topology_details
except
grpc
.
RpcError
:
#LOGGER.exception('Unable to get topology({:s} / {:s})'.format(str(context_uuid), str(topology_uuid)))
return
None
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