From 3bd01c27a3e878fbf9d8e9e97529c000608878f1 Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Wed, 14 Jun 2017 16:02:07 -0700 Subject: mpm/n310: Moved eth dispatcher setup into __init__ --- mpm/python/usrp_mpm/periph_manager/n310.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'mpm/python/usrp_mpm/periph_manager/n310.py') diff --git a/mpm/python/usrp_mpm/periph_manager/n310.py b/mpm/python/usrp_mpm/periph_manager/n310.py index 7b403a830..6ab151454 100644 --- a/mpm/python/usrp_mpm/periph_manager/n310.py +++ b/mpm/python/usrp_mpm/periph_manager/n310.py @@ -139,8 +139,12 @@ class n310(PeriphManagerBase): ) ) self.log.info("mboard info: {}".format(self.mboard_info)) - # Define some attributes so PyLint stays quiet - self._eth_dispatchers = None + self._eth_dispatchers = { + x: EthDispatcherTable(self.eth_tables.get(x)) + for x in list(self._chdr_interfaces.keys()) + } + for ifname, table in iteritems(self._eth_dispatchers): + table.set_ipv4_addr(self._chdr_interfaces[ifname]['ip_addr']) def init(self, args): """ @@ -148,12 +152,7 @@ class n310(PeriphManagerBase): dispatchers accordingly. """ result = super(n310, self).init(args) - self._eth_dispatchers = { - x: EthDispatcherTable(self.eth_tables.get(x)) - for x in list(self._chdr_interfaces.keys()) - } - for ifname, table in iteritems(self._eth_dispatchers): - table.set_ipv4_addr(self._chdr_interfaces[ifname]['ip_addr']) + for _, table in iteritems(self._eth_dispatchers): if 'forward_eth' in args or 'forward_bcast' in args: table.set_forward_policy( args.get('forward_eth', False), -- cgit v1.2.3