Skip to content

Commit

Permalink
Merge branch 'main' into update_changelog_entries
Browse files Browse the repository at this point in the history
  • Loading branch information
roverflow authored May 31, 2024
2 parents fa43dae + 302007e commit 479bcb8
Show file tree
Hide file tree
Showing 10 changed files with 127 additions and 6 deletions.
3 changes: 3 additions & 0 deletions changelogs/fragments/ios_acls_udp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
bugfixes:
- ios_acls - fix incorrect mapping of port 135/udp to msrpc.
3 changes: 3 additions & 0 deletions changelogs/fragments/ios_logging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
doc_changes:
- logging_global - update documentation for severity attribute within buffered.
3 changes: 3 additions & 0 deletions changelogs/fragments/static_routes_facts_fix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
bugfixes:
- ios_static_routes - Fix gathering facts by properly distinguising routes.
4 changes: 4 additions & 0 deletions docs/cisco.ios.ios_logging_global_module.rst
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ Parameters
</td>
<td>
<div>Logging severity level</div>
<div>Idempotency is not maintained for this attribute for the value &#x27;debugging&#x27; since this value is not shown in running-config.</div>
</td>
</tr>
<tr>
Expand Down Expand Up @@ -633,6 +634,7 @@ Parameters
</td>
<td>
<div>Logging severity level</div>
<div>Idempotency is not maintained for this attribute for the value &#x27;debugging&#x27; since this value is not shown in running-config.</div>
</td>
</tr>
<tr>
Expand Down Expand Up @@ -1461,6 +1463,7 @@ Parameters
</td>
<td>
<div>Logging severity level</div>
<div>Idempotency is not maintained for this attribute for the value &#x27;debugging&#x27; since this value is not shown in running-config.</div>
</td>
</tr>
<tr>
Expand Down Expand Up @@ -1970,6 +1973,7 @@ Parameters
</td>
<td>
<div>Logging severity level</div>
<div>Idempotency is not maintained for this attribute for the value &#x27;debugging&#x27; since this value is not shown in running-config.</div>
</td>
</tr>

Expand Down
6 changes: 4 additions & 2 deletions plugins/module_utils/network/ios/config/acls/acls.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()):
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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)
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}",
Expand Down
5 changes: 4 additions & 1 deletion plugins/modules/ios_logging_global.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 19 additions & 0 deletions tests/integration/targets/ios_logging_global/tests/cli/merged.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
33 changes: 33 additions & 0 deletions tests/unit/modules/network/ios/test_ios_acls.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
Expand Down Expand Up @@ -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 ============",
Expand Down
55 changes: 53 additions & 2 deletions tests/unit/modules/network/ios/test_ios_static_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand All @@ -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",
},
],
},
],
Expand All @@ -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)

0 comments on commit 479bcb8

Please sign in to comment.