Skip to content

Commit

Permalink
Update _api_data.py (#324)
Browse files Browse the repository at this point in the history
* Update _api_data.py

* Create 324-fix-firewall-log-and-log-prefix.yaml

* Update changelogs/fragments/324-fix-firewall-log-and-log-prefix.yaml

Co-authored-by: Felix Fontein <[email protected]>

* Update test_api_info.py

* fix tests

---------

Co-authored-by: Felix Fontein <[email protected]>
Co-authored-by: alsmirnov <[email protected]>
  • Loading branch information
3 people authored Nov 22, 2024
1 parent 14d89a3 commit 249b1a9
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 8 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/324-fix-firewall-log-and-log-prefix.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- api_info, api_modify - fields ``log`` and ``log-prefix`` in paths ``ip firewall filter``, ``ip firewall mangle``, ``ip firewall nat``, ``ip firewall raw`` now have the correct default values (https://github.com/ansible-collections/community.routeros/pull/324).
16 changes: 8 additions & 8 deletions plugins/module_utils/_api_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -2986,8 +2986,8 @@ def join_path(path):
'jump-target': KeyInfo(can_disable=True),
'layer7-protocol': KeyInfo(can_disable=True),
'limit': KeyInfo(can_disable=True),
'log': KeyInfo(can_disable=True),
'log-prefix': KeyInfo(can_disable=True),
'log': KeyInfo(default=False),
'log-prefix': KeyInfo(default=''),
'nth': KeyInfo(can_disable=True),
'out-bridge-port': KeyInfo(can_disable=True),
'out-bridge-port-list': KeyInfo(can_disable=True),
Expand Down Expand Up @@ -3057,8 +3057,8 @@ def join_path(path):
'jump-target': KeyInfo(can_disable=True),
'layer7-protocol': KeyInfo(can_disable=True),
'limit': KeyInfo(can_disable=True),
'log': KeyInfo(can_disable=True),
'log-prefix': KeyInfo(can_disable=True),
'log': KeyInfo(default=False),
'log-prefix': KeyInfo(default=''),
'new-connection-mark': KeyInfo(can_disable=True),
'new-dscp': KeyInfo(can_disable=True),
'new-mss': KeyInfo(can_disable=True),
Expand Down Expand Up @@ -3137,8 +3137,8 @@ def join_path(path):
'jump-target': KeyInfo(can_disable=True),
'layer7-protocol': KeyInfo(can_disable=True),
'limit': KeyInfo(can_disable=True),
'log': KeyInfo(can_disable=True),
'log-prefix': KeyInfo(can_disable=True),
'log': KeyInfo(default=False),
'log-prefix': KeyInfo(default=''),
'nth': KeyInfo(can_disable=True),
'out-bridge-port': KeyInfo(can_disable=True),
'out-bridge-port-list': KeyInfo(can_disable=True),
Expand Down Expand Up @@ -3200,8 +3200,8 @@ def join_path(path):
'ipv4-options': KeyInfo(can_disable=True),
'jump-target': KeyInfo(can_disable=True),
'limit': KeyInfo(can_disable=True),
'log': KeyInfo(can_disable=True),
'log-prefix': KeyInfo(can_disable=True),
'log': KeyInfo(default=False),
'log-prefix': KeyInfo(default=''),
'nth': KeyInfo(can_disable=True),
'out-bridge-port': KeyInfo(can_disable=True),
'out-bridge-port-list': KeyInfo(can_disable=True),
Expand Down
14 changes: 14 additions & 0 deletions tests/unit/plugins/modules/test_api_find_and_modify.py
Original file line number Diff line number Diff line change
Expand Up @@ -620,20 +620,26 @@ def test_change_remove_generic(self):
'comment': 'defconf',
'protocol': 'icmp',
'disabled': False,
'log': False,
'log-prefix': '',
},
{
'.id': '*3',
'action': 'accept',
'chain': 'input',
'comment': 'defconf',
'disabled': False,
'log': False,
'log-prefix': '',
},
{
'.id': '*4',
'action': 'accept',
'chain': 'input',
'comment': 'defconf',
'disabled': False,
'log': False,
'log-prefix': '',
},
{
'.id': '*7',
Expand All @@ -642,6 +648,8 @@ def test_change_remove_generic(self):
'comment': 'defconf',
'disabled': False,
'in-interface': 'wan',
'log': False,
'log-prefix': '',
},
{
'.id': '*8',
Expand All @@ -650,6 +658,8 @@ def test_change_remove_generic(self):
'comment': 'defconf',
'connection-state': 'established',
'disabled': False,
'log': False,
'log-prefix': '',
},
{
'.id': '*9',
Expand All @@ -658,6 +668,8 @@ def test_change_remove_generic(self):
'comment': 'defconf',
'connection-state': 'related',
'disabled': False,
'log': False,
'log-prefix': '',
},
{
'.id': '*A',
Expand All @@ -666,6 +678,8 @@ def test_change_remove_generic(self):
'comment': 'defconf',
'connection-status': 'invalid',
'disabled': False,
'log': False,
'log-prefix': '',
},
])
self.assertEqual(result['match_count'], 3)
Expand Down

0 comments on commit 249b1a9

Please sign in to comment.