def netconf(self): """ Prints the network configuration as saved in the config file """ logging.debugv("menu/status.py->netconf(self)", []) infs = f.ifListAll() report = t.formatTitle("Main network configuration") try: self.c.validNetConf() except excepts.ConfigException, e: e = str(e) e = e.strip('"') report += t.formatLog("Valid network config", False, 1) report += " %s\n" % str(e)
def interfaces(self): """ Prints information about the actual network interfaces """ logging.debugv("menu/status.py->interfaces(self)", []) infList = f.ifListAll() report = t.formatTitle("Network interfaces") for (inf) in infList: status = f.infStatus(inf) if status == 0: statustxt = "Non-existant" elif status == 1: statustxt = "Down" elif status == 2: statustxt = "Up" elif status == 3: statustxt = "Up, configured" report += t.formatLog("Interface", inf) report += t.formatLog(" Status", statustxt) if status != 0: try: mac = f.getMac(inf) except excepts.InterfaceException: mac = "false" report += t.formatLog(" MAC", mac) if status == 3: ip = f.getIp(inf) nm = f.getNm(inf) bc = t.broadcast(ip, nm) gw = f.getGw(inf) if ip: report += t.formatLog(" Address", ip) if nm: report += t.formatLog(" Netmask", nm) if bc: report += t.formatLog(" Broadcast", bc) if gw: report += t.formatLog(" Gateway", gw) if status != 0: active_flags = f.getIfFlags(inf) report += t.formatLog(" Flags", active_flags) report += "\n" return self.d.msgbox(report, width=100, height=40, no_collapse=1, colors=1)