diff --git a/changelogs/fragments/62589-ce_bgp_af-to-fix-bugs.yml b/changelogs/fragments/62589-ce_bgp_af-to-fix-bugs.yml new file mode 100644 index 00000000000..e0f5314630a --- /dev/null +++ b/changelogs/fragments/62589-ce_bgp_af-to-fix-bugs.yml @@ -0,0 +1,2 @@ +bugfixes: +- ce_bgp_af - update to fix some bugs - Add some update statements. (https://github.com/ansible/ansible/pull/62589) diff --git a/lib/ansible/modules/network/cloudengine/ce_bgp_af.py b/lib/ansible/modules/network/cloudengine/ce_bgp_af.py index c0918996593..80d3584e550 100644 --- a/lib/ansible/modules/network/cloudengine/ce_bgp_af.py +++ b/lib/ansible/modules/network/cloudengine/ce_bgp_af.py @@ -2555,15 +2555,15 @@ class BgpAf(object): cmds.append(cmd) preference_external = module.params['preference_external'] - if preference_external: - conf_str += "%s" % preference_external - preference_internal = module.params['preference_internal'] - if preference_internal: - conf_str += "%s" % preference_internal - preference_local = module.params['preference_local'] - if preference_local: + if any([preference_external, preference_internal, preference_local]): + preference_external = preference_external or "255" + preference_internal = preference_internal or "255" + preference_local = preference_local or "255" + + conf_str += "%s" % preference_external + conf_str += "%s" % preference_internal conf_str += "%s" % preference_local cmd = "preference %s %s %s" % ( @@ -2808,6 +2808,8 @@ class BgpAf(object): cmds = [] cmd = "import-route %s %s" % (import_protocol, import_process_id) + if import_protocol == "direct" or import_protocol == "static": + cmd = "import-route %s" % import_protocol cmds.append(cmd) return cmds @@ -2836,7 +2838,7 @@ class BgpAf(object): cmds = [] cmd = "import-route %s %s" % (import_protocol, import_process_id) - if import_process_id == "0": + if import_protocol == "direct" or import_protocol == "static": cmd = "import-route %s" % import_protocol cmds.append(cmd) @@ -2866,6 +2868,8 @@ class BgpAf(object): cmds = [] cmd = "undo import-route %s %s" % (import_protocol, import_process_id) + if import_protocol == "direct" or import_protocol == "static": + cmd = "undo import-route %s" % import_protocol cmds.append(cmd) return cmds