Fwtester libraries

Submodules

lib.argument module

class lib.argument.argument(name, default_value, help_string, logger, required=False)

Bases: object

lib.argumentparser module

class lib.argumentparser.argumentparser(logger)

Bases: object

add_argument(argument_name, argument_default_value, argument_helpstring, required=False)
get_argument(argument_name)
get_arguments()
is_defined(argument_name)
parse_arguments()

lib.config module

class lib.config.config(path)

Bases: object

Class to manage configuration files in yml format

get_parameter(name)
save(path=None)
set_logger(logger)
set_parameter(name, value)

lib.datastorage module

class lib.datastorage.datastorage(driver, storage, logger, username=None, password=None, host=None)

Bases: object

Class to abstract access to different type of datastorages

add_row(row, table)
add_rows(rows, table)
get_rows(table, num_of_rows=None, offset=0, headers_in_file=True)

lib.datastoragecsv module

class lib.datastoragecsv.datastoragecsv(logger)

Bases: lib.datastorageinterface.datastorageinterface

Class to manage data storage of type csv

add_row(row, table)

Adds a row of data to the data storage

add_rows(rows, table, truncate=False)

Adds some rows of data to the data storage

get_rows(table, num_of_rows=None, offset=0, headers_in_file=True)

@get_rows: read csv lines from a file and retun them as a tupple

lib.datastorageinterface module

class lib.datastorageinterface.datastorageinterface

Bases: object

Interface class for subclasses which manage storage of data

abstract add_row(data=[])

Adds a row of data to the data storage

add_rows(data=[])

Adds some rows of data to the data storage

abstract get_row(number=0)

Gets a row of data from the data storage

abstract get_rows(num_of_rows=None, offset=0)

Gets some rows of data from the data storage

lib.datastoragemongodb module

class lib.datastoragemongodb.datastoragemongodb(database, logger)

Bases: lib.datastorageinterface.datastorageinterface

Class to manage data storage of type MongoDB

add_row(row, table)

Adds a row of data to the data storage

add_rows(rows, table)

Adds some rows of data to the data storage

get_rows(table, num_of_rows=None, offset=0)

@get_rows: read documents from a collection in MongoDB database

lib.datastoragesqlite module

class lib.datastoragesqlite.datastoragesqlite

Bases: lib.datastorageinterface.datastorageinterface

Class to manage data storage of type database

lib.logger module

class lib.logger.logger(log_path, file_level=10, console_level=40, log_format='%(asctime)s:%(name)s:%(levelname)s:%(message)s', debug_level=0)

Bases: object

Class responsible of logging features for the code

debug(message, message_level=0)
error(message)
info(message)
warning(message)

lib.network module

class lib.network.network(logger)

Bases: object

Class used to manage TCP/IP operations: -IP network and address -TCP/UPD Ports

get_address(address, fw_nics, fw_routes, nic='')
get_default_route(routes)
get_mask(network)
get_mask_cidr(network)
get_network_address(network)
get_port(port, protocol='tcp')
is_host(address)
is_in_network(ip, network)
is_network(address)
is_subnet(network1, network2)

lib.report module

class lib.report.report(logger, report_type='csv')

Bases: object

Class responsible to write final reports reports. Currently it supports this formats: -CSV Its planned to support this others: -HTML -XML

add_section(section_name, section_headers, section_data)
generate(report_name)

lib.reportcsv module

class lib.reportcsv.reportcsv(logger)

Bases: lib.reportinterface.reportinterface

add_section(section_name, section_headers, section_data)
del_section()
generate(report_name)

lib.reporthtml module

class lib.reporthtml.reporthtml

Bases: lib.reportinterface.reportinterface

lib.reportinterface module

class lib.reportinterface.reportinterface

Bases: abc.ABC

Interface class for subclasses which manage reports

abstract add_section(section_name, section_headers, section_data)
abstract del_section(section_name)
abstract generate(report_name)

Module contents