Unit Tests for network code.
-
class IptablesManagerTestCase(*args, **kwargs)
Bases: nova.test.TestCase
-
binary_name = 'setup.py'
-
sample_filter = ['#Generated by iptables-save on Fri Feb 18 15:17:05 2011', '*filter', ':INPUT ACCEPT [2223527:305688874]', ':FORWARD ACCEPT [0:0]', ':OUTPUT ACCEPT [2172501:140856656]', ':iptables-top-rule - [0:0]', ':iptables-bottom-rule - [0:0]', ':setup.py-FORWARD - [0:0]', ':setup.py-INPUT - [0:0]', ':setup.py-local - [0:0]', ':setup.py-OUTPUT - [0:0]', ':nova-filter-top - [0:0]', '[0:0] -A FORWARD -j nova-filter-top', '[0:0] -A OUTPUT -j nova-filter-top', '[0:0] -A nova-filter-top -j setup.py-local', '[0:0] -A INPUT -j setup.py-INPUT', '[0:0] -A OUTPUT -j setup.py-OUTPUT', '[0:0] -A FORWARD -j setup.py-FORWARD', '[0:0] -A INPUT -i virbr0 -p udp -m udp --dport 53 -j ACCEPT', '[0:0] -A INPUT -i virbr0 -p tcp -m tcp --dport 53 -j ACCEPT', '[0:0] -A INPUT -i virbr0 -p udp -m udp --dport 67 -j ACCEPT', '[0:0] -A INPUT -i virbr0 -p tcp -m tcp --dport 67 -j ACCEPT', '[0:0] -A FORWARD -s 192.168.122.0/24 -i virbr0 -j ACCEPT', '[0:0] -A FORWARD -i virbr0 -o virbr0 -j ACCEPT', '[0:0] -A FORWARD -o virbr0 -j REJECT --reject-with icmp-port-unreachable', '[0:0] -A FORWARD -i virbr0 -j REJECT --reject-with icmp-port-unreachable', 'COMMIT', '# Completed on Fri Feb 18 15:17:05 2011']
-
sample_nat = ['# Generated by iptables-save on Fri Feb 18 15:17:05 2011', '*nat', ':PREROUTING ACCEPT [3936:762355]', ':INPUT ACCEPT [2447:225266]', ':OUTPUT ACCEPT [63491:4191863]', ':POSTROUTING ACCEPT [63112:4108641]', ':setup.py-OUTPUT - [0:0]', ':setup.py-snat - [0:0]', ':setup.py-PREROUTING - [0:0]', ':setup.py-float-snat - [0:0]', ':setup.py-POSTROUTING - [0:0]', ':nova-postrouting-bottom - [0:0]', '[0:0] -A PREROUTING -j setup.py-PREROUTING', '[0:0] -A OUTPUT -j setup.py-OUTPUT', '[0:0] -A POSTROUTING -j setup.py-POSTROUTING', '[0:0] -A nova-postrouting-bottom -j setup.py-snat', '[0:0] -A setup.py-snat -j setup.py-float-snat', '[0:0] -A POSTROUTING -j nova-postrouting-bottom', 'COMMIT', '# Completed on Fri Feb 18 15:17:05 2011']
-
setUp()
-
test_filter_rules()
-
test_filter_rules_are_wrapped()
-
test_iptables_bottom_order()
-
test_iptables_preserve_order()
-
test_iptables_top_order()
-
test_missing_table()
-
test_nat_rules()
-
test_remove_rules_regex()