Reviewed-by: Crístian Viana <vianac(a)linux.vnet.ibm.com>
On 04-11-2014 11:25, Daniel Henrique Barboza wrote:
'Link_detected' returns 'yes' if the network card is
attached
to a cable (or other media), 'no' if it's disconnected and
'n/a' if the link state can't be determined (if the network
interface is down).
This is an information that might be useful for some
plug-ins - Ginger, for instance - to present to the user.
Example of the updated netinfo.get_interface_info call:
$ sudo PYTHONPATH=src python
Python 2.7.5 (default, Sep 25 2014, 13:52:19)
[GCC 4.8.3 20140624 (Red Hat 4.8.3-1)] on linux2
Type "help", "copyright", "credits" or "license"
for more information.
>>> from kimchi import netinfo
>>> netinfo.get_interface_info('em1')
{'status': 'active', 'name': 'em1', 'ipaddr':
'', 'netmask': '', 'link_detected': 'no',
'type': 'nic'}
---- with em1 interface down -----
>>> netinfo.get_interface_info('em1')
{'status': 'inactive', 'name': 'em1', 'ipaddr':
'', 'netmask': '', 'link_detected': 'n/a',
'type': 'nic'}
Daniel Henrique Barboza (1):
netinfo.py: adding 'link_detected' to get_interface_info
src/kimchi/netinfo.py | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)