1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-07-15 01:24:29 +02:00

new ifconfig parser with additional fields. tests passing

This commit is contained in:
Kelly Brazil
2022-11-06 12:04:34 -08:00
parent a6b56519a2
commit 0144863d33
8 changed files with 124 additions and 76 deletions

View File

@ -27,48 +27,65 @@ Schema:
[ [
{ {
"name": string, "name": string,
"type": string, "type": string,
"metric": integer "metric": integer
"flags": integer, "flags": integer,
"state": [ "state": [
string string
], ],
"mtu": integer, "mtu": integer,
"mac_addr": string, "mac_addr": string,
"ipv4_addr": string, # [0] "ipv4_addr": string, # [0]
"ipv4_mask": string, # [0] "ipv4_mask": string, # [0]
"ipv4_bcast": string, # [0] "ipv4_bcast": string, # [0]
"ipv6_addr": string, # [0] "ipv6_addr": string, # [0]
"ipv6_mask": integer, # [0] "ipv6_mask": integer, # [0]
"ipv6_scope": string, # [0] "ipv6_scope": string, # [0]
"ipv6_type": string, # [0] "ipv6_type": string, # [0]
"rx_packets": integer, "rx_packets": integer,
"rx_bytes": integer, "rx_bytes": integer,
"rx_errors": integer, "rx_errors": integer,
"rx_dropped": integer, "rx_dropped": integer,
"rx_overruns": integer, "rx_overruns": integer,
"rx_frame": integer, "rx_frame": integer,
"tx_packets": integer, "tx_packets": integer,
"tx_bytes": integer, "tx_bytes": integer,
"tx_errors": integer, "tx_errors": integer,
"tx_dropped": integer, "tx_dropped": integer,
"tx_overruns": integer, "tx_overruns": integer,
"tx_carrier": integer, "tx_carrier": integer,
"tx_collisions": integer, "tx_collisions": integer,
"status": string,
"hw_address": string,
"media": string,
"media_flags": [
string
],
"nd6_options": integer,
"nd6_flags": [
string
],
"plugged": string,
"vendor": string,
"vendor_pn": string,
"vendor_sn": string,
"vendor_date": string,
"module_temperature": string,
"module_voltage": string
"ipv4": [ "ipv4": [
{ {
"address": string, "address": string,
"mask": string, "mask": string,
"broadcast": string "broadcast": string
} }
], ],
"ipv6: [ "ipv6: [
{ {
"address": string, "address": string,
"mask": integer, "mask": integer,
"scope": string, "scope": string,
"type": string "type": string
} }
] ]
} }

View File

@ -22,49 +22,65 @@ Schema:
[ [
{ {
"name": string, "name": string,
"type": string, "type": string,
"metric": integer "metric": integer
"flags": integer, "flags": integer,
"state": [ "state": [
string string
], ],
"mtu": integer, "mtu": integer,
"mac_addr": string, "mac_addr": string,
"ipv4_addr": string, # [0] "ipv4_addr": string, # [0]
"ipv4_mask": string, # [0] "ipv4_mask": string, # [0]
"ipv4_bcast": string, # [0] "ipv4_bcast": string, # [0]
"ipv6_addr": string, # [0] "ipv6_addr": string, # [0]
"ipv6_mask": integer, # [0] "ipv6_mask": integer, # [0]
"ipv6_scope": string, # [0] "ipv6_scope": string, # [0]
"ipv6_type": string, # [0] "ipv6_type": string, # [0]
"rx_packets": integer, "rx_packets": integer,
"rx_bytes": integer, "rx_bytes": integer,
"rx_errors": integer, "rx_errors": integer,
"rx_dropped": integer, "rx_dropped": integer,
"rx_overruns": integer, "rx_overruns": integer,
"rx_frame": integer, "rx_frame": integer,
"tx_packets": integer, "tx_packets": integer,
"tx_bytes": integer, "tx_bytes": integer,
"tx_errors": integer, "tx_errors": integer,
"tx_dropped": integer, "tx_dropped": integer,
"tx_overruns": integer, "tx_overruns": integer,
"tx_carrier": integer, "tx_carrier": integer,
"tx_collisions": integer, "tx_collisions": integer,
"status": string, "status": string,
"hw_address": string,
"media": string,
"media_flags": [
string
],
"nd6_options": integer,
"nd6_flags": [
string
],
"plugged": string,
"vendor": string,
"vendor_pn": string,
"vendor_sn": string,
"vendor_date": string,
"module_temperature": string,
"module_voltage": string
"ipv4": [ "ipv4": [
{ {
"address": string, "address": string,
"mask": string, "mask": string,
"broadcast": string "broadcast": string
} }
], ],
"ipv6: [ "ipv6: [
{ {
"address": string, "address": string,
"mask": integer, "mask": integer,
"scope": string, "scope": string,
"type": string "type": string
} }
] ]
} }
@ -212,7 +228,7 @@ def _process(proc_data: List[JSONDictType]) -> List[JSONDictType]:
int_list = { int_list = {
'flags', 'mtu', 'ipv6_mask', 'rx_packets', 'rx_bytes', 'rx_errors', 'rx_dropped', 'flags', 'mtu', 'ipv6_mask', 'rx_packets', 'rx_bytes', 'rx_errors', 'rx_dropped',
'rx_overruns', 'rx_frame', 'tx_packets', 'tx_bytes', 'tx_errors', 'tx_dropped', 'rx_overruns', 'rx_frame', 'tx_packets', 'tx_bytes', 'tx_errors', 'tx_dropped',
'tx_overruns', 'tx_carrier', 'tx_collisions', 'metric' 'tx_overruns', 'tx_carrier', 'tx_collisions', 'metric', 'nd6_options'
} }
for entry in proc_data: for entry in proc_data:
@ -258,6 +274,13 @@ def _process(proc_data: List[JSONDictType]) -> List[JSONDictType]:
if 'mask' in ip_address: if 'mask' in ip_address:
ip_address['mask'] = jc.utils.convert_to_int(ip_address['mask']) # type: ignore ip_address['mask'] = jc.utils.convert_to_int(ip_address['mask']) # type: ignore
# final conversions
if entry.get('media_flags', None):
entry['media_flags'] = entry['media_flags'].split(',')
if entry.get('nd6_flags', None):
entry['nd6_flags'] = entry['nd6_flags'].split(',')
return proc_data return proc_data
@ -521,6 +544,11 @@ def parse(
voltage:\s(?P<module_voltage>.+) voltage:\s(?P<module_voltage>.+)
''', re.IGNORECASE | re.VERBOSE ''', re.IGNORECASE | re.VERBOSE
) )
# RX: 0.52 mW (-2.82 dBm) TX: 0.00 mW (-40.00 dBm)
re_freebsd_tx_rx_power = re.compile(r'''
RX:\s+(?P<rx_power>.+)\s+TX:\s(?P<tx_pwer>.+)
''', re.IGNORECASE | re.VERBOSE
)
re_linux = [ re_linux = [
re_linux_interface, re_linux_ipv4, re_linux_ipv6, re_linux_state, re_linux_rx, re_linux_tx, re_linux_interface, re_linux_ipv4, re_linux_ipv6, re_linux_state, re_linux_rx, re_linux_tx,
@ -533,7 +561,7 @@ def parse(
re_freebsd = [ re_freebsd = [
re_freebsd_interface, re_freebsd_ipv4, re_freebsd_ipv6, re_freebsd_details, re_freebsd_status, re_freebsd_interface, re_freebsd_ipv4, re_freebsd_ipv6, re_freebsd_details, re_freebsd_status,
re_freebsd_nd6_options, re_freebsd_plugged, re_freebsd_vendor_pn_sn_date, re_freebsd_temp_volts, re_freebsd_nd6_options, re_freebsd_plugged, re_freebsd_vendor_pn_sn_date, re_freebsd_temp_volts,
re_freebsd_hwaddr, re_freebsd_media re_freebsd_hwaddr, re_freebsd_media, re_freebsd_tx_rx_power
] ]
interface_patterns = [re_linux_interface, re_openbsd_interface, re_freebsd_interface] interface_patterns = [re_linux_interface, re_openbsd_interface, re_freebsd_interface]

View File

@ -1,4 +1,4 @@
.TH jc 1 2022-11-05 1.22.2 "JSON Convert" .TH jc 1 2022-11-06 1.22.2 "JSON Convert"
.SH NAME .SH NAME
\fBjc\fP \- JSON Convert JSONifies the output of many CLI tools, file-types, and strings \fBjc\fP \- JSON Convert JSONifies the output of many CLI tools, file-types, and strings
.SH SYNOPSIS .SH SYNOPSIS

View File

@ -1 +1 @@
[{"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}] [{"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,"nd6_options":1,"nd6_flags":["PERFORMNUD"],"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,"nd6_options":1,"nd6_flags":["PERFORMNUD"],"status":"active","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,"media":"autoselect","media_flags":["full-duplex"],"status":"inactive"},{"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,"status":"inactive"},{"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,"nd6_options":1,"nd6_flags":["PERFORMNUD"],"status":"inactive"}]

View File

@ -1 +1 @@
[{"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}] [{"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,"nd6_options":1,"nd6_flags":["PERFORMNUD"],"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,"nd6_options":1,"nd6_flags":["PERFORMNUD"],"status":"active","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,"media":"autoselect","media_flags":["full-duplex"],"status":"inactive"},{"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,"status":"inactive"},{"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,"nd6_options":1,"nd6_flags":["PERFORMNUD"],"status":"inactive"}]

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -100,5 +100,8 @@ class MyTests(unittest.TestCase):
def test_ifconfig_freebsd_extra_fields2(self): def test_ifconfig_freebsd_extra_fields2(self):
pass pass
def test_ifconfig_freebsd_extra_fields3(self):
pass
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()