mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-03 12:18:00 +00:00
creation of lfdata.py, import of lfdata.py
Signed-off-by: Dipti <dipti.dhond@candelatech.com>
This commit is contained in:
@@ -605,7 +605,7 @@ class LFCliBase:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
#================ Pandas Dataframe Functions ======================================
|
#================ Pandas Dataframe Functions ======================================
|
||||||
|
import datatable as dt
|
||||||
#takes any dataframe and returns the specified file extension of it
|
#takes any dataframe and returns the specified file extension of it
|
||||||
def df_to_file(self, output_f=None,dataframe=None, save_path=None):
|
def df_to_file(self, output_f=None,dataframe=None, save_path=None):
|
||||||
if output_f.lower() == 'hdf':
|
if output_f.lower() == 'hdf':
|
||||||
@@ -629,6 +629,7 @@ class LFCliBase:
|
|||||||
dataframe.to_html(save_path.replace('csv','html',1))
|
dataframe.to_html(save_path.replace('csv','html',1))
|
||||||
|
|
||||||
#takes any format of a file and returns a dataframe of it
|
#takes any format of a file and returns a dataframe of it
|
||||||
|
#here, use datables fread
|
||||||
def file_to_df(self,file_name):
|
def file_to_df(self,file_name):
|
||||||
if file_name.split('.')[-1] == 'csv':
|
if file_name.split('.')[-1] == 'csv':
|
||||||
return pd.read_csv(file_name)
|
return pd.read_csv(file_name)
|
||||||
|
|||||||
39
py-json/lfdata.py
Normal file
39
py-json/lfdata.py
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
import re
|
||||||
|
import time
|
||||||
|
import pprint
|
||||||
|
from pprint import pprint
|
||||||
|
from LANforge import LFRequest
|
||||||
|
from LANforge import LFUtils
|
||||||
|
from LANforge import lfcli_base
|
||||||
|
from LANforge.lfcli_base import LFCliBase
|
||||||
|
from LANforge import add_monitor
|
||||||
|
from LANforge.add_monitor import *
|
||||||
|
import os
|
||||||
|
import datetime
|
||||||
|
import base64
|
||||||
|
import xlsxwriter
|
||||||
|
import pandas as pd
|
||||||
|
import requests
|
||||||
|
import ast
|
||||||
|
import csv
|
||||||
|
|
||||||
|
# LFData class actions:
|
||||||
|
# - Methods to collect data/store data (use from monitor instance) - used by Profile class.
|
||||||
|
# - file open/save
|
||||||
|
# - save row (rolling) - to CSV (standard)
|
||||||
|
# - headers
|
||||||
|
# - file to data-storage-type conversion and vice versa (e.g. dataframe (or datatable) to file type and vice versa)
|
||||||
|
# - other common util methods related to immediate data storage
|
||||||
|
# - include compression method
|
||||||
|
# - monitoring truncates every 5 mins and sends to report? --- need clarification. truncate file and rewrite to same file?
|
||||||
|
# - large data collection use NFS share to NAS.
|
||||||
|
# Websocket class actions:
|
||||||
|
#reading data from websockets
|
||||||
|
|
||||||
|
class LFDataCollection(LFCliBase):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class WebSocket():
|
||||||
|
pass
|
||||||
@@ -11,7 +11,8 @@ from LANforge import add_dut
|
|||||||
from LANforge import lfcli_base
|
from LANforge import lfcli_base
|
||||||
from LANforge import add_vap
|
from LANforge import add_vap
|
||||||
from LANforge.lfcli_base import LFCliBase
|
from LANforge.lfcli_base import LFCliBase
|
||||||
#from generic_cx import GenericCx
|
from .lfdata import LFDataCollection
|
||||||
|
from .lfdata import WebSocket
|
||||||
from LANforge import add_monitor
|
from LANforge import add_monitor
|
||||||
from LANforge.add_monitor import *
|
from LANforge.add_monitor import *
|
||||||
import os
|
import os
|
||||||
|
|||||||
Reference in New Issue
Block a user