nrvr.util.networkinterface
index
/usr/lib/python2.7/site-packages/nrvr/util/networkinterface.py

nrvr.util.networkinterface - Utilities regarding network interfaces
 
Classes provided by this module include
NetworkInterface
NetworkConfigurationStaticParameters
 
Works in Linux and Mac OS X.
 
Idea and first implementation - Leo Baschy <srguiwiz12 AT nrvr DOT com>
 
Public repository - https://github.com/srguiwiz/nrvr-commander
 
Copyright (c) Nirvana Research 2006-2015.
Simplified BSD License

 
Modules
       
math
re

 
Classes
       
__builtin__.object
NetworkInterface
NetworkConfigurationStaticParameters(__builtin__.tuple)
NetworkConfigurationStaticParameters

 
class NetworkConfigurationStaticParameters(NetworkConfigurationStaticParameters)
    Static IP options for network configuration.
 
As implemented only supports IPv4.
 
 
Method resolution order:
NetworkConfigurationStaticParameters
NetworkConfigurationStaticParameters
__builtin__.tuple
__builtin__.object

Class methods defined here:
normalizeStaticIp(self, ipaddress, netmask='255.255.255.0', gateway=None, nameservers=None) from __builtin__.type
Normalize static IP options for network configuration.
 
As implemented only supports IPv4.
 
ipaddress
    IP address.
 
netmask
    netmask.
    Defaults to 255.255.255.0.
 
gateway
    gateway.
    If None then default to ip.1.
 
nameservers
    one nameserver or a list of nameservers.
    If None then default to gateway.
    If empty list then remove option.
 
return
    a NetworkConfigurationStaticParameters instance.

Data descriptors defined here:
localprefix
routingprefixlength
Return an integer.

Methods inherited from NetworkConfigurationStaticParameters:
__getnewargs__(self)
Return self as a plain tuple.  Used by copy and pickle.
__repr__(self)
Return a nicely formatted representation string
_asdict(self)
Return a new OrderedDict which maps field names to their values
_replace(_self, **kwds)
Return a new NetworkConfigurationStaticParameters object replacing specified fields with new values

Class methods inherited from NetworkConfigurationStaticParameters:
_make(cls, iterable, new=<built-in method __new__ of type object>, len=<built-in function len>) from __builtin__.type
Make a new NetworkConfigurationStaticParameters object from a sequence or iterable

Static methods inherited from NetworkConfigurationStaticParameters:
__new__(_cls, ipaddress, netmask, gateway, nameservers)
Create new instance of NetworkConfigurationStaticParameters(ipaddress, netmask, gateway, nameservers)

Data descriptors inherited from NetworkConfigurationStaticParameters:
gateway
Alias for field number 2
ipaddress
Alias for field number 0
nameservers
Alias for field number 3
netmask
Alias for field number 1

Data and other attributes inherited from NetworkConfigurationStaticParameters:
_fields = ('ipaddress', 'netmask', 'gateway', 'nameservers')

Methods inherited from __builtin__.tuple:
__add__(...)
x.__add__(y) <==> x+y
__contains__(...)
x.__contains__(y) <==> y in x
__eq__(...)
x.__eq__(y) <==> x==y
__ge__(...)
x.__ge__(y) <==> x>=y
__getattribute__(...)
x.__getattribute__('name') <==> x.name
__getitem__(...)
x.__getitem__(y) <==> x[y]
__getslice__(...)
x.__getslice__(i, j) <==> x[i:j]
 
Use of negative indices is not supported.
__gt__(...)
x.__gt__(y) <==> x>y
__hash__(...)
x.__hash__() <==> hash(x)
__iter__(...)
x.__iter__() <==> iter(x)
__le__(...)
x.__le__(y) <==> x<=y
__len__(...)
x.__len__() <==> len(x)
__lt__(...)
x.__lt__(y) <==> x<y
__mul__(...)
x.__mul__(n) <==> x*n
__ne__(...)
x.__ne__(y) <==> x!=y
__rmul__(...)
x.__rmul__(n) <==> n*x
__sizeof__(...)
T.__sizeof__() -- size of T in memory, in bytes
count(...)
T.count(value) -> integer -- return number of occurrences of value
index(...)
T.index(value, [start, [stop]]) -> integer -- return first index of value.
Raises ValueError if the value is not present.

 
class NetworkInterface(__builtin__.object)
    Utilities regarding network interfaces.
 
As implemented only supports IPv4.
 
  Class methods defined here:
commandsUsedInImplementation(cls) from __builtin__.type
Return a list to be passed to SystemRequirements.commandsRequired().
 
This class can be passed to SystemRequirements.commandsRequiredByImplementations().
ipAddressOf(cls, networkInterfaceName) from __builtin__.type
For networkInterfaceName="lo" return "127.0.0.1".
 
networkInterfaceName
    the name of the interface.
 
Return the IP address of the interface, or None.

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)