Debian Codegraph @

lib/ansible/module_utils/facts/network/openbsd.py

raw
1 # This file is part of Ansible
2 #
3 # Ansible is free software: you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation, either version 3 of the License, or
6 # (at your option) any later version.
7 #
8 # Ansible is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with Ansible. If not, see <http://www.gnu.org/licenses/>.
15
16 from __future__ import annotations
17
18 from ansible.module_utils.facts.network.base import NetworkCollector
19 from ansible.module_utils.facts.network.generic_bsd import GenericBsdIfconfigNetwork
20
21
22 class OpenBSDNetwork(GenericBsdIfconfigNetwork):
23 """
24 This is the OpenBSD Network Class.
25 It uses the GenericBsdIfconfigNetwork.
26 """
27 platform = 'OpenBSD'
28
29 # OpenBSD 'ifconfig -a' does not have information about aliases
30 def get_interfaces_info(self, ifconfig_path, ifconfig_options='-aA'):
31 return super(OpenBSDNetwork, self).get_interfaces_info(ifconfig_path, ifconfig_options)
32
33 # Return macaddress instead of lladdr
34 def parse_lladdr_line(self, words, current_if, ips):
35 current_if['macaddress'] = words[1]
36 current_if['type'] = 'ether'
37
38
39 class OpenBSDNetworkCollector(NetworkCollector):
40 _fact_class = OpenBSDNetwork
41 _platform = 'OpenBSD'