aboutsummaryrefslogtreecommitdiffstats
path: root/mpm/python
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2017-08-09 10:34:04 -0700
committerMartin Braun <martin.braun@ettus.com>2017-12-22 15:04:00 -0800
commitd711ad4c93e0396590cfcd992a55b9d49ac9b326 (patch)
tree81f0e587cee51c999ee969b3ffb757eef3d0f1f5 /mpm/python
parent25197587f4819ff2c966d7ee65b9fbe41d336089 (diff)
downloaduhd-d711ad4c93e0396590cfcd992a55b9d49ac9b326.tar.gz
uhd-d711ad4c93e0396590cfcd992a55b9d49ac9b326.tar.bz2
uhd-d711ad4c93e0396590cfcd992a55b9d49ac9b326.zip
mpm: RPC methods now tell us if they need a claim
On the RPC server side, we keep track of which methods require a claim token. MPM shell uses this info to automatically add claim tokens when required.
Diffstat (limited to 'mpm/python')
-rw-r--r--mpm/python/usrp_mpm/rpc_server.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/mpm/python/usrp_mpm/rpc_server.py b/mpm/python/usrp_mpm/rpc_server.py
index 2f21edbee..d2635c7c2 100644
--- a/mpm/python/usrp_mpm/rpc_server.py
+++ b/mpm/python/usrp_mpm/rpc_server.py
@@ -51,18 +51,16 @@ class MPMServer(RPCServer):
"""
Main MPM RPC class which holds the periph_manager object and translates
RPC calls to appropiate calls in the periph_manager and dboard_managers.
-
- Claiming and unclaiming is implemented in python only
"""
- _db_methods = []
- _mb_methods = []
-
def __init__(self, state, mgr, *args, **kwargs):
self.log = get_main_logger().getChild('RPCServer')
self._state = state
self._timer = Greenlet()
self.session_id = None
self.periph_manager = mgr
+ self._db_methods = []
+ self._mb_methods = []
+ self.claimed_methods = ['init', 'reclaim', 'unclaim', 'allocate_sid']
# add public mboard methods without namespace
self._update_component_commands(mgr, '', '_mb_methods')
# add public dboard methods in `db_<slot>_` namespace
@@ -101,6 +99,7 @@ class MPMServer(RPCServer):
self._add_safe_command(new_rpc_method, command_name)
else:
self._add_claimed_command(new_rpc_method, command_name)
+ self.claimed_methods.append(command_name)
getattr(self, storage).append(command_name)
@@ -139,9 +138,11 @@ class MPMServer(RPCServer):
Returns a tuple of public methods and
corresponding docs of this RPC server
"""
- return [(met, getattr(self, met).__doc__)
+ return [(met, getattr(self, met).__doc__, met in self.claimed_methods)
for met in dir(self)
- if not met.startswith('_') and callable(getattr(self, met))]
+ if not met.startswith('_') \
+ and callable(getattr(self, met))
+ ] # TODO _notok is missing from the list of checks
def ping(self, data=None):
"""