From fa37d9ec4eca274b3c7f1b1522cabc744384bf19 Mon Sep 17 00:00:00 2001 From: Sagar Paul Date: Wed, 16 Oct 2024 17:57:49 +0530 Subject: [PATCH] fix parsing of password_options while gathering password configuration from appliance (#1122) --- changelogs/fragments/bgp_global_render_pass.yml | 4 ++++ .../network/ios/rm_templates/bgp_address_family.py | 4 ++-- .../module_utils/network/ios/rm_templates/bgp_global.py | 2 +- tests/unit/modules/network/ios/test_ios_bgp_global.py | 9 ++++++++- 4 files changed, 15 insertions(+), 4 deletions(-) create mode 100644 changelogs/fragments/bgp_global_render_pass.yml diff --git a/changelogs/fragments/bgp_global_render_pass.yml b/changelogs/fragments/bgp_global_render_pass.yml new file mode 100644 index 000000000..d6c7c5e5a --- /dev/null +++ b/changelogs/fragments/bgp_global_render_pass.yml @@ -0,0 +1,4 @@ +--- +bugfixes: + - ios_bgp_global - fix parsing of password_options while gathering password configuration from appliance. + - ios_bgp_address_family - fix parsing of password_options while gathering password configuration from appliance. diff --git a/plugins/module_utils/network/ios/rm_templates/bgp_address_family.py b/plugins/module_utils/network/ios/rm_templates/bgp_address_family.py index d55ddc088..b0f207c74 100644 --- a/plugins/module_utils/network/ios/rm_templates/bgp_address_family.py +++ b/plugins/module_utils/network/ios/rm_templates/bgp_address_family.py @@ -1586,8 +1586,8 @@ def __init__(self, lines=None, module=None): "getval": re.compile( r""" \s\sneighbor\s(?P\S+)\spassword - \s(?P\d+) - (\s(?P.$))? + (\s(?P\d+)) + (\s(?P.+))? $""", re.VERBOSE, ), diff --git a/plugins/module_utils/network/ios/rm_templates/bgp_global.py b/plugins/module_utils/network/ios/rm_templates/bgp_global.py index a210b2fc3..641a02240 100644 --- a/plugins/module_utils/network/ios/rm_templates/bgp_global.py +++ b/plugins/module_utils/network/ios/rm_templates/bgp_global.py @@ -1642,7 +1642,7 @@ def __init__(self, lines=None, module=None): r""" \sneighbor\s(?P\S+)\spassword \s(?P\d+) - (\s(?P.$))? + (\s(?P.+))? $""", re.VERBOSE, ), diff --git a/tests/unit/modules/network/ios/test_ios_bgp_global.py b/tests/unit/modules/network/ios/test_ios_bgp_global.py index 67fd77e1d..947adf2ef 100644 --- a/tests/unit/modules/network/ios/test_ios_bgp_global.py +++ b/tests/unit/modules/network/ios/test_ios_bgp_global.py @@ -628,6 +628,7 @@ def test_ios_bgp_global_parsed(self): timers bgp 100 200 150 redistribute connected metric 10 neighbor 192.0.2.1 remote-as 100 + neighbor 192.0.2.1 password 7 DEQPITOP101395 neighbor 192.0.2.1 route-map test-route out address-family ipv4 neighbor 192.0.2.28 activate @@ -652,7 +653,13 @@ def test_ios_bgp_global_parsed(self): { "remote_as": "100", "neighbor_address": "192.0.2.1", - "route_maps": [{"name": "test-route", "out": True}], + "route_maps": [ + {"name": "test-route", "out": True}, + ], + "password_options": { + "encryption": 7, + "pass_key": "DEQPITOP101395", + }, }, ], }