diff --git a/changelogs/fragments/ios_acls_udp.yml b/changelogs/fragments/ios_acls_udp.yml new file mode 100644 index 000000000..71df169e5 --- /dev/null +++ b/changelogs/fragments/ios_acls_udp.yml @@ -0,0 +1,3 @@ +--- +bugfixes: + - ios_acls - fix incorrect mapping of port 135/udp to msrpc. diff --git a/changelogs/fragments/ios_logging.yml b/changelogs/fragments/ios_logging.yml new file mode 100644 index 000000000..2ae48d1b6 --- /dev/null +++ b/changelogs/fragments/ios_logging.yml @@ -0,0 +1,3 @@ +--- +doc_changes: + - logging_global - update documentation for severity attribute within buffered. diff --git a/changelogs/fragments/static_routes_facts_fix.yml b/changelogs/fragments/static_routes_facts_fix.yml new file mode 100644 index 000000000..82bc47710 --- /dev/null +++ b/changelogs/fragments/static_routes_facts_fix.yml @@ -0,0 +1,3 @@ +--- +bugfixes: + - ios_static_routes - Fix gathering facts by properly distinguising routes. diff --git a/docs/cisco.ios.ios_logging_global_module.rst b/docs/cisco.ios.ios_logging_global_module.rst index 504441719..979918e67 100644 --- a/docs/cisco.ios.ios_logging_global_module.rst +++ b/docs/cisco.ios.ios_logging_global_module.rst @@ -127,6 +127,7 @@ Parameters
Logging severity level
+
Idempotency is not maintained for this attribute for the value 'debugging' since this value is not shown in running-config.
@@ -633,6 +634,7 @@ Parameters
Logging severity level
+
Idempotency is not maintained for this attribute for the value 'debugging' since this value is not shown in running-config.
@@ -1461,6 +1463,7 @@ Parameters
Logging severity level
+
Idempotency is not maintained for this attribute for the value 'debugging' since this value is not shown in running-config.
@@ -1970,6 +1973,7 @@ Parameters
Logging severity level
+
Idempotency is not maintained for this attribute for the value 'debugging' since this value is not shown in running-config.
diff --git a/plugins/module_utils/network/ios/config/acls/acls.py b/plugins/module_utils/network/ios/config/acls/acls.py index f604e4360..86feba1b0 100644 --- a/plugins/module_utils/network/ios/config/acls/acls.py +++ b/plugins/module_utils/network/ios/config/acls/acls.py @@ -323,7 +323,7 @@ def list_to_dict(self, param): ace.get("destination", {}).get("port_protocol", {}).items() ): ace["destination"]["port_protocol"][k] = ( - self.port_protocl_no_to_protocol(v) + self.port_protocl_no_to_protocol(v, ace.get("protocol")) ) if acl.get("acl_type") == "standard": for ks in list(ace.keys()): @@ -376,7 +376,7 @@ def list_to_dict(self, param): temp.update({each["afi"]: {"acls": temp_acls}}) return temp - def port_protocl_no_to_protocol(self, num): + def port_protocl_no_to_protocol(self, num, protocol): map_protocol = { "179": "bgp", "19": "chargen", @@ -414,4 +414,6 @@ def port_protocl_no_to_protocol(self, num): "43": "whois", "80": "www", } # NOTE - "514": "syslog" duplicate value device renders "cmd" + if protocol == "udp" and num in ["135"]: + return num return map_protocol.get(num, num) diff --git a/plugins/module_utils/network/ios/rm_templates/static_routes.py b/plugins/module_utils/network/ios/rm_templates/static_routes.py index a43d59cf7..bee1aed63 100644 --- a/plugins/module_utils/network/ios/rm_templates/static_routes.py +++ b/plugins/module_utils/network/ios/rm_templates/static_routes.py @@ -64,7 +64,7 @@ def __init__(self, lines=None, module=None): "{{ (' dhcp' ) if ipv4.dhcp|d(False) else '' }}" "{{ (' global' ) if ipv4.global|d(False) else '' }}", "result": { - "{{ dest }}_{{ vrf|d() }}_{{ topology|d() }}_ipv4": [ + "{{ dest }}_{{ netmask }}_{{ vrf|d() }}_{{ topology|d() }}_ipv4": [ { "_vrf": "{{ vrf }}", "_topology": "{{ topology }}", diff --git a/plugins/modules/ios_logging_global.py b/plugins/modules/ios_logging_global.py index aab889772..4a78dbb5f 100644 --- a/plugins/modules/ios_logging_global.py +++ b/plugins/modules/ios_logging_global.py @@ -38,7 +38,10 @@ description: Logging buffer size type: int severity: &severity - description: Logging severity level + description: + - Logging severity level + - Idempotency is not maintained for this attribute for the value 'debugging' + since this value is not shown in running-config. type: str choices: &severity_subgroup - alerts diff --git a/tests/integration/targets/ios_logging_global/tests/cli/merged.yaml b/tests/integration/targets/ios_logging_global/tests/cli/merged.yaml index 7c3a84b8e..72fd5af2a 100644 --- a/tests/integration/targets/ios_logging_global/tests/cli/merged.yaml +++ b/tests/integration/targets/ios_logging_global/tests/cli/merged.yaml @@ -57,5 +57,24 @@ that: - merged['after'] == result['after'] + - name: Test - [merged] merge buffered severity with device configuration (idempotent) + cisco.ios.ios_logging_global: &id001 + config: + buffered: + severity: debugging + size: 5099 + xml: true + + - name: Test - [merged] merge console severity with device configuration (idempotent) + register: resultdeb + cisco.ios.ios_logging_global: *id001 + + - name: Test - [merged] assert that debugging value is not idempotent + ansible.builtin.assert: + that: + - resultdeb['changed'] == true + - "'logging buffered xml 5099 debugging' in resultdeb['commands']" + - resultdeb["before"]["buffered"] == resultdeb["after"]["buffered"] + always: - ansible.builtin.include_tasks: _remove_config.yaml diff --git a/tests/unit/modules/network/ios/test_ios_acls.py b/tests/unit/modules/network/ios/test_ios_acls.py index 36d96365a..b06978c3b 100644 --- a/tests/unit/modules/network/ios/test_ios_acls.py +++ b/tests/unit/modules/network/ios/test_ios_acls.py @@ -362,6 +362,36 @@ def test_ios_acls_merged_remarks_positional(self): "acl_type": "extended", "name": "mytest", }, + { + "aces": [ + { + "destination": { + "any": True, + "port_protocol": { + "eq": "135", + }, + }, + "grant": "permit", + "protocol": "tcp", + "sequence": 10, + "source": {"any": True}, + }, + { + "destination": { + "any": True, + "port_protocol": { + "eq": "135", + }, + }, + "grant": "permit", + "protocol": "udp", + "sequence": 20, + "source": {"any": True}, + }, + ], + "name": "example", + "acl_type": "extended", + }, ], "afi": "ipv4", }, @@ -467,6 +497,9 @@ def test_ios_acls_merged_remarks_positional(self): "110 permit ip host 10.40.150.0 any", "remark I am the peace ace", "remark Peace out", + "ip access-list extended example", + "10 permit tcp any any eq msrpc", + "20 permit udp any any eq 135", "ip access-list extended TEST", "10 remark FIRST REMARK BEFORE LINE 10", "10 remark ============", diff --git a/tests/unit/modules/network/ios/test_ios_static_routes.py b/tests/unit/modules/network/ios/test_ios_static_routes.py index 57a416433..4bb89cc79 100644 --- a/tests/unit/modules/network/ios/test_ios_static_routes.py +++ b/tests/unit/modules/network/ios/test_ios_static_routes.py @@ -2138,6 +2138,11 @@ def test_ios_static_route_gathered(self): self.execute_show_command.return_value = dedent( """\ ip route 10.0.0.0 255.0.0.0 Null0 permanent + ip route 192.168.1.0 255.255.255.0 GigabitEthernet0/1.22 10.0.0.1 tag 30 + ip route 192.168.1.0 255.255.255.0 10.0.0.2 + ip route 192.168.1.0 255.255.255.248 GigabitEthernet0/1.23 10.0.0.3 tag 30 + ipv6 route 2001:DB8:0:3::/128 2001:DB8:0:3::33 + ipv6 route 2001:DB8:0:3::/64 2001:DB8:0:3::3 """, ) set_module_args(dict(state="gathered")) @@ -2150,7 +2155,54 @@ def test_ios_static_route_gathered(self): { "dest": "10.0.0.0/8", "next_hops": [ - {"interface": "Null0", "permanent": True}, + { + "interface": "Null0", + "permanent": True, + }, + ], + }, + { + "dest": "192.168.1.0/24", + "next_hops": [ + { + "forward_router_address": "10.0.0.1", + "interface": "GigabitEthernet0/1.22", + "tag": 30, + }, + { + "forward_router_address": "10.0.0.2", + }, + ], + }, + { + "dest": "192.168.1.0/29", + "next_hops": [ + { + "forward_router_address": "10.0.0.3", + "interface": "GigabitEthernet0/1.23", + "tag": 30, + }, + ], + }, + ], + }, + { + "afi": "ipv6", + "routes": [ + { + "dest": "2001:DB8:0:3::/128", + "next_hops": [ + { + "forward_router_address": "2001:DB8:0:3::33", + }, + ], + }, + { + "dest": "2001:DB8:0:3::/64", + "next_hops": [ + { + "forward_router_address": "2001:DB8:0:3::3", + }, ], }, ], @@ -2162,4 +2214,3 @@ def test_ios_static_route_gathered(self): self.maxDiff = None print(result["gathered"]) self.assertEqual(sorted(result["gathered"]), sorted(gathered)) - # self.assertEqual(result["gathered"], gathered)