|
|
@ -1259,7 +1259,7 @@ class GenericBsdIfconfigNetwork(Network):
|
|
|
|
all_ipv4_addresses = [],
|
|
|
|
all_ipv4_addresses = [],
|
|
|
|
all_ipv6_addresses = [],
|
|
|
|
all_ipv6_addresses = [],
|
|
|
|
)
|
|
|
|
)
|
|
|
|
rc, out, err = module.run_command([ifconfig_path])
|
|
|
|
rc, out, err = module.run_command([ifconfig_path, '-a'])
|
|
|
|
|
|
|
|
|
|
|
|
for line in out.split('\n'):
|
|
|
|
for line in out.split('\n'):
|
|
|
|
|
|
|
|
|
|
|
@ -1328,6 +1328,8 @@ class GenericBsdIfconfigNetwork(Network):
|
|
|
|
def parse_inet_line(self, words, current_if, ips):
|
|
|
|
def parse_inet_line(self, words, current_if, ips):
|
|
|
|
address = {'address': words[1]}
|
|
|
|
address = {'address': words[1]}
|
|
|
|
# deal with hex netmask
|
|
|
|
# deal with hex netmask
|
|
|
|
|
|
|
|
if re.match('([0-9a-f]){8}', words[3]) and len(words[3]) == 8:
|
|
|
|
|
|
|
|
words[3] = '0x' + words[3]
|
|
|
|
if words[3].startswith('0x'):
|
|
|
|
if words[3].startswith('0x'):
|
|
|
|
address['netmask'] = socket.inet_ntoa(struct.pack('!L', int(words[3], base=16)))
|
|
|
|
address['netmask'] = socket.inet_ntoa(struct.pack('!L', int(words[3], base=16)))
|
|
|
|
else:
|
|
|
|
else:
|
|
|
@ -1401,6 +1403,22 @@ class DarwinNetwork(GenericBsdIfconfigNetwork, Network):
|
|
|
|
current_if['media_options'] = self.get_options(words[3])
|
|
|
|
current_if['media_options'] = self.get_options(words[3])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class SunOSNetwork(GenericBsdIfconfigNetwork, Network):
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
This is the SunOS Network Class.
|
|
|
|
|
|
|
|
It uses the GenericBsdIfconfigNetwork unchanged
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
platform = 'SunOS'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Solaris displays single digit octets in MAC addresses e.g. 0:1:2:d:e:f
|
|
|
|
|
|
|
|
# Add leading zero to each octet where needed.
|
|
|
|
|
|
|
|
def parse_ether_line(self, words, current_if, ips):
|
|
|
|
|
|
|
|
macaddress = ''
|
|
|
|
|
|
|
|
for octet in words[1].split(':'):
|
|
|
|
|
|
|
|
octet = ('0' + octet)[-2:None]
|
|
|
|
|
|
|
|
macaddress += (octet + ':')
|
|
|
|
|
|
|
|
current_if['macaddress'] = macaddress[0:-1]
|
|
|
|
|
|
|
|
|
|
|
|
class FreeBSDNetwork(GenericBsdIfconfigNetwork, Network):
|
|
|
|
class FreeBSDNetwork(GenericBsdIfconfigNetwork, Network):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
This is the FreeBSD Network Class.
|
|
|
|
This is the FreeBSD Network Class.
|
|
|
|