From e9a1af171eecb333326b3d791fd6516788ec7cac Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Mon, 22 May 2017 13:28:11 -0700 Subject: mpm: Better handling of case where no CHDR interfaces are available --- mpm/python/usrp_mpm/net.py | 3 ++- mpm/python/usrp_mpm/periph_manager/base.py | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'mpm') diff --git a/mpm/python/usrp_mpm/net.py b/mpm/python/usrp_mpm/net.py index 29c1bcab9..78895a0bb 100644 --- a/mpm/python/usrp_mpm/net.py +++ b/mpm/python/usrp_mpm/net.py @@ -37,7 +37,8 @@ def get_valid_interfaces(iface_list): continue valid_iface_idx = valid_iface_idx[0] link_info = ipr.get_links(valid_iface_idx)[0] - if link_info.get_attr('IFLA_OPERSTATE') == 'UP': + if link_info.get_attr('IFLA_OPERSTATE') == 'UP' \ + and len(get_iface_addrs(link_info.get_attr('IFLA_ADDRESS'))): assert link_info.get_attr('IFLA_IFNAME') == iface valid_ifaces.append(iface) ipr.close() diff --git a/mpm/python/usrp_mpm/periph_manager/base.py b/mpm/python/usrp_mpm/periph_manager/base.py index 846797c20..022464476 100644 --- a/mpm/python/usrp_mpm/periph_manager/base.py +++ b/mpm/python/usrp_mpm/periph_manager/base.py @@ -353,7 +353,10 @@ class PeriphManagerBase(object): self.chdr_interfaces )) valid_ifaces = net.get_valid_interfaces(self.chdr_interfaces) - self.log.debug("Found CHDR interfaces: `{}'".format(valid_ifaces)) + if len(valid_ifaces): + self.log.debug("Found CHDR interfaces: `{}'".format(valid_ifaces)) + else: + self.log.warning("No CHDR interfaces found!") self._chdr_interfaces = { x: net.get_iface_info(x) for x in valid_ifaces -- cgit v1.2.3