Endian banner

endian.system package

Submodules

endian.system.bridge module

class Bridges(load=True)

Bases: UserDict.UserDict

This class represents a “brctl show” holding all necessary information of that output easily accessible with python

the class is a dict with bridge names as keys and the following data-structure as value:

{
    'device': None,
    'id': '',
    'stp': False,
    'ports': ['', ''],
}

'device':   devicename, example: br0'
'id':       bridge id, example: '0000.80c6ca001000'
'stp':      is True if the spanning tree protocol is enabled
'ports':    a list of interfaces which are bridge members.
            Example: ['lan2.40', 'eth0']

The class contains also a field ‘nicmap’ which maps network interfaces to the bridge having it as member.

Parameters:load (bool) – if False data will not be loaded. This is needed for testing
diff(data2)

compare bridge configuration supplied by ‘data2’ with current configuration. Returns a dict of the following structure:

{
    'remove': { 'brX': [''] },
    'add': { 'brY': [''] },
    'create': { 'brZ': [''] },
}

The three dicts describe what has to be done in current configuration in order to have the situation of ‘data2’: ‘remove’ interfaces to be removed from a certain bridge. ‘add’ interfaces to be added to a certain bridge. ‘create’ bridge to be created with interfaces as its members.

All three dict entries contain dictionaries with bridge names as key and a list of interface names as value.

‘data2’ is of the following structure:

{
    'brX': {
               'device': 'brX',
               'ports': ['', '', ...],
           },
    ...
}
Parameters:data2 (a dict containing bridge setups.) – the bridge setup used to compare with current setup.
load()

endian.system.nic module

class Nic

Bases: UserDict.UserDict

This class represents an “ip addr show” holding all necessary information of that output easily accessible with python

the class is a dict with nic names as keys and the following data-structure as value:

{
    'device': None,
    'inet': [CIDR, CIDR],
    'inet6': ['', ''],
    'remoteIp': None,
    'mac': None,
    'mtu': None,
    'flags': None,
    'state': None,
    'isPPP': False,
}

'device':   devicename
'inet':     CIDR list of ip/bit pairs held by the device
'inet6':    string list of ipv6 addresses held by the device
'mac':      mac address of the device if it is an ethernet device
'mtu':      the mtu value of the device
'flags':    string represented flags of the device. example: 
            '<BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP>'
'state':    state of the device: UNKNOWN, UP, LOWERLAYERDOWN, etc
'isPPP':    True if the device is a point-to-point device
'remoteIP': holds remote ip in case of a ppp device

The class contains also a field ‘ipmap’ which maps ip-addresses to the device items which are holding that ip-address

load()

endian.system.proc module

getMountpoints(deviceRE=None, mountpointRE=None, fstypeRE=None)

Return a list of tuples (fs_spec, fs_file, fs_vfstype, fs_mntops, fs_freq, fs_passno) for every mounted filesystem. If one or more of deviceRE, mountpointRE or fstypeRE strings are specified, they are used to filter only the matching devices.

endian.system.wtmp module

class Wtmp(filename='/var/log/wtmp')

Bases: UserList.UserList

Parse the wtmp file

last()

Returns the content of the wtmp file in a format similar to the last command