[Backport/2.9/62589]update ce_bgp_af to fix bugs (#62652)

* update ce_bgp_af to fix bugs (#62589)

* update to fix bugs

* update to fix bugs

(cherry picked from commit 2a206f0e4c)

* Update ce_bgp_af modified information
pull/64281/head
yanzhangi 5 years ago committed by Toshio Kuratomi
parent c95f012ff6
commit fb897c3f48

@ -0,0 +1,2 @@
bugfixes:
- ce_bgp_af - update to fix some bugs - Add some update statements. (https://github.com/ansible/ansible/pull/62589)

@ -2555,15 +2555,15 @@ class BgpAf(object):
cmds.append(cmd) cmds.append(cmd)
preference_external = module.params['preference_external'] preference_external = module.params['preference_external']
if preference_external:
conf_str += "<preferenceExternal>%s</preferenceExternal>" % preference_external
preference_internal = module.params['preference_internal'] preference_internal = module.params['preference_internal']
if preference_internal:
conf_str += "<preferenceInternal>%s</preferenceInternal>" % preference_internal
preference_local = module.params['preference_local'] 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 += "<preferenceExternal>%s</preferenceExternal>" % preference_external
conf_str += "<preferenceInternal>%s</preferenceInternal>" % preference_internal
conf_str += "<preferenceLocal>%s</preferenceLocal>" % preference_local conf_str += "<preferenceLocal>%s</preferenceLocal>" % preference_local
cmd = "preference %s %s %s" % ( cmd = "preference %s %s %s" % (
@ -2808,6 +2808,8 @@ class BgpAf(object):
cmds = [] cmds = []
cmd = "import-route %s %s" % (import_protocol, import_process_id) 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) cmds.append(cmd)
return cmds return cmds
@ -2836,7 +2838,7 @@ class BgpAf(object):
cmds = [] cmds = []
cmd = "import-route %s %s" % (import_protocol, import_process_id) 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 cmd = "import-route %s" % import_protocol
cmds.append(cmd) cmds.append(cmd)
@ -2866,6 +2868,8 @@ class BgpAf(object):
cmds = [] cmds = []
cmd = "undo import-route %s %s" % (import_protocol, import_process_id) 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) cmds.append(cmd)
return cmds return cmds

Loading…
Cancel
Save