diff options
author | Martin Braun <martin.braun@ettus.com> | 2017-05-16 15:19:32 -0700 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2017-12-22 15:03:53 -0800 |
commit | 7cc40f9d12a53ef9dfda98047599e79f57a1ca36 (patch) | |
tree | f4d837914c0bb419185b59d0e2c4790326374474 /mpm/python/usrp_mpm/periph_manager | |
parent | e10817781df505332d15fe4a7ea48efccad796d3 (diff) | |
download | uhd-7cc40f9d12a53ef9dfda98047599e79f57a1ca36.tar.gz uhd-7cc40f9d12a53ef9dfda98047599e79f57a1ca36.tar.bz2 uhd-7cc40f9d12a53ef9dfda98047599e79f57a1ca36.zip |
mpm: Added ethernet dispatcher code for N310
Diffstat (limited to 'mpm/python/usrp_mpm/periph_manager')
-rw-r--r-- | mpm/python/usrp_mpm/periph_manager/CMakeLists.txt | 1 | ||||
-rw-r--r-- | mpm/python/usrp_mpm/periph_manager/net.py | 60 |
2 files changed, 0 insertions, 61 deletions
diff --git a/mpm/python/usrp_mpm/periph_manager/CMakeLists.txt b/mpm/python/usrp_mpm/periph_manager/CMakeLists.txt index f4bc1d1d2..49ca8e411 100644 --- a/mpm/python/usrp_mpm/periph_manager/CMakeLists.txt +++ b/mpm/python/usrp_mpm/periph_manager/CMakeLists.txt @@ -24,7 +24,6 @@ SET(USRP_MPM_PERIPHMGR_FILES ${CMAKE_CURRENT_SOURCE_DIR}/base.py ${CMAKE_CURRENT_SOURCE_DIR}/n310.py ${CMAKE_CURRENT_SOURCE_DIR}/test.py - ${CMAKE_CURRENT_SOURCE_DIR}/net.py ${CMAKE_CURRENT_SOURCE_DIR}/udev.py ) LIST(APPEND USRP_MPM_FILES ${USRP_MPM_PERIPHMGR_FILES}) diff --git a/mpm/python/usrp_mpm/periph_manager/net.py b/mpm/python/usrp_mpm/periph_manager/net.py deleted file mode 100644 index 4eb1890cb..000000000 --- a/mpm/python/usrp_mpm/periph_manager/net.py +++ /dev/null @@ -1,60 +0,0 @@ - -# Copyright 2017 Ettus Research (National Instruments) -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. -# -""" -N310 implementation module -""" -import itertools -import socket -from pyroute2 import IPRoute -from ..mpmlog import get_logger - -def get_iface_addrs(mac_addr): - """ - return ipv4 addresses for a given macaddress - input format: "aa:bb:cc:dd:ee:ff" - """ - ip2 = IPRoute() - # returns index - [link] = ip2.link_lookup(address=mac_addr) - # Only get v4 addresses - addresses = [addr.get_attrs('IFA_ADDRESS') - for addr in ip2.get_addr(family=socket.AF_INET) - if addr.get('index', None) == link] - # flatten possibly nested list - addresses = list(itertools.chain.from_iterable(addresses)) - return addresses - - -def byte_to_mac(byte_str): - """ - converts a bytestring into nice hex representation - """ - return ':'.join(["%02x" % ord(x) for x in byte_str]) - - -def get_mac_addr(remote_addr): - """ - return MAC address of a remote host already discovered - or None if no host entry was found - """ - ip2 = IPRoute() - addrs = ip2.get_neighbours(dst=remote_addr) - if len(addrs) > 1: - get_logger('get_mac_addr').warning("More than one device with the same IP address found. Picking entry at random") - if not addrs: - return None - return addrs[0].get_attr('NDA_LLADDR') |