ce_bgp: update bgp to fix bugs (#57317)

* update bgp to fix bgus

* add a changelog fragment for bgp
This commit is contained in:
YuandongXu 2019-06-29 04:47:36 +08:00 committed by ansibot
parent bb33c922f7
commit 36cfa9e931
5 changed files with 153 additions and 109 deletions

View file

@ -0,0 +1,5 @@
bugfixes:
- Fixed ce_bgp,first the pattern to be searched is need to change, otherwise there is no data to be found.then after running a task with this module,it will not show 'changed' correctly.
- Fixed ce_bgp_af,'changed' of module run restult is not showed, however the module run correctly,and update coommands of result is not correct.
- Fixed ce_bgp_neighbor, find specify bgp as information, as number is necessary and so on.
- Fixed ce_bgp_neighbor_af,update commands should be showed correctly, and xml for filter and edit are also re-factor as the software version upgrade and update.

View file

@ -1254,7 +1254,7 @@ class Bgp(object):
return result return result
else: else:
re_find = re.findall( re_find = re.findall(
r'.*<asNumber>(.*)</asNumber>.*\s*<bgpEnable>(.*)</bgpEnable>.*', xml_str) r'.*<bgpEnable>(.*)</bgpEnable>.*\s*<asNumber>(.*)</asNumber>.*', xml_str)
if re_find: if re_find:
return re_find return re_find
@ -2127,9 +2127,12 @@ def main():
bgp_enable_exist = ce_bgp_obj.get_bgp_enable(module=module) bgp_enable_exist = ce_bgp_obj.get_bgp_enable(module=module)
existing["bgp enable"] = bgp_enable_exist existing["bgp enable"] = bgp_enable_exist
if bgp_enable_exist:
asnumber_exist = bgp_enable_exist[0][0] asnumber_exist = bgp_enable_exist[0][0]
bgpenable_exist = bgp_enable_exist[0][1] bgpenable_exist = bgp_enable_exist[0][1]
else:
asnumber_exist = None
bgpenable_exist = None
if state == "present": if state == "present":
bgp_enable_new = (as_number, "true") bgp_enable_new = (as_number, "true")
@ -2300,7 +2303,9 @@ def main():
if end_tmp: if end_tmp:
end_state["bgp instance other"] = end_tmp end_state["bgp instance other"] = end_tmp
if end_state == existing:
changed = False
updates = list()
results = dict() results = dict()
results['proposed'] = proposed results['proposed'] = proposed
results['existing'] = existing results['existing'] = existing

View file

@ -2678,10 +2678,17 @@ class BgpAf(object):
ingress_lsp_policy_name = module.params['ingress_lsp_policy_name'] ingress_lsp_policy_name = module.params['ingress_lsp_policy_name']
if ingress_lsp_policy_name: if ingress_lsp_policy_name:
conf_str += "<ingressLspPolicyName>%s</ingressLspPolicyName>" % ingress_lsp_policy_name conf_str += "<ingressLspPolicyName>%s</ingressLspPolicyName>" % ingress_lsp_policy_name
cmd = "ingress-lsp trigger route-policy %s" % ingress_lsp_policy_name
cmds.append(cmd)
originator_prior = module.params['originator_prior'] originator_prior = module.params['originator_prior']
if originator_prior != 'no_use': if originator_prior != 'no_use':
conf_str += "<originatorPrior>%s</originatorPrior>" % originator_prior conf_str += "<originatorPrior>%s</originatorPrior>" % originator_prior
if originator_prior == "true":
cmd = "bestroute routerid-prior-clusterlist"
else:
cmd = "undo bestroute routerid-prior-clusterlist"
cmds.append(cmd)
lowest_priority = module.params['lowest_priority'] lowest_priority = module.params['lowest_priority']
if lowest_priority != 'no_use': if lowest_priority != 'no_use':
@ -2697,6 +2704,11 @@ class BgpAf(object):
if relay_delay_enable != 'no_use': if relay_delay_enable != 'no_use':
conf_str += "<relayDelayEnable>%s</relayDelayEnable>" % relay_delay_enable conf_str += "<relayDelayEnable>%s</relayDelayEnable>" % relay_delay_enable
if relay_delay_enable == "true":
cmd = "nexthop recursive-lookup restrain enable"
else:
cmd = "nexthop recursive-lookup restrain disable"
cmds.append(cmd)
conf_str += CE_MERGE_BGP_ADDRESS_FAMILY_TAIL conf_str += CE_MERGE_BGP_ADDRESS_FAMILY_TAIL
recv_xml = self.netconf_set_config(module=module, conf_str=conf_str) recv_xml = self.netconf_set_config(module=module, conf_str=conf_str)
@ -2766,7 +2778,7 @@ class BgpAf(object):
import_process_id = "0" import_process_id = "0"
conf_str = CE_MERGE_BGP_IMPORT_ROUTE_HEADER % ( conf_str = CE_MERGE_BGP_IMPORT_ROUTE_HEADER % (
vrf_name, af_type, import_protocol, import_process_id) + CE_MERGE_BGP_ADDRESS_FAMILY_TAIL vrf_name, af_type, import_protocol, import_process_id) + CE_MERGE_BGP_IMPORT_ROUTE_TAIL
recv_xml = self.netconf_set_config(module=module, conf_str=conf_str) recv_xml = self.netconf_set_config(module=module, conf_str=conf_str)

View file

@ -261,7 +261,7 @@ CE_GET_BGP_PEER_HEADER = """
<vrfName>%s</vrfName> <vrfName>%s</vrfName>
<bgpPeers> <bgpPeers>
<bgpPeer> <bgpPeer>
<peerAddr></peerAddr> <peerAddr>%s</peerAddr>
""" """
CE_GET_BGP_PEER_TAIL = """ CE_GET_BGP_PEER_TAIL = """
</bgpPeer> </bgpPeer>
@ -273,7 +273,6 @@ CE_GET_BGP_PEER_TAIL = """
</filter> </filter>
""" """
# merge bgp peer # merge bgp peer
CE_MERGE_BGP_PEER_HEADER = """ CE_MERGE_BGP_PEER_HEADER = """
<config> <config>
@ -475,6 +474,7 @@ class BgpNeighbor(object):
result = dict() result = dict()
need_cfg = False need_cfg = False
peerip = module.params['peer_addr']
vrf_name = module.params['vrf_name'] vrf_name = module.params['vrf_name']
if vrf_name: if vrf_name:
if len(vrf_name) > 31 or len(vrf_name) == 0: if len(vrf_name) > 31 or len(vrf_name) == 0:
@ -487,7 +487,7 @@ class BgpNeighbor(object):
module.fail_json( module.fail_json(
msg='Error: The len of description %s is out of [1 - 80].' % description) msg='Error: The len of description %s is out of [1 - 80].' % description)
conf_str = CE_GET_BGP_PEER_HEADER % vrf_name + \ conf_str = CE_GET_BGP_PEER_HEADER % (vrf_name, peerip) + \
"<description></description>" + CE_GET_BGP_PEER_TAIL "<description></description>" + CE_GET_BGP_PEER_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
@ -510,7 +510,7 @@ class BgpNeighbor(object):
module.fail_json( module.fail_json(
msg='Error: The len of fake_as %s is out of [1 - 11].' % fake_as) msg='Error: The len of fake_as %s is out of [1 - 11].' % fake_as)
conf_str = CE_GET_BGP_PEER_HEADER % vrf_name + \ conf_str = CE_GET_BGP_PEER_HEADER % (vrf_name, peerip) + \
"<fakeAs></fakeAs>" + CE_GET_BGP_PEER_TAIL "<fakeAs></fakeAs>" + CE_GET_BGP_PEER_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
@ -530,7 +530,7 @@ class BgpNeighbor(object):
dual_as = module.params['dual_as'] dual_as = module.params['dual_as']
if dual_as != 'no_use': if dual_as != 'no_use':
conf_str = CE_GET_BGP_PEER_HEADER % vrf_name + \ conf_str = CE_GET_BGP_PEER_HEADER % (vrf_name, peerip) + \
"<dualAs></dualAs>" + CE_GET_BGP_PEER_TAIL "<dualAs></dualAs>" + CE_GET_BGP_PEER_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
@ -542,7 +542,7 @@ class BgpNeighbor(object):
if re_find: if re_find:
result["dual_as"] = re_find result["dual_as"] = re_find
if re_find[0] != fake_as: if re_find[0] != dual_as:
need_cfg = True need_cfg = True
else: else:
need_cfg = True need_cfg = True
@ -550,10 +550,9 @@ class BgpNeighbor(object):
conventional = module.params['conventional'] conventional = module.params['conventional']
if conventional != 'no_use': if conventional != 'no_use':
conf_str = CE_GET_BGP_PEER_HEADER % vrf_name + \ conf_str = CE_GET_BGP_PEER_HEADER % (vrf_name, peerip) + \
"<conventional></conventional>" + CE_GET_BGP_PEER_TAIL "<conventional></conventional>" + CE_GET_BGP_PEER_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
if "<data/>" in recv_xml: if "<data/>" in recv_xml:
need_cfg = True need_cfg = True
else: else:
@ -570,7 +569,7 @@ class BgpNeighbor(object):
route_refresh = module.params['route_refresh'] route_refresh = module.params['route_refresh']
if route_refresh != 'no_use': if route_refresh != 'no_use':
conf_str = CE_GET_BGP_PEER_HEADER % vrf_name + \ conf_str = CE_GET_BGP_PEER_HEADER % (vrf_name, peerip) + \
"<routeRefresh></routeRefresh>" + CE_GET_BGP_PEER_TAIL "<routeRefresh></routeRefresh>" + CE_GET_BGP_PEER_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
@ -590,7 +589,7 @@ class BgpNeighbor(object):
four_byte_as = module.params['four_byte_as'] four_byte_as = module.params['four_byte_as']
if four_byte_as != 'no_use': if four_byte_as != 'no_use':
conf_str = CE_GET_BGP_PEER_HEADER % vrf_name + \ conf_str = CE_GET_BGP_PEER_HEADER % (vrf_name, peerip) + \
"<fourByteAs></fourByteAs>" + CE_GET_BGP_PEER_TAIL "<fourByteAs></fourByteAs>" + CE_GET_BGP_PEER_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
@ -610,7 +609,7 @@ class BgpNeighbor(object):
is_ignore = module.params['is_ignore'] is_ignore = module.params['is_ignore']
if is_ignore != 'no_use': if is_ignore != 'no_use':
conf_str = CE_GET_BGP_PEER_HEADER % vrf_name + \ conf_str = CE_GET_BGP_PEER_HEADER % (vrf_name, peerip) + \
"<isIgnore></isIgnore>" + CE_GET_BGP_PEER_TAIL "<isIgnore></isIgnore>" + CE_GET_BGP_PEER_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
@ -633,7 +632,7 @@ class BgpNeighbor(object):
module.fail_json( module.fail_json(
msg='Error: The len of local_if_name %s is out of [1 - 63].' % local_if_name) msg='Error: The len of local_if_name %s is out of [1 - 63].' % local_if_name)
conf_str = CE_GET_BGP_PEER_HEADER % vrf_name + \ conf_str = CE_GET_BGP_PEER_HEADER % (vrf_name, peerip) + \
"<localIfName></localIfName>" + CE_GET_BGP_PEER_TAIL "<localIfName></localIfName>" + CE_GET_BGP_PEER_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
@ -645,7 +644,7 @@ class BgpNeighbor(object):
if re_find: if re_find:
result["local_if_name"] = re_find result["local_if_name"] = re_find
if re_find[0] != local_if_name: if re_find[0].lower() != local_if_name.lower():
need_cfg = True need_cfg = True
else: else:
need_cfg = True need_cfg = True
@ -656,7 +655,7 @@ class BgpNeighbor(object):
module.fail_json( module.fail_json(
msg='Error: The value of ebgp_max_hop %s is out of [1 - 255].' % ebgp_max_hop) msg='Error: The value of ebgp_max_hop %s is out of [1 - 255].' % ebgp_max_hop)
conf_str = CE_GET_BGP_PEER_HEADER % vrf_name + \ conf_str = CE_GET_BGP_PEER_HEADER % (vrf_name, peerip) + \
"<ebgpMaxHop></ebgpMaxHop>" + CE_GET_BGP_PEER_TAIL "<ebgpMaxHop></ebgpMaxHop>" + CE_GET_BGP_PEER_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
@ -679,7 +678,7 @@ class BgpNeighbor(object):
module.fail_json( module.fail_json(
msg='Error: The value of valid_ttl_hops %s is out of [1 - 255].' % valid_ttl_hops) msg='Error: The value of valid_ttl_hops %s is out of [1 - 255].' % valid_ttl_hops)
conf_str = CE_GET_BGP_PEER_HEADER % vrf_name + \ conf_str = CE_GET_BGP_PEER_HEADER % (vrf_name, peerip) + \
"<validTtlHops></validTtlHops>" + CE_GET_BGP_PEER_TAIL "<validTtlHops></validTtlHops>" + CE_GET_BGP_PEER_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
@ -699,7 +698,7 @@ class BgpNeighbor(object):
connect_mode = module.params['connect_mode'] connect_mode = module.params['connect_mode']
if connect_mode: if connect_mode:
conf_str = CE_GET_BGP_PEER_HEADER % vrf_name + \ conf_str = CE_GET_BGP_PEER_HEADER % (vrf_name, peerip) + \
"<connectMode></connectMode>" + CE_GET_BGP_PEER_TAIL "<connectMode></connectMode>" + CE_GET_BGP_PEER_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
@ -719,7 +718,7 @@ class BgpNeighbor(object):
is_log_change = module.params['is_log_change'] is_log_change = module.params['is_log_change']
if is_log_change != 'no_use': if is_log_change != 'no_use':
conf_str = CE_GET_BGP_PEER_HEADER % vrf_name + \ conf_str = CE_GET_BGP_PEER_HEADER % (vrf_name, peerip) + \
"<isLogChange></isLogChange>" + CE_GET_BGP_PEER_TAIL "<isLogChange></isLogChange>" + CE_GET_BGP_PEER_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
@ -739,7 +738,7 @@ class BgpNeighbor(object):
pswd_type = module.params['pswd_type'] pswd_type = module.params['pswd_type']
if pswd_type: if pswd_type:
conf_str = CE_GET_BGP_PEER_HEADER % vrf_name + \ conf_str = CE_GET_BGP_PEER_HEADER % (vrf_name, peerip) + \
"<pswdType></pswdType>" + CE_GET_BGP_PEER_TAIL "<pswdType></pswdType>" + CE_GET_BGP_PEER_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
@ -762,7 +761,7 @@ class BgpNeighbor(object):
module.fail_json( module.fail_json(
msg='Error: The len of pswd_cipher_text %s is out of [1 - 255].' % pswd_cipher_text) msg='Error: The len of pswd_cipher_text %s is out of [1 - 255].' % pswd_cipher_text)
conf_str = CE_GET_BGP_PEER_HEADER % vrf_name + \ conf_str = CE_GET_BGP_PEER_HEADER % (vrf_name, peerip) + \
"<pswdCipherText></pswdCipherText>" + CE_GET_BGP_PEER_TAIL "<pswdCipherText></pswdCipherText>" + CE_GET_BGP_PEER_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
@ -785,7 +784,7 @@ class BgpNeighbor(object):
module.fail_json( module.fail_json(
msg='Error: The len of keep_alive_time %s is out of [0 - 21845].' % keep_alive_time) msg='Error: The len of keep_alive_time %s is out of [0 - 21845].' % keep_alive_time)
conf_str = CE_GET_BGP_PEER_HEADER % vrf_name + \ conf_str = CE_GET_BGP_PEER_HEADER % (vrf_name, peerip) + \
"<keepAliveTime></keepAliveTime>" + CE_GET_BGP_PEER_TAIL "<keepAliveTime></keepAliveTime>" + CE_GET_BGP_PEER_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
@ -808,7 +807,7 @@ class BgpNeighbor(object):
module.fail_json( module.fail_json(
msg='Error: The value of hold_time %s is out of [0 or 3 - 65535].' % hold_time) msg='Error: The value of hold_time %s is out of [0 or 3 - 65535].' % hold_time)
conf_str = CE_GET_BGP_PEER_HEADER % vrf_name + \ conf_str = CE_GET_BGP_PEER_HEADER % (vrf_name, peerip) + \
"<holdTime></holdTime>" + CE_GET_BGP_PEER_TAIL "<holdTime></holdTime>" + CE_GET_BGP_PEER_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
@ -831,7 +830,7 @@ class BgpNeighbor(object):
module.fail_json( module.fail_json(
msg='Error: The value of min_hold_time %s is out of [0 or 20 - 65535].' % min_hold_time) msg='Error: The value of min_hold_time %s is out of [0 or 20 - 65535].' % min_hold_time)
conf_str = CE_GET_BGP_PEER_HEADER % vrf_name + \ conf_str = CE_GET_BGP_PEER_HEADER % (vrf_name, peerip) + \
"<minHoldTime></minHoldTime>" + CE_GET_BGP_PEER_TAIL "<minHoldTime></minHoldTime>" + CE_GET_BGP_PEER_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
@ -854,7 +853,7 @@ class BgpNeighbor(object):
module.fail_json( module.fail_json(
msg='Error: The len of key_chain_name %s is out of [1 - 47].' % key_chain_name) msg='Error: The len of key_chain_name %s is out of [1 - 47].' % key_chain_name)
conf_str = CE_GET_BGP_PEER_HEADER % vrf_name + \ conf_str = CE_GET_BGP_PEER_HEADER % (vrf_name, peerip) + \
"<keyChainName></keyChainName>" + CE_GET_BGP_PEER_TAIL "<keyChainName></keyChainName>" + CE_GET_BGP_PEER_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
@ -877,7 +876,7 @@ class BgpNeighbor(object):
module.fail_json( module.fail_json(
msg='Error: The value of conn_retry_time %s is out of [1 - 65535].' % conn_retry_time) msg='Error: The value of conn_retry_time %s is out of [1 - 65535].' % conn_retry_time)
conf_str = CE_GET_BGP_PEER_HEADER % vrf_name + \ conf_str = CE_GET_BGP_PEER_HEADER % (vrf_name, peerip) + \
"<connRetryTime></connRetryTime>" + CE_GET_BGP_PEER_TAIL "<connRetryTime></connRetryTime>" + CE_GET_BGP_PEER_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
@ -900,7 +899,7 @@ class BgpNeighbor(object):
module.fail_json( module.fail_json(
msg='Error: The value of tcp_mss %s is out of [176 - 4096].' % tcp_mss) msg='Error: The value of tcp_mss %s is out of [176 - 4096].' % tcp_mss)
conf_str = CE_GET_BGP_PEER_HEADER % vrf_name + \ conf_str = CE_GET_BGP_PEER_HEADER % (vrf_name, peerip) + \
"<tcpMSS></tcpMSS>" + CE_GET_BGP_PEER_TAIL "<tcpMSS></tcpMSS>" + CE_GET_BGP_PEER_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
@ -920,7 +919,7 @@ class BgpNeighbor(object):
mpls_local_ifnet_disable = module.params['mpls_local_ifnet_disable'] mpls_local_ifnet_disable = module.params['mpls_local_ifnet_disable']
if mpls_local_ifnet_disable != 'no_use': if mpls_local_ifnet_disable != 'no_use':
conf_str = CE_GET_BGP_PEER_HEADER % vrf_name + \ conf_str = CE_GET_BGP_PEER_HEADER % (vrf_name, peerip) + \
"<mplsLocalIfnetDisable></mplsLocalIfnetDisable>" + CE_GET_BGP_PEER_TAIL "<mplsLocalIfnetDisable></mplsLocalIfnetDisable>" + CE_GET_BGP_PEER_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
@ -940,7 +939,7 @@ class BgpNeighbor(object):
prepend_global_as = module.params['prepend_global_as'] prepend_global_as = module.params['prepend_global_as']
if prepend_global_as != 'no_use': if prepend_global_as != 'no_use':
conf_str = CE_GET_BGP_PEER_HEADER % vrf_name + \ conf_str = CE_GET_BGP_PEER_HEADER % (vrf_name, peerip) + \
"<prependGlobalAs></prependGlobalAs>" + CE_GET_BGP_PEER_TAIL "<prependGlobalAs></prependGlobalAs>" + CE_GET_BGP_PEER_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
@ -960,7 +959,7 @@ class BgpNeighbor(object):
prepend_fake_as = module.params['prepend_fake_as'] prepend_fake_as = module.params['prepend_fake_as']
if prepend_fake_as != 'no_use': if prepend_fake_as != 'no_use':
conf_str = CE_GET_BGP_PEER_HEADER % vrf_name + \ conf_str = CE_GET_BGP_PEER_HEADER % (vrf_name, peerip) + \
"<prependFakeAs></prependFakeAs>" + CE_GET_BGP_PEER_TAIL "<prependFakeAs></prependFakeAs>" + CE_GET_BGP_PEER_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
@ -1276,14 +1275,14 @@ class BgpNeighbor(object):
""" get_bgp_peer """ """ get_bgp_peer """
module = kwargs["module"] module = kwargs["module"]
peerip = module.params['peer_addr']
vrf_name = module.params['vrf_name'] vrf_name = module.params['vrf_name']
if vrf_name: if vrf_name:
if len(vrf_name) > 31 or len(vrf_name) == 0: if len(vrf_name) > 31 or len(vrf_name) == 0:
module.fail_json( module.fail_json(
msg='Error: The len of vrf_name %s is out of [1 - 31].' % vrf_name) msg='Error: The len of vrf_name %s is out of [1 - 31].' % vrf_name)
conf_str = CE_GET_BGP_PEER_HEADER % vrf_name + \ conf_str = CE_GET_BGP_PEER_HEADER % (vrf_name, peerip) + \
"<remoteAs></remoteAs>" + CE_GET_BGP_PEER_TAIL "<remoteAs></remoteAs>" + CE_GET_BGP_PEER_TAIL
xml_str = self.netconf_get_config(module=module, conf_str=conf_str) xml_str = self.netconf_get_config(module=module, conf_str=conf_str)
@ -1305,14 +1304,14 @@ class BgpNeighbor(object):
""" get_bgp_del_peer """ """ get_bgp_del_peer """
module = kwargs["module"] module = kwargs["module"]
peerip = module.params['peer_addr']
vrf_name = module.params['vrf_name'] vrf_name = module.params['vrf_name']
if vrf_name: if vrf_name:
if len(vrf_name) > 31 or len(vrf_name) == 0: if len(vrf_name) > 31 or len(vrf_name) == 0:
module.fail_json( module.fail_json(
msg='Error: The len of vrf_name %s is out of [1 - 31].' % vrf_name) msg='Error: The len of vrf_name %s is out of [1 - 31].' % vrf_name)
conf_str = CE_GET_BGP_PEER_HEADER % vrf_name + CE_GET_BGP_PEER_TAIL conf_str = CE_GET_BGP_PEER_HEADER % (vrf_name, peerip) + CE_GET_BGP_PEER_TAIL
xml_str = self.netconf_get_config(module=module, conf_str=conf_str) xml_str = self.netconf_get_config(module=module, conf_str=conf_str)
@ -1434,7 +1433,6 @@ class BgpNeighbor(object):
conventional = module.params['conventional'] conventional = module.params['conventional']
if conventional != 'no_use': if conventional != 'no_use':
conf_str += "<conventional>%s</conventional>" % conventional conf_str += "<conventional>%s</conventional>" % conventional
if conventional == "true": if conventional == "true":
cmd = "peer %s capability-advertise conventional" % peer_addr cmd = "peer %s capability-advertise conventional" % peer_addr
else: else:
@ -1494,7 +1492,6 @@ class BgpNeighbor(object):
connect_mode = module.params['connect_mode'] connect_mode = module.params['connect_mode']
if connect_mode: if connect_mode:
conf_str += "<connectMode>%s</connectMode>" % connect_mode
if connect_mode == "listenOnly": if connect_mode == "listenOnly":
cmd = "peer %s listen-only" % peer_addr cmd = "peer %s listen-only" % peer_addr
@ -1502,11 +1499,13 @@ class BgpNeighbor(object):
elif connect_mode == "connectOnly": elif connect_mode == "connectOnly":
cmd = "peer %s connect-only" % peer_addr cmd = "peer %s connect-only" % peer_addr
cmds.append(cmd) cmds.append(cmd)
elif connect_mode == "null": elif connect_mode == "both":
connect_mode = "null"
cmd = "peer %s listen-only" % peer_addr cmd = "peer %s listen-only" % peer_addr
cmds.append(cmd) cmds.append(cmd)
cmd = "peer %s connect-only" % peer_addr cmd = "peer %s connect-only" % peer_addr
cmds.append(cmd) cmds.append(cmd)
conf_str += "<connectMode>%s</connectMode>" % connect_mode
is_log_change = module.params['is_log_change'] is_log_change = module.params['is_log_change']
if is_log_change != 'no_use': if is_log_change != 'no_use':
@ -1595,6 +1594,12 @@ class BgpNeighbor(object):
if prepend_fake_as != 'no_use': if prepend_fake_as != 'no_use':
conf_str += "<prependFakeAs>%s</prependFakeAs>" % prepend_fake_as conf_str += "<prependFakeAs>%s</prependFakeAs>" % prepend_fake_as
if prepend_fake_as == "true":
cmd = "peer %s prepend-local-as" % peer_addr
else:
cmd = "undo peer %s prepend-local-as" % peer_addr
cmds.append(cmd)
conf_str += CE_MERGE_BGP_PEER_TAIL conf_str += CE_MERGE_BGP_PEER_TAIL
recv_xml = self.netconf_set_config(module=module, conf_str=conf_str) recv_xml = self.netconf_set_config(module=module, conf_str=conf_str)
@ -1759,7 +1764,7 @@ def main():
local_if_name=dict(type='str'), local_if_name=dict(type='str'),
ebgp_max_hop=dict(type='str'), ebgp_max_hop=dict(type='str'),
valid_ttl_hops=dict(type='str'), valid_ttl_hops=dict(type='str'),
connect_mode=dict(choices=['listenOnly', 'connectOnly', 'null']), connect_mode=dict(choices=['listenOnly', 'connectOnly', 'both']),
is_log_change=dict(type='str', default='no_use', choices=['no_use', 'true', 'false']), is_log_change=dict(type='str', default='no_use', choices=['no_use', 'true', 'false']),
pswd_type=dict(choices=['null', 'cipher', 'simple']), pswd_type=dict(choices=['null', 'cipher', 'simple']),
pswd_cipher_text=dict(type='str', no_log=True), pswd_cipher_text=dict(type='str', no_log=True),
@ -1913,7 +1918,6 @@ def main():
existing["bgp peer"] = bgp_peer_exist existing["bgp peer"] = bgp_peer_exist
bgp_peer_new = (peer_addr, remote_as) bgp_peer_new = (peer_addr, remote_as)
if len(bgp_peer_exist) == 0: if len(bgp_peer_exist) == 0:
cmd = ce_bgp_peer_obj.create_bgp_peer(module=module) cmd = ce_bgp_peer_obj.create_bgp_peer(module=module)
changed = True changed = True

View file

@ -402,7 +402,7 @@ CE_GET_BGP_PEER_AF_HEADER = """
<afType>%s</afType> <afType>%s</afType>
<peerAFs> <peerAFs>
<peerAF> <peerAF>
<remoteAddress></remoteAddress> <remoteAddress>%s</remoteAddress>
""" """
CE_GET_BGP_PEER_AF_TAIL = """ CE_GET_BGP_PEER_AF_TAIL = """
</peerAF> </peerAF>
@ -539,7 +539,7 @@ class BgpNeighborAf(object):
msg='Error: The remote_address %s is invalid.' % remote_address) msg='Error: The remote_address %s is invalid.' % remote_address)
conf_str = CE_GET_BGP_PEER_AF_HEADER % ( conf_str = CE_GET_BGP_PEER_AF_HEADER % (
vrf_name, af_type) + CE_GET_BGP_PEER_AF_TAIL vrf_name, af_type, remote_address) + CE_GET_BGP_PEER_AF_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
if state == "present": if state == "present":
@ -548,12 +548,11 @@ class BgpNeighborAf(object):
else: else:
re_find = re.findall( re_find = re.findall(
r'.*<remoteAddress>(.*)</remoteAddress>.*', recv_xml) r'.*<remoteAddress>(.*)</remoteAddress>.*', recv_xml)
if re_find: if re_find:
result["remote_address"] = re_find result["remote_address"] = re_find
result["vrf_name"] = vrf_name result["vrf_name"] = vrf_name
result["af_type"] = af_type result["af_type"] = af_type
if re_find[0] != remote_address: if remote_address not in re_find:
need_cfg = True need_cfg = True
else: else:
need_cfg = True need_cfg = True
@ -584,6 +583,7 @@ class BgpNeighborAf(object):
state = module.params['state'] state = module.params['state']
vrf_name = module.params['vrf_name'] vrf_name = module.params['vrf_name']
af_type = module.params['af_type'] af_type = module.params['af_type']
remote_address = module.params['remote_address']
if state == "absent": if state == "absent":
result["need_cfg"] = need_cfg result["need_cfg"] = need_cfg
@ -593,15 +593,14 @@ class BgpNeighborAf(object):
if advertise_irb != 'no_use': if advertise_irb != 'no_use':
conf_str = CE_GET_BGP_PEER_AF_HEADER % ( conf_str = CE_GET_BGP_PEER_AF_HEADER % (
vrf_name, af_type) + "<advertiseIrb></advertiseIrb>" + CE_GET_BGP_PEER_AF_TAIL vrf_name, af_type, remote_address) + "<advertiseIrb></advertiseIrb>" + CE_GET_BGP_PEER_AF_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
if "<data/>" in recv_xml: if "<data/>" in recv_xml:
need_cfg = True need_cfg = True
else: else:
re_find = re.findall( re_find = re.findall(r'.*<remoteAddress>%s</remoteAddress>\s*'
r'.*<advertiseIrb>(.*)</advertiseIrb>.*', recv_xml) r'<advertiseIrb>(.*)</advertiseIrb>.*' % remote_address, recv_xml)
if re_find: if re_find:
result["advertise_irb"] = re_find result["advertise_irb"] = re_find
result["vrf_name"] = vrf_name result["vrf_name"] = vrf_name
@ -615,14 +614,14 @@ class BgpNeighborAf(object):
if advertise_arp != 'no_use': if advertise_arp != 'no_use':
conf_str = CE_GET_BGP_PEER_AF_HEADER % ( conf_str = CE_GET_BGP_PEER_AF_HEADER % (
vrf_name, af_type) + "<advertiseArp></advertiseArp>" + CE_GET_BGP_PEER_AF_TAIL vrf_name, af_type, remote_address) + "<advertiseArp></advertiseArp>" + CE_GET_BGP_PEER_AF_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
if "<data/>" in recv_xml: if "<data/>" in recv_xml:
need_cfg = True need_cfg = True
else: else:
re_find = re.findall( re_find = re.findall(r'.*<remoteAddress>%s</remoteAddress>\s*'
r'.*<advertiseArp>(.*)</advertiseArp>.*', recv_xml) r'.*<advertiseArp>(.*)</advertiseArp>.*' % remote_address, recv_xml)
if re_find: if re_find:
result["advertise_arp"] = re_find result["advertise_arp"] = re_find
@ -637,7 +636,7 @@ class BgpNeighborAf(object):
if advertise_remote_nexthop != 'no_use': if advertise_remote_nexthop != 'no_use':
conf_str = CE_GET_BGP_PEER_AF_HEADER % ( conf_str = CE_GET_BGP_PEER_AF_HEADER % (
vrf_name, af_type) + "<advertiseRemoteNexthop></advertiseRemoteNexthop>" + CE_GET_BGP_PEER_AF_TAIL vrf_name, af_type, remote_address) + "<advertiseRemoteNexthop></advertiseRemoteNexthop>" + CE_GET_BGP_PEER_AF_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
if "<data/>" in recv_xml: if "<data/>" in recv_xml:
@ -659,7 +658,7 @@ class BgpNeighborAf(object):
if advertise_community != 'no_use': if advertise_community != 'no_use':
conf_str = CE_GET_BGP_PEER_AF_HEADER % ( conf_str = CE_GET_BGP_PEER_AF_HEADER % (
vrf_name, af_type) + "<advertiseCommunity></advertiseCommunity>" + CE_GET_BGP_PEER_AF_TAIL vrf_name, af_type, remote_address) + "<advertiseCommunity></advertiseCommunity>" + CE_GET_BGP_PEER_AF_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
if "<data/>" in recv_xml: if "<data/>" in recv_xml:
@ -681,9 +680,8 @@ class BgpNeighborAf(object):
if advertise_ext_community != 'no_use': if advertise_ext_community != 'no_use':
conf_str = CE_GET_BGP_PEER_AF_HEADER % ( conf_str = CE_GET_BGP_PEER_AF_HEADER % (
vrf_name, af_type) + "<advertiseExtCommunity></advertiseExtCommunity>" + CE_GET_BGP_PEER_AF_TAIL vrf_name, af_type, remote_address) + "<advertiseExtCommunity></advertiseExtCommunity>" + CE_GET_BGP_PEER_AF_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
if "<data/>" in recv_xml: if "<data/>" in recv_xml:
need_cfg = True need_cfg = True
else: else:
@ -703,7 +701,7 @@ class BgpNeighborAf(object):
if discard_ext_community != 'no_use': if discard_ext_community != 'no_use':
conf_str = CE_GET_BGP_PEER_AF_HEADER % ( conf_str = CE_GET_BGP_PEER_AF_HEADER % (
vrf_name, af_type) + "<discardExtCommunity></discardExtCommunity>" + CE_GET_BGP_PEER_AF_TAIL vrf_name, af_type, remote_address) + "<discardExtCommunity></discardExtCommunity>" + CE_GET_BGP_PEER_AF_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
if "<data/>" in recv_xml: if "<data/>" in recv_xml:
@ -725,7 +723,7 @@ class BgpNeighborAf(object):
if allow_as_loop_enable != 'no_use': if allow_as_loop_enable != 'no_use':
conf_str = CE_GET_BGP_PEER_AF_HEADER % ( conf_str = CE_GET_BGP_PEER_AF_HEADER % (
vrf_name, af_type) + "<allowAsLoopEnable></allowAsLoopEnable>" + CE_GET_BGP_PEER_AF_TAIL vrf_name, af_type, remote_address) + "<allowAsLoopEnable></allowAsLoopEnable>" + CE_GET_BGP_PEER_AF_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
if "<data/>" in recv_xml: if "<data/>" in recv_xml:
@ -750,7 +748,7 @@ class BgpNeighborAf(object):
msg='the value of allow_as_loop_limit %s is out of [1 - 10].' % allow_as_loop_limit) msg='the value of allow_as_loop_limit %s is out of [1 - 10].' % allow_as_loop_limit)
conf_str = CE_GET_BGP_PEER_AF_HEADER % ( conf_str = CE_GET_BGP_PEER_AF_HEADER % (
vrf_name, af_type) + "<allowAsLoopLimit></allowAsLoopLimit>" + CE_GET_BGP_PEER_AF_TAIL vrf_name, af_type, remote_address) + "<allowAsLoopLimit></allowAsLoopLimit>" + CE_GET_BGP_PEER_AF_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
if "<data/>" in recv_xml: if "<data/>" in recv_xml:
@ -772,7 +770,7 @@ class BgpNeighborAf(object):
if keep_all_routes != 'no_use': if keep_all_routes != 'no_use':
conf_str = CE_GET_BGP_PEER_AF_HEADER % ( conf_str = CE_GET_BGP_PEER_AF_HEADER % (
vrf_name, af_type) + "<keepAllRoutes></keepAllRoutes>" + CE_GET_BGP_PEER_AF_TAIL vrf_name, af_type, remote_address) + "<keepAllRoutes></keepAllRoutes>" + CE_GET_BGP_PEER_AF_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
if "<data/>" in recv_xml: if "<data/>" in recv_xml:
@ -794,7 +792,7 @@ class BgpNeighborAf(object):
if nexthop_configure: if nexthop_configure:
conf_str = CE_GET_BGP_PEER_AF_HEADER % ( conf_str = CE_GET_BGP_PEER_AF_HEADER % (
vrf_name, af_type) + "<nextHopConfigure></nextHopConfigure>" + CE_GET_BGP_PEER_AF_TAIL vrf_name, af_type, remote_address) + "<nextHopConfigure></nextHopConfigure>" + CE_GET_BGP_PEER_AF_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
if "<data/>" in recv_xml: if "<data/>" in recv_xml:
@ -819,7 +817,7 @@ class BgpNeighborAf(object):
msg='the value of preferred_value %s is out of [0 - 65535].' % preferred_value) msg='the value of preferred_value %s is out of [0 - 65535].' % preferred_value)
conf_str = CE_GET_BGP_PEER_AF_HEADER % ( conf_str = CE_GET_BGP_PEER_AF_HEADER % (
vrf_name, af_type) + "<preferredValue></preferredValue>" + CE_GET_BGP_PEER_AF_TAIL vrf_name, af_type, remote_address) + "<preferredValue></preferredValue>" + CE_GET_BGP_PEER_AF_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
if "<data/>" in recv_xml: if "<data/>" in recv_xml:
@ -841,7 +839,7 @@ class BgpNeighborAf(object):
if public_as_only != 'no_use': if public_as_only != 'no_use':
conf_str = CE_GET_BGP_PEER_AF_HEADER % ( conf_str = CE_GET_BGP_PEER_AF_HEADER % (
vrf_name, af_type) + "<publicAsOnly></publicAsOnly>" + CE_GET_BGP_PEER_AF_TAIL vrf_name, af_type, remote_address) + "<publicAsOnly></publicAsOnly>" + CE_GET_BGP_PEER_AF_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
if "<data/>" in recv_xml: if "<data/>" in recv_xml:
@ -863,7 +861,7 @@ class BgpNeighborAf(object):
if public_as_only_force != 'no_use': if public_as_only_force != 'no_use':
conf_str = CE_GET_BGP_PEER_AF_HEADER % ( conf_str = CE_GET_BGP_PEER_AF_HEADER % (
vrf_name, af_type) + "<publicAsOnlyForce></publicAsOnlyForce>" + CE_GET_BGP_PEER_AF_TAIL vrf_name, af_type, remote_address) + "<publicAsOnlyForce></publicAsOnlyForce>" + CE_GET_BGP_PEER_AF_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
if "<data/>" in recv_xml: if "<data/>" in recv_xml:
@ -885,7 +883,7 @@ class BgpNeighborAf(object):
if public_as_only_limited != 'no_use': if public_as_only_limited != 'no_use':
conf_str = CE_GET_BGP_PEER_AF_HEADER % ( conf_str = CE_GET_BGP_PEER_AF_HEADER % (
vrf_name, af_type) + "<publicAsOnlyLimited></publicAsOnlyLimited>" + CE_GET_BGP_PEER_AF_TAIL vrf_name, af_type, remote_address) + "<publicAsOnlyLimited></publicAsOnlyLimited>" + CE_GET_BGP_PEER_AF_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
if "<data/>" in recv_xml: if "<data/>" in recv_xml:
@ -907,7 +905,7 @@ class BgpNeighborAf(object):
if public_as_only_replace != 'no_use': if public_as_only_replace != 'no_use':
conf_str = CE_GET_BGP_PEER_AF_HEADER % ( conf_str = CE_GET_BGP_PEER_AF_HEADER % (
vrf_name, af_type) + "<publicAsOnlyReplace></publicAsOnlyReplace>" + CE_GET_BGP_PEER_AF_TAIL vrf_name, af_type, remote_address) + "<publicAsOnlyReplace></publicAsOnlyReplace>" + CE_GET_BGP_PEER_AF_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
if "<data/>" in recv_xml: if "<data/>" in recv_xml:
@ -930,7 +928,7 @@ class BgpNeighborAf(object):
if public_as_only_skip_peer_as != 'no_use': if public_as_only_skip_peer_as != 'no_use':
conf_str = CE_GET_BGP_PEER_AF_HEADER % ( conf_str = CE_GET_BGP_PEER_AF_HEADER % (
vrf_name, af_type) + "<publicAsOnlySkipPeerAs></publicAsOnlySkipPeerAs>" + CE_GET_BGP_PEER_AF_TAIL vrf_name, af_type, remote_address) + "<publicAsOnlySkipPeerAs></publicAsOnlySkipPeerAs>" + CE_GET_BGP_PEER_AF_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
if "<data/>" in recv_xml: if "<data/>" in recv_xml:
@ -956,7 +954,7 @@ class BgpNeighborAf(object):
msg='the value of route_limit %s is out of [1 - 4294967295].' % route_limit) msg='the value of route_limit %s is out of [1 - 4294967295].' % route_limit)
conf_str = CE_GET_BGP_PEER_AF_HEADER % ( conf_str = CE_GET_BGP_PEER_AF_HEADER % (
vrf_name, af_type) + "<routeLimit></routeLimit>" + CE_GET_BGP_PEER_AF_TAIL vrf_name, af_type, remote_address) + "<routeLimit></routeLimit>" + CE_GET_BGP_PEER_AF_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
if "<data/>" in recv_xml: if "<data/>" in recv_xml:
@ -982,7 +980,7 @@ class BgpNeighborAf(object):
msg='Error: The value of route_limit_percent %s is out of [1 - 100].' % route_limit_percent) msg='Error: The value of route_limit_percent %s is out of [1 - 100].' % route_limit_percent)
conf_str = CE_GET_BGP_PEER_AF_HEADER % ( conf_str = CE_GET_BGP_PEER_AF_HEADER % (
vrf_name, af_type) + "<routeLimitPercent></routeLimitPercent>" + CE_GET_BGP_PEER_AF_TAIL vrf_name, af_type, remote_address) + "<routeLimitPercent></routeLimitPercent>" + CE_GET_BGP_PEER_AF_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
if "<data/>" in recv_xml: if "<data/>" in recv_xml:
@ -1004,7 +1002,7 @@ class BgpNeighborAf(object):
if route_limit_type: if route_limit_type:
conf_str = CE_GET_BGP_PEER_AF_HEADER % ( conf_str = CE_GET_BGP_PEER_AF_HEADER % (
vrf_name, af_type) + "<routeLimitType></routeLimitType>" + CE_GET_BGP_PEER_AF_TAIL vrf_name, af_type, remote_address) + "<routeLimitType></routeLimitType>" + CE_GET_BGP_PEER_AF_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
if "<data/>" in recv_xml: if "<data/>" in recv_xml:
@ -1031,7 +1029,7 @@ class BgpNeighborAf(object):
'[1 - 1200].' % route_limit_idle_timeout) '[1 - 1200].' % route_limit_idle_timeout)
conf_str = CE_GET_BGP_PEER_AF_HEADER % ( conf_str = CE_GET_BGP_PEER_AF_HEADER % (
vrf_name, af_type) + "<routeLimitIdleTimeout></routeLimitPercent>" + CE_GET_BGP_PEER_AF_TAIL vrf_name, af_type, remote_address) + "<routeLimitIdleTimeout></routeLimitIdleTimeout>" + CE_GET_BGP_PEER_AF_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
if "<data/>" in recv_xml: if "<data/>" in recv_xml:
@ -1057,7 +1055,7 @@ class BgpNeighborAf(object):
msg='Error: The value of rt_updt_interval %s is out of [0 - 600].' % rt_updt_interval) msg='Error: The value of rt_updt_interval %s is out of [0 - 600].' % rt_updt_interval)
conf_str = CE_GET_BGP_PEER_AF_HEADER % ( conf_str = CE_GET_BGP_PEER_AF_HEADER % (
vrf_name, af_type) + "<rtUpdtInterval></rtUpdtInterval>" + CE_GET_BGP_PEER_AF_TAIL vrf_name, af_type, remote_address) + "<rtUpdtInterval></rtUpdtInterval>" + CE_GET_BGP_PEER_AF_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
if "<data/>" in recv_xml: if "<data/>" in recv_xml:
@ -1079,7 +1077,7 @@ class BgpNeighborAf(object):
if redirect_ip != 'no_use': if redirect_ip != 'no_use':
conf_str = CE_GET_BGP_PEER_AF_HEADER % ( conf_str = CE_GET_BGP_PEER_AF_HEADER % (
vrf_name, af_type) + "<redirectIP></redirectIP>" + CE_GET_BGP_PEER_AF_TAIL vrf_name, af_type, remote_address) + "<redirectIP></redirectIP>" + CE_GET_BGP_PEER_AF_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
if "<data/>" in recv_xml: if "<data/>" in recv_xml:
@ -1101,7 +1099,7 @@ class BgpNeighborAf(object):
if redirect_ip_vaildation != 'no_use': if redirect_ip_vaildation != 'no_use':
conf_str = CE_GET_BGP_PEER_AF_HEADER % ( conf_str = CE_GET_BGP_PEER_AF_HEADER % (
vrf_name, af_type) + "<redirectIPVaildation></redirectIPVaildation>" + CE_GET_BGP_PEER_AF_TAIL vrf_name, af_type, remote_address) + "<redirectIPVaildation></redirectIPVaildation>" + CE_GET_BGP_PEER_AF_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
if "<data/>" in recv_xml: if "<data/>" in recv_xml:
@ -1123,7 +1121,7 @@ class BgpNeighborAf(object):
if reflect_client != 'no_use': if reflect_client != 'no_use':
conf_str = CE_GET_BGP_PEER_AF_HEADER % ( conf_str = CE_GET_BGP_PEER_AF_HEADER % (
vrf_name, af_type) + "<reflectClient></reflectClient>" + CE_GET_BGP_PEER_AF_TAIL vrf_name, af_type, remote_address) + "<reflectClient></reflectClient>" + CE_GET_BGP_PEER_AF_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
if "<data/>" in recv_xml: if "<data/>" in recv_xml:
@ -1145,7 +1143,7 @@ class BgpNeighborAf(object):
if substitute_as_enable != 'no_use': if substitute_as_enable != 'no_use':
conf_str = CE_GET_BGP_PEER_AF_HEADER % ( conf_str = CE_GET_BGP_PEER_AF_HEADER % (
vrf_name, af_type) + "<substituteAsEnable></substituteAsEnable>" + CE_GET_BGP_PEER_AF_TAIL vrf_name, af_type, remote_address) + "<substituteAsEnable></substituteAsEnable>" + CE_GET_BGP_PEER_AF_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
if "<data/>" in recv_xml: if "<data/>" in recv_xml:
@ -1171,7 +1169,7 @@ class BgpNeighborAf(object):
msg='Error: The len of import_rt_policy_name %s is out of [1 - 40].' % import_rt_policy_name) msg='Error: The len of import_rt_policy_name %s is out of [1 - 40].' % import_rt_policy_name)
conf_str = CE_GET_BGP_PEER_AF_HEADER % ( conf_str = CE_GET_BGP_PEER_AF_HEADER % (
vrf_name, af_type) + "<importRtPolicyName></importRtPolicyName>" + CE_GET_BGP_PEER_AF_TAIL vrf_name, af_type, remote_address) + "<importRtPolicyName></importRtPolicyName>" + CE_GET_BGP_PEER_AF_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
if "<data/>" in recv_xml: if "<data/>" in recv_xml:
@ -1197,7 +1195,7 @@ class BgpNeighborAf(object):
msg='Error: The len of export_rt_policy_name %s is out of [1 - 40].' % export_rt_policy_name) msg='Error: The len of export_rt_policy_name %s is out of [1 - 40].' % export_rt_policy_name)
conf_str = CE_GET_BGP_PEER_AF_HEADER % ( conf_str = CE_GET_BGP_PEER_AF_HEADER % (
vrf_name, af_type) + "<exportRtPolicyName></exportRtPolicyName>" + CE_GET_BGP_PEER_AF_TAIL vrf_name, af_type, remote_address) + "<exportRtPolicyName></exportRtPolicyName>" + CE_GET_BGP_PEER_AF_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
if "<data/>" in recv_xml: if "<data/>" in recv_xml:
@ -1223,7 +1221,7 @@ class BgpNeighborAf(object):
msg='Error: The len of import_pref_filt_name %s is out of [1 - 169].' % import_pref_filt_name) msg='Error: The len of import_pref_filt_name %s is out of [1 - 169].' % import_pref_filt_name)
conf_str = CE_GET_BGP_PEER_AF_HEADER % ( conf_str = CE_GET_BGP_PEER_AF_HEADER % (
vrf_name, af_type) + "<importPrefFiltName></importPrefFiltName>" + CE_GET_BGP_PEER_AF_TAIL vrf_name, af_type, remote_address) + "<importPrefFiltName></importPrefFiltName>" + CE_GET_BGP_PEER_AF_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
if "<data/>" in recv_xml: if "<data/>" in recv_xml:
@ -1249,7 +1247,7 @@ class BgpNeighborAf(object):
msg='Error: The len of export_pref_filt_name %s is out of [1 - 169].' % export_pref_filt_name) msg='Error: The len of export_pref_filt_name %s is out of [1 - 169].' % export_pref_filt_name)
conf_str = CE_GET_BGP_PEER_AF_HEADER % ( conf_str = CE_GET_BGP_PEER_AF_HEADER % (
vrf_name, af_type) + "<exportPrefFiltName></exportPrefFiltName>" + CE_GET_BGP_PEER_AF_TAIL vrf_name, af_type, remote_address) + "<exportPrefFiltName></exportPrefFiltName>" + CE_GET_BGP_PEER_AF_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
if "<data/>" in recv_xml: if "<data/>" in recv_xml:
@ -1275,7 +1273,7 @@ class BgpNeighborAf(object):
msg='Error: The value of import_as_path_filter %s is out of [1 - 256].' % import_as_path_filter) msg='Error: The value of import_as_path_filter %s is out of [1 - 256].' % import_as_path_filter)
conf_str = CE_GET_BGP_PEER_AF_HEADER % ( conf_str = CE_GET_BGP_PEER_AF_HEADER % (
vrf_name, af_type) + "<importAsPathFilter></importAsPathFilter>" + CE_GET_BGP_PEER_AF_TAIL vrf_name, af_type, remote_address) + "<importAsPathFilter></importAsPathFilter>" + CE_GET_BGP_PEER_AF_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
if "<data/>" in recv_xml: if "<data/>" in recv_xml:
@ -1301,7 +1299,7 @@ class BgpNeighborAf(object):
msg='Error: The value of export_as_path_filter %s is out of [1 - 256].' % export_as_path_filter) msg='Error: The value of export_as_path_filter %s is out of [1 - 256].' % export_as_path_filter)
conf_str = CE_GET_BGP_PEER_AF_HEADER % ( conf_str = CE_GET_BGP_PEER_AF_HEADER % (
vrf_name, af_type) + "<exportAsPathFilter></exportAsPathFilter>" + CE_GET_BGP_PEER_AF_TAIL vrf_name, af_type, remote_address) + "<exportAsPathFilter></exportAsPathFilter>" + CE_GET_BGP_PEER_AF_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
if "<data/>" in recv_xml: if "<data/>" in recv_xml:
@ -1329,7 +1327,7 @@ class BgpNeighborAf(object):
'of [1 - 51].' % import_as_path_name_or_num) 'of [1 - 51].' % import_as_path_name_or_num)
conf_str = CE_GET_BGP_PEER_AF_HEADER % ( conf_str = CE_GET_BGP_PEER_AF_HEADER % (
vrf_name, af_type) + "<importAsPathNameOrNum></importAsPathNameOrNum>" + CE_GET_BGP_PEER_AF_TAIL vrf_name, af_type, remote_address) + "<importAsPathNameOrNum></importAsPathNameOrNum>" + CE_GET_BGP_PEER_AF_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
if "<data/>" in recv_xml: if "<data/>" in recv_xml:
@ -1357,7 +1355,7 @@ class BgpNeighborAf(object):
'of [1 - 51].' % export_as_path_name_or_num) 'of [1 - 51].' % export_as_path_name_or_num)
conf_str = CE_GET_BGP_PEER_AF_HEADER % ( conf_str = CE_GET_BGP_PEER_AF_HEADER % (
vrf_name, af_type) + "<exportAsPathNameOrNum></exportAsPathNameOrNum>" + CE_GET_BGP_PEER_AF_TAIL vrf_name, af_type, remote_address) + "<exportAsPathNameOrNum></exportAsPathNameOrNum>" + CE_GET_BGP_PEER_AF_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
if "<data/>" in recv_xml: if "<data/>" in recv_xml:
@ -1383,7 +1381,7 @@ class BgpNeighborAf(object):
msg='Error: The len of import_acl_name_or_num %s is out of [1 - 32].' % import_acl_name_or_num) msg='Error: The len of import_acl_name_or_num %s is out of [1 - 32].' % import_acl_name_or_num)
conf_str = CE_GET_BGP_PEER_AF_HEADER % ( conf_str = CE_GET_BGP_PEER_AF_HEADER % (
vrf_name, af_type) + "<importAclNameOrNum></importAclNameOrNum>" + CE_GET_BGP_PEER_AF_TAIL vrf_name, af_type, remote_address) + "<importAclNameOrNum></importAclNameOrNum>" + CE_GET_BGP_PEER_AF_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
if "<data/>" in recv_xml: if "<data/>" in recv_xml:
@ -1409,7 +1407,7 @@ class BgpNeighborAf(object):
msg='Error: The len of export_acl_name_or_num %s is out of [1 - 32].' % export_acl_name_or_num) msg='Error: The len of export_acl_name_or_num %s is out of [1 - 32].' % export_acl_name_or_num)
conf_str = CE_GET_BGP_PEER_AF_HEADER % ( conf_str = CE_GET_BGP_PEER_AF_HEADER % (
vrf_name, af_type) + "<exportAclNameOrNum></exportAclNameOrNum>" + CE_GET_BGP_PEER_AF_TAIL vrf_name, af_type, remote_address) + "<exportAclNameOrNum></exportAclNameOrNum>" + CE_GET_BGP_PEER_AF_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
if "<data/>" in recv_xml: if "<data/>" in recv_xml:
@ -1430,7 +1428,7 @@ class BgpNeighborAf(object):
ipprefix_orf_enable = module.params['ipprefix_orf_enable'] ipprefix_orf_enable = module.params['ipprefix_orf_enable']
if ipprefix_orf_enable != 'no_use': if ipprefix_orf_enable != 'no_use':
conf_str = CE_GET_BGP_PEER_AF_HEADER % ( conf_str = CE_GET_BGP_PEER_AF_HEADER % (
vrf_name, af_type) + "<ipprefixOrfEnable></ipprefixOrfEnable>" + CE_GET_BGP_PEER_AF_TAIL vrf_name, af_type, remote_address) + "<ipprefixOrfEnable></ipprefixOrfEnable>" + CE_GET_BGP_PEER_AF_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
if "<data/>" in recv_xml: if "<data/>" in recv_xml:
@ -1452,7 +1450,7 @@ class BgpNeighborAf(object):
if is_nonstd_ipprefix_mod != 'no_use': if is_nonstd_ipprefix_mod != 'no_use':
conf_str = CE_GET_BGP_PEER_AF_HEADER % ( conf_str = CE_GET_BGP_PEER_AF_HEADER % (
vrf_name, af_type) + "<isNonstdIpprefixMod></isNonstdIpprefixMod>" + CE_GET_BGP_PEER_AF_TAIL vrf_name, af_type, remote_address) + "<isNonstdIpprefixMod></isNonstdIpprefixMod>" + CE_GET_BGP_PEER_AF_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
if "<data/>" in recv_xml: if "<data/>" in recv_xml:
@ -1478,7 +1476,7 @@ class BgpNeighborAf(object):
msg='Error: The value of orftype %s is out of [0 - 65535].' % orftype) msg='Error: The value of orftype %s is out of [0 - 65535].' % orftype)
conf_str = CE_GET_BGP_PEER_AF_HEADER % ( conf_str = CE_GET_BGP_PEER_AF_HEADER % (
vrf_name, af_type) + "<orftype></orftype>" + CE_GET_BGP_PEER_AF_TAIL vrf_name, af_type, remote_address) + "<orftype></orftype>" + CE_GET_BGP_PEER_AF_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
if "<data/>" in recv_xml: if "<data/>" in recv_xml:
@ -1500,7 +1498,7 @@ class BgpNeighborAf(object):
if orf_mode: if orf_mode:
conf_str = CE_GET_BGP_PEER_AF_HEADER % ( conf_str = CE_GET_BGP_PEER_AF_HEADER % (
vrf_name, af_type) + "<orfMode></orfMode>" + CE_GET_BGP_PEER_AF_TAIL vrf_name, af_type, remote_address) + "<orfMode></orfMode>" + CE_GET_BGP_PEER_AF_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
if "<data/>" in recv_xml: if "<data/>" in recv_xml:
@ -1526,7 +1524,7 @@ class BgpNeighborAf(object):
msg='Error: The len of soostring %s is out of [3 - 21].' % soostring) msg='Error: The len of soostring %s is out of [3 - 21].' % soostring)
conf_str = CE_GET_BGP_PEER_AF_HEADER % ( conf_str = CE_GET_BGP_PEER_AF_HEADER % (
vrf_name, af_type) + "<soostring></soostring>" + CE_GET_BGP_PEER_AF_TAIL vrf_name, af_type, remote_address) + "<soostring></soostring>" + CE_GET_BGP_PEER_AF_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
if "<data/>" in recv_xml: if "<data/>" in recv_xml:
@ -1548,7 +1546,7 @@ class BgpNeighborAf(object):
if default_rt_adv_enable != 'no_use': if default_rt_adv_enable != 'no_use':
conf_str = CE_GET_BGP_PEER_AF_HEADER % ( conf_str = CE_GET_BGP_PEER_AF_HEADER % (
vrf_name, af_type) + "<defaultRtAdvEnable></defaultRtAdvEnable>" + CE_GET_BGP_PEER_AF_TAIL vrf_name, af_type, remote_address) + "<defaultRtAdvEnable></defaultRtAdvEnable>" + CE_GET_BGP_PEER_AF_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
if "<data/>" in recv_xml: if "<data/>" in recv_xml:
@ -1574,7 +1572,7 @@ class BgpNeighborAf(object):
msg='Error: The len of default_rt_adv_policy %s is out of [1 - 40].' % default_rt_adv_policy) msg='Error: The len of default_rt_adv_policy %s is out of [1 - 40].' % default_rt_adv_policy)
conf_str = CE_GET_BGP_PEER_AF_HEADER % ( conf_str = CE_GET_BGP_PEER_AF_HEADER % (
vrf_name, af_type) + "<defaultRtAdvPolicy></defaultRtAdvPolicy>" + CE_GET_BGP_PEER_AF_TAIL vrf_name, af_type, remote_address) + "<defaultRtAdvPolicy></defaultRtAdvPolicy>" + CE_GET_BGP_PEER_AF_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
if "<data/>" in recv_xml: if "<data/>" in recv_xml:
@ -1596,7 +1594,7 @@ class BgpNeighborAf(object):
if default_rt_match_mode: if default_rt_match_mode:
conf_str = CE_GET_BGP_PEER_AF_HEADER % ( conf_str = CE_GET_BGP_PEER_AF_HEADER % (
vrf_name, af_type) + "<defaultRtMatchMode></defaultRtMatchMode>" + CE_GET_BGP_PEER_AF_TAIL vrf_name, af_type, remote_address) + "<defaultRtMatchMode></defaultRtMatchMode>" + CE_GET_BGP_PEER_AF_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
if "<data/>" in recv_xml: if "<data/>" in recv_xml:
@ -1618,7 +1616,7 @@ class BgpNeighborAf(object):
if add_path_mode: if add_path_mode:
conf_str = CE_GET_BGP_PEER_AF_HEADER % ( conf_str = CE_GET_BGP_PEER_AF_HEADER % (
vrf_name, af_type) + "<addPathMode></addPathMode>" + CE_GET_BGP_PEER_AF_TAIL vrf_name, af_type, remote_address) + "<addPathMode></addPathMode>" + CE_GET_BGP_PEER_AF_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
if "<data/>" in recv_xml: if "<data/>" in recv_xml:
@ -1644,7 +1642,7 @@ class BgpNeighborAf(object):
msg='Error: The value of adv_add_path_num %s is out of [2 - 64].' % adv_add_path_num) msg='Error: The value of adv_add_path_num %s is out of [2 - 64].' % adv_add_path_num)
conf_str = CE_GET_BGP_PEER_AF_HEADER % ( conf_str = CE_GET_BGP_PEER_AF_HEADER % (
vrf_name, af_type) + "<advAddPathNum></advAddPathNum>" + CE_GET_BGP_PEER_AF_TAIL vrf_name, af_type, remote_address) + "<advAddPathNum></advAddPathNum>" + CE_GET_BGP_PEER_AF_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
if "<data/>" in recv_xml: if "<data/>" in recv_xml:
@ -1666,7 +1664,7 @@ class BgpNeighborAf(object):
if origin_as_valid != 'no_use': if origin_as_valid != 'no_use':
conf_str = CE_GET_BGP_PEER_AF_HEADER % ( conf_str = CE_GET_BGP_PEER_AF_HEADER % (
vrf_name, af_type) + "<originAsValid></originAsValid>" + CE_GET_BGP_PEER_AF_TAIL vrf_name, af_type, remote_address) + "<originAsValid></originAsValid>" + CE_GET_BGP_PEER_AF_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
if "<data/>" in recv_xml: if "<data/>" in recv_xml:
@ -1688,7 +1686,7 @@ class BgpNeighborAf(object):
if vpls_enable != 'no_use': if vpls_enable != 'no_use':
conf_str = CE_GET_BGP_PEER_AF_HEADER % ( conf_str = CE_GET_BGP_PEER_AF_HEADER % (
vrf_name, af_type) + "<vplsEnable></vplsEnable>" + CE_GET_BGP_PEER_AF_TAIL vrf_name, af_type, remote_address) + "<vplsEnable></vplsEnable>" + CE_GET_BGP_PEER_AF_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
if "<data/>" in recv_xml: if "<data/>" in recv_xml:
@ -1710,7 +1708,7 @@ class BgpNeighborAf(object):
if vpls_ad_disable != 'no_use': if vpls_ad_disable != 'no_use':
conf_str = CE_GET_BGP_PEER_AF_HEADER % ( conf_str = CE_GET_BGP_PEER_AF_HEADER % (
vrf_name, af_type) + "<vplsAdDisable></vplsAdDisable>" + CE_GET_BGP_PEER_AF_TAIL vrf_name, af_type, remote_address) + "<vplsAdDisable></vplsAdDisable>" + CE_GET_BGP_PEER_AF_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
if "<data/>" in recv_xml: if "<data/>" in recv_xml:
@ -1733,7 +1731,7 @@ class BgpNeighborAf(object):
if update_pkt_standard_compatible != 'no_use': if update_pkt_standard_compatible != 'no_use':
conf_str = CE_GET_BGP_PEER_AF_HEADER % ( conf_str = CE_GET_BGP_PEER_AF_HEADER % (
vrf_name, af_type) + "<updatePktStandardCompatible></updatePktStandardCompatible>" + \ vrf_name, af_type, remote_address) + "<updatePktStandardCompatible></updatePktStandardCompatible>" + \
CE_GET_BGP_PEER_AF_TAIL CE_GET_BGP_PEER_AF_TAIL
recv_xml = self.netconf_get_config(module=module, conf_str=conf_str) recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
@ -1773,6 +1771,7 @@ class BgpNeighborAf(object):
module.fail_json(msg='Error: Merge bgp peer address family failed.') module.fail_json(msg='Error: Merge bgp peer address family failed.')
cmds = [] cmds = []
cmd = af_type
if af_type == "ipv4uni": if af_type == "ipv4uni":
cmd = "ipv4-family unicast" cmd = "ipv4-family unicast"
elif af_type == "ipv4multi": elif af_type == "ipv4multi":
@ -1802,6 +1801,7 @@ class BgpNeighborAf(object):
module.fail_json(msg='Error: Create bgp peer address family failed.') module.fail_json(msg='Error: Create bgp peer address family failed.')
cmds = [] cmds = []
cmd = af_type
if af_type == "ipv4uni": if af_type == "ipv4uni":
cmd = "ipv4-family unicast" cmd = "ipv4-family unicast"
elif af_type == "ipv4multi": elif af_type == "ipv4multi":
@ -1831,6 +1831,7 @@ class BgpNeighborAf(object):
module.fail_json(msg='Error: Delete bgp peer address family failed.') module.fail_json(msg='Error: Delete bgp peer address family failed.')
cmds = [] cmds = []
cmd = af_type
if af_type == "ipv4uni": if af_type == "ipv4uni":
cmd = "ipv4-family unicast" cmd = "ipv4-family unicast"
elif af_type == "ipv4multi": elif af_type == "ipv4multi":
@ -1861,7 +1862,7 @@ class BgpNeighborAf(object):
if advertise_irb != 'no_use': if advertise_irb != 'no_use':
conf_str += "<advertiseIrb>%s</advertiseIrb>" % advertise_irb conf_str += "<advertiseIrb>%s</advertiseIrb>" % advertise_irb
if advertise_irb == "ture": if advertise_irb == "true":
cmd = "peer %s advertise irb" % remote_address cmd = "peer %s advertise irb" % remote_address
else: else:
cmd = "undo peer %s advertise irb" % remote_address cmd = "undo peer %s advertise irb" % remote_address
@ -1871,7 +1872,7 @@ class BgpNeighborAf(object):
if advertise_arp != 'no_use': if advertise_arp != 'no_use':
conf_str += "<advertiseArp>%s</advertiseArp>" % advertise_arp conf_str += "<advertiseArp>%s</advertiseArp>" % advertise_arp
if advertise_arp == "ture": if advertise_arp == "true":
cmd = "peer %s advertise arp" % remote_address cmd = "peer %s advertise arp" % remote_address
else: else:
cmd = "undo peer %s advertise arp" % remote_address cmd = "undo peer %s advertise arp" % remote_address
@ -2081,6 +2082,12 @@ class BgpNeighborAf(object):
if substitute_as_enable != 'no_use': if substitute_as_enable != 'no_use':
conf_str += "<substituteAsEnable>%s</substituteAsEnable>" % substitute_as_enable conf_str += "<substituteAsEnable>%s</substituteAsEnable>" % substitute_as_enable
if substitute_as_enable == "true":
cmd = "peer %s substitute-as" % remote_address
else:
cmd = "undo peer %s substitute-as" % remote_address
cmds.append(cmd)
import_rt_policy_name = module.params['import_rt_policy_name'] import_rt_policy_name = module.params['import_rt_policy_name']
if import_rt_policy_name: if import_rt_policy_name:
conf_str += "<importRtPolicyName>%s</importRtPolicyName>" % import_rt_policy_name conf_str += "<importRtPolicyName>%s</importRtPolicyName>" % import_rt_policy_name
@ -2210,12 +2217,13 @@ class BgpNeighborAf(object):
cmd += "peer %s default-route-advertise" % remote_address cmd += "peer %s default-route-advertise" % remote_address
else: else:
cmd += "undo peer %s default-route-advertise" % remote_address cmd += "undo peer %s default-route-advertise" % remote_address
cmds.append(cmd)
default_rt_adv_policy = module.params['default_rt_adv_policy'] default_rt_adv_policy = module.params['default_rt_adv_policy']
if default_rt_adv_policy: if default_rt_adv_policy:
conf_str += "<defaultRtAdvPolicy>%s</defaultRtAdvPolicy>" % default_rt_adv_policy conf_str += "<defaultRtAdvPolicy>%s</defaultRtAdvPolicy>" % default_rt_adv_policy
cmd = " route-policy %s" % default_rt_adv_policy
cmd += " route-policy %s" % default_rt_adv_policy cmds.append(cmd)
default_rt_match_mode = module.params['default_rt_match_mode'] default_rt_match_mode = module.params['default_rt_match_mode']
if default_rt_match_mode: if default_rt_match_mode:
@ -2232,11 +2240,21 @@ class BgpNeighborAf(object):
add_path_mode = module.params['add_path_mode'] add_path_mode = module.params['add_path_mode']
if add_path_mode: if add_path_mode:
conf_str += "<addPathMode>%s</addPathMode>" % add_path_mode conf_str += "<addPathMode>%s</addPathMode>" % add_path_mode
if add_path_mode == "receive":
cmd += " add-path receive"
elif add_path_mode == "send":
cmd += " add-path send"
elif add_path_mode == "both":
cmd += " add-path both"
if cmd:
cmds.append(cmd)
adv_add_path_num = module.params['adv_add_path_num'] adv_add_path_num = module.params['adv_add_path_num']
if adv_add_path_num: if adv_add_path_num:
conf_str += "<advAddPathNum>%s</advAddPathNum>" % adv_add_path_num conf_str += "<advAddPathNum>%s</advAddPathNum>" % adv_add_path_num
cmd += " advertise add-path path-number %s" % adv_add_path_num
if cmd:
cmds.append(cmd)
origin_as_valid = module.params['origin_as_valid'] origin_as_valid = module.params['origin_as_valid']
if origin_as_valid != 'no_use': if origin_as_valid != 'no_use':
conf_str += "<originAsValid>%s</originAsValid>" % origin_as_valid conf_str += "<originAsValid>%s</originAsValid>" % origin_as_valid