2
0
mirror of https://opendev.org/x/pyghmi synced 2025-01-27 19:37:44 +00:00

Allow skipping retrieval of gateway mac addresses

As a network configuration item, gateway mac addresses are rarely used.  However,
some devices consider such a request an attempt to do arp, and will slow their response
trying to fill in a field that no one cares about.  Allow calling code to disable fetching of
this frequently problematic data.

Change-Id: Ia9b434e2a74983d822c91d5248815a0312942c15
This commit is contained in:
Jarrod Johnson 2016-03-25 13:20:25 -04:00
parent 7d782e7cd5
commit 15ddafb8fb

View File

@ -716,12 +716,13 @@ class Command(object):
cmddata = bytearray((channel, 12)) + socket.inet_aton(ipv4_gateway)
self.xraw_command(netfn=0xc, command=1, data=cmddata)
def get_net_configuration(self, channel=None):
def get_net_configuration(self, channel=None, gateway_macs=True):
"""Get network configuration data
Retrieve network configuration from the target
:param channel: Channel to configure, defaults to None for 'autodetect'
:param gateway_macs: Whether to retrieve mac addresses for gateways
:returns: A dictionary of network configuration data
"""
if channel is None:
@ -744,10 +745,11 @@ class Command(object):
channel, 4)]
retdata['mac_address'] = self._fetch_lancfg_param(channel, 5)
retdata['ipv4_gateway'] = self._fetch_lancfg_param(channel, 12)
retdata['ipv4_gateway_mac'] = self._fetch_lancfg_param(channel, 13)
retdata['ipv4_backup_gateway'] = self._fetch_lancfg_param(channel, 14)
retdata['ipv4_backup_gateway_mac'] = self._fetch_lancfg_param(channel,
15)
if gateway_macs:
retdata['ipv4_gateway_mac'] = self._fetch_lancfg_param(channel, 13)
retdata['ipv4_backup_gateway_mac'] = self._fetch_lancfg_param(
channel, 15)
self.oem_init()
self._oem.add_extra_net_configuration(retdata)
return retdata