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
ae9705af
Commit
ae9705af
authored
2 years ago
by
Lluis Gifre Renom
Browse files
Options
Downloads
Patches
Plain Diff
Common - MockServicers:
- added missing log messages in MockContext
parent
b099f36f
No related branches found
No related tags found
2 merge requests
!54
Release 2.0.0
,
!34
Context Scalability extensions using CockroachDB + Removal of Stateful database inside Device + other
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/common/tests/MockServicerImpl_Context.py
+105
-35
105 additions, 35 deletions
src/common/tests/MockServicerImpl_Context.py
with
105 additions
and
35 deletions
src/common/tests/MockServicerImpl_Context.py
+
105
−
35
View file @
ae9705af
...
@@ -103,23 +103,33 @@ class MockServicerImpl_Context(ContextServiceServicer):
...
@@ -103,23 +103,33 @@ class MockServicerImpl_Context(ContextServiceServicer):
def
ListContextIds
(
self
,
request
:
Empty
,
context
:
grpc
.
ServicerContext
)
->
ContextIdList
:
def
ListContextIds
(
self
,
request
:
Empty
,
context
:
grpc
.
ServicerContext
)
->
ContextIdList
:
LOGGER
.
info
(
'
[ListContextIds] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
LOGGER
.
info
(
'
[ListContextIds] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
return
ContextIdList
(
context_ids
=
[
context
.
context_id
for
context
in
get_entries
(
self
.
database
,
'
context
'
)])
reply
=
ContextIdList
(
context_ids
=
[
context
.
context_id
for
context
in
get_entries
(
self
.
database
,
'
context
'
)])
LOGGER
.
info
(
'
[ListContextIds] reply={:s}
'
.
format
(
grpc_message_to_json_string
(
reply
)))
return
reply
def
ListContexts
(
self
,
request
:
Empty
,
context
:
grpc
.
ServicerContext
)
->
ContextList
:
def
ListContexts
(
self
,
request
:
Empty
,
context
:
grpc
.
ServicerContext
)
->
ContextList
:
LOGGER
.
info
(
'
[ListContexts] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
LOGGER
.
info
(
'
[ListContexts] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
return
ContextList
(
contexts
=
get_entries
(
self
.
database
,
'
context
'
))
reply
=
ContextList
(
contexts
=
get_entries
(
self
.
database
,
'
context
'
))
LOGGER
.
info
(
'
[ListContexts] reply={:s}
'
.
format
(
grpc_message_to_json_string
(
reply
)))
return
reply
def
GetContext
(
self
,
request
:
ContextId
,
context
:
grpc
.
ServicerContext
)
->
Context
:
def
GetContext
(
self
,
request
:
ContextId
,
context
:
grpc
.
ServicerContext
)
->
Context
:
LOGGER
.
info
(
'
[GetContext] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
LOGGER
.
info
(
'
[GetContext] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
return
get_entry
(
context
,
self
.
database
,
'
context
'
,
request
.
context_uuid
.
uuid
)
reply
=
get_entry
(
context
,
self
.
database
,
'
context
'
,
request
.
context_uuid
.
uuid
)
LOGGER
.
info
(
'
[GetContext] reply={:s}
'
.
format
(
grpc_message_to_json_string
(
reply
)))
return
reply
def
SetContext
(
self
,
request
:
Context
,
context
:
grpc
.
ServicerContext
)
->
ContextId
:
def
SetContext
(
self
,
request
:
Context
,
context
:
grpc
.
ServicerContext
)
->
ContextId
:
LOGGER
.
info
(
'
[SetContext] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
LOGGER
.
info
(
'
[SetContext] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
return
self
.
_set
(
request
,
'
context
'
,
request
.
context_id
.
context_uuid
.
uuid
,
'
context_id
'
,
TOPIC_CONTEXT
)
reply
=
self
.
_set
(
request
,
'
context
'
,
request
.
context_id
.
context_uuid
.
uuid
,
'
context_id
'
,
TOPIC_CONTEXT
)
LOGGER
.
info
(
'
[SetContext] reply={:s}
'
.
format
(
grpc_message_to_json_string
(
reply
)))
return
reply
def
RemoveContext
(
self
,
request
:
ContextId
,
context
:
grpc
.
ServicerContext
)
->
Empty
:
def
RemoveContext
(
self
,
request
:
ContextId
,
context
:
grpc
.
ServicerContext
)
->
Empty
:
LOGGER
.
info
(
'
[RemoveContext] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
LOGGER
.
info
(
'
[RemoveContext] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
return
self
.
_del
(
request
,
'
context
'
,
request
.
context_uuid
.
uuid
,
'
context_id
'
,
TOPIC_CONTEXT
,
context
)
reply
=
self
.
_del
(
request
,
'
context
'
,
request
.
context_uuid
.
uuid
,
'
context_id
'
,
TOPIC_CONTEXT
,
context
)
LOGGER
.
info
(
'
[RemoveContext] reply={:s}
'
.
format
(
grpc_message_to_json_string
(
reply
)))
return
reply
def
GetContextEvents
(
self
,
request
:
Empty
,
context
:
grpc
.
ServicerContext
)
->
Iterator
[
ContextEvent
]:
def
GetContextEvents
(
self
,
request
:
Empty
,
context
:
grpc
.
ServicerContext
)
->
Iterator
[
ContextEvent
]:
LOGGER
.
info
(
'
[GetContextEvents] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
LOGGER
.
info
(
'
[GetContextEvents] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
...
@@ -131,29 +141,39 @@ class MockServicerImpl_Context(ContextServiceServicer):
...
@@ -131,29 +141,39 @@ class MockServicerImpl_Context(ContextServiceServicer):
def
ListTopologyIds
(
self
,
request
:
ContextId
,
context
:
grpc
.
ServicerContext
)
->
TopologyIdList
:
def
ListTopologyIds
(
self
,
request
:
ContextId
,
context
:
grpc
.
ServicerContext
)
->
TopologyIdList
:
LOGGER
.
info
(
'
[ListTopologyIds] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
LOGGER
.
info
(
'
[ListTopologyIds] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
topologies
=
get_entries
(
self
.
database
,
'
topology[{:s}]
'
.
format
(
str
(
request
.
context_uuid
.
uuid
)))
topologies
=
get_entries
(
self
.
database
,
'
topology[{:s}]
'
.
format
(
str
(
request
.
context_uuid
.
uuid
)))
return
TopologyIdList
(
topology_ids
=
[
topology
.
topology_id
for
topology
in
topologies
])
reply
=
TopologyIdList
(
topology_ids
=
[
topology
.
topology_id
for
topology
in
topologies
])
LOGGER
.
info
(
'
[ListTopologyIds] reply={:s}
'
.
format
(
grpc_message_to_json_string
(
reply
)))
return
reply
def
ListTopologies
(
self
,
request
:
ContextId
,
context
:
grpc
.
ServicerContext
)
->
TopologyList
:
def
ListTopologies
(
self
,
request
:
ContextId
,
context
:
grpc
.
ServicerContext
)
->
TopologyList
:
LOGGER
.
info
(
'
[ListTopologies] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
LOGGER
.
info
(
'
[ListTopologies] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
topologies
=
get_entries
(
self
.
database
,
'
topology[{:s}]
'
.
format
(
str
(
request
.
context_uuid
.
uuid
)))
topologies
=
get_entries
(
self
.
database
,
'
topology[{:s}]
'
.
format
(
str
(
request
.
context_uuid
.
uuid
)))
return
TopologyList
(
topologies
=
[
topology
for
topology
in
topologies
])
reply
=
TopologyList
(
topologies
=
[
topology
for
topology
in
topologies
])
LOGGER
.
info
(
'
[ListTopologies] reply={:s}
'
.
format
(
grpc_message_to_json_string
(
reply
)))
return
reply
def
GetTopology
(
self
,
request
:
TopologyId
,
context
:
grpc
.
ServicerContext
)
->
Topology
:
def
GetTopology
(
self
,
request
:
TopologyId
,
context
:
grpc
.
ServicerContext
)
->
Topology
:
LOGGER
.
info
(
'
[GetTopology] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
LOGGER
.
info
(
'
[GetTopology] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
container_name
=
'
topology[{:s}]
'
.
format
(
str
(
request
.
context_id
.
context_uuid
.
uuid
))
container_name
=
'
topology[{:s}]
'
.
format
(
str
(
request
.
context_id
.
context_uuid
.
uuid
))
return
get_entry
(
context
,
self
.
database
,
container_name
,
request
.
topology_uuid
.
uuid
)
reply
=
get_entry
(
context
,
self
.
database
,
container_name
,
request
.
topology_uuid
.
uuid
)
LOGGER
.
info
(
'
[GetTopology] reply={:s}
'
.
format
(
grpc_message_to_json_string
(
reply
)))
return
reply
def
SetTopology
(
self
,
request
:
Topology
,
context
:
grpc
.
ServicerContext
)
->
TopologyId
:
def
SetTopology
(
self
,
request
:
Topology
,
context
:
grpc
.
ServicerContext
)
->
TopologyId
:
LOGGER
.
info
(
'
[SetTopology] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
LOGGER
.
info
(
'
[SetTopology] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
container_name
=
'
topology[{:s}]
'
.
format
(
str
(
request
.
topology_id
.
context_id
.
context_uuid
.
uuid
))
container_name
=
'
topology[{:s}]
'
.
format
(
str
(
request
.
topology_id
.
context_id
.
context_uuid
.
uuid
))
topology_uuid
=
request
.
topology_id
.
topology_uuid
.
uuid
topology_uuid
=
request
.
topology_id
.
topology_uuid
.
uuid
return
self
.
_set
(
request
,
container_name
,
topology_uuid
,
'
topology_id
'
,
TOPIC_TOPOLOGY
)
reply
=
self
.
_set
(
request
,
container_name
,
topology_uuid
,
'
topology_id
'
,
TOPIC_TOPOLOGY
)
LOGGER
.
info
(
'
[SetTopology] reply={:s}
'
.
format
(
grpc_message_to_json_string
(
reply
)))
return
reply
def
RemoveTopology
(
self
,
request
:
TopologyId
,
context
:
grpc
.
ServicerContext
)
->
Empty
:
def
RemoveTopology
(
self
,
request
:
TopologyId
,
context
:
grpc
.
ServicerContext
)
->
Empty
:
LOGGER
.
info
(
'
[RemoveTopology] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
LOGGER
.
info
(
'
[RemoveTopology] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
container_name
=
'
topology[{:s}]
'
.
format
(
str
(
request
.
context_id
.
context_uuid
.
uuid
))
container_name
=
'
topology[{:s}]
'
.
format
(
str
(
request
.
context_id
.
context_uuid
.
uuid
))
topology_uuid
=
request
.
topology_uuid
.
uuid
topology_uuid
=
request
.
topology_uuid
.
uuid
return
self
.
_del
(
request
,
container_name
,
topology_uuid
,
'
topology_id
'
,
TOPIC_TOPOLOGY
,
context
)
reply
=
self
.
_del
(
request
,
container_name
,
topology_uuid
,
'
topology_id
'
,
TOPIC_TOPOLOGY
,
context
)
LOGGER
.
info
(
'
[RemoveTopology] reply={:s}
'
.
format
(
grpc_message_to_json_string
(
reply
)))
return
reply
def
GetTopologyEvents
(
self
,
request
:
Empty
,
context
:
grpc
.
ServicerContext
)
->
Iterator
[
TopologyEvent
]:
def
GetTopologyEvents
(
self
,
request
:
Empty
,
context
:
grpc
.
ServicerContext
)
->
Iterator
[
TopologyEvent
]:
LOGGER
.
info
(
'
[GetTopologyEvents] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
LOGGER
.
info
(
'
[GetTopologyEvents] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
...
@@ -164,23 +184,33 @@ class MockServicerImpl_Context(ContextServiceServicer):
...
@@ -164,23 +184,33 @@ class MockServicerImpl_Context(ContextServiceServicer):
def
ListDeviceIds
(
self
,
request
:
Empty
,
context
:
grpc
.
ServicerContext
)
->
DeviceIdList
:
def
ListDeviceIds
(
self
,
request
:
Empty
,
context
:
grpc
.
ServicerContext
)
->
DeviceIdList
:
LOGGER
.
info
(
'
[ListDeviceIds] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
LOGGER
.
info
(
'
[ListDeviceIds] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
return
DeviceIdList
(
device_ids
=
[
device
.
device_id
for
device
in
get_entries
(
self
.
database
,
'
device
'
)])
reply
=
DeviceIdList
(
device_ids
=
[
device
.
device_id
for
device
in
get_entries
(
self
.
database
,
'
device
'
)])
LOGGER
.
info
(
'
[ListDeviceIds] reply={:s}
'
.
format
(
grpc_message_to_json_string
(
reply
)))
return
reply
def
ListDevices
(
self
,
request
:
Empty
,
context
:
grpc
.
ServicerContext
)
->
DeviceList
:
def
ListDevices
(
self
,
request
:
Empty
,
context
:
grpc
.
ServicerContext
)
->
DeviceList
:
LOGGER
.
info
(
'
[ListDevices] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
LOGGER
.
info
(
'
[ListDevices] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
return
DeviceList
(
devices
=
get_entries
(
self
.
database
,
'
device
'
))
reply
=
DeviceList
(
devices
=
get_entries
(
self
.
database
,
'
device
'
))
LOGGER
.
info
(
'
[ListDevices] reply={:s}
'
.
format
(
grpc_message_to_json_string
(
reply
)))
return
reply
def
GetDevice
(
self
,
request
:
DeviceId
,
context
:
grpc
.
ServicerContext
)
->
Device
:
def
GetDevice
(
self
,
request
:
DeviceId
,
context
:
grpc
.
ServicerContext
)
->
Device
:
LOGGER
.
info
(
'
[GetDevice] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
LOGGER
.
info
(
'
[GetDevice] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
return
get_entry
(
context
,
self
.
database
,
'
device
'
,
request
.
device_uuid
.
uuid
)
reply
=
get_entry
(
context
,
self
.
database
,
'
device
'
,
request
.
device_uuid
.
uuid
)
LOGGER
.
info
(
'
[GetDevice] reply={:s}
'
.
format
(
grpc_message_to_json_string
(
reply
)))
return
reply
def
SetDevice
(
self
,
request
:
Context
,
context
:
grpc
.
ServicerContext
)
->
DeviceId
:
def
SetDevice
(
self
,
request
:
Context
,
context
:
grpc
.
ServicerContext
)
->
DeviceId
:
LOGGER
.
info
(
'
[SetDevice] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
LOGGER
.
info
(
'
[SetDevice] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
return
self
.
_set
(
request
,
'
device
'
,
request
.
device_id
.
device_uuid
.
uuid
,
'
device_id
'
,
TOPIC_DEVICE
)
reply
=
self
.
_set
(
request
,
'
device
'
,
request
.
device_id
.
device_uuid
.
uuid
,
'
device_id
'
,
TOPIC_DEVICE
)
LOGGER
.
info
(
'
[SetDevice] reply={:s}
'
.
format
(
grpc_message_to_json_string
(
reply
)))
return
reply
def
RemoveDevice
(
self
,
request
:
DeviceId
,
context
:
grpc
.
ServicerContext
)
->
Empty
:
def
RemoveDevice
(
self
,
request
:
DeviceId
,
context
:
grpc
.
ServicerContext
)
->
Empty
:
LOGGER
.
info
(
'
[RemoveDevice] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
LOGGER
.
info
(
'
[RemoveDevice] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
return
self
.
_del
(
request
,
'
device
'
,
request
.
device_uuid
.
uuid
,
'
device_id
'
,
TOPIC_DEVICE
,
context
)
reply
=
self
.
_del
(
request
,
'
device
'
,
request
.
device_uuid
.
uuid
,
'
device_id
'
,
TOPIC_DEVICE
,
context
)
LOGGER
.
info
(
'
[RemoveDevice] reply={:s}
'
.
format
(
grpc_message_to_json_string
(
reply
)))
return
reply
def
GetDeviceEvents
(
self
,
request
:
Empty
,
context
:
grpc
.
ServicerContext
)
->
Iterator
[
DeviceEvent
]:
def
GetDeviceEvents
(
self
,
request
:
Empty
,
context
:
grpc
.
ServicerContext
)
->
Iterator
[
DeviceEvent
]:
LOGGER
.
info
(
'
[GetDeviceEvents] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
LOGGER
.
info
(
'
[GetDeviceEvents] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
...
@@ -191,23 +221,33 @@ class MockServicerImpl_Context(ContextServiceServicer):
...
@@ -191,23 +221,33 @@ class MockServicerImpl_Context(ContextServiceServicer):
def
ListLinkIds
(
self
,
request
:
Empty
,
context
:
grpc
.
ServicerContext
)
->
LinkIdList
:
def
ListLinkIds
(
self
,
request
:
Empty
,
context
:
grpc
.
ServicerContext
)
->
LinkIdList
:
LOGGER
.
info
(
'
[ListLinkIds] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
LOGGER
.
info
(
'
[ListLinkIds] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
return
LinkIdList
(
link_ids
=
[
link
.
link_id
for
link
in
get_entries
(
self
.
database
,
'
link
'
)])
reply
=
LinkIdList
(
link_ids
=
[
link
.
link_id
for
link
in
get_entries
(
self
.
database
,
'
link
'
)])
LOGGER
.
info
(
'
[ListLinkIds] reply={:s}
'
.
format
(
grpc_message_to_json_string
(
reply
)))
return
reply
def
ListLinks
(
self
,
request
:
Empty
,
context
:
grpc
.
ServicerContext
)
->
LinkList
:
def
ListLinks
(
self
,
request
:
Empty
,
context
:
grpc
.
ServicerContext
)
->
LinkList
:
LOGGER
.
info
(
'
[ListLinks] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
LOGGER
.
info
(
'
[ListLinks] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
return
LinkList
(
links
=
get_entries
(
self
.
database
,
'
link
'
))
reply
=
LinkList
(
links
=
get_entries
(
self
.
database
,
'
link
'
))
LOGGER
.
info
(
'
[ListLinks] reply={:s}
'
.
format
(
grpc_message_to_json_string
(
reply
)))
return
reply
def
GetLink
(
self
,
request
:
LinkId
,
context
:
grpc
.
ServicerContext
)
->
Link
:
def
GetLink
(
self
,
request
:
LinkId
,
context
:
grpc
.
ServicerContext
)
->
Link
:
LOGGER
.
info
(
'
[GetLink] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
LOGGER
.
info
(
'
[GetLink] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
return
get_entry
(
context
,
self
.
database
,
'
link
'
,
request
.
link_uuid
.
uuid
)
reply
=
get_entry
(
context
,
self
.
database
,
'
link
'
,
request
.
link_uuid
.
uuid
)
LOGGER
.
info
(
'
[GetLink] reply={:s}
'
.
format
(
grpc_message_to_json_string
(
reply
)))
return
reply
def
SetLink
(
self
,
request
:
Context
,
context
:
grpc
.
ServicerContext
)
->
LinkId
:
def
SetLink
(
self
,
request
:
Context
,
context
:
grpc
.
ServicerContext
)
->
LinkId
:
LOGGER
.
info
(
'
[SetLink] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
LOGGER
.
info
(
'
[SetLink] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
return
self
.
_set
(
request
,
'
link
'
,
request
.
link_id
.
link_uuid
.
uuid
,
'
link_id
'
,
TOPIC_LINK
)
reply
=
self
.
_set
(
request
,
'
link
'
,
request
.
link_id
.
link_uuid
.
uuid
,
'
link_id
'
,
TOPIC_LINK
)
LOGGER
.
info
(
'
[SetLink] reply={:s}
'
.
format
(
grpc_message_to_json_string
(
reply
)))
return
reply
def
RemoveLink
(
self
,
request
:
LinkId
,
context
:
grpc
.
ServicerContext
)
->
Empty
:
def
RemoveLink
(
self
,
request
:
LinkId
,
context
:
grpc
.
ServicerContext
)
->
Empty
:
LOGGER
.
info
(
'
[RemoveLink] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
LOGGER
.
info
(
'
[RemoveLink] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
return
self
.
_del
(
request
,
'
link
'
,
request
.
link_uuid
.
uuid
,
'
link_id
'
,
TOPIC_LINK
,
context
)
reply
=
self
.
_del
(
request
,
'
link
'
,
request
.
link_uuid
.
uuid
,
'
link_id
'
,
TOPIC_LINK
,
context
)
LOGGER
.
info
(
'
[RemoveLink] reply={:s}
'
.
format
(
grpc_message_to_json_string
(
reply
)))
return
reply
def
GetLinkEvents
(
self
,
request
:
Empty
,
context
:
grpc
.
ServicerContext
)
->
Iterator
[
LinkEvent
]:
def
GetLinkEvents
(
self
,
request
:
Empty
,
context
:
grpc
.
ServicerContext
)
->
Iterator
[
LinkEvent
]:
LOGGER
.
info
(
'
[GetLinkEvents] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
LOGGER
.
info
(
'
[GetLinkEvents] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
...
@@ -219,29 +259,39 @@ class MockServicerImpl_Context(ContextServiceServicer):
...
@@ -219,29 +259,39 @@ class MockServicerImpl_Context(ContextServiceServicer):
def
ListSliceIds
(
self
,
request
:
ContextId
,
context
:
grpc
.
ServicerContext
)
->
SliceIdList
:
def
ListSliceIds
(
self
,
request
:
ContextId
,
context
:
grpc
.
ServicerContext
)
->
SliceIdList
:
LOGGER
.
info
(
'
[ListSliceIds] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
LOGGER
.
info
(
'
[ListSliceIds] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
slices
=
get_entries
(
self
.
database
,
'
slice[{:s}]
'
.
format
(
str
(
request
.
context_uuid
.
uuid
)))
slices
=
get_entries
(
self
.
database
,
'
slice[{:s}]
'
.
format
(
str
(
request
.
context_uuid
.
uuid
)))
return
SliceIdList
(
slice_ids
=
[
slice
.
slice_id
for
slice
in
slices
])
reply
=
SliceIdList
(
slice_ids
=
[
slice
.
slice_id
for
slice
in
slices
])
LOGGER
.
info
(
'
[ListSliceIds] reply={:s}
'
.
format
(
grpc_message_to_json_string
(
reply
)))
return
reply
def
ListSlices
(
self
,
request
:
ContextId
,
context
:
grpc
.
ServicerContext
)
->
SliceList
:
def
ListSlices
(
self
,
request
:
ContextId
,
context
:
grpc
.
ServicerContext
)
->
SliceList
:
LOGGER
.
info
(
'
[ListSlices] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
LOGGER
.
info
(
'
[ListSlices] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
slices
=
get_entries
(
self
.
database
,
'
slice[{:s}]
'
.
format
(
str
(
request
.
context_uuid
.
uuid
)))
slices
=
get_entries
(
self
.
database
,
'
slice[{:s}]
'
.
format
(
str
(
request
.
context_uuid
.
uuid
)))
return
SliceList
(
slices
=
[
slice
for
slice
in
slices
])
reply
=
SliceList
(
slices
=
[
slice
for
slice
in
slices
])
LOGGER
.
info
(
'
[ListSlices] reply={:s}
'
.
format
(
grpc_message_to_json_string
(
reply
)))
return
reply
def
GetSlice
(
self
,
request
:
SliceId
,
context
:
grpc
.
ServicerContext
)
->
Slice
:
def
GetSlice
(
self
,
request
:
SliceId
,
context
:
grpc
.
ServicerContext
)
->
Slice
:
LOGGER
.
info
(
'
[GetSlice] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
LOGGER
.
info
(
'
[GetSlice] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
container_name
=
'
slice[{:s}]
'
.
format
(
str
(
request
.
context_id
.
context_uuid
.
uuid
))
container_name
=
'
slice[{:s}]
'
.
format
(
str
(
request
.
context_id
.
context_uuid
.
uuid
))
return
get_entry
(
context
,
self
.
database
,
container_name
,
request
.
slice_uuid
.
uuid
)
reply
=
get_entry
(
context
,
self
.
database
,
container_name
,
request
.
slice_uuid
.
uuid
)
LOGGER
.
info
(
'
[GetSlice] reply={:s}
'
.
format
(
grpc_message_to_json_string
(
reply
)))
return
reply
def
SetSlice
(
self
,
request
:
Slice
,
context
:
grpc
.
ServicerContext
)
->
SliceId
:
def
SetSlice
(
self
,
request
:
Slice
,
context
:
grpc
.
ServicerContext
)
->
SliceId
:
LOGGER
.
info
(
'
[SetSlice] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
LOGGER
.
info
(
'
[SetSlice] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
container_name
=
'
slice[{:s}]
'
.
format
(
str
(
request
.
slice_id
.
context_id
.
context_uuid
.
uuid
))
container_name
=
'
slice[{:s}]
'
.
format
(
str
(
request
.
slice_id
.
context_id
.
context_uuid
.
uuid
))
slice_uuid
=
request
.
slice_id
.
slice_uuid
.
uuid
slice_uuid
=
request
.
slice_id
.
slice_uuid
.
uuid
return
self
.
_set
(
request
,
container_name
,
slice_uuid
,
'
slice_id
'
,
TOPIC_SLICE
)
reply
=
self
.
_set
(
request
,
container_name
,
slice_uuid
,
'
slice_id
'
,
TOPIC_SLICE
)
LOGGER
.
info
(
'
[SetSlice] reply={:s}
'
.
format
(
grpc_message_to_json_string
(
reply
)))
return
reply
def
RemoveSlice
(
self
,
request
:
SliceId
,
context
:
grpc
.
ServicerContext
)
->
Empty
:
def
RemoveSlice
(
self
,
request
:
SliceId
,
context
:
grpc
.
ServicerContext
)
->
Empty
:
LOGGER
.
info
(
'
[RemoveSlice] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
LOGGER
.
info
(
'
[RemoveSlice] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
container_name
=
'
slice[{:s}]
'
.
format
(
str
(
request
.
context_id
.
context_uuid
.
uuid
))
container_name
=
'
slice[{:s}]
'
.
format
(
str
(
request
.
context_id
.
context_uuid
.
uuid
))
slice_uuid
=
request
.
slice_uuid
.
uuid
slice_uuid
=
request
.
slice_uuid
.
uuid
return
self
.
_del
(
request
,
container_name
,
slice_uuid
,
'
slice_id
'
,
TOPIC_SLICE
,
context
)
reply
=
self
.
_del
(
request
,
container_name
,
slice_uuid
,
'
slice_id
'
,
TOPIC_SLICE
,
context
)
LOGGER
.
info
(
'
[RemoveSlice] reply={:s}
'
.
format
(
grpc_message_to_json_string
(
reply
)))
return
reply
def
GetSliceEvents
(
self
,
request
:
Empty
,
context
:
grpc
.
ServicerContext
)
->
Iterator
[
SliceEvent
]:
def
GetSliceEvents
(
self
,
request
:
Empty
,
context
:
grpc
.
ServicerContext
)
->
Iterator
[
SliceEvent
]:
LOGGER
.
info
(
'
[GetSliceEvents] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
LOGGER
.
info
(
'
[GetSliceEvents] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
...
@@ -253,29 +303,39 @@ class MockServicerImpl_Context(ContextServiceServicer):
...
@@ -253,29 +303,39 @@ class MockServicerImpl_Context(ContextServiceServicer):
def
ListServiceIds
(
self
,
request
:
ContextId
,
context
:
grpc
.
ServicerContext
)
->
ServiceIdList
:
def
ListServiceIds
(
self
,
request
:
ContextId
,
context
:
grpc
.
ServicerContext
)
->
ServiceIdList
:
LOGGER
.
info
(
'
[ListServiceIds] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
LOGGER
.
info
(
'
[ListServiceIds] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
services
=
get_entries
(
self
.
database
,
'
service[{:s}]
'
.
format
(
str
(
request
.
context_uuid
.
uuid
)))
services
=
get_entries
(
self
.
database
,
'
service[{:s}]
'
.
format
(
str
(
request
.
context_uuid
.
uuid
)))
return
ServiceIdList
(
service_ids
=
[
service
.
service_id
for
service
in
services
])
reply
=
ServiceIdList
(
service_ids
=
[
service
.
service_id
for
service
in
services
])
LOGGER
.
info
(
'
[ListServiceIds] reply={:s}
'
.
format
(
grpc_message_to_json_string
(
reply
)))
return
reply
def
ListServices
(
self
,
request
:
ContextId
,
context
:
grpc
.
ServicerContext
)
->
ServiceList
:
def
ListServices
(
self
,
request
:
ContextId
,
context
:
grpc
.
ServicerContext
)
->
ServiceList
:
LOGGER
.
info
(
'
[ListServices] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
LOGGER
.
info
(
'
[ListServices] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
services
=
get_entries
(
self
.
database
,
'
service[{:s}]
'
.
format
(
str
(
request
.
context_uuid
.
uuid
)))
services
=
get_entries
(
self
.
database
,
'
service[{:s}]
'
.
format
(
str
(
request
.
context_uuid
.
uuid
)))
return
ServiceList
(
services
=
[
service
for
service
in
services
])
reply
=
ServiceList
(
services
=
[
service
for
service
in
services
])
LOGGER
.
info
(
'
[ListServices] reply={:s}
'
.
format
(
grpc_message_to_json_string
(
reply
)))
return
reply
def
GetService
(
self
,
request
:
ServiceId
,
context
:
grpc
.
ServicerContext
)
->
Service
:
def
GetService
(
self
,
request
:
ServiceId
,
context
:
grpc
.
ServicerContext
)
->
Service
:
LOGGER
.
info
(
'
[GetService] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
LOGGER
.
info
(
'
[GetService] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
container_name
=
'
service[{:s}]
'
.
format
(
str
(
request
.
context_id
.
context_uuid
.
uuid
))
container_name
=
'
service[{:s}]
'
.
format
(
str
(
request
.
context_id
.
context_uuid
.
uuid
))
return
get_entry
(
context
,
self
.
database
,
container_name
,
request
.
service_uuid
.
uuid
)
reply
=
get_entry
(
context
,
self
.
database
,
container_name
,
request
.
service_uuid
.
uuid
)
LOGGER
.
info
(
'
[GetService] reply={:s}
'
.
format
(
grpc_message_to_json_string
(
reply
)))
return
reply
def
SetService
(
self
,
request
:
Service
,
context
:
grpc
.
ServicerContext
)
->
ServiceId
:
def
SetService
(
self
,
request
:
Service
,
context
:
grpc
.
ServicerContext
)
->
ServiceId
:
LOGGER
.
info
(
'
[SetService] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
LOGGER
.
info
(
'
[SetService] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
container_name
=
'
service[{:s}]
'
.
format
(
str
(
request
.
service_id
.
context_id
.
context_uuid
.
uuid
))
container_name
=
'
service[{:s}]
'
.
format
(
str
(
request
.
service_id
.
context_id
.
context_uuid
.
uuid
))
service_uuid
=
request
.
service_id
.
service_uuid
.
uuid
service_uuid
=
request
.
service_id
.
service_uuid
.
uuid
return
self
.
_set
(
request
,
container_name
,
service_uuid
,
'
service_id
'
,
TOPIC_SERVICE
)
reply
=
self
.
_set
(
request
,
container_name
,
service_uuid
,
'
service_id
'
,
TOPIC_SERVICE
)
LOGGER
.
info
(
'
[SetService] reply={:s}
'
.
format
(
grpc_message_to_json_string
(
reply
)))
return
reply
def
RemoveService
(
self
,
request
:
ServiceId
,
context
:
grpc
.
ServicerContext
)
->
Empty
:
def
RemoveService
(
self
,
request
:
ServiceId
,
context
:
grpc
.
ServicerContext
)
->
Empty
:
LOGGER
.
info
(
'
[RemoveService] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
LOGGER
.
info
(
'
[RemoveService] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
container_name
=
'
service[{:s}]
'
.
format
(
str
(
request
.
context_id
.
context_uuid
.
uuid
))
container_name
=
'
service[{:s}]
'
.
format
(
str
(
request
.
context_id
.
context_uuid
.
uuid
))
service_uuid
=
request
.
service_uuid
.
uuid
service_uuid
=
request
.
service_uuid
.
uuid
return
self
.
_del
(
request
,
container_name
,
service_uuid
,
'
service_id
'
,
TOPIC_SERVICE
,
context
)
reply
=
self
.
_del
(
request
,
container_name
,
service_uuid
,
'
service_id
'
,
TOPIC_SERVICE
,
context
)
LOGGER
.
info
(
'
[RemoveService] reply={:s}
'
.
format
(
grpc_message_to_json_string
(
reply
)))
return
reply
def
GetServiceEvents
(
self
,
request
:
Empty
,
context
:
grpc
.
ServicerContext
)
->
Iterator
[
ServiceEvent
]:
def
GetServiceEvents
(
self
,
request
:
Empty
,
context
:
grpc
.
ServicerContext
)
->
Iterator
[
ServiceEvent
]:
LOGGER
.
info
(
'
[GetServiceEvents] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
LOGGER
.
info
(
'
[GetServiceEvents] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
...
@@ -288,17 +348,23 @@ class MockServicerImpl_Context(ContextServiceServicer):
...
@@ -288,17 +348,23 @@ class MockServicerImpl_Context(ContextServiceServicer):
LOGGER
.
info
(
'
[ListConnectionIds] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
LOGGER
.
info
(
'
[ListConnectionIds] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
container_name
=
'
service_connections[{:s}/{:s}]
'
.
format
(
container_name
=
'
service_connections[{:s}/{:s}]
'
.
format
(
str
(
request
.
context_id
.
context_uuid
.
uuid
),
str
(
request
.
service_uuid
.
uuid
))
str
(
request
.
context_id
.
context_uuid
.
uuid
),
str
(
request
.
service_uuid
.
uuid
))
return
ConnectionIdList
(
connection_ids
=
[
c
.
connection_id
for
c
in
get_entries
(
self
.
database
,
container_name
)])
reply
=
ConnectionIdList
(
connection_ids
=
[
c
.
connection_id
for
c
in
get_entries
(
self
.
database
,
container_name
)])
LOGGER
.
info
(
'
[ListConnectionIds] reply={:s}
'
.
format
(
grpc_message_to_json_string
(
reply
)))
return
reply
def
ListConnections
(
self
,
request
:
ServiceId
,
context
:
grpc
.
ServicerContext
)
->
ConnectionList
:
def
ListConnections
(
self
,
request
:
ServiceId
,
context
:
grpc
.
ServicerContext
)
->
ConnectionList
:
LOGGER
.
info
(
'
[ListConnections] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
LOGGER
.
info
(
'
[ListConnections] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
container_name
=
'
service_connections[{:s}/{:s}]
'
.
format
(
container_name
=
'
service_connections[{:s}/{:s}]
'
.
format
(
str
(
request
.
context_id
.
context_uuid
.
uuid
),
str
(
request
.
service_uuid
.
uuid
))
str
(
request
.
context_id
.
context_uuid
.
uuid
),
str
(
request
.
service_uuid
.
uuid
))
return
ConnectionList
(
connections
=
get_entries
(
self
.
database
,
container_name
))
reply
=
ConnectionList
(
connections
=
get_entries
(
self
.
database
,
container_name
))
LOGGER
.
info
(
'
[ListConnections] reply={:s}
'
.
format
(
grpc_message_to_json_string
(
reply
)))
return
reply
def
GetConnection
(
self
,
request
:
ConnectionId
,
context
:
grpc
.
ServicerContext
)
->
Connection
:
def
GetConnection
(
self
,
request
:
ConnectionId
,
context
:
grpc
.
ServicerContext
)
->
Connection
:
LOGGER
.
info
(
'
[GetConnection] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
LOGGER
.
info
(
'
[GetConnection] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
return
get_entry
(
context
,
self
.
database
,
'
connection
'
,
request
.
connection_uuid
.
uuid
)
reply
=
get_entry
(
context
,
self
.
database
,
'
connection
'
,
request
.
connection_uuid
.
uuid
)
LOGGER
.
info
(
'
[GetConnection] reply={:s}
'
.
format
(
grpc_message_to_json_string
(
reply
)))
return
reply
def
SetConnection
(
self
,
request
:
Connection
,
context
:
grpc
.
ServicerContext
)
->
ConnectionId
:
def
SetConnection
(
self
,
request
:
Connection
,
context
:
grpc
.
ServicerContext
)
->
ConnectionId
:
LOGGER
.
info
(
'
[SetConnection] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
LOGGER
.
info
(
'
[SetConnection] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
...
@@ -306,7 +372,9 @@ class MockServicerImpl_Context(ContextServiceServicer):
...
@@ -306,7 +372,9 @@ class MockServicerImpl_Context(ContextServiceServicer):
str
(
request
.
service_id
.
context_id
.
context_uuid
.
uuid
),
str
(
request
.
service_id
.
service_uuid
.
uuid
))
str
(
request
.
service_id
.
context_id
.
context_uuid
.
uuid
),
str
(
request
.
service_id
.
service_uuid
.
uuid
))
connection_uuid
=
request
.
connection_id
.
connection_uuid
.
uuid
connection_uuid
=
request
.
connection_id
.
connection_uuid
.
uuid
set_entry
(
self
.
database
,
container_name
,
connection_uuid
,
request
)
set_entry
(
self
.
database
,
container_name
,
connection_uuid
,
request
)
return
self
.
_set
(
request
,
'
connection
'
,
connection_uuid
,
'
connection_id
'
,
TOPIC_CONNECTION
)
reply
=
self
.
_set
(
request
,
'
connection
'
,
connection_uuid
,
'
connection_id
'
,
TOPIC_CONNECTION
)
LOGGER
.
info
(
'
[SetConnection] reply={:s}
'
.
format
(
grpc_message_to_json_string
(
reply
)))
return
reply
def
RemoveConnection
(
self
,
request
:
ConnectionId
,
context
:
grpc
.
ServicerContext
)
->
Empty
:
def
RemoveConnection
(
self
,
request
:
ConnectionId
,
context
:
grpc
.
ServicerContext
)
->
Empty
:
LOGGER
.
info
(
'
[RemoveConnection] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
LOGGER
.
info
(
'
[RemoveConnection] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
...
@@ -315,7 +383,9 @@ class MockServicerImpl_Context(ContextServiceServicer):
...
@@ -315,7 +383,9 @@ class MockServicerImpl_Context(ContextServiceServicer):
str
(
connection
.
service_id
.
context_id
.
context_uuid
.
uuid
),
str
(
connection
.
service_id
.
service_uuid
.
uuid
))
str
(
connection
.
service_id
.
context_id
.
context_uuid
.
uuid
),
str
(
connection
.
service_id
.
service_uuid
.
uuid
))
connection_uuid
=
request
.
connection_uuid
.
uuid
connection_uuid
=
request
.
connection_uuid
.
uuid
del_entry
(
context
,
self
.
database
,
container_name
,
connection_uuid
)
del_entry
(
context
,
self
.
database
,
container_name
,
connection_uuid
)
return
self
.
_del
(
request
,
'
connection
'
,
connection_uuid
,
'
connection_id
'
,
TOPIC_CONNECTION
,
context
)
reply
=
self
.
_del
(
request
,
'
connection
'
,
connection_uuid
,
'
connection_id
'
,
TOPIC_CONNECTION
,
context
)
LOGGER
.
info
(
'
[RemoveConnection] reply={:s}
'
.
format
(
grpc_message_to_json_string
(
reply
)))
return
reply
def
GetConnectionEvents
(
self
,
request
:
Empty
,
context
:
grpc
.
ServicerContext
)
->
Iterator
[
ConnectionEvent
]:
def
GetConnectionEvents
(
self
,
request
:
Empty
,
context
:
grpc
.
ServicerContext
)
->
Iterator
[
ConnectionEvent
]:
LOGGER
.
info
(
'
[GetConnectionEvents] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
LOGGER
.
info
(
'
[GetConnectionEvents] request={:s}
'
.
format
(
grpc_message_to_json_string
(
request
)))
...
...
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