dnac_pnp.utils module¶
Utility module for dnac_pnp
-
check_csv_cell_name(cell_name=None)¶ This function checks validity of single CSV cell name
- Parameters
cell_name – (str) Cell name form file
- Returns
(str) Valid cell name
-
check_csv_header(file_headers=None)¶ This function checks the csv headers against accepted headers
- Parameters
file_headers – (list) A list of headers retrieved from CSV file
- Returns
(list) A list (subset or equal) of headers that has been checked
-
debug_manager()¶ This function acts accordingly with –debug switch
-
divider(text='', char='=')¶ Print a divider with a headline:
- Parameters
text – (unicode) Headline text. If empty, only the line is printed.
char – (unicode) Line character to repeat, e.g. =.
- Returns
(stdout) on screen
-
do_camel_case(input_string=None)¶ This function creates camelCased strings
Warning
Can’t handle already camelCased string and unicode strings
- Parameters
input_string – (str) string to be camel cased
- Returns
(str) Camel cased string
-
goodbye(before=False, data=None)¶ Shows goodbye message
- Parameters
before – (boolean) Whether to show a message before goodbye
data – (dict) skipped information
- Returns
(stdout) On screen output
-
initial_message()¶ This function shows the initialization message
-
parse_csv(file_to_parse=None)¶ This function parses CSV for device import
- Parameters
file_to_parse – (str) Full path of CSV file
- Returns
(list) of dictionaries with each row as an item
-
parse_txt(serials_file_path=None)¶ This function parses a text file line by line and returns a list of serials
- Parameters
serials_file_path – (str) Full path to serials to delete file
- Returns
(list) A list of serials
-
show_info(view_type=None)¶ This function prints information about the package on screen
- Parameters
view_type – (boolean) To show more or less info
- Returns
(stdout) output to the screen
-
validate_delete_input(ctx, param, value)¶ This function validates the device delete input
-
validate_file_extension(ctx, param, value)¶ This function validates file extensions
-
validate_input(ctx, param, value)¶ This function validates other inputs. [alphanumeric and - and _]
-
validate_serial(ctx, param, value)¶ This function validates serial number