def __init__(self, swname, portInfo): print portInfo self.sw_serial = swname # portInfo.pop('name') self.portInfo = portInfo self.cfg = self.getCfg() self.cmdList = self.getCmdList() print portInfo.values() self.ip = portInfo['ip'] self.online_port_list = [] self.name = swname self.rdb = fleta_dbms.FletaDb() # self.portInfo.pop('name') self.password = portInfo['password'] self.username = portInfo['username'] self.fileName = os.path.join('data', '%s_%s.tmp' % ( self.name, self.ip, )) self.com = common.Common() self.net_connect = ConnectHandler(**self.portInfo) self.portinfolist = [] self.portlist = [] self.r = self.redis() self.now = datetime.datetime.now() self.store_time = self.now.strftime('%Y-%m-%d %H:%M:%S') self.lhour = ''
def __init__(self): self.serial = '' # r=redis.Redis(host='121.170.193.222', port=6379) self.r = self.getRedis() # redis_db.lpush('test','1,2,3,4,5') self.now = datetime.datetime.now().strftime('%Y-%m-%d %H') self.hour = self.now[-1:-2] self.rangemin = '' self.portnumList = None self.rdb = fleta_dbms.FletaDb() self.pdb = fleta_dbms.FpimDb() self.todaty = datetime.datetime.now().strftime('%Y%m%d')
def __init__(self): self.serial = '' # r=redis.Redis(host='121.170.193.222', port=6379) self.r = redis.StrictRedis(host="121.170.193.222", port=6379, db=0, password='******') # redis_db.lpush('test','1,2,3,4,5') self.now = datetime.datetime.now().strftime('%Y-%m-%d %H') self.hour = self.now[-1:-2] self.rangemin = '' self.portnumList = None self.rdb = fleta_dbms.FletaDb() self.pdb = fleta_dbms.FpimDb()
def __init__(self,swname,portInfo,store_time): # print portInfo self.sw_serial=swname self.store_time=store_time print "Brocade serial :",self.sw_serial self.event_time=datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') # portInfo.pop('name') self.portInfo=portInfo self.cfg=self.getCfg() self.cmdList=self.getCmdList() # print portInfo.values() self.ip = portInfo['ip'] self.online_port_list=[] self.name = swname self.rdb=fleta_dbms.FletaDb() # self.portInfo.pop('name') if 'targetList' in self.portInfo.keys(): self.targetList=self.portInfo['targetList'] self.portInfo.pop('targetList') else: self.targetList={'log_bit':False,'crc_bit':False,'sfp_bit':False,'througput_bit':False} self.password=portInfo['password'] self.username=portInfo['username'] self.fileName=os.path.join('data','%s_%s.tmp'%(self.name,self.ip,)) self.com=common.Common() self.net_connect = ConnectHandler(**self.portInfo) self.portinfolist=[] self.portlist=[] self.r=self.redis() self.now=datetime.datetime.now() self.lhour='' self.portValue={} self.slot_bit = False
def __init__(self): self.rdb=fleta_dbms.FletaDb() self.pdb=fleta_dbms.FpimDb self.yd=self.getYd() self.tbname=self.get_table()
def __init__(self): self.swlist = self.getList() self.rdb = fleta_dbms.FletaDb() self.cfg = self.getCfg()
def getListDb(): cfg = ConfigParser.RawConfigParser() cfgFile = os.path.join('config', 'config.cfg') # print cfgFile,os.path.isfile(cfgFile) cfg.read(cfgFile) cj_center = cfg.get('swi_center', 'cj') if ',' in cj_center: cj_list = [] for cj in cj_center.split(','): cj_list.append(cj) str = "','".join(cj_list) print str query_string = """ SELECT swi_serial, device_type, create_ip, user_name, pass_word, port, secret, verboses, event_log, crc, sfp, throughput FROM ref.ref_code_monitor_san_info; """ rdb = fleta_dbms.FletaDb() print 'query :', query_string rows = rdb.getRaw(query_string) swList = [] for row in rows: log_bit = False crc_bit = True sfp_bit = True throughput_bit = True log_str = row[8] crc_str = row[9] sfp_str = row[10] thr_str = row[11] bitDic = {} if log_str == 'O': log_bit = True else: log_bit = False if crc_str == 'O': crc_bit = True else: crc_bit = False if sfp_str == 'O': sfp_bit = True else: sfp_bit = False if thr_str == 'O': throughput_bit = True else: throughput_bit = False # print row bitDic['log_bit'] = log_bit bitDic['crc_bit'] = crc_bit bitDic['sfp_bit'] = sfp_bit bitDic['throughput_bit'] = throughput_bit sw = {} sw['name'] = row[0] sw['ip'] = row[2] sw['username'] = row[3] sw['password'] = row[4] sw['device_type'] = row[1] sw['secret'] = False sw['verbose'] = False sw['targetList'] = bitDic # print sw if sw['ip'] <> None: pat = re.compile("^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$") isip = pat.match(sw['ip']) if isip: swList.append(sw) return swList
def __init__(self): self.swlist=self.getList() self.rdb=fleta_dbms.FletaDb() self.cfg=self.getCfg() self.store_time=datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
def set_check_date(check_date,status,serial): qeury_string="UPDATE ref.ref_code_monitor_san_info SET perm_check_date='{}' , perm_collect_stat='{}' WHERE swi_serial='{}'".format(check_date,status,serial) rdb=fleta_dbms.FletaDb() rdb.queryExec(qeury_string)
def __init__(self): self.rdb = fleta_dbms.FletaDb()