aboutsummaryrefslogtreecommitdiffstats
path: root/mpm/python/usrp_mpm/xports/xportmgr_udp.py
diff options
context:
space:
mode:
authorSamuel O'Brien <sam.obrien@ni.com>2020-07-31 13:43:43 -0500
committerAaron Rossetto <aaron.rossetto@ni.com>2020-10-07 15:29:19 -0500
commit6394a7c6ea395e2d21c3e2b9e43e1b2dc84666b5 (patch)
treee5c230efe4781ac294641464d99cf51b6bf44024 /mpm/python/usrp_mpm/xports/xportmgr_udp.py
parent1bb603fffdbdcc87f7c26809d495ced7a5afc93b (diff)
downloaduhd-6394a7c6ea395e2d21c3e2b9e43e1b2dc84666b5.tar.gz
uhd-6394a7c6ea395e2d21c3e2b9e43e1b2dc84666b5.tar.bz2
uhd-6394a7c6ea395e2d21c3e2b9e43e1b2dc84666b5.zip
sim: Lay Groundwork for Simulator
At this point, only about half of the mpm methods work on the simulator over the mpm shell, and it hasn't been tested with uhd at all. If you want to give it a try, first install all of the python dependencies of mpm (The simulator doesn't require libusrp or any of the C++ deps). In addition, running mpm on a desktop machine requires the python lib netifaces. Next, make an /mpm/build directory and open it. Run `cmake .. -DMPM_DEVICE=sim`, then `make`. Finally, run `python3 python/usrp_hwd.py`. You should be able to open another terminal and run `mpm/tools/mpm_shell.py localhost` to connect to the mpm server. Signed-off-by: Samuel O'Brien <sam.obrien@ni.com>
Diffstat (limited to 'mpm/python/usrp_mpm/xports/xportmgr_udp.py')
-rw-r--r--mpm/python/usrp_mpm/xports/xportmgr_udp.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/mpm/python/usrp_mpm/xports/xportmgr_udp.py b/mpm/python/usrp_mpm/xports/xportmgr_udp.py
index 099a67d2a..197a628e4 100644
--- a/mpm/python/usrp_mpm/xports/xportmgr_udp.py
+++ b/mpm/python/usrp_mpm/xports/xportmgr_udp.py
@@ -8,10 +8,10 @@
UDP Transport manager
"""
+import importlib
import subprocess
from six import iteritems, itervalues
from usrp_mpm import prefs
-from usrp_mpm.ethdispatch import EthDispatcherCtrl
from usrp_mpm.sys_utils import net
DEFAULT_BRIDGE_MODE = False
@@ -30,7 +30,9 @@ class XportMgrUDP:
iface_config = {}
bridges = {}
- def __init__(self, log, args):
+ def __init__(self, log, args, eth_dispatcher_cls=None):
+ self.eth_dispatcher_cls = eth_dispatcher_cls or \
+ importlib.import_module('usrp_mpm.ethdispatch').EthDispatcherCtrl
assert self.iface_config
assert all((
all((key in x for key in ('label',)))
@@ -40,7 +42,7 @@ class XportMgrUDP:
self.log.trace("Initializing UDP xport manager...")
self._possible_chdr_ifaces = self.iface_config.keys()
self.log.trace("Identifying available network interfaces...")
- self.chdr_port = EthDispatcherCtrl.DEFAULT_VITA_PORT[0]
+ self.chdr_port = self.eth_dispatcher_cls.DEFAULT_VITA_PORT[0]
self._chdr_ifaces = self._init_interfaces(self._possible_chdr_ifaces)
self._bridge_mode = args.get('bridge_mode', DEFAULT_BRIDGE_MODE)
self._eth_dispatchers = {}
@@ -106,7 +108,7 @@ class XportMgrUDP:
"Updated dispatchers in bridge mode with bridge interface {}"
.format(bridge_iface))
self._eth_dispatchers = {
- x: EthDispatcherCtrl(self.iface_config[x]['label'])
+ x: self.eth_dispatcher_cls(self.iface_config[x]['label'])
for x in self.bridges[bridge_iface]
}
for dispatcher, table in iteritems(self._eth_dispatchers):
@@ -132,7 +134,7 @@ class XportMgrUDP:
continue
if iface not in self._eth_dispatchers:
self._eth_dispatchers[iface] = \
- EthDispatcherCtrl(self.iface_config[iface]['label'])
+ self.eth_dispatcher_cls(self.iface_config[iface]['label'])
self._eth_dispatchers[iface].set_ipv4_addr(
self._chdr_ifaces[iface]['ip_addr']
)
@@ -218,7 +220,7 @@ class XportMgrUDP:
deinit() was not yet called.
"""
assert host_location in ('remote', 'local', 'all')
-
+
return [
{
'ipv4': str(iface_info['ip_addr']) if (self.iface_config[iface_name]['type'] != 'internal')