Skip to content

some fields are not extracting properly #8

@harishcr

Description

@harishcr

I tried to use your script to get ifconfig and I am seeing problem with few fields are not extracting properly, please see below sample test results. Please let me know if I am missing anything, thanks.

harish@xbs3 (master):tests$ cat mytest_ifcfg_parser.py
import pprint
import commands
from ifparser import Ifcfg

ifdata = Ifcfg(commands.getoutput('/sbin/ifconfig -a'))

eth2 = ifdata.get_interface('eth2')
pprint.pprint(eth2.get_values())

harish@xbs3 (master):tests$ python mytest_ifcfg_parser.py
{u'BROADCAST': True,
u'DYNAMIC': False,
u'LOOPBACK': False,
u'MASTER': False,
u'MULTICAST': True,
u'NOARP': False,
u'POINTOPOINT': False,
u'PROMISC': False,
u'RUNNING': True,
u'SIMPLEX': False,
u'SMART': False,
u'UP': True,
u'bcast': None,
u'hwaddr': 'b4:96:91:02:e3:c4',
u'interface': 'eth2',
u'ip': None,
u'itype': None,
u'mask': None,
u'mtu': '1500',
u'rxbytes': None,
u'rxdroppedpkts': None,

u'rxerrors': None,
u'rxframe': None,
u'rxoverruns': None,
u'rxpkts': None,
u'txbytes': None,

u'txpkts': '41276367'}
harish@xbs3 (master):tests$ /sbin/ifconfig eth2

eth2: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
ether b4:96:91:02:e3:c4 txqueuelen 1000 (Ethernet)
RX packets 120189236 bytes 64423737706 (59.9 GiB)
RX errors 0 dropped 636408 overruns 0 frame 0
TX packets 41276427 bytes 16461100298 (15.3 GiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions