DHCP = 1
IP = 2
GATEWAY = 3
- NAMESERVER = 4
+ NETMASK = 4
def __init__(self, type):
- Converter.___init__(self)
+ Converter.__init__(self, type)
self.type = {
"Mac" : self.MAC,
"Dhcp" : self.DHCP,
"Ip" : self.IP,
"Gateway" : self.GATEWAY,
- "Nameserver" : self.NAMESERVER,
+ "Netmask" : self.NETMASK,
}[type]
@cached
def getText(self):
- iface = iface.interface
+ iface = self.source.interface
if self.type is self.MAC:
return iface.mac
elif self.type is self.DHCP:
return iface.dhcp
elif self.type is self.IP:
- return iface.IP
+ return iface.ip
elif self.type is self.GATEWAY:
return iface.gateway
- elif self.type is self.NAMESERVER:
- return iface.nameserver
+ elif self.type is self.NETMASK:
+ return iface.netmask
+ else:
+ return _("N/A")
text = property(getText)
\ No newline at end of file
from Components.Sources.Source import Source
from Components.Network import iNetwork
-from Components.Element import cached
+#from Components.Element import cached
class Network(Source):
self.iface = "eth0"
elif device is self.WLAN:
self.iface = "ath0"
- @cached
+
+
+ #Get Network Info
+ def ConvertIP(self, list):
+ if(len(list) == 4):
+ retstr = "%s.%s.%s.%s" %(list[0], list[1], list[2], list[3])
+ else:
+ retstr = "0.0.0.0"
+ return retstr
+# @cached
def getInterface(self):
self.mac = iNetwork.getAdapterAttribute(self.iface, "mac")
self.dhcp = iNetwork.getAdapterAttribute(self.iface, "dhcp")
- self.ip = ConvertIP(iNetwork.getAdapterAttribute(self.iface, "ip"))
- self.netmask = ConvertIP(iNetwork.getAdapterAttribute(self.iface, "netmask"))
- self.gateway = ConvertIP(iNetwork.getAdapterAttribute(self.iface, "gateway"))
+ self.ip = self.ConvertIP(iNetwork.getAdapterAttribute(self.iface, "ip"))
+ self.netmask = self.ConvertIP(iNetwork.getAdapterAttribute(self.iface, "netmask"))
+ self.gateway = self.ConvertIP(iNetwork.getAdapterAttribute(self.iface, "gateway"))
+
+ return self
interface = property(getInterface)