def search_btsinfo(searchid): from getdata import get_data_by_sql bts_group_list = [] if searchid.isdigit(): btsid = searchid field, result = get_data_by_sql('select * from btstable where btsid={};'.format(btsid)) bts_info_list = [] bts_info = {} if result == []: return [], [] bts_info['btsid'] = result[0].btsid bts_info['btsip'] = result[0].btsip bts_info['powerstatus'] = result[0].powerstatus bts_info['lock'] = result[0].lock bts_info['group'] = result[0].group bts_info['version'] = result[0].version bts_info['powerstatus'] = result[0].powerstatus bts_info['status'] = result[0].status bts_info['hwtype'] = result[0].hwtype bts_info_list.append(bts_info) if result[0].group not in bts_group_list: bts_group_list.append(result[0].group) return bts_info_list, bts_group_list else: group = searchid.upper() field, result = get_data_by_sql('select * from btstable where `group`="{}";'.format(group)) bts_info_list = [] bts_group_list = [] if result == []: return [], [] for line in result: bts_info = {} bts_info['btsid'] = line.btsid bts_info['btsip'] = line.btsip bts_info['powerstatus'] = line.powerstatus bts_info['lock'] = line.lock bts_info['group'] = line.group bts_info['version'] = line.version bts_info['powerstatus'] = line.powerstatus bts_info['status'] = line.status bts_info['hwtype'] = line.hwtype bts_info_list.append(bts_info) if line.group not in bts_group_list: bts_group_list.append(line.group) return bts_info_list, bts_group_list
def search_joblist(btsid): from getdata import get_data_by_sql field, result = get_data_by_sql('select `joblist` from btstable where btsid={};'.format(btsid)) if result == []: return "" else: if result[0].joblist == 'NULL': return "" jobstr = result[0].joblist return jobstr
def load_config(btsid): print('Log config for {}'.format(btsid)) from getdata import get_data_by_sql field, result = get_data_by_sql('select * from btstable where btsid={};'.format(btsid)) bts = [x for x in result if x.btsid == btsid][0] # if bts: # self._config = bts[0] # for attr in [x for x in dir(self._config) if not x.startswith('_')]: # setattr(self, attr, getattr(self._config, attr)) bts.bts_id = bts.btsid bts.bts_ip = bts.btsip bts.workcell = 1 bts.is5g = 0 # bts.airscale = True if bts.airscale == '1' else False # bts.sran = bts.airscale == '1' bts.bts_fcm_ip = '192.168.255.1' bts.bts_fcm_username = '******' bts.bts_fcm_password = '******' bts.bts_ftm_ip = '192.168.255.129' bts.bts_ftm_username = '******' bts.bts_ftm_password = '******' bts.mr_paging_ioc, bts.mr_paging_impair_ioc = '140', '84' bts.mr_call_drop_ioc, bts.mr_call_drop_impair_ioc = '140', '84' bts.mr_ho_ioc, bts.mr_ho_impair_ioc = '140', '89' bts.mr_volte_ioc, bts.mr_volte_impair_ioc = '140', '84' bts.conn_bts = None bts.ftmctrl = None bts.config_id = '' bts.cell_count = 0 bts.used = True bts.infomodel_pid = [] bts.new_earfcn_list = [] bts.new_eutraCarrierInfo_list = [] # bts.pcap_interface = (r'\Device\NPF_' + # bts.pcap_interface.upper().split('NPF_')[-1]) bts.scf_filename = '' bts.infomodel = None bts.ute_admin = None bts.error_log_list = [] bts.monitor_error_log = False bts.btslog_buffer = [] bts.pm_counter_path = '/tmp' if bts.sran else '/ram' bts.scf_change_is_differ = True bts.btsmode = 'S' bts.cpc = None bts.btslogger = None bts.infomodel = None bts.admin_api = None bts.ftmctrl = None bts.fct_cpu_manager = None bts.fct_memory_manager = None bts.tti = None bts.bts_control_pc_lab = "" bts.api_version = 2 return bts
def update_testline(request): print('update testline info...') from getdata import get_data_by_sql # btsid = str(request.POST['btsid']) # field, result = get_data_by_sql('select * from testlinetopo where btsid="{}";'.format(btsid)) testlineid = str(request.POST['testlineid']) field, result = get_data_by_sql('select * from testlinetopo where testlineid="{}";'.format(testlineid)) if result == []: return insert_testline(request) else: return edit_testline(request)
def check_btsid(btsid): from getdata import get_data_by_sql field, result = get_data_by_sql('select * from btstable where btsid={};'.format(btsid)) bts_info_list = [] for bts in result: bts_info = {} bts_info['btsid'] = bts.btsid bts_info['btsip'] = bts.btsip bts_info['sran'] = bts.sran bts_info['pbinfo'] = bts.pbinfo bts_info['powerstatus'] = bts.powerstatus bts_info['version'] = bts.version bts_info['status'] = bts.status bts_info['group'] = bts.group bts_info['hwtype'] = bts.hwtype bts_info_list.append(bts_info) return bts_info_list
def get_btsinfo(): from getdata import get_data_by_sql field, result = get_data_by_sql('select * from btstable;') bts_info_list = [] bts_group_list = [] for bts in result: bts_info = {} bts_info['btsid'] = bts.btsid bts_info['btsip'] = bts.btsip bts_info['lock'] = bts.lock bts_info['powerstatus'] = bts.powerstatus bts_info['group'] = bts.group bts_info['version'] = bts.version bts_info['status'] = bts.status bts_info['hwtype'] = bts.hwtype if bts.group not in bts_group_list: bts_group_list.append(bts.group) bts_info_list.append(bts_info) return bts_info_list, bts_group_list
def get_testline(): from getdata import get_data_by_sql field, result = get_data_by_sql( 'select * from testlinetopo order by testlineid;') testline_info_list = [] for info in result: testline_info = {} testline_info[ 'testlineid'] = info.testlineid if info.testlineid else "" testline_info['entity'] = info.entity if info.entity else "" testline_info['btsid'] = info.btsid if info.btsid else "" testline_info['flag'] = info.flag if info.flag else "" testline_info['btss1ip'] = info.btss1ip if info.btss1ip else "" testline_info['btspc'] = info.btspc if info.btspc else "" testline_info[ 'pbinfo'] = info.pbinfo if info.pbinfo or info.pbinfo != 'None' else "" testline_info[ 'painfo'] = info.painfo if info.painfo or info.painfo != 'None' else "" testline_info[ 'papc'] = info.papc if info.papc or info.papc != 'None' else " " testline_info[ 'uetype'] = info.uetype if info.uetype or info.uetype != 'None' else "" testline_info[ 'uelist'] = info.uelist if info.uelist or info.uelist != 'None' else "" testline_info[ 'uepc'] = info.uepc if info.uepc or info.uepc != 'None' else "" testline_info[ 'mcsinfo'] = info.mcsinfo if info.mcsinfo or info.mcsinfo != 'None' else "" testline_info[ 'mcspc'] = info.mcspc if info.mcspc or info.mcspc != 'None' else "" # testline_info['hwinfo'] = info.hwinfo if info.hwinfo or info.hwinfo != 'None' else "" testline_info[ 'hwinfo'] = info.hw_info if info.hw_info != '' else info.hwinfo testline_info[ 'owner'] = info.owner if info.owner or info.owner != 'None' else "" testline_info[ 'version'] = info.version if info.version or info.version != 'None' else "" testline_info_list.append(testline_info) return testline_info_list
def search_testline2(searchid): from getdata import get_data_by_sql print('search testline {}'.format(searchid)) if searchid.isdigit(): testlineid = searchid field, result = get_data_by_sql( 'select * from testlinetopo where testlineid={};'.format( testlineid)) testline_info_list = [] if result == []: return [] for info in result: testline_info = {} testline_info['testlineid'] = info.testlineid testline_info['btsid'] = info.btsid testline_info['entity'] = info.entity testline_info['flag'] = info.flag testline_info['btss1ip'] = info.btss1ip testline_info['btspc'] = info.btspc testline_info['pbinfo'] = info.pbinfo testline_info['painfo'] = info.painfo testline_info['papc'] = info.papc testline_info['uetype'] = info.uetype testline_info['uelist'] = info.uelist testline_info['uepc'] = info.uepc testline_info['mcsinfo'] = info.mcsinfo testline_info['mcspc'] = info.mcspc # testline_info['hwinfo'] = info.hwinfo testline_info[ 'hwinfo'] = info.hw_info if info.hw_info != '' else info.hwinfo testline_info['owner'] = info.owner testline_info['version'] = info.version if "other:" in info.uetype: testline_info['other_uetype'] = info.uetype.split(":")[1] else: testline_info['other_uetype'] = "" testline_info_list.append(testline_info) return testline_info_list
def get_lock(btsid): from getdata import get_data_by_sql field, result = get_data_by_sql('select `lock` from btstable where btsid={};'.format(btsid)) return result[0].lock
def get_pbinfo(btsid): from getdata import get_data_by_sql field, result = get_data_by_sql('select pbinfo from btstable where btsid={};'.format(btsid)) return result[0].pbinfo