Skip to content

Commit ea4c4da

Browse files
roverflowpre-commit-ci[bot]rohitthakur2590
authored
Fixes ipv6 remark parsing in older device (#1159)
* Fixes ipv6 remark parsing in older device * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Add changelog * adding sorted * Fix lldp interface issue * fix overridden state lldp interfaces * Fix lldp interfaces --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Rohit Thakur <rohitthakur2590@outlook.com>
1 parent 9895686 commit ea4c4da

File tree

8 files changed

+85
-7
lines changed

8 files changed

+85
-7
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
bugfixes:
3+
- ios_acls - Fixed issue where cisco.ios.ios_acls module failed to process IPv6 ACL remarks, causing unsupported parameter errors.

plugins/module_utils/network/ios/facts/acls/acls.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ def collect_remarks(aces):
235235

236236
for each in temp_v6:
237237
if each.get("aces"):
238-
# each["aces"] = collect_remarks(each.get("aces"))
238+
each["aces"] = collect_remarks(each.get("aces"))
239239
process_protocol_options(each)
240240

241241
objs = []

tests/integration/targets/ios_lldp_interfaces/tests/cli/_populate_config.yaml

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,27 @@
11
---
2-
- name: Populate configuration
3-
vars:
2+
- name: Configure GigabitEthernet1
3+
cisco.ios.ios_config:
44
lines:
5-
"interface GigabitEthernet 1\nlldp receive\nlldp transmit\ninterface GigabitEthernet 2\nlldp receive\nlldp transmit\ninterface GigabitEthernet 3\n\
6-
lldp receive\nlldp transmit\n"
7-
ansible.netcommon.cli_config:
8-
config: "{{ lines }}"
5+
- lldp receive
6+
- lldp transmit
7+
parents:
8+
- interface GigabitEthernet1
9+
10+
- name: Configure GigabitEthernet2
11+
cisco.ios.ios_config:
12+
lines:
13+
- lldp receive
14+
- lldp transmit
15+
parents:
16+
- interface GigabitEthernet2
17+
18+
- name: Configure GigabitEthernet3
19+
cisco.ios.ios_config:
20+
lines:
21+
- lldp receive
22+
- lldp transmit
23+
parents:
24+
- interface GigabitEthernet3
925

1026
- name: Negate GigabitEthernet 4 lldp receive and transmit if merged
1127
vars:

tests/integration/targets/ios_lldp_interfaces/tests/cli/gathered.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
- ansible.builtin.include_tasks: _enable_lldp.yaml
66
- ansible.builtin.include_tasks: _remove_config.yaml
77
- ansible.builtin.include_tasks: _populate_config.yaml
8+
vars:
9+
isMerged: true
810

911
- block:
1012
- name: Gather the provided configuration with the existing running configuration

tests/integration/targets/ios_lldp_interfaces/tests/cli/overridden.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
- ansible.builtin.include_tasks: _remove_config.yaml
88

99
- ansible.builtin.include_tasks: _populate_config.yaml
10+
vars:
11+
isMerged: true
1012

1113
- block:
1214
- name: Override device configuration of all lldp_interfaces with provided configuration

tests/integration/targets/ios_lldp_interfaces/tests/cli/replaced.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
- ansible.builtin.include_tasks: _remove_config.yaml
88

99
- ansible.builtin.include_tasks: _populate_config.yaml
10+
vars:
11+
isMerged: true
1012

1113
- block:
1214
- name: Replaces device configuration of listed lldp_interfaces with provided configuration

tests/integration/test_integration.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ def run(ansible_project, environment):
2121
"debug",
2222
"--lf",
2323
str(ansible_project.log_file),
24+
"-vvv",
2425
]
2526
process = subprocess.run(
2627
args=args,

tests/unit/modules/network/ios/test_ios_acls.py

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2303,3 +2303,55 @@ def test_ios_acls_overridden_remarks_complex(self):
23032303
"no ip access-list extended test_acl",
23042304
]
23052305
self.assertEqual(sorted(result["commands"]), sorted(commands))
2306+
2307+
def test_ios_merged_general(self):
2308+
self.execute_show_command.return_value = dedent(
2309+
"""\
2310+
ipv6 access-list extended std_acl_name_test_1
2311+
10 remark std_acl_name_test_1
2312+
20 permit 220 any any
2313+
""",
2314+
)
2315+
self.execute_show_command_name.return_value = dedent("")
2316+
set_module_args(
2317+
dict(
2318+
config=[
2319+
{
2320+
"afi": "ipv6",
2321+
"acls": [
2322+
{
2323+
"name": "std_acl_name_test_1",
2324+
"acl_type": "extended",
2325+
"aces": [
2326+
{
2327+
"remarks": [
2328+
"Test_ipv4_ipv6_acl",
2329+
],
2330+
},
2331+
{
2332+
"destination": {
2333+
"any": True,
2334+
},
2335+
"grant": "permit",
2336+
"protocol": 220,
2337+
"sequence": 40,
2338+
"source": {
2339+
"any": True,
2340+
},
2341+
},
2342+
],
2343+
},
2344+
],
2345+
},
2346+
],
2347+
state="merged",
2348+
),
2349+
)
2350+
2351+
result = self.execute_module(changed=True)
2352+
commands = [
2353+
"ipv6 access-list std_acl_name_test_1",
2354+
"permit 220 any any sequence 40",
2355+
"remark Test_ipv4_ipv6_acl",
2356+
]
2357+
self.assertEqual(sorted(result["commands"]), sorted(commands))

0 commit comments

Comments
 (0)