mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-03 04:07:52 +00:00
labels port manager columns if they are not layer 3 columns
This commit is contained in:
@@ -15,6 +15,7 @@ from LANforge.LFUtils import *
|
||||
from LANforge import LFRequest
|
||||
import LANforge.LFRequest
|
||||
import csv
|
||||
import pandas as pd
|
||||
|
||||
class LFCliBase:
|
||||
|
||||
@@ -618,7 +619,7 @@ class LFCliBase:
|
||||
|
||||
#================ Pandas Dataframe Functions ======================================
|
||||
|
||||
#takes any dataframe and returns the specified outputfile format of it
|
||||
#takes any dataframe and returns the specified file extension of it
|
||||
def df_to_file(self, dataframe=None, output_f=None):
|
||||
df = dataframe
|
||||
if output_f == 'hdf':
|
||||
@@ -638,13 +639,14 @@ class LFCliBase:
|
||||
# return exec('df.to_' + x + '("'+file_name'")')
|
||||
|
||||
#takes any format of a file and returns a dataframe of it
|
||||
def file_to_df(file_name):
|
||||
def file_to_df(self,file_name):
|
||||
return pd.read_csv(file_name)
|
||||
|
||||
def compare_two_df(dataframe_one=None,dataframe_two=None):
|
||||
def compare_two_df(self,dataframe_one=None,dataframe_two=None):
|
||||
pass
|
||||
#return compared_df
|
||||
|
||||
def append_df_to_file(dataframe, file_name):
|
||||
def append_df_to_file(self,dataframe, file_name):
|
||||
pass
|
||||
|
||||
# ~class
|
||||
|
||||
@@ -1224,7 +1224,7 @@ class L3CXProfile(LFCliBase):
|
||||
port_mgr_cols=[self.replace_special_char(x) for x in port_mgr_cols]
|
||||
port_mgr_cols_labelled =[]
|
||||
for col_name in port_mgr_cols:
|
||||
port_mgr_cols_labelled.append(col_name)
|
||||
port_mgr_cols_labelled.append("port mgr - " + col_name)
|
||||
|
||||
port_mgr_fields=",".join(port_mgr_cols)
|
||||
header_row.extend(port_mgr_cols_labelled)
|
||||
@@ -1279,7 +1279,6 @@ class L3CXProfile(LFCliBase):
|
||||
|
||||
temp_list=[]
|
||||
for endpoint in layer_3_response["endpoint"]:
|
||||
|
||||
if debug:
|
||||
print("Current endpoint values list... ")
|
||||
print(list(endpoint.values())[0])
|
||||
@@ -1293,7 +1292,12 @@ class L3CXProfile(LFCliBase):
|
||||
for interface in port_mgr_response["interfaces"]:
|
||||
if sta_name in list(interface.keys())[0]:
|
||||
merge=temp_endp_values.copy()
|
||||
merge.update(list(interface.values())[0])
|
||||
#rename keys (separate port mgr 'rx bytes' from layer3 'rx bytes')
|
||||
port_mgr_values_dict =list(interface.values())[0]
|
||||
renamed_port_cols={}
|
||||
for key in port_mgr_values_dict.keys():
|
||||
renamed_port_cols['port mgr - ' +key]=port_mgr_values_dict[key]
|
||||
merge.update(renamed_port_cols)
|
||||
|
||||
for name in header_row[2:-3]:
|
||||
temp_list.append(merge[name])
|
||||
|
||||
Reference in New Issue
Block a user