@@ -27,9 +27,9 @@ def __init__(self, *args, **kwargs):
2727
2828 def check_target_addr (self , params , target_elt ):
2929 """ test the addresses definition """
30- #if params['target'] == '2.3.4.5:443':
31- # self.assert_xml_elt_equal(target_elt, 'target', '2.3.4.5')
32- # self.assert_xml_elt_equal(target_elt, 'local-port', '443')
30+ # if params['target'] == '2.3.4.5:443':
31+ # self.assert_xml_elt_equal(target_elt, 'target', '2.3.4.5')
32+ # self.assert_xml_elt_equal(target_elt, 'local-port', '443')
3333
3434 def get_associated_rule_elt (self , params , ruleid ):
3535 """ check the associated rule """
@@ -104,15 +104,18 @@ def get_target_elt(self, obj, absent=False, module_result=None):
104104 #
105105 def test_nat_port_forward_create (self ):
106106 """ test """
107- obj = dict (descr = 'test_pf' , interface = 'lan' , source = 'any' , source_port = '443' , destination = '1.2.3.4' , destination_port = '443' , target = '2.3.4.5:443' , associated_rule = 'pass' )
107+ obj = dict (descr = 'test_pf' , interface = 'lan' , source = 'any' , source_port = '443' , destination = '1.2.3.4' , destination_port = '443' , target = '2.3.4.5:443' ,
108+ associated_rule = 'pass' )
108109 command = (
109- "create nat_port_forward 'test_pf', interface='lan', source='any', source_port='443', destination='1.2.3.4', destination_port='443', target='2.3.4.5:443', associated_rule='pass'"
110+ "create nat_port_forward 'test_pf', interface='lan', source='any', source_port='443', destination='1.2.3.4', "
111+ "destination_port='443', target='2.3.4.5:443', associated_rule='pass'"
110112 )
111113 self .do_module_test (obj , command = command , target_idx = 3 )
112114
113115 def test_nat_port_forward_create_range (self ):
114116 """ test """
115- obj = dict (descr = 'test_pf' , interface = 'lan' , source = 'any' , source_port = '9000-10000' , destination = '1.2.3.4' , destination_port = '9000-10000' , target = '2.3.4.5:9000' , associated_rule = 'none' )
117+ obj = dict (descr = 'test_pf' , interface = 'lan' , source = 'any' , source_port = '9000-10000' , destination = '1.2.3.4' , destination_port = '9000-10000' , target = '2.3.4.5:9000' ,
118+ associated_rule = 'none' )
116119 command = (
117120 "create nat_port_forward 'test_pf', interface='lan', source='any', source_port='9000-10000', destination='1.2.3.4', destination_port='9000-10000', "
118121 "target='2.3.4.5:9000', associated_rule='none'"
@@ -121,14 +124,16 @@ def test_nat_port_forward_create_range(self):
121124
122125 def test_nat_port_forward_create_associated (self ):
123126 """ test """
124- obj = dict (descr = 'test_pf' , interface = 'lan' , source = 'any' , source_port = '443' , destination = '1.2.3.4' , destination_port = '443' , target = '2.3.4.5:443' , associated_rule = 'associated' )
127+ obj = dict (descr = 'test_pf' , interface = 'lan' , source = 'any' , source_port = '443' , destination = '1.2.3.4' , destination_port = '443' , target = '2.3.4.5:443' ,
128+ associated_rule = 'associated' )
125129 cmd1 = "create rule 'NAT test_pf' on 'lan', source='any', source_port='443', destination='2.3.4.5', destination_port='443', protocol='tcp'"
126130 cmd2 = "create nat_port_forward 'test_pf', interface='lan', source='any', source_port='443', destination='1.2.3.4', destination_port='443', target='2.3.4.5:443'"
127131 self .do_module_test (obj , command = [cmd1 , cmd2 ], target_idx = 3 )
128132
129133 def test_nat_port_forward_create_unassociated (self ):
130134 """ test """
131- obj = dict (descr = 'test_pf' , interface = 'lan' , source = 'any' , source_port = '443' , destination = '1.2.3.4' , destination_port = '443' , target = '2.3.4.5:443' , associated_rule = 'unassociated' )
135+ obj = dict (descr = 'test_pf' , interface = 'lan' , source = 'any' , source_port = '443' , destination = '1.2.3.4' , destination_port = '443' , target = '2.3.4.5:443' ,
136+ associated_rule = 'unassociated' )
132137 cmd1 = "create rule 'NAT test_pf' on 'lan', source='any', source_port='443', destination='2.3.4.5', destination_port='443', protocol='tcp'"
133138 cmd2 = (
134139 "create nat_port_forward 'test_pf', interface='lan', source='any', source_port='443', destination='1.2.3.4', destination_port='443', target='2.3.4.5:443', "
@@ -138,7 +143,8 @@ def test_nat_port_forward_create_unassociated(self):
138143
139144 def test_nat_port_forward_create_top (self ):
140145 """ test """
141- obj = dict (descr = 'test_pf' , interface = 'lan' , source = 'any' , source_port = '443' , destination = '1.2.3.4' , destination_port = '443' , target = '2.3.4.5:443' , associated_rule = 'pass' , after = 'top' )
146+ obj = dict (descr = 'test_pf' , interface = 'lan' , source = 'any' , source_port = '443' , destination = '1.2.3.4' , destination_port = '443' , target = '2.3.4.5:443' ,
147+ associated_rule = 'pass' , after = 'top' )
142148 command = (
143149 "create nat_port_forward 'test_pf', interface='lan', source='any', source_port='443', destination='1.2.3.4', destination_port='443', target='2.3.4.5:443', "
144150 "associated_rule='pass', after='top'"
@@ -147,7 +153,8 @@ def test_nat_port_forward_create_top(self):
147153
148154 def test_nat_port_forward_create_after (self ):
149155 """ test """
150- obj = dict (descr = 'test_pf' , interface = 'lan' , source = 'any' , source_port = '443' , destination = '1.2.3.4' , destination_port = '443' , target = '2.3.4.5:443' , associated_rule = 'pass' , after = 'one' )
156+ obj = dict (descr = 'test_pf' , interface = 'lan' , source = 'any' , source_port = '443' , destination = '1.2.3.4' , destination_port = '443' , target = '2.3.4.5:443' ,
157+ associated_rule = 'pass' , after = 'one' )
151158 command = (
152159 "create nat_port_forward 'test_pf', interface='lan', source='any', source_port='443', destination='1.2.3.4', destination_port='443', target='2.3.4.5:443', "
153160 "associated_rule='pass', after='one'"
@@ -156,7 +163,8 @@ def test_nat_port_forward_create_after(self):
156163
157164 def test_nat_port_forward_create_before (self ):
158165 """ test """
159- obj = dict (descr = 'test_pf' , interface = 'lan' , source = 'any' , source_port = '443' , destination = '1.2.3.4' , destination_port = '443' , target = '2.3.4.5:443' , associated_rule = 'pass' , before = 'two' )
166+ obj = dict (descr = 'test_pf' , interface = 'lan' , source = 'any' , source_port = '443' , destination = '1.2.3.4' , destination_port = '443' , target = '2.3.4.5:443' ,
167+ associated_rule = 'pass' , before = 'two' )
160168 command = (
161169 "create nat_port_forward 'test_pf', interface='lan', source='any', source_port='443', destination='1.2.3.4', destination_port='443', target='2.3.4.5:443', "
162170 "associated_rule='pass', before='two'"
@@ -197,7 +205,8 @@ def test_nat_port_forward_update_bottom(self):
197205
198206 def test_nat_port_forward_update_top (self ):
199207 """ test """
200- obj = dict (descr = 'last' , interface = 'wan' , source = 'any' , destination = 'IP:wan' , destination_port = '22022' , target = '10.255.1.20:22' , associated_rule = 'associated' , after = 'top' )
208+ obj = dict (descr = 'last' , interface = 'wan' , source = 'any' , destination = 'IP:wan' , destination_port = '22022' , target = '10.255.1.20:22' , associated_rule = 'associated' ,
209+ after = 'top' )
201210 command = "update nat_port_forward 'last' set after='top'"
202211 self .do_module_test (obj , command = command , target_idx = 0 )
203212
0 commit comments