コード例 #1
0
mrNames=['RSRP','Tadv','PowerHeadRoom','SinrUL','TadvRsrp']
db = MongoClient('mongodb://*****:*****@10.17.165.106')['ouyh']
for mrName in mrNames:
    try:
        if db['mrs_'+mrName+'_'+date_dir].index_information().get('CellId_1')==None:
            db['mrs_'+mrName+'_'+date_dir].create_index([("CellId", pymongo.ASCENDING)],background=True)
    except:
        print('The colletion is initialized')

for root, dirs_no, files in os.walk('/home/wireless/huawei_mrs/'+date_dir):
    currrent_dir=os.path.join(root, '')
    for name in files:
        if not name.endswith('0000.xml.gz'):
            continue
        print(name)
        try:
            gFile=gzip.GzipFile(currrent_dir + name, 'r')
            root = etree.fromstring(gFile.read())
        except:
            print('Unzip failed. Continue to unzip other files')
            continue
        for item in root.iterchildren():
            if item.tag == 'fileHeader':
                startTime= item.attrib['startTime']
            elif item.tag == 'eNB':
                eNodebId=item.attrib['id']
                reader=MrsReader(mrNames,startTime,date_dir,db,eNodebId)
                for item_measurement in item.iterchildren():
                    reader.read(item_measurement)
        print('insert from ', currrent_dir + name)
        os.remove(currrent_dir + name)
コード例 #2
0
mrNames=['RSRP','Tadv','PowerHeadRoom','SinrUL','TadvRsrp']
db = MongoClient('mongodb://*****:*****@10.17.165.106')['ouyh']
for mrName in mrNames:
    try:
        if db['mrs_'+mrName+'_'+date_dir].index_information().get('CellId_1')==None:
            db['mrs_'+mrName+'_'+date_dir].create_index([("CellId", pymongo.ASCENDING)],background=True)
    except:
        print('The colletion is initialized')

for root, dirs_no, files in os.walk('/home/wireless/zte_mrs/'+date_dir):
    currrent_dir=os.path.join(root, '')
    for name in files:
        if not name.endswith('3000.zip'):
            continue
        print(name)
        try:
            zFile=zipfile.ZipFile(currrent_dir + name, 'r')
            root = etree.fromstring(zFile.read(zFile.namelist()[0]))
        except:
            print('Unzip failed. Continue to unzip other files')
            continue
        for item in root.iterchildren():
            if item.tag == 'fileHeader':
                startTime= item.attrib['startTime']
            elif item.tag == 'eNB':
                reader=MrsReader(mrNames,startTime,date_dir,db, 0)
                item_id = item.attrib.get('MR.eNBId')
                for item_measurement in item.iterchildren():
                    reader.read_zte(item_measurement, item_id)
        print('insert from ', currrent_dir + name)
        os.remove(currrent_dir + name)
コード例 #3
0
for root, dirs_no, files in os.walk('/home/wireless/zte_mrs/' + date_dir):
    currrent_dir = os.path.join(root, '')
    for name in files:
        if not name.endswith(sys.argv[1] + '00.zip'):
            continue
        print(name)
        if name in DFList:
            pass
        try:
            zFile = zipfile.ZipFile(currrent_dir + name, 'r')
            root = etree.fromstring(zFile.read(zFile.namelist()[0]))
        except:
            print('Unzip failed. Continue to unzip other files')
            continue
        for item in root.iterchildren():
            if item.tag == 'fileHeader':
                startTime = item.attrib['startTime']
            elif item.tag == 'eNB':
                reader = MrsReader(mrNames, startTime, date_dir, db, 0)
                item_id = item.attrib.get('MR.eNBId')
                for item_measurement in item.iterchildren():
                    reader.read_zte(item_measurement, item_id)
        print('insert from ', currrent_dir + name)
        DFList.append(name)
        db['Mrs_DFlist_' + date_dir].insert({'dfName': name})
        try:
            os.remove(currrent_dir + name)
        except:
            print('Unable to delete this file: ' + name)
コード例 #4
0
              date_dir].index_information().get('CellId_1') == None:
            db['mrs_' + mrName + '_' + date_dir].create_index(
                [("CellId", pymongo.ASCENDING)], background=True)
    except:
        print('The colletion is initialized')

for root, dirs_no, files in os.walk('/home/wireless/huawei_mrs/' + date_dir):
    currrent_dir = os.path.join(root, '')
    for name in files:
        if not name.endswith(sys.argv[1] + '00.xml.gz'):
            continue
        print(name)
        try:
            gFile = gzip.GzipFile(currrent_dir + name, 'r')
            root = etree.fromstring(gFile.read())
        except:
            print('Unzip failed. Continue to unzip other files')
            continue
        for item in root.iterchildren():
            if item.tag == 'fileHeader':
                startTime = item.attrib['startTime']
            elif item.tag == 'eNB':
                eNodebId = item.attrib['id']
                reader = MrsReader(mrNames, startTime, date_dir, db, eNodebId)
                for item_measurement in item.iterchildren():
                    reader.read(item_measurement)
        print('insert from ', currrent_dir + name)
        try:
            os.remove(currrent_dir + name)
        except:
            print('Unable to delete this file: ' + name)