diff --git a/docs/parsers/ifconfig.md b/docs/parsers/ifconfig.md index 87a20bd0..b56f21fa 100644 --- a/docs/parsers/ifconfig.md +++ b/docs/parsers/ifconfig.md @@ -3,16 +3,12 @@ # jc.parsers.ifconfig -jc - JSON Convert `ifconfig` command output parser +jc - JSON Convert `foo` command output parser No `ifconfig` options are supported. Consider using the `ip` command instead of `ifconfig` as it supports native -JSON output and provides more detailed output than the `ifconfig` parser. -(e.g. support for multiple IPv4 and IPv6 addresses.) - -> Note: This parser will only output the last IPv4 and IPv6 address for -> each interface in the command output. +JSON output. Usage (cli): @@ -32,19 +28,21 @@ Schema: [ { "name": string, + "type": string, + "metric": integer "flags": integer, "state": [ string ], "mtu": integer, - "ipv4_addr": string, - "ipv4_mask": string, - "ipv4_bcast": string, - "ipv6_addr": string, - "ipv6_mask": integer, - "ipv6_scope": string, "mac_addr": string, - "type": string, + "ipv4_addr": string, # [0] + "ipv4_mask": string, # [0] + "ipv4_bcast": string, # [0] + "ipv6_addr": string, # [0] + "ipv6_mask": integer, # [0] + "ipv6_scope": string, # [0] + "ipv6_type": string, # [0] "rx_packets": integer, "rx_bytes": integer, "rx_errors": integer, @@ -58,13 +56,32 @@ Schema: "tx_overruns": integer, "tx_carrier": integer, "tx_collisions": integer, - "metric": integer + "ipv4": [ + { + "address": string, + "mask": string, + "broadcast": string + } + ], + "ipv6: [ + { + "address": string, + "mask": integer, + "scope": string, + "type": string + } + ] } ] + [0] these fields only pick up the last IP address in the interface + output and are here for backwards compatibility. For information on + all IP addresses, use the `ipv4` and `ipv6` objects which contain an + array of IP address objects. + Examples: - $ ifconfig | jc --ifconfig -p + $ ifconfig ens33 | jc --ifconfig -p [ { "name": "ens33", @@ -76,120 +93,92 @@ Examples: "MULTICAST" ], "mtu": 1500, + "type": "Ethernet", + "mac_addr": "00:0c:29:3b:58:0e", "ipv4_addr": "192.168.71.137", "ipv4_mask": "255.255.255.0", "ipv4_bcast": "192.168.71.255", "ipv6_addr": "fe80::c1cb:715d:bc3e:b8a0", "ipv6_mask": 64, "ipv6_scope": "0x20", - "mac_addr": "00:0c:29:3b:58:0e", - "type": "Ethernet", + "ipv6_type": "link", + "metric": null, "rx_packets": 8061, - "rx_bytes": 1514413, "rx_errors": 0, "rx_dropped": 0, "rx_overruns": 0, "rx_frame": 0, "tx_packets": 4502, + "tx_errors": 0, + "tx_dropped": 0, + "tx_overruns": 0, + "tx_carrier": 0, + "tx_collisions": 0, + "rx_bytes": 1514413, "tx_bytes": 866622, - "tx_errors": 0, - "tx_dropped": 0, - "tx_overruns": 0, - "tx_carrier": 0, - "tx_collisions": 0, - "metric": null - }, - { - "name": "lo", - "flags": 73, - "state": [ - "UP", - "LOOPBACK", - "RUNNING" + "ipv4": [ + { + "address": "192.168.71.137", + "mask": "255.255.255.0", + "broadcast": "192.168.71.255" + } ], - "mtu": 65536, - "ipv4_addr": "127.0.0.1", - "ipv4_mask": "255.0.0.0", - "ipv4_bcast": null, - "ipv6_addr": "::1", - "ipv6_mask": 128, - "ipv6_scope": "0x10", - "mac_addr": null, - "type": "Local Loopback", - "rx_packets": 73, - "rx_bytes": 6009, - "rx_errors": 0, - "rx_dropped": 0, - "rx_overruns": 0, - "rx_frame": 0, - "tx_packets": 73, - "tx_bytes": 6009, - "tx_errors": 0, - "tx_dropped": 0, - "tx_overruns": 0, - "tx_carrier": 0, - "tx_collisions": 0, - "metric": null + "ipv6": [ + { + "address": "fe80::c1cb:715d:bc3e:b8a0", + "mask": 64, + "scope": "0x20", + "type": "link" + } + ] } ] - $ ifconfig | jc --ifconfig -p -r + $ ifconfig ens33 | jc --ifconfig -p -r [ { "name": "ens33", "flags": "4163", "state": "UP,BROADCAST,RUNNING,MULTICAST", "mtu": "1500", + "type": "Ethernet", + "mac_addr": "00:0c:29:3b:58:0e", "ipv4_addr": "192.168.71.137", "ipv4_mask": "255.255.255.0", "ipv4_bcast": "192.168.71.255", "ipv6_addr": "fe80::c1cb:715d:bc3e:b8a0", "ipv6_mask": "64", "ipv6_scope": "0x20", - "mac_addr": "00:0c:29:3b:58:0e", - "type": "Ethernet", + "ipv6_type": "link", + "metric": null, "rx_packets": "8061", - "rx_bytes": "1514413", "rx_errors": "0", "rx_dropped": "0", "rx_overruns": "0", "rx_frame": "0", "tx_packets": "4502", + "tx_errors": "0", + "tx_dropped": "0", + "tx_overruns": "0", + "tx_carrier": "0", + "tx_collisions": "0", + "rx_bytes": "1514413", "tx_bytes": "866622", - "tx_errors": "0", - "tx_dropped": "0", - "tx_overruns": "0", - "tx_carrier": "0", - "tx_collisions": "0", - "metric": null - }, - { - "name": "lo", - "flags": "73", - "state": "UP,LOOPBACK,RUNNING", - "mtu": "65536", - "ipv4_addr": "127.0.0.1", - "ipv4_mask": "255.0.0.0", - "ipv4_bcast": null, - "ipv6_addr": "::1", - "ipv6_mask": "128", - "ipv6_scope": "0x10", - "mac_addr": null, - "type": "Local Loopback", - "rx_packets": "73", - "rx_bytes": "6009", - "rx_errors": "0", - "rx_dropped": "0", - "rx_overruns": "0", - "rx_frame": "0", - "tx_packets": "73", - "tx_bytes": "6009", - "tx_errors": "0", - "tx_dropped": "0", - "tx_overruns": "0", - "tx_carrier": "0", - "tx_collisions": "0", - "metric": null + "ipv4": [ + { + "address": "192.168.71.137", + "mask": "255.255.255.0", + "broadcast": "192.168.71.255" + } + ], + "ipv6": [ + { + "address": "fe80::c1cb:715d:bc3e:b8a0", + "mask": "64", + "scope": "0x20", + "type": "link" + } + ] } ] @@ -198,7 +187,9 @@ Examples: ### parse ```python -def parse(data, raw=False, quiet=False) +def parse(data: str, + raw: bool = False, + quiet: bool = False) -> List[JSONDictType] ``` Main text parsing function @@ -216,4 +207,4 @@ Returns: ### Parser Information Compatibility: linux, aix, freebsd, darwin -Version 1.12 by Kelly Brazil (kellyjonbrazil@gmail.com) +Version 2.0 by Kelly Brazil (kellyjonbrazil@gmail.com) diff --git a/jc/lib.py b/jc/lib.py index c33e1245..cee17ce1 100644 --- a/jc/lib.py +++ b/jc/lib.py @@ -54,7 +54,6 @@ parsers: List[str] = [ 'hosts', 'id', 'ifconfig', - 'ifconfig2', 'ini', 'iostat', 'iostat-s', diff --git a/jc/parsers/ifconfig.py b/jc/parsers/ifconfig.py index f19d2210..fa1abcdf 100644 --- a/jc/parsers/ifconfig.py +++ b/jc/parsers/ifconfig.py @@ -1,37 +1,181 @@ """jc - JSON Convert `foo` command output parser -<> +No `ifconfig` options are supported. + +Consider using the `ip` command instead of `ifconfig` as it supports native +JSON output. Usage (cli): - $ foo | jc --foo + $ ifconfig | jc --ifconfig or - $ jc foo + $ jc ifconfig Usage (module): import jc - result = jc.parse('foo', foo_command_output) + result = jc.parse('ifconfig', ifconfig_command_output) Schema: [ { - "foo": string, - "bar": boolean, - "baz": integer + "name": string, + "type": string, + "metric": integer + "flags": integer, + "state": [ + string + ], + "mtu": integer, + "mac_addr": string, + "ipv4_addr": string, # [0] + "ipv4_mask": string, # [0] + "ipv4_bcast": string, # [0] + "ipv6_addr": string, # [0] + "ipv6_mask": integer, # [0] + "ipv6_scope": string, # [0] + "ipv6_type": string, # [0] + "rx_packets": integer, + "rx_bytes": integer, + "rx_errors": integer, + "rx_dropped": integer, + "rx_overruns": integer, + "rx_frame": integer, + "tx_packets": integer, + "tx_bytes": integer, + "tx_errors": integer, + "tx_dropped": integer, + "tx_overruns": integer, + "tx_carrier": integer, + "tx_collisions": integer, + "ipv4": [ + { + "address": string, + "mask": string, + "broadcast": string + } + ], + "ipv6: [ + { + "address": string, + "mask": integer, + "scope": string, + "type": string + } + ] } ] + [0] these fields only pick up the last IP address in the interface + output and are here for backwards compatibility. For information on + all IP addresses, use the `ipv4` and `ipv6` objects which contain an + array of IP address objects. + Examples: - $ foo | jc --foo -p - [] + $ ifconfig ens33 | jc --ifconfig -p + [ + { + "name": "ens33", + "flags": 4163, + "state": [ + "UP", + "BROADCAST", + "RUNNING", + "MULTICAST" + ], + "mtu": 1500, + "type": "Ethernet", + "mac_addr": "00:0c:29:3b:58:0e", + "ipv4_addr": "192.168.71.137", + "ipv4_mask": "255.255.255.0", + "ipv4_bcast": "192.168.71.255", + "ipv6_addr": "fe80::c1cb:715d:bc3e:b8a0", + "ipv6_mask": 64, + "ipv6_scope": "0x20", + "ipv6_type": "link", + "metric": null, + "rx_packets": 8061, + "rx_errors": 0, + "rx_dropped": 0, + "rx_overruns": 0, + "rx_frame": 0, + "tx_packets": 4502, + "tx_errors": 0, + "tx_dropped": 0, + "tx_overruns": 0, + "tx_carrier": 0, + "tx_collisions": 0, + "rx_bytes": 1514413, + "tx_bytes": 866622, + "ipv4": [ + { + "address": "192.168.71.137", + "mask": "255.255.255.0", + "broadcast": "192.168.71.255" + } + ], + "ipv6": [ + { + "address": "fe80::c1cb:715d:bc3e:b8a0", + "mask": 64, + "scope": "0x20", + "type": "link" + } + ] + } + ] - $ foo | jc --foo -p -r - [] + $ ifconfig ens33 | jc --ifconfig -p -r + [ + { + "name": "ens33", + "flags": "4163", + "state": "UP,BROADCAST,RUNNING,MULTICAST", + "mtu": "1500", + "type": "Ethernet", + "mac_addr": "00:0c:29:3b:58:0e", + "ipv4_addr": "192.168.71.137", + "ipv4_mask": "255.255.255.0", + "ipv4_bcast": "192.168.71.255", + "ipv6_addr": "fe80::c1cb:715d:bc3e:b8a0", + "ipv6_mask": "64", + "ipv6_scope": "0x20", + "ipv6_type": "link", + "metric": null, + "rx_packets": "8061", + "rx_errors": "0", + "rx_dropped": "0", + "rx_overruns": "0", + "rx_frame": "0", + "tx_packets": "4502", + "tx_errors": "0", + "tx_dropped": "0", + "tx_overruns": "0", + "tx_carrier": "0", + "tx_collisions": "0", + "rx_bytes": "1514413", + "tx_bytes": "866622", + "ipv4": [ + { + "address": "192.168.71.137", + "mask": "255.255.255.0", + "broadcast": "192.168.71.255" + } + ], + "ipv6": [ + { + "address": "fe80::c1cb:715d:bc3e:b8a0", + "mask": "64", + "scope": "0x20", + "type": "link" + } + ] + } + ] """ import re from typing import List, Dict @@ -45,7 +189,6 @@ class info(): description = '`ifconfig` command parser' author = 'Kelly Brazil' author_email = 'kellyjonbrazil@gmail.com' - details = 'Using ifconfig-parser from https://github.com/KnightWhoSayNi/ifconfig-parser' compatible = ['linux', 'aix', 'freebsd', 'darwin'] magic_commands = ['ifconfig'] @@ -149,10 +292,68 @@ def parse( jc.utils.input_type_check(data) raw_output: List[Dict] = [] - interface_item: Dict = {} + + # for backwards compatibility, preset all fields to None + interface_obj: Dict = { + "name": None, + "flags": None, + "state": None, + "mtu": None, + "type": None, + "mac_addr": None, + "ipv4_addr": None, + "ipv4_mask": None, + "ipv4_bcast": None, + "ipv6_addr": None, + "ipv6_mask": None, + "ipv6_scope": None, + "ipv6_type": None, + "metric": None, + "rx_packets": None, + "rx_errors": None, + "rx_dropped": None, + "rx_overruns": None, + "rx_frame": None, + "tx_packets": None, + "tx_errors": None, + "tx_dropped": None, + "tx_overruns": None, + "tx_carrier": None, + "tx_collisions": None, + "rx_bytes": None, + "tx_bytes": None + } + + interface_item: Dict = interface_obj.copy() ipv4_info: List = [] ipv6_info: List = [] + # Below regular expression patterns are based off of the work of: + # https://github.com/KnightWhoSayNi/ifconfig-parser + # Author: threeheadedknight@protonmail.com + + # MIT License + + # Copyright (c) 2018 threeheadedknight@protonmail.com + + # Permission is hereby granted, free of charge, to any person obtaining a copy + # of this software and associated documentation files (the "Software"), to deal + # in the Software without restriction, including without limitation the rights + # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + # copies of the Software, and to permit persons to whom the Software is + # furnished to do so, subject to the following conditions: + + # The above copyright notice and this permission notice shall be included in all + # copies or substantial portions of the Software. + + # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + # SOFTWARE. + # Linux syntax re_linux_interface = re.compile( r"(?P[a-zA-Z0-9:._-]+)\s+Link encap:(?P\S+\s?\S+)(\s+HWaddr\s+\b" @@ -178,6 +379,7 @@ def parse( re_linux_bytes = re.compile(r"\W+RX bytes:(?P\d+)\s+\(.*\)\s+TX bytes:(?P\d+)\s+\(.*\)", re.I) re_linux_tx_stats = re.compile(r"collisions:(?P[0-9]+)\s+txqueuelen:[0-9]+", re.I) + # OpenBSD syntax re_openbsd_interface = re.compile( r"(?P[a-zA-Z0-9:._-]+):\s+flags=(?P[0-9]+)<(?P\S+)?>\s+mtu\s+(?P[0-9]+)", @@ -202,8 +404,7 @@ def parse( r"TX errors (?P[0-9]+)\s+dropped\s+(?P[0-9]+)\s+overruns\s+" r"(?P[0-9]+)\s+carrier\s+(?P[0-9]+)\s+collisions\s+(?P[0-9]+)", re.I) - re_openbsd = [re_openbsd_interface, re_openbsd_ipv4, re_openbsd_ipv6, re_openbsd_details, re_openbsd_rx, - re_openbsd_rx_stats, re_openbsd_tx, re_openbsd_tx_stats] + # FreeBSD syntax re_freebsd_interface = re.compile( @@ -238,13 +439,13 @@ def parse( # Find new interface lines interface_match = _bundle_match(interface_patterns, line) if interface_match: - if interface_item: + if interface_item['name'] is not None: if ipv4_info: interface_item['ipv4'] = ipv4_info if ipv6_info: interface_item['ipv6'] = ipv6_info raw_output.append(interface_item) - interface_item = {} + interface_item = interface_obj.copy() ipv4_info = [] ipv6_info = [] @@ -304,7 +505,7 @@ def parse( interface_item.update(other_match.groupdict()) continue - if interface_item: + if interface_item['name'] is not None: if ipv4_info: interface_item['ipv4'] = ipv4_info if ipv6_info: diff --git a/jc/parsers/ifconfig2.py b/jc/parsers/ifconfig2.py deleted file mode 100644 index 94fa0096..00000000 --- a/jc/parsers/ifconfig2.py +++ /dev/null @@ -1,506 +0,0 @@ -"""jc - JSON Convert `ifconfig` command output parser - -No `ifconfig` options are supported. - -Consider using the `ip` command instead of `ifconfig` as it supports native -JSON output and provides more detailed output than the `ifconfig` parser. -(e.g. support for multiple IPv4 and IPv6 addresses.) - -> Note: This parser will only output the last IPv4 and IPv6 address for -> each interface in the command output. - -Usage (cli): - - $ ifconfig | jc --ifconfig - -or - - $ jc ifconfig - -Usage (module): - - import jc - result = jc.parse('ifconfig', ifconfig_command_output) - -Schema: - - [ - { - "name": string, - "flags": integer, - "state": [ - string - ], - "mtu": integer, - "ipv4_addr": string, - "ipv4_mask": string, - "ipv4_bcast": string, - "ipv6_addr": string, - "ipv6_mask": integer, - "ipv6_scope": string, - "mac_addr": string, - "type": string, - "rx_packets": integer, - "rx_bytes": integer, - "rx_errors": integer, - "rx_dropped": integer, - "rx_overruns": integer, - "rx_frame": integer, - "tx_packets": integer, - "tx_bytes": integer, - "tx_errors": integer, - "tx_dropped": integer, - "tx_overruns": integer, - "tx_carrier": integer, - "tx_collisions": integer, - "metric": integer - } - ] - -Examples: - - $ ifconfig | jc --ifconfig -p - [ - { - "name": "ens33", - "flags": 4163, - "state": [ - "UP", - "BROADCAST", - "RUNNING", - "MULTICAST" - ], - "mtu": 1500, - "ipv4_addr": "192.168.71.137", - "ipv4_mask": "255.255.255.0", - "ipv4_bcast": "192.168.71.255", - "ipv6_addr": "fe80::c1cb:715d:bc3e:b8a0", - "ipv6_mask": 64, - "ipv6_scope": "0x20", - "mac_addr": "00:0c:29:3b:58:0e", - "type": "Ethernet", - "rx_packets": 8061, - "rx_bytes": 1514413, - "rx_errors": 0, - "rx_dropped": 0, - "rx_overruns": 0, - "rx_frame": 0, - "tx_packets": 4502, - "tx_bytes": 866622, - "tx_errors": 0, - "tx_dropped": 0, - "tx_overruns": 0, - "tx_carrier": 0, - "tx_collisions": 0, - "metric": null - }, - { - "name": "lo", - "flags": 73, - "state": [ - "UP", - "LOOPBACK", - "RUNNING" - ], - "mtu": 65536, - "ipv4_addr": "127.0.0.1", - "ipv4_mask": "255.0.0.0", - "ipv4_bcast": null, - "ipv6_addr": "::1", - "ipv6_mask": 128, - "ipv6_scope": "0x10", - "mac_addr": null, - "type": "Local Loopback", - "rx_packets": 73, - "rx_bytes": 6009, - "rx_errors": 0, - "rx_dropped": 0, - "rx_overruns": 0, - "rx_frame": 0, - "tx_packets": 73, - "tx_bytes": 6009, - "tx_errors": 0, - "tx_dropped": 0, - "tx_overruns": 0, - "tx_carrier": 0, - "tx_collisions": 0, - "metric": null - } - ] - - $ ifconfig | jc --ifconfig -p -r - [ - { - "name": "ens33", - "flags": "4163", - "state": "UP,BROADCAST,RUNNING,MULTICAST", - "mtu": "1500", - "ipv4_addr": "192.168.71.137", - "ipv4_mask": "255.255.255.0", - "ipv4_bcast": "192.168.71.255", - "ipv6_addr": "fe80::c1cb:715d:bc3e:b8a0", - "ipv6_mask": "64", - "ipv6_scope": "0x20", - "mac_addr": "00:0c:29:3b:58:0e", - "type": "Ethernet", - "rx_packets": "8061", - "rx_bytes": "1514413", - "rx_errors": "0", - "rx_dropped": "0", - "rx_overruns": "0", - "rx_frame": "0", - "tx_packets": "4502", - "tx_bytes": "866622", - "tx_errors": "0", - "tx_dropped": "0", - "tx_overruns": "0", - "tx_carrier": "0", - "tx_collisions": "0", - "metric": null - }, - { - "name": "lo", - "flags": "73", - "state": "UP,LOOPBACK,RUNNING", - "mtu": "65536", - "ipv4_addr": "127.0.0.1", - "ipv4_mask": "255.0.0.0", - "ipv4_bcast": null, - "ipv6_addr": "::1", - "ipv6_mask": "128", - "ipv6_scope": "0x10", - "mac_addr": null, - "type": "Local Loopback", - "rx_packets": "73", - "rx_bytes": "6009", - "rx_errors": "0", - "rx_dropped": "0", - "rx_overruns": "0", - "rx_frame": "0", - "tx_packets": "73", - "tx_bytes": "6009", - "tx_errors": "0", - "tx_dropped": "0", - "tx_overruns": "0", - "tx_carrier": "0", - "tx_collisions": "0", - "metric": null - } - ] -""" -import re -from collections import namedtuple -import jc.utils - - -class info(): - """Provides parser metadata (version, author, etc.)""" - version = '1.12' - description = '`ifconfig` command parser' - author = 'Kelly Brazil' - author_email = 'kellyjonbrazil@gmail.com' - details = 'Using ifconfig-parser from https://github.com/KnightWhoSayNi/ifconfig-parser' - compatible = ['linux', 'aix', 'freebsd', 'darwin'] - magic_commands = ['ifconfig'] - - -__version__ = info.version - - -class _IfconfigParser(object): - """ifconfig parser module written by threeheadedknight@protonmail.com""" - # Author: threeheadedknight@protonmail.com - # Date created: 30.06.2018 17:03 - # Python Version: 3.7 - - # MIT License - - # Copyright (c) 2018 threeheadedknight@protonmail.com - - # Permission is hereby granted, free of charge, to any person obtaining a copy - # of this software and associated documentation files (the "Software"), to deal - # in the Software without restriction, including without limitation the rights - # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - # copies of the Software, and to permit persons to whom the Software is - # furnished to do so, subject to the following conditions: - - # The above copyright notice and this permission notice shall be included in all - # copies or substantial portions of the Software. - - # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - # SOFTWARE. - - attributes = [ - 'name', 'type', 'mac_addr', 'ipv4_addr', 'ipv4_bcast', 'ipv4_mask', 'ipv6_addr', - 'ipv6_mask', 'ipv6_scope', 'state', 'mtu', 'metric', 'rx_packets', 'rx_errors', - 'rx_dropped', 'rx_overruns', 'rx_frame', 'tx_packets', 'tx_errors', 'tx_dropped', - 'tx_overruns', 'tx_carrier', 'tx_collisions', 'rx_bytes', 'tx_bytes' - ] - - def __init__(self, console_output): - """ - :param console_output: - """ - - if isinstance(console_output, list): - source_data = " ".join(console_output) - else: - source_data = console_output.replace("\n", " ") - self.interfaces = self.parser(source_data=source_data) - - def list_interfaces(self): - """ - :return: - """ - return sorted(self.interfaces.keys()) - - def count_interfaces(self): - """ - :return: - """ - return len(self.interfaces.keys()) - - def filter_interfaces(self, **kwargs): - """ - :param kwargs: - :return: - """ - for attr in kwargs.keys(): - if attr not in _IfconfigParser.attributes: - raise ValueError("Attribute [{}] not supported.".format(attr)) - - filtered_interfaces = [] - for name, details in self.interfaces.items(): - - if all(getattr(details, attr) == kwargs[attr] for attr in kwargs.keys()): - filtered_interfaces.append(name) - - return sorted(filtered_interfaces) - - def get_interface(self, name): - """ - :param name: - :return: - """ - if name in self.list_interfaces(): - return self.interfaces[name] - else: - raise InterfaceNotFound("Interface [{}] not found.".format(name)) - - def get_interfaces(self): - """ - :return: - """ - return self.interfaces - - def is_available(self, name): - """ - :param name: - :return: - """ - return name in self.interfaces - - def parser(self, source_data): - """ - :param source_data: - :return: - """ - - # Linux syntax - re_linux_interface = re.compile( - r"(?P[a-zA-Z0-9:._-]+)\s+Link encap:(?P\S+\s?\S+)(\s+HWaddr\s+\b" - r"(?P[0-9A-Fa-f:?]+))?", - re.I) - re_linux_ipv4 = re.compile( - r"inet addr:(?P(?:[0-9]{1,3}\.){3}[0-9]{1,3})(\s+Bcast:" - r"(?P(?:[0-9]{1,3}\.){3}[0-9]{1,3}))?\s+Mask:(?P(?:[0-9]{1,3}\.){3}[0-9]{1,3})", - re.I) - re_linux_ipv6 = re.compile( - r"inet6 addr:\s+(?P\S+)/(?P[0-9]+)\s+Scope:(?PLink|Host)", - re.I) - re_linux_state = re.compile( - r"\W+(?P(?:\w+\s)+)(?:\s+)?MTU:(?P[0-9]+)\s+Metric:(?P[0-9]+)", re.I) - re_linux_rx = re.compile( - r"RX packets:(?P[0-9]+)\s+errors:(?P[0-9]+)\s+dropped:" - r"(?P[0-9]+)\s+overruns:(?P[0-9]+)\s+frame:(?P[0-9]+)", - re.I) - re_linux_tx = re.compile( - r"TX packets:(?P[0-9]+)\s+errors:(?P[0-9]+)\s+dropped:" - r"(?P[0-9]+)\s+overruns:(?P[0-9]+)\s+carrier:(?P[0-9]+)", - re.I) - re_linux_bytes = re.compile(r"\W+RX bytes:(?P\d+)\s+\(.*\)\s+TX bytes:(?P\d+)\s+\(.*\)", re.I) - re_linux_tx_stats = re.compile(r"collisions:(?P[0-9]+)\s+txqueuelen:[0-9]+", re.I) - re_linux = [re_linux_interface, re_linux_ipv4, re_linux_ipv6, re_linux_state, re_linux_rx, re_linux_tx, - re_linux_bytes, re_linux_tx_stats] - - # OpenBSD syntax - re_openbsd_interface = re.compile( - r"(?P[a-zA-Z0-9:._-]+):\s+flags=(?P[0-9]+)<(?P\S+)?>\s+mtu\s+(?P[0-9]+)", - re.I) - re_openbsd_ipv4 = re.compile( - r"inet (?P(?:[0-9]{1,3}\.){3}[0-9]{1,3})\s+netmask\s+" - r"(?P(?:[0-9]{1,3}\.){3}[0-9]{1,3})(\s+broadcast\s+" - r"(?P(?:[0-9]{1,3}\.){3}[0-9]{1,3}))?", - re.I) - re_openbsd_ipv6 = re.compile( - r"inet6\s+(?P\S+)\s+prefixlen\s+(?P[0-9]+)\s+scopeid\s+(?P\w+x\w+)<" - r"(?:link|host)>", - re.I) - re_openbsd_details = re.compile( - r"\S+\s+(?:(?P[0-9A-Fa-f:?]+)\s+)?txqueuelen\s+[0-9]+\s+\((?P\S+\s?\S+)\)", re.I) - re_openbsd_rx = re.compile(r"RX packets (?P[0-9]+)\s+bytes\s+(?P\d+)\s+.*", re.I) - re_openbsd_rx_stats = re.compile( - r"RX errors (?P[0-9]+)\s+dropped\s+(?P[0-9]+)\s+overruns\s+" - r"(?P[0-9]+)\s+frame\s+(?P[0-9]+)", - re.I) - re_openbsd_tx = re.compile(r"TX packets (?P[0-9]+)\s+bytes\s+(?P\d+)\s+.*", re.I) - re_openbsd_tx_stats = re.compile( - r"TX errors (?P[0-9]+)\s+dropped\s+(?P[0-9]+)\s+overruns\s+" - r"(?P[0-9]+)\s+carrier\s+(?P[0-9]+)\s+collisions\s+(?P[0-9]+)", - re.I) - re_openbsd = [re_openbsd_interface, re_openbsd_ipv4, re_openbsd_ipv6, re_openbsd_details, re_openbsd_rx, - re_openbsd_rx_stats, re_openbsd_tx, re_openbsd_tx_stats] - - # FreeBSD syntax - re_freebsd_interface = re.compile( - r"(?P[a-zA-Z0-9:._-]+):\s+flags=(?P[0-9]+)<(?P\S+)>\s+metric\s+" - r"(?P[0-9]+)\s+mtu\s+(?P[0-9]+)", - re.I) - re_freebsd_ipv4 = re.compile( - r"inet (?P(?:[0-9]{1,3}\.){3}[0-9]{1,3})\s+netmask\s+(?P0x\S+)(\s+broadcast\s+" - r"(?P(?:[0-9]{1,3}\.){3}[0-9]{1,3}))?", - re.I) - re_freebsd_ipv6 = re.compile(r"\s?inet6\s(?P.*)(?:\%\w+\d+)\sprefixlen\s(?P\d+)(?:\s\w+)?\sscopeid\s(?P\w+x\w+)", re.I) - re_freebsd_details = re.compile(r"ether\s+(?P[0-9A-Fa-f:?]+)", re.I) - re_freebsd = [re_freebsd_interface, re_freebsd_ipv4, re_freebsd_ipv6, re_freebsd_details] - - available_interfaces = dict() - - for pattern in [re_linux_interface, re_openbsd_interface, re_freebsd_interface]: - network_interfaces = re.finditer(pattern, source_data) - positions = [] - while True: - try: - pos = next(network_interfaces) - positions.append(max(pos.start() - 1, 0)) - except StopIteration: - break - if positions: - positions.append(len(source_data)) - break - - if not positions: - return available_interfaces - - for l, r in zip(positions, positions[1:]): - chunk = source_data[l:r] - _interface = dict() - for pattern in re_linux + re_openbsd + re_freebsd: - match = re.search(pattern, chunk.replace('\t', '\n')) - if match: - details = match.groupdict() - for k, v in details.items(): - if isinstance(v, str): - details[k] = v.strip() - _interface.update(details) - if _interface is not None: - available_interfaces[_interface['name']] = self.update_interface_details(_interface) - - return available_interfaces - - @staticmethod - def update_interface_details(interface): - for attr in _IfconfigParser.attributes: - if attr not in interface: - interface[attr] = None - return namedtuple('Interface', interface.keys())(**interface) - - -class InterfaceNotFound(Exception): - pass - - -def _process(proc_data): - """ - Final processing to conform to the schema. - - Parameters: - - proc_data: (List of Dictionaries) raw structured data to process - - Returns: - - List of Dictionaries. Structured data to conform to the schema. - """ - int_list = { - 'flags', 'mtu', 'ipv6_mask', 'rx_packets', 'rx_bytes', 'rx_errors', 'rx_dropped', - 'rx_overruns', 'rx_frame', 'tx_packets', 'tx_bytes', 'tx_errors', 'tx_dropped', - 'tx_overruns', 'tx_carrier', 'tx_collisions', 'metric' - } - - for entry in proc_data: - for key in entry: - if key in int_list: - entry[key] = jc.utils.convert_to_int(entry[key]) - - # convert OSX-style subnet mask to dotted quad - if 'ipv4_mask' in entry: - try: - if entry['ipv4_mask'].startswith('0x'): - new_mask = entry['ipv4_mask'] - new_mask = new_mask.lstrip('0x') - new_mask = '.'.join(str(int(i, 16)) for i in [new_mask[i:i + 2] for i in range(0, len(new_mask), 2)]) - entry['ipv4_mask'] = new_mask - except (ValueError, TypeError, AttributeError): - pass - - # convert state value to an array - if 'state' in entry: - try: - new_state = entry['state'].split(',') - entry['state'] = new_state - except (ValueError, TypeError, AttributeError): - pass - - return proc_data - - -def parse(data, raw=False, quiet=False): - """ - Main text parsing function - - Parameters: - - data: (string) text data to parse - raw: (boolean) unprocessed output if True - quiet: (boolean) suppress warning messages if True - - Returns: - - List of Dictionaries. Raw or processed structured data. - """ - jc.utils.compatibility(__name__, info.compatible, quiet) - jc.utils.input_type_check(data) - - raw_output = [] - - if jc.utils.has_data(data): - - parsed = _IfconfigParser(console_output=data) - interfaces = parsed.get_interfaces() - - # convert ifconfigparser output to a dictionary - for iface in interfaces: - d = interfaces[iface]._asdict() - dct = dict(d) - raw_output.append(dct) - - if raw: - return raw_output - else: - return _process(raw_output) diff --git a/man/jc.1 b/man/jc.1 index bfc9d1f9..198f88e7 100644 --- a/man/jc.1 +++ b/man/jc.1 @@ -1,4 +1,4 @@ -.TH jc 1 2022-11-04 1.22.2 "JSON Convert" +.TH jc 1 2022-11-05 1.22.2 "JSON Convert" .SH NAME \fBjc\fP \- JSON Convert JSONifies the output of many CLI tools, file-types, and strings .SH SYNOPSIS diff --git a/tests/fixtures/centos-7.7/ifconfig.json b/tests/fixtures/centos-7.7/ifconfig.json index a66c4f0a..e41d4f68 100644 --- a/tests/fixtures/centos-7.7/ifconfig.json +++ b/tests/fixtures/centos-7.7/ifconfig.json @@ -1 +1 @@ -[{"name": "docker0", "flags": 4099, "state": ["UP", "BROADCAST", "MULTICAST"], "mtu": 1500, "ipv4_addr": "172.17.0.1", "ipv4_mask": "255.255.0.0", "ipv4_bcast": "0.0.0.0", "mac_addr": "02:42:b1:9a:ea:02", "type": "Ethernet", "rx_packets": 0, "rx_bytes": 0, "rx_errors": 0, "rx_dropped": 0, "rx_overruns": 0, "rx_frame": 0, "tx_packets": 0, "tx_bytes": 0, "tx_errors": 0, "tx_dropped": 0, "tx_overruns": 0, "tx_carrier": 0, "tx_collisions": 0, "ipv6_addr": null, "ipv6_mask": null, "ipv6_scope": null, "metric": null}, {"name": "ens33", "flags": 4163, "state": ["UP", "BROADCAST", "RUNNING", "MULTICAST"], "mtu": 1500, "ipv4_addr": "192.168.71.137", "ipv4_mask": "255.255.255.0", "ipv4_bcast": "192.168.71.255", "ipv6_addr": "fe80::c1cb:715d:bc3e:b8a0", "ipv6_mask": 64, "ipv6_scope": "0x20", "mac_addr": "00:0c:29:3b:58:0e", "type": "Ethernet", "rx_packets": 8061, "rx_bytes": 1514413, "rx_errors": 0, "rx_dropped": 0, "rx_overruns": 0, "rx_frame": 0, "tx_packets": 4502, "tx_bytes": 866622, "tx_errors": 0, "tx_dropped": 0, "tx_overruns": 0, "tx_carrier": 0, "tx_collisions": 0, "metric": null}, {"name": "lo", "flags": 73, "state": ["UP", "LOOPBACK", "RUNNING"], "mtu": 65536, "ipv4_addr": "127.0.0.1", "ipv4_mask": "255.0.0.0", "ipv4_bcast": null, "ipv6_addr": "::1", "ipv6_mask": 128, "ipv6_scope": "0x10", "mac_addr": null, "type": "Local Loopback", "rx_packets": 73, "rx_bytes": 6009, "rx_errors": 0, "rx_dropped": 0, "rx_overruns": 0, "rx_frame": 0, "tx_packets": 73, "tx_bytes": 6009, "tx_errors": 0, "tx_dropped": 0, "tx_overruns": 0, "tx_carrier": 0, "tx_collisions": 0, "metric": null}] +[{"name":"docker0","flags":4099,"state":["UP","BROADCAST","MULTICAST"],"mtu":1500,"type":"Ethernet","mac_addr":"02:42:b1:9a:ea:02","ipv4_addr":"172.17.0.1","ipv4_mask":"255.255.0.0","ipv4_bcast":"0.0.0.0","ipv6_addr":null,"ipv6_mask":null,"ipv6_scope":null,"ipv6_type":null,"metric":null,"rx_packets":0,"rx_errors":0,"rx_dropped":0,"rx_overruns":0,"rx_frame":0,"tx_packets":0,"tx_errors":0,"tx_dropped":0,"tx_overruns":0,"tx_carrier":0,"tx_collisions":0,"rx_bytes":0,"tx_bytes":0,"ipv4":[{"address":"172.17.0.1","mask":"255.255.0.0","broadcast":"0.0.0.0"}]},{"name":"ens33","flags":4163,"state":["UP","BROADCAST","RUNNING","MULTICAST"],"mtu":1500,"type":"Ethernet","mac_addr":"00:0c:29:3b:58:0e","ipv4_addr":"192.168.71.137","ipv4_mask":"255.255.255.0","ipv4_bcast":"192.168.71.255","ipv6_addr":"fe80::c1cb:715d:bc3e:b8a0","ipv6_mask":64,"ipv6_scope":"0x20","ipv6_type":"link","metric":null,"rx_packets":8061,"rx_errors":0,"rx_dropped":0,"rx_overruns":0,"rx_frame":0,"tx_packets":4502,"tx_errors":0,"tx_dropped":0,"tx_overruns":0,"tx_carrier":0,"tx_collisions":0,"rx_bytes":1514413,"tx_bytes":866622,"ipv4":[{"address":"192.168.71.137","mask":"255.255.255.0","broadcast":"192.168.71.255"}],"ipv6":[{"address":"fe80::c1cb:715d:bc3e:b8a0","mask":64,"scope":"0x20","type":"link"}]},{"name":"lo","flags":73,"state":["UP","LOOPBACK","RUNNING"],"mtu":65536,"type":"Local Loopback","mac_addr":null,"ipv4_addr":"127.0.0.1","ipv4_mask":"255.0.0.0","ipv4_bcast":null,"ipv6_addr":"::1","ipv6_mask":128,"ipv6_scope":"0x10","ipv6_type":"host","metric":null,"rx_packets":73,"rx_errors":0,"rx_dropped":0,"rx_overruns":0,"rx_frame":0,"tx_packets":73,"tx_errors":0,"tx_dropped":0,"tx_overruns":0,"tx_carrier":0,"tx_collisions":0,"rx_bytes":6009,"tx_bytes":6009,"ipv4":[{"address":"127.0.0.1","mask":"255.0.0.0","broadcast":null}],"ipv6":[{"address":"::1","mask":128,"scope":"0x10","type":"host"}]}] diff --git a/tests/fixtures/osx-10.11.6/ifconfig.json b/tests/fixtures/osx-10.11.6/ifconfig.json index 700de99d..3153077a 100644 --- a/tests/fixtures/osx-10.11.6/ifconfig.json +++ b/tests/fixtures/osx-10.11.6/ifconfig.json @@ -1 +1 @@ -[{"name": "lo0", "flags": 8049, "state": ["UP", "LOOPBACK", "RUNNING", "MULTICAST"], "mtu": 16384, "ipv4_addr": "127.0.0.1", "ipv4_mask": "255.0.0.0", "ipv4_bcast": null, "ipv6_addr": "fe80::1", "ipv6_mask": 64, "ipv6_scope": "0x1", "type": null, "mac_addr": null, "metric": null, "rx_packets": null, "rx_errors": null, "rx_dropped": null, "rx_overruns": null, "rx_frame": null, "tx_packets": null, "tx_errors": null, "tx_dropped": null, "tx_overruns": null, "tx_carrier": null, "tx_collisions": null, "rx_bytes": null, "tx_bytes": null}, {"name": "gif0", "flags": 8010, "state": ["POINTOPOINT", "MULTICAST"], "mtu": 1280, "type": null, "mac_addr": null, "ipv4_addr": null, "ipv4_bcast": null, "ipv4_mask": null, "ipv6_addr": null, "ipv6_mask": null, "ipv6_scope": null, "metric": null, "rx_packets": null, "rx_errors": null, "rx_dropped": null, "rx_overruns": null, "rx_frame": null, "tx_packets": null, "tx_errors": null, "tx_dropped": null, "tx_overruns": null, "tx_carrier": null, "tx_collisions": null, "rx_bytes": null, "tx_bytes": null}, {"name": "stf0", "flags": 0, "state": null, "mtu": 1280, "type": null, "mac_addr": null, "ipv4_addr": null, "ipv4_bcast": null, "ipv4_mask": null, "ipv6_addr": null, "ipv6_mask": null, "ipv6_scope": null, "metric": null, "rx_packets": null, "rx_errors": null, "rx_dropped": null, "rx_overruns": null, "rx_frame": null, "tx_packets": null, "tx_errors": null, "tx_dropped": null, "tx_overruns": null, "tx_carrier": null, "tx_collisions": null, "rx_bytes": null, "tx_bytes": null}, {"name": "en0", "flags": 8863, "state": ["UP", "BROADCAST", "SMART", "RUNNING", "SIMPLEX", "MULTICAST"], "mtu": 1500, "ipv4_addr": "192.168.1.81", "ipv4_mask": "255.255.255.0", "ipv4_bcast": "192.168.1.255", "ipv6_addr": "fe80::6aa8:6dff:fe12:f575", "ipv6_mask": 64, "ipv6_scope": "0x4", "mac_addr": "68:a8:6d:12:f5:75", "type": null, "metric": null, "rx_packets": null, "rx_errors": null, "rx_dropped": null, "rx_overruns": null, "rx_frame": null, "tx_packets": null, "tx_errors": null, "tx_dropped": null, "tx_overruns": null, "tx_carrier": null, "tx_collisions": null, "rx_bytes": null, "tx_bytes": null}, {"name": "en1", "flags": 963, "state": ["UP", "BROADCAST", "SMART", "RUNNING", "PROMISC", "SIMPLEX"], "mtu": 1500, "mac_addr": "b2:00:19:cb:f5:50", "type": null, "ipv4_addr": null, "ipv4_bcast": null, "ipv4_mask": null, "ipv6_addr": null, "ipv6_mask": null, "ipv6_scope": null, "metric": null, "rx_packets": null, "rx_errors": null, "rx_dropped": null, "rx_overruns": null, "rx_frame": null, "tx_packets": null, "tx_errors": null, "tx_dropped": null, "tx_overruns": null, "tx_carrier": null, "tx_collisions": null, "rx_bytes": null, "tx_bytes": null}, {"name": "p2p0", "flags": 8843, "state": ["UP", "BROADCAST", "RUNNING", "SIMPLEX", "MULTICAST"], "mtu": 2304, "mac_addr": "0a:a8:6d:12:f5:75", "type": null, "ipv4_addr": null, "ipv4_bcast": null, "ipv4_mask": null, "ipv6_addr": null, "ipv6_mask": null, "ipv6_scope": null, "metric": null, "rx_packets": null, "rx_errors": null, "rx_dropped": null, "rx_overruns": null, "rx_frame": null, "tx_packets": null, "tx_errors": null, "tx_dropped": null, "tx_overruns": null, "tx_carrier": null, "tx_collisions": null, "rx_bytes": null, "tx_bytes": null}, {"name": "bridge0", "flags": 8863, "state": ["UP", "BROADCAST", "SMART", "RUNNING", "SIMPLEX", "MULTICAST"], "mtu": 1500, "mac_addr": "6a:a8:6d:21:38:00", "type": null, "ipv4_addr": null, "ipv4_bcast": null, "ipv4_mask": null, "ipv6_addr": null, "ipv6_mask": null, "ipv6_scope": null, "metric": null, "rx_packets": null, "rx_errors": null, "rx_dropped": null, "rx_overruns": null, "rx_frame": null, "tx_packets": null, "tx_errors": null, "tx_dropped": null, "tx_overruns": null, "tx_carrier": null, "tx_collisions": null, "rx_bytes": null, "tx_bytes": null}] +[{"name":"lo0","flags":8049,"state":["UP","LOOPBACK","RUNNING","MULTICAST"],"mtu":16384,"type":null,"mac_addr":null,"ipv4_addr":"127.0.0.1","ipv4_mask":"255.0.0.0","ipv4_bcast":null,"ipv6_addr":"fe80::1","ipv6_mask":64,"ipv6_scope":"0x1","ipv6_type":null,"metric":null,"rx_packets":null,"rx_errors":null,"rx_dropped":null,"rx_overruns":null,"rx_frame":null,"tx_packets":null,"tx_errors":null,"tx_dropped":null,"tx_overruns":null,"tx_carrier":null,"tx_collisions":null,"rx_bytes":null,"tx_bytes":null,"ipv4":[{"address":"127.0.0.1","mask":"255.0.0.0","broadcast":null}],"ipv6":[{"address":"fe80::1","mask":64,"scope":"0x1"}]},{"name":"gif0","flags":8010,"state":["POINTOPOINT","MULTICAST"],"mtu":1280,"type":null,"mac_addr":null,"ipv4_addr":null,"ipv4_mask":null,"ipv4_bcast":null,"ipv6_addr":null,"ipv6_mask":null,"ipv6_scope":null,"ipv6_type":null,"metric":null,"rx_packets":null,"rx_errors":null,"rx_dropped":null,"rx_overruns":null,"rx_frame":null,"tx_packets":null,"tx_errors":null,"tx_dropped":null,"tx_overruns":null,"tx_carrier":null,"tx_collisions":null,"rx_bytes":null,"tx_bytes":null},{"name":"stf0","flags":0,"state":null,"mtu":1280,"type":null,"mac_addr":null,"ipv4_addr":null,"ipv4_mask":null,"ipv4_bcast":null,"ipv6_addr":null,"ipv6_mask":null,"ipv6_scope":null,"ipv6_type":null,"metric":null,"rx_packets":null,"rx_errors":null,"rx_dropped":null,"rx_overruns":null,"rx_frame":null,"tx_packets":null,"tx_errors":null,"tx_dropped":null,"tx_overruns":null,"tx_carrier":null,"tx_collisions":null,"rx_bytes":null,"tx_bytes":null},{"name":"en0","flags":8863,"state":["UP","BROADCAST","SMART","RUNNING","SIMPLEX","MULTICAST"],"mtu":1500,"type":null,"mac_addr":"68:a8:6d:12:f5:75","ipv4_addr":"192.168.1.81","ipv4_mask":"255.255.255.0","ipv4_bcast":"192.168.1.255","ipv6_addr":"fe80::6aa8:6dff:fe12:f575","ipv6_mask":64,"ipv6_scope":"0x4","ipv6_type":null,"metric":null,"rx_packets":null,"rx_errors":null,"rx_dropped":null,"rx_overruns":null,"rx_frame":null,"tx_packets":null,"tx_errors":null,"tx_dropped":null,"tx_overruns":null,"tx_carrier":null,"tx_collisions":null,"rx_bytes":null,"tx_bytes":null,"ipv4":[{"address":"192.168.1.81","mask":"255.255.255.0","broadcast":"192.168.1.255"}],"ipv6":[{"address":"fe80::6aa8:6dff:fe12:f575","mask":64,"scope":"0x4"}]},{"name":"en1","flags":963,"state":["UP","BROADCAST","SMART","RUNNING","PROMISC","SIMPLEX"],"mtu":1500,"type":null,"mac_addr":"b2:00:19:cb:f5:50","ipv4_addr":null,"ipv4_mask":null,"ipv4_bcast":null,"ipv6_addr":null,"ipv6_mask":null,"ipv6_scope":null,"ipv6_type":null,"metric":null,"rx_packets":null,"rx_errors":null,"rx_dropped":null,"rx_overruns":null,"rx_frame":null,"tx_packets":null,"tx_errors":null,"tx_dropped":null,"tx_overruns":null,"tx_carrier":null,"tx_collisions":null,"rx_bytes":null,"tx_bytes":null},{"name":"p2p0","flags":8843,"state":["UP","BROADCAST","RUNNING","SIMPLEX","MULTICAST"],"mtu":2304,"type":null,"mac_addr":"0a:a8:6d:12:f5:75","ipv4_addr":null,"ipv4_mask":null,"ipv4_bcast":null,"ipv6_addr":null,"ipv6_mask":null,"ipv6_scope":null,"ipv6_type":null,"metric":null,"rx_packets":null,"rx_errors":null,"rx_dropped":null,"rx_overruns":null,"rx_frame":null,"tx_packets":null,"tx_errors":null,"tx_dropped":null,"tx_overruns":null,"tx_carrier":null,"tx_collisions":null,"rx_bytes":null,"tx_bytes":null},{"name":"bridge0","flags":8863,"state":["UP","BROADCAST","SMART","RUNNING","SIMPLEX","MULTICAST"],"mtu":1500,"type":null,"mac_addr":"6a:a8:6d:21:38:00","ipv4_addr":null,"ipv4_mask":null,"ipv4_bcast":null,"ipv6_addr":null,"ipv6_mask":null,"ipv6_scope":null,"ipv6_type":null,"metric":null,"rx_packets":null,"rx_errors":null,"rx_dropped":null,"rx_overruns":null,"rx_frame":null,"tx_packets":null,"tx_errors":null,"tx_dropped":null,"tx_overruns":null,"tx_carrier":null,"tx_collisions":null,"rx_bytes":null,"tx_bytes":null}] diff --git a/tests/fixtures/osx-10.11.6/ifconfig2.json b/tests/fixtures/osx-10.11.6/ifconfig2.json index c9c3f17a..dd34218d 100644 --- a/tests/fixtures/osx-10.11.6/ifconfig2.json +++ b/tests/fixtures/osx-10.11.6/ifconfig2.json @@ -1 +1 @@ -[{"name": "lo0", "flags": 8049, "state": ["UP", "LOOPBACK", "RUNNING", "MULTICAST"], "mtu": 16384, "ipv4_addr": "127.0.0.1", "ipv4_mask": "255.0.0.0", "ipv4_bcast": null, "ipv6_addr": "fe80::1", "ipv6_mask": 64, "ipv6_scope": "0x1", "type": null, "mac_addr": null, "metric": null, "rx_packets": null, "rx_errors": null, "rx_dropped": null, "rx_overruns": null, "rx_frame": null, "tx_packets": null, "tx_errors": null, "tx_dropped": null, "tx_overruns": null, "tx_carrier": null, "tx_collisions": null, "rx_bytes": null, "tx_bytes": null}, {"name": "gif0", "flags": 8010, "state": ["POINTOPOINT", "MULTICAST"], "mtu": 1280, "type": null, "mac_addr": null, "ipv4_addr": null, "ipv4_bcast": null, "ipv4_mask": null, "ipv6_addr": null, "ipv6_mask": null, "ipv6_scope": null, "metric": null, "rx_packets": null, "rx_errors": null, "rx_dropped": null, "rx_overruns": null, "rx_frame": null, "tx_packets": null, "tx_errors": null, "tx_dropped": null, "tx_overruns": null, "tx_carrier": null, "tx_collisions": null, "rx_bytes": null, "tx_bytes": null}, {"name": "stf0", "flags": 0, "state": null, "mtu": 1280, "type": null, "mac_addr": null, "ipv4_addr": null, "ipv4_bcast": null, "ipv4_mask": null, "ipv6_addr": null, "ipv6_mask": null, "ipv6_scope": null, "metric": null, "rx_packets": null, "rx_errors": null, "rx_dropped": null, "rx_overruns": null, "rx_frame": null, "tx_packets": null, "tx_errors": null, "tx_dropped": null, "tx_overruns": null, "tx_carrier": null, "tx_collisions": null, "rx_bytes": null, "tx_bytes": null}, {"name": "en0", "flags": 8863, "state": ["UP", "BROADCAST", "SMART", "RUNNING", "SIMPLEX", "MULTICAST"], "mtu": 1500, "ipv4_addr": "192.168.1.65", "ipv4_mask": "255.255.255.0", "ipv4_bcast": "192.168.1.255", "ipv6_addr": "fe80::62c5:47ff:fe0a:ce0b", "ipv6_mask": 64, "ipv6_scope": "0x4", "mac_addr": "60:c5:47:0a:ce:0b", "type": null, "metric": null, "rx_packets": null, "rx_errors": null, "rx_dropped": null, "rx_overruns": null, "rx_frame": null, "tx_packets": null, "tx_errors": null, "tx_dropped": null, "tx_overruns": null, "tx_carrier": null, "tx_collisions": null, "rx_bytes": null, "tx_bytes": null}, {"name": "en1", "flags": 963, "state": ["UP", "BROADCAST", "SMART", "RUNNING", "PROMISC", "SIMPLEX"], "mtu": 1500, "mac_addr": "b2:00:14:06:39:21", "type": null, "ipv4_addr": null, "ipv4_bcast": null, "ipv4_mask": null, "ipv6_addr": null, "ipv6_mask": null, "ipv6_scope": null, "metric": null, "rx_packets": null, "rx_errors": null, "rx_dropped": null, "rx_overruns": null, "rx_frame": null, "tx_packets": null, "tx_errors": null, "tx_dropped": null, "tx_overruns": null, "tx_carrier": null, "tx_collisions": null, "rx_bytes": null, "tx_bytes": null}, {"name": "p2p0", "flags": 8843, "state": ["UP", "BROADCAST", "RUNNING", "SIMPLEX", "MULTICAST"], "mtu": 2304, "mac_addr": "02:c5:47:0a:ce:0b", "type": null, "ipv4_addr": null, "ipv4_bcast": null, "ipv4_mask": null, "ipv6_addr": null, "ipv6_mask": null, "ipv6_scope": null, "metric": null, "rx_packets": null, "rx_errors": null, "rx_dropped": null, "rx_overruns": null, "rx_frame": null, "tx_packets": null, "tx_errors": null, "tx_dropped": null, "tx_overruns": null, "tx_carrier": null, "tx_collisions": null, "rx_bytes": null, "tx_bytes": null}, {"name": "bridge0", "flags": 8863, "state": ["UP", "BROADCAST", "SMART", "RUNNING", "SIMPLEX", "MULTICAST"], "mtu": 1500, "mac_addr": "62:c5:47:a0:f7:10", "type": null, "ipv4_addr": null, "ipv4_bcast": null, "ipv4_mask": null, "ipv6_addr": null, "ipv6_mask": null, "ipv6_scope": null, "metric": null, "rx_packets": null, "rx_errors": null, "rx_dropped": null, "rx_overruns": null, "rx_frame": null, "tx_packets": null, "tx_errors": null, "tx_dropped": null, "tx_overruns": null, "tx_carrier": null, "tx_collisions": null, "rx_bytes": null, "tx_bytes": null}] +[{"name":"lo0","flags":8049,"state":["UP","LOOPBACK","RUNNING","MULTICAST"],"mtu":16384,"type":null,"mac_addr":null,"ipv4_addr":"127.0.0.1","ipv4_mask":"255.0.0.0","ipv4_bcast":null,"ipv6_addr":"fe80::1","ipv6_mask":64,"ipv6_scope":"0x1","ipv6_type":null,"metric":null,"rx_packets":null,"rx_errors":null,"rx_dropped":null,"rx_overruns":null,"rx_frame":null,"tx_packets":null,"tx_errors":null,"tx_dropped":null,"tx_overruns":null,"tx_carrier":null,"tx_collisions":null,"rx_bytes":null,"tx_bytes":null,"ipv4":[{"address":"127.0.0.1","mask":"255.0.0.0","broadcast":null}],"ipv6":[{"address":"fe80::1","mask":64,"scope":"0x1"}]},{"name":"gif0","flags":8010,"state":["POINTOPOINT","MULTICAST"],"mtu":1280,"type":null,"mac_addr":null,"ipv4_addr":null,"ipv4_mask":null,"ipv4_bcast":null,"ipv6_addr":null,"ipv6_mask":null,"ipv6_scope":null,"ipv6_type":null,"metric":null,"rx_packets":null,"rx_errors":null,"rx_dropped":null,"rx_overruns":null,"rx_frame":null,"tx_packets":null,"tx_errors":null,"tx_dropped":null,"tx_overruns":null,"tx_carrier":null,"tx_collisions":null,"rx_bytes":null,"tx_bytes":null},{"name":"stf0","flags":0,"state":null,"mtu":1280,"type":null,"mac_addr":null,"ipv4_addr":null,"ipv4_mask":null,"ipv4_bcast":null,"ipv6_addr":null,"ipv6_mask":null,"ipv6_scope":null,"ipv6_type":null,"metric":null,"rx_packets":null,"rx_errors":null,"rx_dropped":null,"rx_overruns":null,"rx_frame":null,"tx_packets":null,"tx_errors":null,"tx_dropped":null,"tx_overruns":null,"tx_carrier":null,"tx_collisions":null,"rx_bytes":null,"tx_bytes":null},{"name":"en0","flags":8863,"state":["UP","BROADCAST","SMART","RUNNING","SIMPLEX","MULTICAST"],"mtu":1500,"type":null,"mac_addr":"60:c5:47:0a:ce:0b","ipv4_addr":"192.168.1.65","ipv4_mask":"255.255.255.0","ipv4_bcast":"192.168.1.255","ipv6_addr":"fe80::62c5:47ff:fe0a:ce0b","ipv6_mask":64,"ipv6_scope":"0x4","ipv6_type":null,"metric":null,"rx_packets":null,"rx_errors":null,"rx_dropped":null,"rx_overruns":null,"rx_frame":null,"tx_packets":null,"tx_errors":null,"tx_dropped":null,"tx_overruns":null,"tx_carrier":null,"tx_collisions":null,"rx_bytes":null,"tx_bytes":null,"ipv4":[{"address":"192.168.1.65","mask":"255.255.255.0","broadcast":"192.168.1.255"}],"ipv6":[{"address":"fe80::62c5:47ff:fe0a:ce0b","mask":64,"scope":"0x4"}]},{"name":"en1","flags":963,"state":["UP","BROADCAST","SMART","RUNNING","PROMISC","SIMPLEX"],"mtu":1500,"type":null,"mac_addr":"b2:00:14:06:39:21","ipv4_addr":null,"ipv4_mask":null,"ipv4_bcast":null,"ipv6_addr":null,"ipv6_mask":null,"ipv6_scope":null,"ipv6_type":null,"metric":null,"rx_packets":null,"rx_errors":null,"rx_dropped":null,"rx_overruns":null,"rx_frame":null,"tx_packets":null,"tx_errors":null,"tx_dropped":null,"tx_overruns":null,"tx_carrier":null,"tx_collisions":null,"rx_bytes":null,"tx_bytes":null},{"name":"p2p0","flags":8843,"state":["UP","BROADCAST","RUNNING","SIMPLEX","MULTICAST"],"mtu":2304,"type":null,"mac_addr":"02:c5:47:0a:ce:0b","ipv4_addr":null,"ipv4_mask":null,"ipv4_bcast":null,"ipv6_addr":null,"ipv6_mask":null,"ipv6_scope":null,"ipv6_type":null,"metric":null,"rx_packets":null,"rx_errors":null,"rx_dropped":null,"rx_overruns":null,"rx_frame":null,"tx_packets":null,"tx_errors":null,"tx_dropped":null,"tx_overruns":null,"tx_carrier":null,"tx_collisions":null,"rx_bytes":null,"tx_bytes":null},{"name":"bridge0","flags":8863,"state":["UP","BROADCAST","SMART","RUNNING","SIMPLEX","MULTICAST"],"mtu":1500,"type":null,"mac_addr":"62:c5:47:a0:f7:10","ipv4_addr":null,"ipv4_mask":null,"ipv4_bcast":null,"ipv6_addr":null,"ipv6_mask":null,"ipv6_scope":null,"ipv6_type":null,"metric":null,"rx_packets":null,"rx_errors":null,"rx_dropped":null,"rx_overruns":null,"rx_frame":null,"tx_packets":null,"tx_errors":null,"tx_dropped":null,"tx_overruns":null,"tx_carrier":null,"tx_collisions":null,"rx_bytes":null,"tx_bytes":null}] diff --git a/tests/fixtures/osx-10.14.6/ifconfig.json b/tests/fixtures/osx-10.14.6/ifconfig.json index cdd439ff..1f6ac69f 100644 --- a/tests/fixtures/osx-10.14.6/ifconfig.json +++ b/tests/fixtures/osx-10.14.6/ifconfig.json @@ -1 +1 @@ -[{"name": "lo0", "flags": 8049, "state": ["UP", "LOOPBACK", "RUNNING", "MULTICAST"], "mtu": 16384, "ipv4_addr": "127.0.0.1", "ipv4_mask": "255.0.0.0", "ipv4_bcast": null, "ipv6_addr": "fe80::1", "ipv6_mask": 64, "ipv6_scope": "0x1", "type": null, "mac_addr": null, "metric": null, "rx_packets": null, "rx_errors": null, "rx_dropped": null, "rx_overruns": null, "rx_frame": null, "tx_packets": null, "tx_errors": null, "tx_dropped": null, "tx_overruns": null, "tx_carrier": null, "tx_collisions": null, "rx_bytes": null, "tx_bytes": null}, {"name": "gif0", "flags": 8010, "state": ["POINTOPOINT", "MULTICAST"], "mtu": 1280, "type": null, "mac_addr": null, "ipv4_addr": null, "ipv4_bcast": null, "ipv4_mask": null, "ipv6_addr": null, "ipv6_mask": null, "ipv6_scope": null, "metric": null, "rx_packets": null, "rx_errors": null, "rx_dropped": null, "rx_overruns": null, "rx_frame": null, "tx_packets": null, "tx_errors": null, "tx_dropped": null, "tx_overruns": null, "tx_carrier": null, "tx_collisions": null, "rx_bytes": null, "tx_bytes": null}, {"name": "stf0", "flags": 0, "state": null, "mtu": 1280, "type": null, "mac_addr": null, "ipv4_addr": null, "ipv4_bcast": null, "ipv4_mask": null, "ipv6_addr": null, "ipv6_mask": null, "ipv6_scope": null, "metric": null, "rx_packets": null, "rx_errors": null, "rx_dropped": null, "rx_overruns": null, "rx_frame": null, "tx_packets": null, "tx_errors": null, "tx_dropped": null, "tx_overruns": null, "tx_carrier": null, "tx_collisions": null, "rx_bytes": null, "tx_bytes": null}, {"name": "XHC1", "flags": 0, "state": null, "mtu": 0, "type": null, "mac_addr": null, "ipv4_addr": null, "ipv4_bcast": null, "ipv4_mask": null, "ipv6_addr": null, "ipv6_mask": null, "ipv6_scope": null, "metric": null, "rx_packets": null, "rx_errors": null, "rx_dropped": null, "rx_overruns": null, "rx_frame": null, "tx_packets": null, "tx_errors": null, "tx_dropped": null, "tx_overruns": null, "tx_carrier": null, "tx_collisions": null, "rx_bytes": null, "tx_bytes": null}, {"name": "XHC0", "flags": 0, "state": null, "mtu": 0, "type": null, "mac_addr": null, "ipv4_addr": null, "ipv4_bcast": null, "ipv4_mask": null, "ipv6_addr": null, "ipv6_mask": null, "ipv6_scope": null, "metric": null, "rx_packets": null, "rx_errors": null, "rx_dropped": null, "rx_overruns": null, "rx_frame": null, "tx_packets": null, "tx_errors": null, "tx_dropped": null, "tx_overruns": null, "tx_carrier": null, "tx_collisions": null, "rx_bytes": null, "tx_bytes": null}, {"name": "XHC20", "flags": 0, "state": null, "mtu": 0, "type": null, "mac_addr": null, "ipv4_addr": null, "ipv4_bcast": null, "ipv4_mask": null, "ipv6_addr": null, "ipv6_mask": null, "ipv6_scope": null, "metric": null, "rx_packets": null, "rx_errors": null, "rx_dropped": null, "rx_overruns": null, "rx_frame": null, "tx_packets": null, "tx_errors": null, "tx_dropped": null, "tx_overruns": null, "tx_carrier": null, "tx_collisions": null, "rx_bytes": null, "tx_bytes": null}, {"name": "en5", "flags": 8863, "state": ["UP", "BROADCAST", "SMART", "RUNNING", "SIMPLEX", "MULTICAST"], "mtu": 1500, "ipv6_addr": "fe80::aede:48ff:fe00:1323", "ipv6_mask": 64, "ipv6_scope": "0x7", "mac_addr": "ac:de:48:00:13:23", "type": null, "ipv4_addr": null, "ipv4_bcast": null, "ipv4_mask": null, "metric": null, "rx_packets": null, "rx_errors": null, "rx_dropped": null, "rx_overruns": null, "rx_frame": null, "tx_packets": null, "tx_errors": null, "tx_dropped": null, "tx_overruns": null, "tx_carrier": null, "tx_collisions": null, "rx_bytes": null, "tx_bytes": null}, {"name": "en0", "flags": 8863, "state": ["UP", "BROADCAST", "SMART", "RUNNING", "SIMPLEX", "MULTICAST"], "mtu": 1500, "ipv4_addr": "192.168.1.72", "ipv4_mask": "255.255.255.0", "ipv4_bcast": "192.168.1.255", "ipv6_addr": "fe80::8b7:1281:7499:b504", "ipv6_mask": 64, "ipv6_scope": "0x8", "mac_addr": "f0:18:98:03:d9:30", "type": null, "metric": null, "rx_packets": null, "rx_errors": null, "rx_dropped": null, "rx_overruns": null, "rx_frame": null, "tx_packets": null, "tx_errors": null, "tx_dropped": null, "tx_overruns": null, "tx_carrier": null, "tx_collisions": null, "rx_bytes": null, "tx_bytes": null}, {"name": "p2p0", "flags": 8843, "state": ["UP", "BROADCAST", "RUNNING", "SIMPLEX", "MULTICAST"], "mtu": 2304, "mac_addr": "02:18:98:03:f8:49", "type": null, "ipv4_addr": null, "ipv4_bcast": null, "ipv4_mask": null, "ipv6_addr": null, "ipv6_mask": null, "ipv6_scope": null, "metric": null, "rx_packets": null, "rx_errors": null, "rx_dropped": null, "rx_overruns": null, "rx_frame": null, "tx_packets": null, "tx_errors": null, "tx_dropped": null, "tx_overruns": null, "tx_carrier": null, "tx_collisions": null, "rx_bytes": null, "tx_bytes": null}, {"name": "awdl0", "flags": 8943, "state": ["UP", "BROADCAST", "RUNNING", "PROMISC", "SIMPLEX", "MULTICAST"], "mtu": 1484, "ipv6_addr": "fe80::1c06:52ff:feda:9b86", "ipv6_mask": 64, "ipv6_scope": "0xa", "mac_addr": "1e:06:52:da:9b:86", "type": null, "ipv4_addr": null, "ipv4_bcast": null, "ipv4_mask": null, "metric": null, "rx_packets": null, "rx_errors": null, "rx_dropped": null, "rx_overruns": null, "rx_frame": null, "tx_packets": null, "tx_errors": null, "tx_dropped": null, "tx_overruns": null, "tx_carrier": null, "tx_collisions": null, "rx_bytes": null, "tx_bytes": null}, {"name": "en1", "flags": 8963, "state": ["UP", "BROADCAST", "SMART", "RUNNING", "PROMISC", "SIMPLEX", "MULTICAST"], "mtu": 1500, "mac_addr": "02:00:31:81:83:05", "type": null, "ipv4_addr": null, "ipv4_bcast": null, "ipv4_mask": null, "ipv6_addr": null, "ipv6_mask": null, "ipv6_scope": null, "metric": null, "rx_packets": null, "rx_errors": null, "rx_dropped": null, "rx_overruns": null, "rx_frame": null, "tx_packets": null, "tx_errors": null, "tx_dropped": null, "tx_overruns": null, "tx_carrier": null, "tx_collisions": null, "rx_bytes": null, "tx_bytes": null}, {"name": "en2", "flags": 8963, "state": ["UP", "BROADCAST", "SMART", "RUNNING", "PROMISC", "SIMPLEX", "MULTICAST"], "mtu": 1500, "mac_addr": "02:00:31:81:94:10", "type": null, "ipv4_addr": null, "ipv4_bcast": null, "ipv4_mask": null, "ipv6_addr": null, "ipv6_mask": null, "ipv6_scope": null, "metric": null, "rx_packets": null, "rx_errors": null, "rx_dropped": null, "rx_overruns": null, "rx_frame": null, "tx_packets": null, "tx_errors": null, "tx_dropped": null, "tx_overruns": null, "tx_carrier": null, "tx_collisions": null, "rx_bytes": null, "tx_bytes": null}, {"name": "en3", "flags": 8963, "state": ["UP", "BROADCAST", "SMART", "RUNNING", "PROMISC", "SIMPLEX", "MULTICAST"], "mtu": 1500, "mac_addr": "02:00:31:81:94:06", "type": null, "ipv4_addr": null, "ipv4_bcast": null, "ipv4_mask": null, "ipv6_addr": null, "ipv6_mask": null, "ipv6_scope": null, "metric": null, "rx_packets": null, "rx_errors": null, "rx_dropped": null, "rx_overruns": null, "rx_frame": null, "tx_packets": null, "tx_errors": null, "tx_dropped": null, "tx_overruns": null, "tx_carrier": null, "tx_collisions": null, "rx_bytes": null, "tx_bytes": null}, {"name": "en4", "flags": 8963, "state": ["UP", "BROADCAST", "SMART", "RUNNING", "PROMISC", "SIMPLEX", "MULTICAST"], "mtu": 1500, "mac_addr": "02:00:31:81:94:05", "type": null, "ipv4_addr": null, "ipv4_bcast": null, "ipv4_mask": null, "ipv6_addr": null, "ipv6_mask": null, "ipv6_scope": null, "metric": null, "rx_packets": null, "rx_errors": null, "rx_dropped": null, "rx_overruns": null, "rx_frame": null, "tx_packets": null, "tx_errors": null, "tx_dropped": null, "tx_overruns": null, "tx_carrier": null, "tx_collisions": null, "rx_bytes": null, "tx_bytes": null}, {"name": "bridge0", "flags": 8863, "state": ["UP", "BROADCAST", "SMART", "RUNNING", "SIMPLEX", "MULTICAST"], "mtu": 1500, "mac_addr": "02:00:31:81:94:02", "type": null, "ipv4_addr": null, "ipv4_bcast": null, "ipv4_mask": null, "ipv6_addr": null, "ipv6_mask": null, "ipv6_scope": null, "metric": null, "rx_packets": null, "rx_errors": null, "rx_dropped": null, "rx_overruns": null, "rx_frame": null, "tx_packets": null, "tx_errors": null, "tx_dropped": null, "tx_overruns": null, "tx_carrier": null, "tx_collisions": null, "rx_bytes": null, "tx_bytes": null}, {"name": "utun0", "flags": 8051, "state": ["UP", "POINTOPOINT", "RUNNING", "MULTICAST"], "mtu": 2000, "ipv6_addr": "fe80::cec:23d0:8cf7:c88e", "ipv6_mask": 64, "ipv6_scope": "0x10", "type": null, "mac_addr": null, "ipv4_addr": null, "ipv4_bcast": null, "ipv4_mask": null, "metric": null, "rx_packets": null, "rx_errors": null, "rx_dropped": null, "rx_overruns": null, "rx_frame": null, "tx_packets": null, "tx_errors": null, "tx_dropped": null, "tx_overruns": null, "tx_carrier": null, "tx_collisions": null, "rx_bytes": null, "tx_bytes": null}, {"name": "utun1", "flags": 8051, "state": ["UP", "POINTOPOINT", "RUNNING", "MULTICAST"], "mtu": 1380, "ipv6_addr": "fe80::cf42:647e:9077:7bcb", "ipv6_mask": 64, "ipv6_scope": "0x11", "type": null, "mac_addr": null, "ipv4_addr": null, "ipv4_bcast": null, "ipv4_mask": null, "metric": null, "rx_packets": null, "rx_errors": null, "rx_dropped": null, "rx_overruns": null, "rx_frame": null, "tx_packets": null, "tx_errors": null, "tx_dropped": null, "tx_overruns": null, "tx_carrier": null, "tx_collisions": null, "rx_bytes": null, "tx_bytes": null}, {"name": "utun2", "flags": 8051, "state": ["UP", "POINTOPOINT", "RUNNING", "MULTICAST"], "mtu": 1380, "ipv6_addr": "fe80::f67f:be47:695a:f5b1", "ipv6_mask": 64, "ipv6_scope": "0x12", "type": null, "mac_addr": null, "ipv4_addr": null, "ipv4_bcast": null, "ipv4_mask": null, "metric": null, "rx_packets": null, "rx_errors": null, "rx_dropped": null, "rx_overruns": null, "rx_frame": null, "tx_packets": null, "tx_errors": null, "tx_dropped": null, "tx_overruns": null, "tx_carrier": null, "tx_collisions": null, "rx_bytes": null, "tx_bytes": null}, {"name": "utun3", "flags": 8051, "state": ["UP", "POINTOPOINT", "RUNNING", "MULTICAST"], "mtu": 1380, "ipv6_addr": "fe80::2998:653d:a6da:9ca5", "ipv6_mask": 64, "ipv6_scope": "0x13", "type": null, "mac_addr": null, "ipv4_addr": null, "ipv4_bcast": null, "ipv4_mask": null, "metric": null, "rx_packets": null, "rx_errors": null, "rx_dropped": null, "rx_overruns": null, "rx_frame": null, "tx_packets": null, "tx_errors": null, "tx_dropped": null, "tx_overruns": null, "tx_carrier": null, "tx_collisions": null, "rx_bytes": null, "tx_bytes": null}, {"name": "utun4", "flags": 8051, "state": ["UP", "POINTOPOINT", "RUNNING", "MULTICAST"], "mtu": 1380, "ipv6_addr": "fe80::8e0f:4631:2328:5209", "ipv6_mask": 64, "ipv6_scope": "0x14", "type": null, "mac_addr": null, "ipv4_addr": null, "ipv4_bcast": null, "ipv4_mask": null, "metric": null, "rx_packets": null, "rx_errors": null, "rx_dropped": null, "rx_overruns": null, "rx_frame": null, "tx_packets": null, "tx_errors": null, "tx_dropped": null, "tx_overruns": null, "tx_carrier": null, "tx_collisions": null, "rx_bytes": null, "tx_bytes": null}] +[{"name":"lo0","flags":8049,"state":["UP","LOOPBACK","RUNNING","MULTICAST"],"mtu":16384,"type":null,"mac_addr":null,"ipv4_addr":"127.0.0.1","ipv4_mask":"255.0.0.0","ipv4_bcast":null,"ipv6_addr":"fe80::1","ipv6_mask":64,"ipv6_scope":"0x1","ipv6_type":null,"metric":null,"rx_packets":null,"rx_errors":null,"rx_dropped":null,"rx_overruns":null,"rx_frame":null,"tx_packets":null,"tx_errors":null,"tx_dropped":null,"tx_overruns":null,"tx_carrier":null,"tx_collisions":null,"rx_bytes":null,"tx_bytes":null,"ipv4":[{"address":"127.0.0.1","mask":"255.0.0.0","broadcast":null}],"ipv6":[{"address":"fe80::1","mask":64,"scope":"0x1"}]},{"name":"gif0","flags":8010,"state":["POINTOPOINT","MULTICAST"],"mtu":1280,"type":null,"mac_addr":null,"ipv4_addr":null,"ipv4_mask":null,"ipv4_bcast":null,"ipv6_addr":null,"ipv6_mask":null,"ipv6_scope":null,"ipv6_type":null,"metric":null,"rx_packets":null,"rx_errors":null,"rx_dropped":null,"rx_overruns":null,"rx_frame":null,"tx_packets":null,"tx_errors":null,"tx_dropped":null,"tx_overruns":null,"tx_carrier":null,"tx_collisions":null,"rx_bytes":null,"tx_bytes":null},{"name":"stf0","flags":0,"state":null,"mtu":1280,"type":null,"mac_addr":null,"ipv4_addr":null,"ipv4_mask":null,"ipv4_bcast":null,"ipv6_addr":null,"ipv6_mask":null,"ipv6_scope":null,"ipv6_type":null,"metric":null,"rx_packets":null,"rx_errors":null,"rx_dropped":null,"rx_overruns":null,"rx_frame":null,"tx_packets":null,"tx_errors":null,"tx_dropped":null,"tx_overruns":null,"tx_carrier":null,"tx_collisions":null,"rx_bytes":null,"tx_bytes":null},{"name":"XHC1","flags":0,"state":null,"mtu":0,"type":null,"mac_addr":null,"ipv4_addr":null,"ipv4_mask":null,"ipv4_bcast":null,"ipv6_addr":null,"ipv6_mask":null,"ipv6_scope":null,"ipv6_type":null,"metric":null,"rx_packets":null,"rx_errors":null,"rx_dropped":null,"rx_overruns":null,"rx_frame":null,"tx_packets":null,"tx_errors":null,"tx_dropped":null,"tx_overruns":null,"tx_carrier":null,"tx_collisions":null,"rx_bytes":null,"tx_bytes":null},{"name":"XHC0","flags":0,"state":null,"mtu":0,"type":null,"mac_addr":null,"ipv4_addr":null,"ipv4_mask":null,"ipv4_bcast":null,"ipv6_addr":null,"ipv6_mask":null,"ipv6_scope":null,"ipv6_type":null,"metric":null,"rx_packets":null,"rx_errors":null,"rx_dropped":null,"rx_overruns":null,"rx_frame":null,"tx_packets":null,"tx_errors":null,"tx_dropped":null,"tx_overruns":null,"tx_carrier":null,"tx_collisions":null,"rx_bytes":null,"tx_bytes":null},{"name":"XHC20","flags":0,"state":null,"mtu":0,"type":null,"mac_addr":null,"ipv4_addr":null,"ipv4_mask":null,"ipv4_bcast":null,"ipv6_addr":null,"ipv6_mask":null,"ipv6_scope":null,"ipv6_type":null,"metric":null,"rx_packets":null,"rx_errors":null,"rx_dropped":null,"rx_overruns":null,"rx_frame":null,"tx_packets":null,"tx_errors":null,"tx_dropped":null,"tx_overruns":null,"tx_carrier":null,"tx_collisions":null,"rx_bytes":null,"tx_bytes":null},{"name":"en5","flags":8863,"state":["UP","BROADCAST","SMART","RUNNING","SIMPLEX","MULTICAST"],"mtu":1500,"type":null,"mac_addr":"ac:de:48:00:13:23","ipv4_addr":null,"ipv4_mask":null,"ipv4_bcast":null,"ipv6_addr":"fe80::aede:48ff:fe00:1323","ipv6_mask":64,"ipv6_scope":"0x7","ipv6_type":null,"metric":null,"rx_packets":null,"rx_errors":null,"rx_dropped":null,"rx_overruns":null,"rx_frame":null,"tx_packets":null,"tx_errors":null,"tx_dropped":null,"tx_overruns":null,"tx_carrier":null,"tx_collisions":null,"rx_bytes":null,"tx_bytes":null,"ipv6":[{"address":"fe80::aede:48ff:fe00:1323","mask":64,"scope":"0x7"}]},{"name":"en0","flags":8863,"state":["UP","BROADCAST","SMART","RUNNING","SIMPLEX","MULTICAST"],"mtu":1500,"type":null,"mac_addr":"f0:18:98:03:d9:30","ipv4_addr":"192.168.1.72","ipv4_mask":"255.255.255.0","ipv4_bcast":"192.168.1.255","ipv6_addr":"fe80::8b7:1281:7499:b504","ipv6_mask":64,"ipv6_scope":"0x8","ipv6_type":null,"metric":null,"rx_packets":null,"rx_errors":null,"rx_dropped":null,"rx_overruns":null,"rx_frame":null,"tx_packets":null,"tx_errors":null,"tx_dropped":null,"tx_overruns":null,"tx_carrier":null,"tx_collisions":null,"rx_bytes":null,"tx_bytes":null,"ipv4":[{"address":"192.168.1.72","mask":"255.255.255.0","broadcast":"192.168.1.255"}],"ipv6":[{"address":"fe80::8b7:1281:7499:b504","mask":64,"scope":"0x8"}]},{"name":"p2p0","flags":8843,"state":["UP","BROADCAST","RUNNING","SIMPLEX","MULTICAST"],"mtu":2304,"type":null,"mac_addr":"02:18:98:03:f8:49","ipv4_addr":null,"ipv4_mask":null,"ipv4_bcast":null,"ipv6_addr":null,"ipv6_mask":null,"ipv6_scope":null,"ipv6_type":null,"metric":null,"rx_packets":null,"rx_errors":null,"rx_dropped":null,"rx_overruns":null,"rx_frame":null,"tx_packets":null,"tx_errors":null,"tx_dropped":null,"tx_overruns":null,"tx_carrier":null,"tx_collisions":null,"rx_bytes":null,"tx_bytes":null},{"name":"awdl0","flags":8943,"state":["UP","BROADCAST","RUNNING","PROMISC","SIMPLEX","MULTICAST"],"mtu":1484,"type":null,"mac_addr":"1e:06:52:da:9b:86","ipv4_addr":null,"ipv4_mask":null,"ipv4_bcast":null,"ipv6_addr":"fe80::1c06:52ff:feda:9b86","ipv6_mask":64,"ipv6_scope":"0xa","ipv6_type":null,"metric":null,"rx_packets":null,"rx_errors":null,"rx_dropped":null,"rx_overruns":null,"rx_frame":null,"tx_packets":null,"tx_errors":null,"tx_dropped":null,"tx_overruns":null,"tx_carrier":null,"tx_collisions":null,"rx_bytes":null,"tx_bytes":null,"ipv6":[{"address":"fe80::1c06:52ff:feda:9b86","mask":64,"scope":"0xa"}]},{"name":"en1","flags":8963,"state":["UP","BROADCAST","SMART","RUNNING","PROMISC","SIMPLEX","MULTICAST"],"mtu":1500,"type":null,"mac_addr":"02:00:31:81:83:05","ipv4_addr":null,"ipv4_mask":null,"ipv4_bcast":null,"ipv6_addr":null,"ipv6_mask":null,"ipv6_scope":null,"ipv6_type":null,"metric":null,"rx_packets":null,"rx_errors":null,"rx_dropped":null,"rx_overruns":null,"rx_frame":null,"tx_packets":null,"tx_errors":null,"tx_dropped":null,"tx_overruns":null,"tx_carrier":null,"tx_collisions":null,"rx_bytes":null,"tx_bytes":null},{"name":"en2","flags":8963,"state":["UP","BROADCAST","SMART","RUNNING","PROMISC","SIMPLEX","MULTICAST"],"mtu":1500,"type":null,"mac_addr":"02:00:31:81:94:10","ipv4_addr":null,"ipv4_mask":null,"ipv4_bcast":null,"ipv6_addr":null,"ipv6_mask":null,"ipv6_scope":null,"ipv6_type":null,"metric":null,"rx_packets":null,"rx_errors":null,"rx_dropped":null,"rx_overruns":null,"rx_frame":null,"tx_packets":null,"tx_errors":null,"tx_dropped":null,"tx_overruns":null,"tx_carrier":null,"tx_collisions":null,"rx_bytes":null,"tx_bytes":null},{"name":"en3","flags":8963,"state":["UP","BROADCAST","SMART","RUNNING","PROMISC","SIMPLEX","MULTICAST"],"mtu":1500,"type":null,"mac_addr":"02:00:31:81:94:06","ipv4_addr":null,"ipv4_mask":null,"ipv4_bcast":null,"ipv6_addr":null,"ipv6_mask":null,"ipv6_scope":null,"ipv6_type":null,"metric":null,"rx_packets":null,"rx_errors":null,"rx_dropped":null,"rx_overruns":null,"rx_frame":null,"tx_packets":null,"tx_errors":null,"tx_dropped":null,"tx_overruns":null,"tx_carrier":null,"tx_collisions":null,"rx_bytes":null,"tx_bytes":null},{"name":"en4","flags":8963,"state":["UP","BROADCAST","SMART","RUNNING","PROMISC","SIMPLEX","MULTICAST"],"mtu":1500,"type":null,"mac_addr":"02:00:31:81:94:05","ipv4_addr":null,"ipv4_mask":null,"ipv4_bcast":null,"ipv6_addr":null,"ipv6_mask":null,"ipv6_scope":null,"ipv6_type":null,"metric":null,"rx_packets":null,"rx_errors":null,"rx_dropped":null,"rx_overruns":null,"rx_frame":null,"tx_packets":null,"tx_errors":null,"tx_dropped":null,"tx_overruns":null,"tx_carrier":null,"tx_collisions":null,"rx_bytes":null,"tx_bytes":null},{"name":"bridge0","flags":8863,"state":["UP","BROADCAST","SMART","RUNNING","SIMPLEX","MULTICAST"],"mtu":1500,"type":null,"mac_addr":"02:00:31:81:94:02","ipv4_addr":null,"ipv4_mask":null,"ipv4_bcast":null,"ipv6_addr":null,"ipv6_mask":null,"ipv6_scope":null,"ipv6_type":null,"metric":null,"rx_packets":null,"rx_errors":null,"rx_dropped":null,"rx_overruns":null,"rx_frame":null,"tx_packets":null,"tx_errors":null,"tx_dropped":null,"tx_overruns":null,"tx_carrier":null,"tx_collisions":null,"rx_bytes":null,"tx_bytes":null},{"name":"utun0","flags":8051,"state":["UP","POINTOPOINT","RUNNING","MULTICAST"],"mtu":2000,"type":null,"mac_addr":null,"ipv4_addr":null,"ipv4_mask":null,"ipv4_bcast":null,"ipv6_addr":"fe80::cec:23d0:8cf7:c88e","ipv6_mask":64,"ipv6_scope":"0x10","ipv6_type":null,"metric":null,"rx_packets":null,"rx_errors":null,"rx_dropped":null,"rx_overruns":null,"rx_frame":null,"tx_packets":null,"tx_errors":null,"tx_dropped":null,"tx_overruns":null,"tx_carrier":null,"tx_collisions":null,"rx_bytes":null,"tx_bytes":null,"ipv6":[{"address":"fe80::cec:23d0:8cf7:c88e","mask":64,"scope":"0x10"}]},{"name":"utun1","flags":8051,"state":["UP","POINTOPOINT","RUNNING","MULTICAST"],"mtu":1380,"type":null,"mac_addr":null,"ipv4_addr":null,"ipv4_mask":null,"ipv4_bcast":null,"ipv6_addr":"fe80::cf42:647e:9077:7bcb","ipv6_mask":64,"ipv6_scope":"0x11","ipv6_type":null,"metric":null,"rx_packets":null,"rx_errors":null,"rx_dropped":null,"rx_overruns":null,"rx_frame":null,"tx_packets":null,"tx_errors":null,"tx_dropped":null,"tx_overruns":null,"tx_carrier":null,"tx_collisions":null,"rx_bytes":null,"tx_bytes":null,"ipv6":[{"address":"fe80::cf42:647e:9077:7bcb","mask":64,"scope":"0x11"}]},{"name":"utun2","flags":8051,"state":["UP","POINTOPOINT","RUNNING","MULTICAST"],"mtu":1380,"type":null,"mac_addr":null,"ipv4_addr":null,"ipv4_mask":null,"ipv4_bcast":null,"ipv6_addr":"fe80::f67f:be47:695a:f5b1","ipv6_mask":64,"ipv6_scope":"0x12","ipv6_type":null,"metric":null,"rx_packets":null,"rx_errors":null,"rx_dropped":null,"rx_overruns":null,"rx_frame":null,"tx_packets":null,"tx_errors":null,"tx_dropped":null,"tx_overruns":null,"tx_carrier":null,"tx_collisions":null,"rx_bytes":null,"tx_bytes":null,"ipv6":[{"address":"fe80::f67f:be47:695a:f5b1","mask":64,"scope":"0x12"}]},{"name":"utun3","flags":8051,"state":["UP","POINTOPOINT","RUNNING","MULTICAST"],"mtu":1380,"type":null,"mac_addr":null,"ipv4_addr":null,"ipv4_mask":null,"ipv4_bcast":null,"ipv6_addr":"fe80::2998:653d:a6da:9ca5","ipv6_mask":64,"ipv6_scope":"0x13","ipv6_type":null,"metric":null,"rx_packets":null,"rx_errors":null,"rx_dropped":null,"rx_overruns":null,"rx_frame":null,"tx_packets":null,"tx_errors":null,"tx_dropped":null,"tx_overruns":null,"tx_carrier":null,"tx_collisions":null,"rx_bytes":null,"tx_bytes":null,"ipv6":[{"address":"fe80::2998:653d:a6da:9ca5","mask":64,"scope":"0x13"}]},{"name":"utun4","flags":8051,"state":["UP","POINTOPOINT","RUNNING","MULTICAST"],"mtu":1380,"type":null,"mac_addr":null,"ipv4_addr":null,"ipv4_mask":null,"ipv4_bcast":null,"ipv6_addr":"fe80::8e0f:4631:2328:5209","ipv6_mask":64,"ipv6_scope":"0x14","ipv6_type":null,"metric":null,"rx_packets":null,"rx_errors":null,"rx_dropped":null,"rx_overruns":null,"rx_frame":null,"tx_packets":null,"tx_errors":null,"tx_dropped":null,"tx_overruns":null,"tx_carrier":null,"tx_collisions":null,"rx_bytes":null,"tx_bytes":null,"ipv6":[{"address":"fe80::8e0f:4631:2328:5209","mask":64,"scope":"0x14"}]}] diff --git a/tests/fixtures/osx-10.14.6/ifconfig2.json b/tests/fixtures/osx-10.14.6/ifconfig2.json index fc81cc41..49d255d8 100644 --- a/tests/fixtures/osx-10.14.6/ifconfig2.json +++ b/tests/fixtures/osx-10.14.6/ifconfig2.json @@ -1 +1 @@ -[{"name": "lo0", "flags": 8049, "state": ["UP", "LOOPBACK", "RUNNING", "MULTICAST"], "mtu": 16384, "ipv4_addr": "127.0.0.1", "ipv4_mask": "255.0.0.0", "ipv4_bcast": null, "ipv6_addr": "fe80::1", "ipv6_mask": 64, "ipv6_scope": "0x1", "type": null, "mac_addr": null, "metric": null, "rx_packets": null, "rx_errors": null, "rx_dropped": null, "rx_overruns": null, "rx_frame": null, "tx_packets": null, "tx_errors": null, "tx_dropped": null, "tx_overruns": null, "tx_carrier": null, "tx_collisions": null, "rx_bytes": null, "tx_bytes": null}, {"name": "gif0", "flags": 8010, "state": ["POINTOPOINT", "MULTICAST"], "mtu": 1280, "type": null, "mac_addr": null, "ipv4_addr": null, "ipv4_bcast": null, "ipv4_mask": null, "ipv6_addr": null, "ipv6_mask": null, "ipv6_scope": null, "metric": null, "rx_packets": null, "rx_errors": null, "rx_dropped": null, "rx_overruns": null, "rx_frame": null, "tx_packets": null, "tx_errors": null, "tx_dropped": null, "tx_overruns": null, "tx_carrier": null, "tx_collisions": null, "rx_bytes": null, "tx_bytes": null}, {"name": "stf0", "flags": 0, "state": null, "mtu": 1280, "type": null, "mac_addr": null, "ipv4_addr": null, "ipv4_bcast": null, "ipv4_mask": null, "ipv6_addr": null, "ipv6_mask": null, "ipv6_scope": null, "metric": null, "rx_packets": null, "rx_errors": null, "rx_dropped": null, "rx_overruns": null, "rx_frame": null, "tx_packets": null, "tx_errors": null, "tx_dropped": null, "tx_overruns": null, "tx_carrier": null, "tx_collisions": null, "rx_bytes": null, "tx_bytes": null}, {"name": "XHC0", "flags": 0, "state": null, "mtu": 0, "type": null, "mac_addr": null, "ipv4_addr": null, "ipv4_bcast": null, "ipv4_mask": null, "ipv6_addr": null, "ipv6_mask": null, "ipv6_scope": null, "metric": null, "rx_packets": null, "rx_errors": null, "rx_dropped": null, "rx_overruns": null, "rx_frame": null, "tx_packets": null, "tx_errors": null, "tx_dropped": null, "tx_overruns": null, "tx_carrier": null, "tx_collisions": null, "rx_bytes": null, "tx_bytes": null}, {"name": "XHC1", "flags": 0, "state": null, "mtu": 0, "type": null, "mac_addr": null, "ipv4_addr": null, "ipv4_bcast": null, "ipv4_mask": null, "ipv6_addr": null, "ipv6_mask": null, "ipv6_scope": null, "metric": null, "rx_packets": null, "rx_errors": null, "rx_dropped": null, "rx_overruns": null, "rx_frame": null, "tx_packets": null, "tx_errors": null, "tx_dropped": null, "tx_overruns": null, "tx_carrier": null, "tx_collisions": null, "rx_bytes": null, "tx_bytes": null}, {"name": "XHC20", "flags": 0, "state": null, "mtu": 0, "type": null, "mac_addr": null, "ipv4_addr": null, "ipv4_bcast": null, "ipv4_mask": null, "ipv6_addr": null, "ipv6_mask": null, "ipv6_scope": null, "metric": null, "rx_packets": null, "rx_errors": null, "rx_dropped": null, "rx_overruns": null, "rx_frame": null, "tx_packets": null, "tx_errors": null, "tx_dropped": null, "tx_overruns": null, "tx_carrier": null, "tx_collisions": null, "rx_bytes": null, "tx_bytes": null}, {"name": "VHC128", "flags": 0, "state": null, "mtu": 0, "type": null, "mac_addr": null, "ipv4_addr": null, "ipv4_bcast": null, "ipv4_mask": null, "ipv6_addr": null, "ipv6_mask": null, "ipv6_scope": null, "metric": null, "rx_packets": null, "rx_errors": null, "rx_dropped": null, "rx_overruns": null, "rx_frame": null, "tx_packets": null, "tx_errors": null, "tx_dropped": null, "tx_overruns": null, "tx_carrier": null, "tx_collisions": null, "rx_bytes": null, "tx_bytes": null}, {"name": "en5", "flags": 8863, "state": ["UP", "BROADCAST", "SMART", "RUNNING", "SIMPLEX", "MULTICAST"], "mtu": 1500, "ipv6_addr": "fe80::aede:48ff:fe00:1020", "ipv6_mask": 64, "ipv6_scope": "0x8", "mac_addr": "ac:de:48:00:10:20", "type": null, "ipv4_addr": null, "ipv4_bcast": null, "ipv4_mask": null, "metric": null, "rx_packets": null, "rx_errors": null, "rx_dropped": null, "rx_overruns": null, "rx_frame": null, "tx_packets": null, "tx_errors": null, "tx_dropped": null, "tx_overruns": null, "tx_carrier": null, "tx_collisions": null, "rx_bytes": null, "tx_bytes": null}, {"name": "ap1", "flags": 8802, "state": ["BROADCAST", "SIMPLEX", "MULTICAST"], "mtu": 1500, "mac_addr": "a6:83:e7:2d:63:8e", "type": null, "ipv4_addr": null, "ipv4_bcast": null, "ipv4_mask": null, "ipv6_addr": null, "ipv6_mask": null, "ipv6_scope": null, "metric": null, "rx_packets": null, "rx_errors": null, "rx_dropped": null, "rx_overruns": null, "rx_frame": null, "tx_packets": null, "tx_errors": null, "tx_dropped": null, "tx_overruns": null, "tx_carrier": null, "tx_collisions": null, "rx_bytes": null, "tx_bytes": null}, {"name": "en0", "flags": 8863, "state": ["UP", "BROADCAST", "SMART", "RUNNING", "SIMPLEX", "MULTICAST"], "mtu": 1500, "ipv4_addr": "192.168.1.221", "ipv4_mask": "255.255.255.0", "ipv4_bcast": "192.168.1.255", "ipv6_addr": "fe80::4dd:cbd7:2743:da63", "ipv6_mask": 64, "ipv6_scope": "0xa", "mac_addr": "a4:83:e7:2d:63:8e", "type": null, "metric": null, "rx_packets": null, "rx_errors": null, "rx_dropped": null, "rx_overruns": null, "rx_frame": null, "tx_packets": null, "tx_errors": null, "tx_dropped": null, "tx_overruns": null, "tx_carrier": null, "tx_collisions": null, "rx_bytes": null, "tx_bytes": null}, {"name": "p2p0", "flags": 8843, "state": ["UP", "BROADCAST", "RUNNING", "SIMPLEX", "MULTICAST"], "mtu": 2304, "mac_addr": "06:83:e7:2d:63:8e", "type": null, "ipv4_addr": null, "ipv4_bcast": null, "ipv4_mask": null, "ipv6_addr": null, "ipv6_mask": null, "ipv6_scope": null, "metric": null, "rx_packets": null, "rx_errors": null, "rx_dropped": null, "rx_overruns": null, "rx_frame": null, "tx_packets": null, "tx_errors": null, "tx_dropped": null, "tx_overruns": null, "tx_carrier": null, "tx_collisions": null, "rx_bytes": null, "tx_bytes": null}, {"name": "awdl0", "flags": 8943, "state": ["UP", "BROADCAST", "RUNNING", "PROMISC", "SIMPLEX", "MULTICAST"], "mtu": 1484, "ipv6_addr": "fe80::7c05:c1ff:fe24:14ca", "ipv6_mask": 64, "ipv6_scope": "0xc", "mac_addr": "7e:05:c1:24:14:ca", "type": null, "ipv4_addr": null, "ipv4_bcast": null, "ipv4_mask": null, "metric": null, "rx_packets": null, "rx_errors": null, "rx_dropped": null, "rx_overruns": null, "rx_frame": null, "tx_packets": null, "tx_errors": null, "tx_dropped": null, "tx_overruns": null, "tx_carrier": null, "tx_collisions": null, "rx_bytes": null, "tx_bytes": null}, {"name": "en1", "flags": 8963, "state": ["UP", "BROADCAST", "SMART", "RUNNING", "PROMISC", "SIMPLEX", "MULTICAST"], "mtu": 1500, "mac_addr": "ea:00:fd:08:58:02", "type": null, "ipv4_addr": null, "ipv4_bcast": null, "ipv4_mask": null, "ipv6_addr": null, "ipv6_mask": null, "ipv6_scope": null, "metric": null, "rx_packets": null, "rx_errors": null, "rx_dropped": null, "rx_overruns": null, "rx_frame": null, "tx_packets": null, "tx_errors": null, "tx_dropped": null, "tx_overruns": null, "tx_carrier": null, "tx_collisions": null, "rx_bytes": null, "tx_bytes": null}, {"name": "en2", "flags": 8963, "state": ["UP", "BROADCAST", "SMART", "RUNNING", "PROMISC", "SIMPLEX", "MULTICAST"], "mtu": 1500, "mac_addr": "ea:00:fd:08:58:01", "type": null, "ipv4_addr": null, "ipv4_bcast": null, "ipv4_mask": null, "ipv6_addr": null, "ipv6_mask": null, "ipv6_scope": null, "metric": null, "rx_packets": null, "rx_errors": null, "rx_dropped": null, "rx_overruns": null, "rx_frame": null, "tx_packets": null, "tx_errors": null, "tx_dropped": null, "tx_overruns": null, "tx_carrier": null, "tx_collisions": null, "rx_bytes": null, "tx_bytes": null}, {"name": "en3", "flags": 8963, "state": ["UP", "BROADCAST", "SMART", "RUNNING", "PROMISC", "SIMPLEX", "MULTICAST"], "mtu": 1500, "mac_addr": "ea:00:fd:08:58:06", "type": null, "ipv4_addr": null, "ipv4_bcast": null, "ipv4_mask": null, "ipv6_addr": null, "ipv6_mask": null, "ipv6_scope": null, "metric": null, "rx_packets": null, "rx_errors": null, "rx_dropped": null, "rx_overruns": null, "rx_frame": null, "tx_packets": null, "tx_errors": null, "tx_dropped": null, "tx_overruns": null, "tx_carrier": null, "tx_collisions": null, "rx_bytes": null, "tx_bytes": null}, {"name": "en4", "flags": 8963, "state": ["UP", "BROADCAST", "SMART", "RUNNING", "PROMISC", "SIMPLEX", "MULTICAST"], "mtu": 1500, "mac_addr": "ea:00:fd:08:58:05", "type": null, "ipv4_addr": null, "ipv4_bcast": null, "ipv4_mask": null, "ipv6_addr": null, "ipv6_mask": null, "ipv6_scope": null, "metric": null, "rx_packets": null, "rx_errors": null, "rx_dropped": null, "rx_overruns": null, "rx_frame": null, "tx_packets": null, "tx_errors": null, "tx_dropped": null, "tx_overruns": null, "tx_carrier": null, "tx_collisions": null, "rx_bytes": null, "tx_bytes": null}, {"name": "bridge0", "flags": 8863, "state": ["UP", "BROADCAST", "SMART", "RUNNING", "SIMPLEX", "MULTICAST"], "mtu": 1500, "mac_addr": "ea:00:fd:08:58:02", "type": null, "ipv4_addr": null, "ipv4_bcast": null, "ipv4_mask": null, "ipv6_addr": null, "ipv6_mask": null, "ipv6_scope": null, "metric": null, "rx_packets": null, "rx_errors": null, "rx_dropped": null, "rx_overruns": null, "rx_frame": null, "tx_packets": null, "tx_errors": null, "tx_dropped": null, "tx_overruns": null, "tx_carrier": null, "tx_collisions": null, "rx_bytes": null, "tx_bytes": null}, {"name": "utun0", "flags": 8051, "state": ["UP", "POINTOPOINT", "RUNNING", "MULTICAST"], "mtu": 2000, "ipv6_addr": "fe80::7b12:adc2:a089:c4d8", "ipv6_mask": 64, "ipv6_scope": "0x12", "type": null, "mac_addr": null, "ipv4_addr": null, "ipv4_bcast": null, "ipv4_mask": null, "metric": null, "rx_packets": null, "rx_errors": null, "rx_dropped": null, "rx_overruns": null, "rx_frame": null, "tx_packets": null, "tx_errors": null, "tx_dropped": null, "tx_overruns": null, "tx_carrier": null, "tx_collisions": null, "rx_bytes": null, "tx_bytes": null}, {"name": "vmnet1", "flags": 8863, "state": ["UP", "BROADCAST", "SMART", "RUNNING", "SIMPLEX", "MULTICAST"], "mtu": 1500, "ipv4_addr": "192.168.101.1", "ipv4_mask": "255.255.255.0", "ipv4_bcast": "192.168.101.255", "mac_addr": "00:50:56:c0:00:01", "type": null, "ipv6_addr": null, "ipv6_mask": null, "ipv6_scope": null, "metric": null, "rx_packets": null, "rx_errors": null, "rx_dropped": null, "rx_overruns": null, "rx_frame": null, "tx_packets": null, "tx_errors": null, "tx_dropped": null, "tx_overruns": null, "tx_carrier": null, "tx_collisions": null, "rx_bytes": null, "tx_bytes": null}, {"name": "vmnet8", "flags": 8863, "state": ["UP", "BROADCAST", "SMART", "RUNNING", "SIMPLEX", "MULTICAST"], "mtu": 1500, "ipv4_addr": "192.168.71.1", "ipv4_mask": "255.255.255.0", "ipv4_bcast": "192.168.71.255", "mac_addr": "00:50:56:c0:00:08", "type": null, "ipv6_addr": null, "ipv6_mask": null, "ipv6_scope": null, "metric": null, "rx_packets": null, "rx_errors": null, "rx_dropped": null, "rx_overruns": null, "rx_frame": null, "tx_packets": null, "tx_errors": null, "tx_dropped": null, "tx_overruns": null, "tx_carrier": null, "tx_collisions": null, "rx_bytes": null, "tx_bytes": null}, {"name": "utun1", "flags": 8051, "state": ["UP", "POINTOPOINT", "RUNNING", "MULTICAST"], "mtu": 1380, "ipv6_addr": "fe80::a08a:46aa:a738:2ea7", "ipv6_mask": 64, "ipv6_scope": "0x15", "type": null, "mac_addr": null, "ipv4_addr": null, "ipv4_bcast": null, "ipv4_mask": null, "metric": null, "rx_packets": null, "rx_errors": null, "rx_dropped": null, "rx_overruns": null, "rx_frame": null, "tx_packets": null, "tx_errors": null, "tx_dropped": null, "tx_overruns": null, "tx_carrier": null, "tx_collisions": null, "rx_bytes": null, "tx_bytes": null}] +[{"name":"lo0","flags":8049,"state":["UP","LOOPBACK","RUNNING","MULTICAST"],"mtu":16384,"type":null,"mac_addr":null,"ipv4_addr":"127.0.0.1","ipv4_mask":"255.0.0.0","ipv4_bcast":null,"ipv6_addr":"fe80::1","ipv6_mask":64,"ipv6_scope":"0x1","ipv6_type":null,"metric":null,"rx_packets":null,"rx_errors":null,"rx_dropped":null,"rx_overruns":null,"rx_frame":null,"tx_packets":null,"tx_errors":null,"tx_dropped":null,"tx_overruns":null,"tx_carrier":null,"tx_collisions":null,"rx_bytes":null,"tx_bytes":null,"ipv4":[{"address":"127.0.0.1","mask":"255.0.0.0","broadcast":null}],"ipv6":[{"address":"fe80::1","mask":64,"scope":"0x1"}]},{"name":"gif0","flags":8010,"state":["POINTOPOINT","MULTICAST"],"mtu":1280,"type":null,"mac_addr":null,"ipv4_addr":null,"ipv4_mask":null,"ipv4_bcast":null,"ipv6_addr":null,"ipv6_mask":null,"ipv6_scope":null,"ipv6_type":null,"metric":null,"rx_packets":null,"rx_errors":null,"rx_dropped":null,"rx_overruns":null,"rx_frame":null,"tx_packets":null,"tx_errors":null,"tx_dropped":null,"tx_overruns":null,"tx_carrier":null,"tx_collisions":null,"rx_bytes":null,"tx_bytes":null},{"name":"stf0","flags":0,"state":null,"mtu":1280,"type":null,"mac_addr":null,"ipv4_addr":null,"ipv4_mask":null,"ipv4_bcast":null,"ipv6_addr":null,"ipv6_mask":null,"ipv6_scope":null,"ipv6_type":null,"metric":null,"rx_packets":null,"rx_errors":null,"rx_dropped":null,"rx_overruns":null,"rx_frame":null,"tx_packets":null,"tx_errors":null,"tx_dropped":null,"tx_overruns":null,"tx_carrier":null,"tx_collisions":null,"rx_bytes":null,"tx_bytes":null},{"name":"XHC0","flags":0,"state":null,"mtu":0,"type":null,"mac_addr":null,"ipv4_addr":null,"ipv4_mask":null,"ipv4_bcast":null,"ipv6_addr":null,"ipv6_mask":null,"ipv6_scope":null,"ipv6_type":null,"metric":null,"rx_packets":null,"rx_errors":null,"rx_dropped":null,"rx_overruns":null,"rx_frame":null,"tx_packets":null,"tx_errors":null,"tx_dropped":null,"tx_overruns":null,"tx_carrier":null,"tx_collisions":null,"rx_bytes":null,"tx_bytes":null},{"name":"XHC1","flags":0,"state":null,"mtu":0,"type":null,"mac_addr":null,"ipv4_addr":null,"ipv4_mask":null,"ipv4_bcast":null,"ipv6_addr":null,"ipv6_mask":null,"ipv6_scope":null,"ipv6_type":null,"metric":null,"rx_packets":null,"rx_errors":null,"rx_dropped":null,"rx_overruns":null,"rx_frame":null,"tx_packets":null,"tx_errors":null,"tx_dropped":null,"tx_overruns":null,"tx_carrier":null,"tx_collisions":null,"rx_bytes":null,"tx_bytes":null},{"name":"XHC20","flags":0,"state":null,"mtu":0,"type":null,"mac_addr":null,"ipv4_addr":null,"ipv4_mask":null,"ipv4_bcast":null,"ipv6_addr":null,"ipv6_mask":null,"ipv6_scope":null,"ipv6_type":null,"metric":null,"rx_packets":null,"rx_errors":null,"rx_dropped":null,"rx_overruns":null,"rx_frame":null,"tx_packets":null,"tx_errors":null,"tx_dropped":null,"tx_overruns":null,"tx_carrier":null,"tx_collisions":null,"rx_bytes":null,"tx_bytes":null},{"name":"VHC128","flags":0,"state":null,"mtu":0,"type":null,"mac_addr":null,"ipv4_addr":null,"ipv4_mask":null,"ipv4_bcast":null,"ipv6_addr":null,"ipv6_mask":null,"ipv6_scope":null,"ipv6_type":null,"metric":null,"rx_packets":null,"rx_errors":null,"rx_dropped":null,"rx_overruns":null,"rx_frame":null,"tx_packets":null,"tx_errors":null,"tx_dropped":null,"tx_overruns":null,"tx_carrier":null,"tx_collisions":null,"rx_bytes":null,"tx_bytes":null},{"name":"en5","flags":8863,"state":["UP","BROADCAST","SMART","RUNNING","SIMPLEX","MULTICAST"],"mtu":1500,"type":null,"mac_addr":"ac:de:48:00:10:20","ipv4_addr":null,"ipv4_mask":null,"ipv4_bcast":null,"ipv6_addr":"fe80::aede:48ff:fe00:1020","ipv6_mask":64,"ipv6_scope":"0x8","ipv6_type":null,"metric":null,"rx_packets":null,"rx_errors":null,"rx_dropped":null,"rx_overruns":null,"rx_frame":null,"tx_packets":null,"tx_errors":null,"tx_dropped":null,"tx_overruns":null,"tx_carrier":null,"tx_collisions":null,"rx_bytes":null,"tx_bytes":null,"ipv6":[{"address":"fe80::aede:48ff:fe00:1020","mask":64,"scope":"0x8"}]},{"name":"ap1","flags":8802,"state":["BROADCAST","SIMPLEX","MULTICAST"],"mtu":1500,"type":null,"mac_addr":"a6:83:e7:2d:63:8e","ipv4_addr":null,"ipv4_mask":null,"ipv4_bcast":null,"ipv6_addr":null,"ipv6_mask":null,"ipv6_scope":null,"ipv6_type":null,"metric":null,"rx_packets":null,"rx_errors":null,"rx_dropped":null,"rx_overruns":null,"rx_frame":null,"tx_packets":null,"tx_errors":null,"tx_dropped":null,"tx_overruns":null,"tx_carrier":null,"tx_collisions":null,"rx_bytes":null,"tx_bytes":null},{"name":"en0","flags":8863,"state":["UP","BROADCAST","SMART","RUNNING","SIMPLEX","MULTICAST"],"mtu":1500,"type":null,"mac_addr":"a4:83:e7:2d:63:8e","ipv4_addr":"192.168.1.221","ipv4_mask":"255.255.255.0","ipv4_bcast":"192.168.1.255","ipv6_addr":"fe80::4dd:cbd7:2743:da63","ipv6_mask":64,"ipv6_scope":"0xa","ipv6_type":null,"metric":null,"rx_packets":null,"rx_errors":null,"rx_dropped":null,"rx_overruns":null,"rx_frame":null,"tx_packets":null,"tx_errors":null,"tx_dropped":null,"tx_overruns":null,"tx_carrier":null,"tx_collisions":null,"rx_bytes":null,"tx_bytes":null,"ipv4":[{"address":"192.168.1.221","mask":"255.255.255.0","broadcast":"192.168.1.255"}],"ipv6":[{"address":"fe80::4dd:cbd7:2743:da63","mask":64,"scope":"0xa"}]},{"name":"p2p0","flags":8843,"state":["UP","BROADCAST","RUNNING","SIMPLEX","MULTICAST"],"mtu":2304,"type":null,"mac_addr":"06:83:e7:2d:63:8e","ipv4_addr":null,"ipv4_mask":null,"ipv4_bcast":null,"ipv6_addr":null,"ipv6_mask":null,"ipv6_scope":null,"ipv6_type":null,"metric":null,"rx_packets":null,"rx_errors":null,"rx_dropped":null,"rx_overruns":null,"rx_frame":null,"tx_packets":null,"tx_errors":null,"tx_dropped":null,"tx_overruns":null,"tx_carrier":null,"tx_collisions":null,"rx_bytes":null,"tx_bytes":null},{"name":"awdl0","flags":8943,"state":["UP","BROADCAST","RUNNING","PROMISC","SIMPLEX","MULTICAST"],"mtu":1484,"type":null,"mac_addr":"7e:05:c1:24:14:ca","ipv4_addr":null,"ipv4_mask":null,"ipv4_bcast":null,"ipv6_addr":"fe80::7c05:c1ff:fe24:14ca","ipv6_mask":64,"ipv6_scope":"0xc","ipv6_type":null,"metric":null,"rx_packets":null,"rx_errors":null,"rx_dropped":null,"rx_overruns":null,"rx_frame":null,"tx_packets":null,"tx_errors":null,"tx_dropped":null,"tx_overruns":null,"tx_carrier":null,"tx_collisions":null,"rx_bytes":null,"tx_bytes":null,"ipv6":[{"address":"fe80::7c05:c1ff:fe24:14ca","mask":64,"scope":"0xc"}]},{"name":"en1","flags":8963,"state":["UP","BROADCAST","SMART","RUNNING","PROMISC","SIMPLEX","MULTICAST"],"mtu":1500,"type":null,"mac_addr":"ea:00:fd:08:58:02","ipv4_addr":null,"ipv4_mask":null,"ipv4_bcast":null,"ipv6_addr":null,"ipv6_mask":null,"ipv6_scope":null,"ipv6_type":null,"metric":null,"rx_packets":null,"rx_errors":null,"rx_dropped":null,"rx_overruns":null,"rx_frame":null,"tx_packets":null,"tx_errors":null,"tx_dropped":null,"tx_overruns":null,"tx_carrier":null,"tx_collisions":null,"rx_bytes":null,"tx_bytes":null},{"name":"en2","flags":8963,"state":["UP","BROADCAST","SMART","RUNNING","PROMISC","SIMPLEX","MULTICAST"],"mtu":1500,"type":null,"mac_addr":"ea:00:fd:08:58:01","ipv4_addr":null,"ipv4_mask":null,"ipv4_bcast":null,"ipv6_addr":null,"ipv6_mask":null,"ipv6_scope":null,"ipv6_type":null,"metric":null,"rx_packets":null,"rx_errors":null,"rx_dropped":null,"rx_overruns":null,"rx_frame":null,"tx_packets":null,"tx_errors":null,"tx_dropped":null,"tx_overruns":null,"tx_carrier":null,"tx_collisions":null,"rx_bytes":null,"tx_bytes":null},{"name":"en3","flags":8963,"state":["UP","BROADCAST","SMART","RUNNING","PROMISC","SIMPLEX","MULTICAST"],"mtu":1500,"type":null,"mac_addr":"ea:00:fd:08:58:06","ipv4_addr":null,"ipv4_mask":null,"ipv4_bcast":null,"ipv6_addr":null,"ipv6_mask":null,"ipv6_scope":null,"ipv6_type":null,"metric":null,"rx_packets":null,"rx_errors":null,"rx_dropped":null,"rx_overruns":null,"rx_frame":null,"tx_packets":null,"tx_errors":null,"tx_dropped":null,"tx_overruns":null,"tx_carrier":null,"tx_collisions":null,"rx_bytes":null,"tx_bytes":null},{"name":"en4","flags":8963,"state":["UP","BROADCAST","SMART","RUNNING","PROMISC","SIMPLEX","MULTICAST"],"mtu":1500,"type":null,"mac_addr":"ea:00:fd:08:58:05","ipv4_addr":null,"ipv4_mask":null,"ipv4_bcast":null,"ipv6_addr":null,"ipv6_mask":null,"ipv6_scope":null,"ipv6_type":null,"metric":null,"rx_packets":null,"rx_errors":null,"rx_dropped":null,"rx_overruns":null,"rx_frame":null,"tx_packets":null,"tx_errors":null,"tx_dropped":null,"tx_overruns":null,"tx_carrier":null,"tx_collisions":null,"rx_bytes":null,"tx_bytes":null},{"name":"bridge0","flags":8863,"state":["UP","BROADCAST","SMART","RUNNING","SIMPLEX","MULTICAST"],"mtu":1500,"type":null,"mac_addr":"ea:00:fd:08:58:02","ipv4_addr":null,"ipv4_mask":null,"ipv4_bcast":null,"ipv6_addr":null,"ipv6_mask":null,"ipv6_scope":null,"ipv6_type":null,"metric":null,"rx_packets":null,"rx_errors":null,"rx_dropped":null,"rx_overruns":null,"rx_frame":null,"tx_packets":null,"tx_errors":null,"tx_dropped":null,"tx_overruns":null,"tx_carrier":null,"tx_collisions":null,"rx_bytes":null,"tx_bytes":null},{"name":"utun0","flags":8051,"state":["UP","POINTOPOINT","RUNNING","MULTICAST"],"mtu":2000,"type":null,"mac_addr":null,"ipv4_addr":null,"ipv4_mask":null,"ipv4_bcast":null,"ipv6_addr":"fe80::7b12:adc2:a089:c4d8","ipv6_mask":64,"ipv6_scope":"0x12","ipv6_type":null,"metric":null,"rx_packets":null,"rx_errors":null,"rx_dropped":null,"rx_overruns":null,"rx_frame":null,"tx_packets":null,"tx_errors":null,"tx_dropped":null,"tx_overruns":null,"tx_carrier":null,"tx_collisions":null,"rx_bytes":null,"tx_bytes":null,"ipv6":[{"address":"fe80::7b12:adc2:a089:c4d8","mask":64,"scope":"0x12"}]},{"name":"vmnet1","flags":8863,"state":["UP","BROADCAST","SMART","RUNNING","SIMPLEX","MULTICAST"],"mtu":1500,"type":null,"mac_addr":"00:50:56:c0:00:01","ipv4_addr":"192.168.101.1","ipv4_mask":"255.255.255.0","ipv4_bcast":"192.168.101.255","ipv6_addr":null,"ipv6_mask":null,"ipv6_scope":null,"ipv6_type":null,"metric":null,"rx_packets":null,"rx_errors":null,"rx_dropped":null,"rx_overruns":null,"rx_frame":null,"tx_packets":null,"tx_errors":null,"tx_dropped":null,"tx_overruns":null,"tx_carrier":null,"tx_collisions":null,"rx_bytes":null,"tx_bytes":null,"ipv4":[{"address":"192.168.101.1","mask":"255.255.255.0","broadcast":"192.168.101.255"}]},{"name":"vmnet8","flags":8863,"state":["UP","BROADCAST","SMART","RUNNING","SIMPLEX","MULTICAST"],"mtu":1500,"type":null,"mac_addr":"00:50:56:c0:00:08","ipv4_addr":"192.168.71.1","ipv4_mask":"255.255.255.0","ipv4_bcast":"192.168.71.255","ipv6_addr":null,"ipv6_mask":null,"ipv6_scope":null,"ipv6_type":null,"metric":null,"rx_packets":null,"rx_errors":null,"rx_dropped":null,"rx_overruns":null,"rx_frame":null,"tx_packets":null,"tx_errors":null,"tx_dropped":null,"tx_overruns":null,"tx_carrier":null,"tx_collisions":null,"rx_bytes":null,"tx_bytes":null,"ipv4":[{"address":"192.168.71.1","mask":"255.255.255.0","broadcast":"192.168.71.255"}]},{"name":"utun1","flags":8051,"state":["UP","POINTOPOINT","RUNNING","MULTICAST"],"mtu":1380,"type":null,"mac_addr":null,"ipv4_addr":null,"ipv4_mask":null,"ipv4_bcast":null,"ipv6_addr":"fe80::a08a:46aa:a738:2ea7","ipv6_mask":64,"ipv6_scope":"0x15","ipv6_type":null,"metric":null,"rx_packets":null,"rx_errors":null,"rx_dropped":null,"rx_overruns":null,"rx_frame":null,"tx_packets":null,"tx_errors":null,"tx_dropped":null,"tx_overruns":null,"tx_carrier":null,"tx_collisions":null,"rx_bytes":null,"tx_bytes":null,"ipv6":[{"address":"fe80::a08a:46aa:a738:2ea7","mask":64,"scope":"0x15"}]}] diff --git a/tests/fixtures/ubuntu-18.04/ifconfig.json b/tests/fixtures/ubuntu-18.04/ifconfig.json index b2763575..7d9be18f 100644 --- a/tests/fixtures/ubuntu-18.04/ifconfig.json +++ b/tests/fixtures/ubuntu-18.04/ifconfig.json @@ -1 +1 @@ -[{"name": "ens33", "flags": 4163, "state": ["UP", "BROADCAST", "RUNNING", "MULTICAST"], "mtu": 1500, "ipv4_addr": "192.168.71.131", "ipv4_mask": "255.255.255.0", "ipv4_bcast": "192.168.71.255", "ipv6_addr": "fe80::20c:29ff:fe99:4517", "ipv6_mask": 64, "ipv6_scope": "0x20", "mac_addr": "00:0c:29:99:45:17", "type": "Ethernet", "rx_packets": 138830, "rx_bytes": 178583682, "rx_errors": 0, "rx_dropped": 0, "rx_overruns": 0, "rx_frame": 0, "tx_packets": 30490, "tx_bytes": 3772041, "tx_errors": 0, "tx_dropped": 0, "tx_overruns": 0, "tx_carrier": 0, "tx_collisions": 0, "metric": null}, {"name": "lo", "flags": 73, "state": ["UP", "LOOPBACK", "RUNNING"], "mtu": 65536, "ipv4_addr": "127.0.0.1", "ipv4_mask": "255.0.0.0", "ipv4_bcast": null, "ipv6_addr": "::1", "ipv6_mask": 128, "ipv6_scope": "0x10", "mac_addr": null, "type": "Local Loopback", "rx_packets": 825, "rx_bytes": 76797, "rx_errors": 0, "rx_dropped": 0, "rx_overruns": 0, "rx_frame": 0, "tx_packets": 825, "tx_bytes": 76797, "tx_errors": 0, "tx_dropped": 0, "tx_overruns": 0, "tx_carrier": 0, "tx_collisions": 0, "metric": null}] +[{"name":"ens33","flags":4163,"state":["UP","BROADCAST","RUNNING","MULTICAST"],"mtu":1500,"ipv4_addr":"192.168.71.131","ipv4_mask":"255.255.255.0","ipv4_bcast":"192.168.71.255","ipv6_addr":"fe80::20c:29ff:fe99:4517","ipv6_mask":64,"ipv6_scope":"0x20","ipv6_type":"link","mac_addr":"00:0c:29:99:45:17","type":"Ethernet","rx_packets":138830,"rx_bytes":178583682,"rx_errors":0,"rx_dropped":0,"rx_overruns":0,"rx_frame":0,"tx_packets":30490,"tx_bytes":3772041,"tx_errors":0,"tx_dropped":0,"tx_overruns":0,"tx_carrier":0,"tx_collisions":0,"metric":null,"ipv4":[{"address":"192.168.71.131","mask":"255.255.255.0","broadcast":"192.168.71.255"}],"ipv6":[{"address":"fe80::20c:29ff:fe99:4517","mask":64,"scope":"0x20","type":"link"}]},{"name":"lo","flags":73,"state":["UP","LOOPBACK","RUNNING"],"mtu":65536,"ipv4_addr":"127.0.0.1","ipv4_mask":"255.0.0.0","ipv4_bcast":null,"ipv6_addr":"::1","ipv6_mask":128,"ipv6_scope":"0x10","ipv6_type":"host","mac_addr":null,"type":"Local Loopback","rx_packets":825,"rx_bytes":76797,"rx_errors":0,"rx_dropped":0,"rx_overruns":0,"rx_frame":0,"tx_packets":825,"tx_bytes":76797,"tx_errors":0,"tx_dropped":0,"tx_overruns":0,"tx_carrier":0,"tx_collisions":0,"metric":null,"ipv4":[{"address":"127.0.0.1","mask":"255.0.0.0","broadcast":null}],"ipv6":[{"address":"::1","mask":128,"scope":"0x10","type":"host"}]}]