log DEBUG "Device '${device}' does not equal port '${port}'."
exit ${EXIT_ERROR}
}
-
-function _status() {
- local port=${1}
- shift
-
- assert isset port
-
- echo "${port}"
-
- local status=$(device_get_status ${port})
- printf "${DEVICE_PRINT_LINE1}" "Status:" "$(echo -ne ${STATUS_COLOUR[${status}]}${STATUS_TEXT[${status}]}${COLOUR_NORMAL})"
-
- cli_headline " Ethernet information:"
- printf "${DEVICE_PRINT_LINE1}" "Address:" $(device_get_address ${port})
- printf "${DEVICE_PRINT_LINE1}" "MTU:" $(device_get_mtu ${port})
- printf "${DEVICE_PRINT_LINE1}" "Promisc mode:" $(device_is_promisc ${port} && echo "yes" || echo "no")
-
- if device_is_bonded ${port}; then
- cli_headline " Bonding information:"
-
- local master=$(bonding_slave_get_master ${port})
- printf "${DEVICE_PRINT_LINE1}" "Master:" "${master}"
-
- local active
- if [ "$(bonding_get_active_slave ${master})" = "${port}" ]; then
- active="yes"
- else
- active="no"
- fi
- printf "${DEVICE_PRINT_LINE1}" "Active slave:" "${active}"
- fi
-
- cli_headline " Statistics:"
- printf "${DEVICE_PRINT_LINE1}" "Received:" \
- "$(beautify_bytes $(device_get_rx_bytes ${port})) ($(device_get_rx_packets ${port}) packets)"
- printf "${DEVICE_PRINT_LINE1}" "Sent:" \
- "$(beautify_bytes $(device_get_tx_bytes ${port})) ($(device_get_tx_packets ${port}) packets)"
-
- echo
-
- exit ${EXIT_OK}
-}