12.1. pyVig - operations
- class nettoolkit.pyVig.oper.DFGen(files)[source]
Bases:
objectDataFrame generator
- Parameters:
files (list) – list of input excel -clean files
- add_cable_connector_details()[source]
add cable and connector details to database (such as: media_type, cable_type, connector_types, mediaspeed, cable-type )
- arrange_cablings(keep_all_cols=True)[source]
arrange cabling tab in to appropriate order given in CABLING COLUMNS
- calculate_cordinates(sheet_filter_dict={})[source]
calculate the x,y coordinate values for each devices and keep Devices, Cablings DataFrame Dictionary ready.
- Parameters:
sheet_filter_dict (dict) – sheet filter dictionary for mutitab executions.
- merge_cable_type(df)[source]
checks a side and b side connectors, media speed and returns desired cable type
- Parameters:
df (DataFrame) – Pandas DataFrame (cabling)
- Returns:
cable type (ex: lc to lc 10g Multimode OM3 Cable)
- Return type:
str
- remove_duplicate_cabling_entries()[source]
removes duplicate cabling entries between a-b devices / deprycated.
- remove_duplicate_cablings()[source]
removes redundant cabling entries between two devices with same port identified
- remove_undefined_cabling_entries()[source]
removes undefined cabling entries where device doesn’t exist in devices tab / deprycated
- update_cable_connector(cm_df, what, mt_col=None)[source]
common definition to update attributes: cable_type, connector_types, mediaspeed
- Parameters:
cm_df (DataFrame) – Pandas DataFrame (cabling)
what (str) – attribute name to be updated
mt_col (str, optional) – mediatype column name. Defaults to None.
- Returns:
found atribute value
- Return type:
str
- update_cabling_df(DCT, file)[source]
update Cabling DataFrame
- Parameters:
DCT (DF_ConverT) – DataFrame Convertor object
file (str) – a single database. -clean excel file.
- update_devices_df(DCT, file)[source]
update Devices DataFrame
- Parameters:
DCT (DF_ConverT) – DataFrame Convertor object
file (str) – a single database. -clean excel file. ( not in use )
- class nettoolkit.pyVig.oper.DF_ConverT(file, default_stencil, line_pattern_style_separation_on, line_pattern_style_shift_no)[source]
Bases:
objectData Frame Converter
- Parameters:
file (str) – a single database. -clean excel file.
default_stencil (str) – default visio stencil file.
line_pattern_style_separation_on (str) – column name on which line pattern separation should be decided on
line_pattern_style_shift_no (int) – line pattern change/shift number/steps
- convert(func_dict)[source]
create physical DataFrame, update with patterns
- Parameters:
func_dict (dict) – custom functions dictionary
- get_self_details(var_func_dict)[source]
update the value from var tab of var function dictionary
- Parameters:
var_func_dict (dict) – custom var functions dictionary
- update_cablings(**default_dic)[source]
creates Cabling object and its DataFrame, adds cabling details
- Returns:
pandas DataFrame
- Return type:
DataFrame
- update_device_self_detils(func_dict)[source]
create a pandas DataFrame object for the self object using var tab and custom functions
- Parameters:
func_dict (dict) – custom var functions
- Returns:
pandas DataFrame for self device
- Return type:
DataFrame
- update_devices()[source]
creates Devices object, and its DataFrame, adds vlan informations.
- Returns:
updated pandas DataFrame for interface connected devices
- Return type:
DataFrame
- nettoolkit.pyVig.oper.get_color(df, colors)[source]
get color of a connector
- Parameters:
df (DataFrame) – Pandas DataFrame (cabling)
colors (dict) – fibertype v/s color dictionary
- Returns:
color for given found cable (Default: black)
- Return type:
str
- nettoolkit.pyVig.oper.get_model_number(df, devices_merged_df, device)[source]
get model number for match device
- Parameters:
df (DataFrame) – Cable Matrix DataFrame
devices_merged_df (DataFrame) – Devices DetaFrame
device (str) – device hostname
- Returns:
model number of device
- Return type:
str
- nettoolkit.pyVig.oper.get_serial_number(df, devices_merged_df, device)[source]
get serial number for match device
- Parameters:
df (DataFrame) – Cable Matrix DataFrame
devices_merged_df (DataFrame) – Devices DetaFrame
device (str) – device hostname
- Returns:
serial number of device
- Return type:
str
- nettoolkit.pyVig.oper.remove_duplicates(df)[source]
removes duplicate cabling entries between a-b devices
- nettoolkit.pyVig.oper.update_b_media_type(cable_df_b_device, cable_df_bport, DCT)[source]
update media type for b-end device.
- Parameters:
cable_df_b_device (str) – hostname of b-end device
cable_df_bport (str) – connected b-end device port
DCT (DF_ConverT) – DataFrame Convertor object
- Returns:
media type information detected for b-end device/port (Default: “”)
- Return type:
str
12.2. pyVig - pyVig
- nettoolkit.pyVig.pyVig.cabling_data_operations(**dic)[source]
create and return cabling data object
- Parameters:
dic (kwargs) – keyword arguments
- Returns:
Cablings data object
- Return type:
- nettoolkit.pyVig.pyVig.device_data_operations(**dic)[source]
creates and returns devices data object after merging columns of the list provided for cols_to_merge key
- Parameters:
dic (kwargs) – keyword arguments.
- Returns:
Devices data object
- Return type:
- nettoolkit.pyVig.pyVig.pyVig(**dic)[source]
main function starting the python based cli - visio generation
- Parameters:
dic (kwargs) – inputs dictionary ( valid and mandatory keys = stencil_folder, data_file ) (valid but optional keys = default_stencil, cols_to_merge, is_sheet_filter, sheet_filters … and many more from DEFAULT_DIC )
- Returns:
None
- Return type:
None
- nettoolkit.pyVig.pyVig.repeat_for_filter(v, devices_data, cable_matrix_data, filt_key, filt_value, page_key=None, **dic)[source]
starts visio page operation for the given filter
- Parameters:
v (VisioObject) – Visio Object
devices_data (DeviceData) – Devices data object
cable_matrix_data (CableMatrixData) – Cablings data object
filt_key (str) – filter key
filt_value (str, tuple, list, set) – filter value(s)
page_key (str) – page key (suffix for filter values in case if multiple filt_values)
dic (kwargs) – keyword arguments
- nettoolkit.pyVig.pyVig.visio_operations(devices_data, cable_matrix_data, stencils, **dic)[source]
create a VisioObject
- Parameters:
devices_data (DeviceData) – Devices data object
cable_matrix_data (CableMatrixData) – Cablings data object
stencils (list) – list of visio stencils
dic (kwargs) – keyword arguments
- Returns:
None
- Return type:
None
- nettoolkit.pyVig.pyVig.visio_page_operation(v, devices_data, cable_matrix_data, flt, page_key=None, **dic)[source]
operate on visio page
- Parameters:
v (VisioObject) – Visio Object
devices_data (DeviceData) – Devices data object
cable_matrix_data (CableMatrixData) – Cablings data object
flt (dict) – filters {key: value} pairs
page_key (str, optional) – page key (suffix for filter values in case if multiple filt_values). Defaults to None.
dic (kwargs) – keyword arguments