Data Structures | |
class | Colors |
Functions | |
def | print_error |
def | delete_rule |
def | run_test |
def | execute_cmd |
def | run_test_file |
def | show_missing |
def | main |
Variables | |
string | IPTABLES = "iptables" |
string | IP6TABLES = "ip6tables" |
string | IPTABLES_SAVE = "iptables-save" |
string | IP6TABLES_SAVE = "ip6tables-save" |
string | EXTENSIONS_PATH = "extensions" |
string | LOGFILE = "/tmp/iptables-test.log" |
log_file = None | |
def iptables-test.delete_rule | ( | iptables, | |
rule, | |||
filename, | |||
lineno | |||
) |
Removes an iptables rule
References execute_cmd(), and print_error().
Referenced by run_test().
def iptables-test.execute_cmd | ( | cmd, | |
filename, | |||
lineno | |||
) |
Executes a command, checking for segfaults and returning the command exit code. :param cmd: string with the command to be executed :param filename: name of the file tested (used for print_error purposes) :param lineno: line number being tested (used for print_error purposes)
References print_error().
Referenced by delete_rule(), run_test(), and run_test_file().
def iptables-test.main | ( | void | ) |
def iptables-test.print_error | ( | reason, | |
filename = None , |
|||
lineno = None |
|||
) |
Prints an error with nice colors, indicating file and line number.
Referenced by delete_rule(), execute_cmd(), and run_test().
def iptables-test.run_test | ( | iptables, | |
rule, | |||
rule_save, | |||
res, | |||
filename, | |||
lineno | |||
) |
Executes an unit test. Returns the output of delete_rule(). Parameters: :param iptables: string with the iptables command to execute :param rule: string with iptables arguments for the rule to test :param rule_save: string to find the rule in the output of iptables -save :param res: expected result of the rule. Valid values: "OK", "FAIL" :param filename: name of the file tested (used for print_error purposes) :param lineno: line number being tested (used for print_error purposes)
References delete_rule(), execute_cmd(), len, and print_error().
Referenced by run_test_file().
def iptables-test.run_test_file | ( | filename | ) |
Runs a test file :param filename: name of the file with the test rules
References execute_cmd(), len, and run_test().
Referenced by main().
def iptables-test.show_missing | ( | ) |
Show the list of missing test files
Referenced by main().
string iptables-test.EXTENSIONS_PATH = "extensions" |
string iptables-test.IP6TABLES = "ip6tables" |
string iptables-test.IP6TABLES_SAVE = "ip6tables-save" |
string iptables-test.IPTABLES = "iptables" |
string iptables-test.IPTABLES_SAVE = "iptables-save" |
iptables-test.log_file = None |
string iptables-test.LOGFILE = "/tmp/iptables-test.log" |