diff options
author | Brent Stapleton <brent.stapleton@ettus.com> | 2018-02-02 11:28:52 -0800 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2018-02-19 16:58:52 -0800 |
commit | 94aedfd2d93f566e229dd001fb8229ed27e1224a (patch) | |
tree | 817c60885dbd99882683b2ab47ed4c07f04dc67c /mpm | |
parent | 6ffe0cc5c8015ce581c9d689c07abb0de294f30e (diff) | |
download | uhd-94aedfd2d93f566e229dd001fb8229ed27e1224a.tar.gz uhd-94aedfd2d93f566e229dd001fb8229ed27e1224a.tar.bz2 uhd-94aedfd2d93f566e229dd001fb8229ed27e1224a.zip |
mpm: adding get_component_info
Add getter function for updateable component information. This is a
minor compat number bump.
Diffstat (limited to 'mpm')
-rw-r--r-- | mpm/python/usrp_mpm/periph_manager/base.py | 18 | ||||
-rw-r--r-- | mpm/python/usrp_mpm/rpc_server.py | 2 |
2 files changed, 19 insertions, 1 deletions
diff --git a/mpm/python/usrp_mpm/periph_manager/base.py b/mpm/python/usrp_mpm/periph_manager/base.py index 6608a5d2b..1eb6dd8b0 100644 --- a/mpm/python/usrp_mpm/periph_manager/base.py +++ b/mpm/python/usrp_mpm/periph_manager/base.py @@ -546,6 +546,24 @@ class PeriphManagerBase(object): update_func(filepath, metadata) return True + @no_claim + def get_component_info(self, component_name): + """ + Returns the metadata for the requested component + :param component_name: string name of the component + :return: Dictionary of strings containg metadata + """ + if component_name in self.updateable_components: + metadata = self.updateable_components.get(component_name) + metadata['id'] = component_name + self.log.trace("Component info: {}".format(metadata)) + # Convert all values to str + return dict([a, str(x)] for a, x in metadata.items()) + else: + self.log.trace("Component not found in updateable components: {}" + .format(component_name)) + return {} + ########################################################################### # Crossbar control ########################################################################### diff --git a/mpm/python/usrp_mpm/rpc_server.py b/mpm/python/usrp_mpm/rpc_server.py index 00175d312..4f8058f2f 100644 --- a/mpm/python/usrp_mpm/rpc_server.py +++ b/mpm/python/usrp_mpm/rpc_server.py @@ -31,7 +31,7 @@ from usrp_mpm.sys_utils import net TIMEOUT_INTERVAL = 3.0 # Seconds before claim expires (default value) TOKEN_LEN = 16 # Length of the token string # Compatibility number for MPM -MPM_COMPAT_NUM = (1, 1) +MPM_COMPAT_NUM = (1, 2) def no_claim(func): " Decorator for functions that require no token check " |