12.1. pyVig - operations

nettoolkit.pyVig.oper.CableMatrix

alias of DFGen

class nettoolkit.pyVig.oper.DFGen(files)[source]

Bases: object

DataFrame generator

Parameters:

files (list) – list of input excel -clean files

add_b_device_media_types()[source]

add b-device media types to database

add_cable_connector_details()[source]

add cable and connector details to database (such as: media_type, cable_type, connector_types, mediaspeed, cable-type )

add_model_n_serial_number_to_cabling()[source]

cabling tab - add device model and serial numbers

arrange_cablings(keep_all_cols=True)[source]

arrange cabling tab in to appropriate order given in CABLING COLUMNS

blank_dfs()[source]

creates devices/cabling blank DataFrames

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.

custom_attributes(**kwargs)[source]

add/update custom attributes for object

custom_functions(**kwargs)[source]

add/update custom functions for object

custom_var_functions(**kwargs)[source]

add/update custom var tab functions for object

map_color(**kwargs)[source]

add, edit line color map

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_subintf_from_ports()[source]

removes subninterface value/string from ports

remove_undefined_cabling_entries()[source]

removes undefined cabling entries where device doesn’t exist in devices tab / deprycated

run()[source]

iterate over all files for generating devices/cabling DataFrame details.

standardize_intf_on_ports()[source]

standardize all interfaces

update(*funcs)[source]
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_color()[source]

define color of connector

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 )

update_weight()[source]

define thickness of connector

class nettoolkit.pyVig.oper.DF_ConverT(file, default_stencil, line_pattern_style_separation_on, line_pattern_style_shift_no)[source]

Bases: object

Data 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

update_devices_df_pattern_n_custom_func(df, func_dict)[source]

updates Devices DataFrame patterns as per custom functions provided in func_dict

Parameters:
  • df (DataFrame) – pandas DataFrame for devices

  • func_dict (dict) – custom functions dictionary

Returns:

updated DataFrame

Return type:

DataFrame

update_devices_for(df, dic)[source]

update DataFrame for the provided dictionary (dic) objects, and removes empty and duplicate hostname value rows.

Parameters:
  • df (DataFrame) – variable DataFrame

  • dic (dict) – variable dictionary

Returns:

updated DataFrame

Return type:

DataFame

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.merge_port_for_duplicates(df)[source]

merge multiple cabling for a-b devices

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

nettoolkit.pyVig.oper.update_color(df, colors)[source]

update line color for all connectors, based on the found cable type. Available options are # ( white, black, red, green, skyblue, blue, yellow, gray, lightgray, darkgray, orange )

Parameters:

df (DataFrame) – Pandas DataFrame (cabling)

nettoolkit.pyVig.oper.update_weight(df, base_weight=1)[source]

update line thickness for all connectors, where found multiple connectivities between two devices

Parameters:
  • df (DataFrame) – Pandas DataFrame (cabling)

  • base_weight (int, optional) – base weight. Defaults to 1.

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:

CableMatrixData

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:

DeviceData

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

12.3. pyVig - statics

12.4. pyVig - exec_fns