def app_log(): filename = Settings.get('logging')['app']['filename'] return Log(filename=filename)
for o, v in opts: if o == '-h': usage() sys.exit(0) if o == '-l': level = int(v) if o == '-p': pop = v if o == '-D': debug = debug + 1 options = ["details"] Attributes.pop = pop Attributes.options = options log = Log.Log(level) import conf conffile = "/import/bta4/v2/etc/bta4.conf" conf.loadconf(conffile) mf = ParseMakefile.ParseMakefile(conf=conf) for rtr in mf.rtrdict.keys(): mtr = mf.getRouterMeter(rtr=rtr) #print "%s = %s" % (rtr, mtr) cfg = RtrConfigParser(dir=RTRCFGDIR, attrs=Attributes) # Routers in the flowrules makefile for r in mf.rtrdict.keys(): found = 0
elif a.dbcustomer == b.dbcustomer: if a.dblink_id > b.dblink_id: return 1 elif a.dblink_id < b.dblink_id: return -1 return 0 if __name__ == "__main__": options = [] options.append("routes") options.append("interfaces") log = Log.Log(3) Attributes.log = log Attributes.options = options Attributes.debug = 4 targets = RtrCfg.RtrCfg("conf/") custs = NetCustomers(routers=targets.routers, attrs=Attributes) clist = custs.dbinterfaces clist.sort(custs.mycmpfunc) for iface in clist: print iface for route in custs.dbroutes: print route