Update ce_bgp_neighbor to fix bugs (#60634)
This commit is contained in:
parent
8233389446
commit
9bf0e69601
1 changed files with 17 additions and 8 deletions
|
@ -529,7 +529,8 @@ class BgpNeighbor(object):
|
|||
|
||||
dual_as = module.params['dual_as']
|
||||
if dual_as != 'no_use':
|
||||
|
||||
if not fake_as:
|
||||
module.fail_json(msg='fake_as must exist.')
|
||||
conf_str = CE_GET_BGP_PEER_HEADER % (vrf_name, peerip) + \
|
||||
"<dualAs></dualAs>" + CE_GET_BGP_PEER_TAIL
|
||||
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
|
||||
|
@ -938,7 +939,8 @@ class BgpNeighbor(object):
|
|||
|
||||
prepend_global_as = module.params['prepend_global_as']
|
||||
if prepend_global_as != 'no_use':
|
||||
|
||||
if not fake_as:
|
||||
module.fail_json(msg='fake_as must exist.')
|
||||
conf_str = CE_GET_BGP_PEER_HEADER % (vrf_name, peerip) + \
|
||||
"<prependGlobalAs></prependGlobalAs>" + CE_GET_BGP_PEER_TAIL
|
||||
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
|
||||
|
@ -958,7 +960,8 @@ class BgpNeighbor(object):
|
|||
|
||||
prepend_fake_as = module.params['prepend_fake_as']
|
||||
if prepend_fake_as != 'no_use':
|
||||
|
||||
if not fake_as:
|
||||
module.fail_json(msg='fake_as must exist.')
|
||||
conf_str = CE_GET_BGP_PEER_HEADER % (vrf_name, peerip) + \
|
||||
"<prependFakeAs></prependFakeAs>" + CE_GET_BGP_PEER_TAIL
|
||||
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
|
||||
|
@ -1473,7 +1476,7 @@ class BgpNeighbor(object):
|
|||
if local_if_name:
|
||||
conf_str += "<localIfName>%s</localIfName>" % local_if_name
|
||||
|
||||
cmd = "peer %s connect-interface local_if_name" % peer_addr
|
||||
cmd = "peer %s connect-interface %s" % (peer_addr, local_if_name)
|
||||
cmds.append(cmd)
|
||||
|
||||
ebgp_max_hop = module.params['ebgp_max_hop']
|
||||
|
@ -1580,14 +1583,20 @@ class BgpNeighbor(object):
|
|||
if mpls_local_ifnet_disable != 'no_use':
|
||||
conf_str += "<mplsLocalIfnetDisable>%s</mplsLocalIfnetDisable>" % mpls_local_ifnet_disable
|
||||
|
||||
if mpls_local_ifnet_disable == "false":
|
||||
cmd = "undo peer %s mpls-local-ifnet disable" % peer_addr
|
||||
else:
|
||||
cmd = "peer %s mpls-local-ifnet disable" % peer_addr
|
||||
cmds.append(cmd)
|
||||
|
||||
prepend_global_as = module.params['prepend_global_as']
|
||||
if prepend_global_as != 'no_use':
|
||||
conf_str += "<prependGlobalAs>%s</prependGlobalAs>" % prepend_global_as
|
||||
|
||||
if prepend_global_as == "true":
|
||||
cmd = "peer %s public-as-only" % peer_addr
|
||||
cmd = "peer %s local-as %s prepend-global-as" % (peer_addr, fake_as)
|
||||
else:
|
||||
cmd = "undo peer %s public-as-only" % peer_addr
|
||||
cmd = "undo peer %s local-as %s prepend-global-as" % (peer_addr, fake_as)
|
||||
cmds.append(cmd)
|
||||
|
||||
prepend_fake_as = module.params['prepend_fake_as']
|
||||
|
@ -1595,9 +1604,9 @@ class BgpNeighbor(object):
|
|||
conf_str += "<prependFakeAs>%s</prependFakeAs>" % prepend_fake_as
|
||||
|
||||
if prepend_fake_as == "true":
|
||||
cmd = "peer %s prepend-local-as" % peer_addr
|
||||
cmd = "peer %s local-as %s prepend-local-as" % (peer_addr, fake_as)
|
||||
else:
|
||||
cmd = "undo peer %s prepend-local-as" % peer_addr
|
||||
cmd = "undo peer %s local-as %s prepend-local-as" % (peer_addr, fake_as)
|
||||
cmds.append(cmd)
|
||||
|
||||
conf_str += CE_MERGE_BGP_PEER_TAIL
|
||||
|
|
Loading…
Reference in a new issue