def get(self): """Allowed networks""" networks=[] netInterfaces=self.Get("os_net_interfaces") for i in netInterfaces: ipaddr, mask = ip.getIp(i),ip.cidrToMask(ip.getMask(i)) if ipaddr and mask: networks.append(ip.getIpNet(ipaddr, mask)) else: networks.append("") return ",".join(filter(lambda x:x,networks))
def convertCidrToMask(x): if x and x.isdigit() and int(x) in range(0,33): return cidrToMask(int(x)) else: return x
def get(self): return map(lambda x:cidrToMask(getMask(x)), self.Get('os_install_net_interfaces'))