mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Add Solaris network facts. IPv6 details overwrite IPv4 per interface, needs further work.
This commit is contained in:
parent
dbfad567bc
commit
6809b56233
1 changed files with 19 additions and 1 deletions
|
@ -1259,7 +1259,7 @@ class GenericBsdIfconfigNetwork(Network):
|
|||
all_ipv4_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'):
|
||||
|
||||
|
@ -1328,6 +1328,8 @@ class GenericBsdIfconfigNetwork(Network):
|
|||
def parse_inet_line(self, words, current_if, ips):
|
||||
address = {'address': words[1]}
|
||||
# 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'):
|
||||
address['netmask'] = socket.inet_ntoa(struct.pack('!L', int(words[3], base=16)))
|
||||
else:
|
||||
|
@ -1401,6 +1403,22 @@ class DarwinNetwork(GenericBsdIfconfigNetwork, Network):
|
|||
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):
|
||||
"""
|
||||
This is the FreeBSD Network Class.
|
||||
|
|
Loading…
Reference in a new issue