update ce_bgp_af to fix bugs (#62589)

* update to fix bugs

* update to fix bugs
This commit is contained in:
yanzhangi 2019-09-20 10:34:11 +08:00 committed by ansibot
parent cee55ab718
commit 2a206f0e4c

View file

@ -2555,15 +2555,15 @@ class BgpAf(object):
cmds.append(cmd)
preference_external = module.params['preference_external']
if preference_external:
conf_str += "<preferenceExternal>%s</preferenceExternal>" % preference_external
preference_internal = module.params['preference_internal']
if preference_internal:
conf_str += "<preferenceInternal>%s</preferenceInternal>" % 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 += "<preferenceExternal>%s</preferenceExternal>" % preference_external
conf_str += "<preferenceInternal>%s</preferenceInternal>" % preference_internal
conf_str += "<preferenceLocal>%s</preferenceLocal>" % 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