Update ce_evpn_bgp to fix bugs (#61136)

This commit is contained in:
yanzhangi 2019-09-18 10:08:27 +08:00 committed by ansibot
parent 1a8c1c7365
commit 90958b01c1

View file

@ -136,7 +136,7 @@ end_state:
import re import re
from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.network.cloudengine.ce import get_config, load_config from ansible.module_utils.network.cloudengine.ce import exec_command, load_config
from ansible.module_utils.network.cloudengine.ce import ce_argument_spec from ansible.module_utils.network.cloudengine.ce import ce_argument_spec
@ -238,18 +238,20 @@ class EvpnBgp(object):
def get_evpn_overlay_config(self): def get_evpn_overlay_config(self):
"""get evpn-overlay enable configuration""" """get evpn-overlay enable configuration"""
flags = list() cmd = "display current-configuration | include ^evpn-overlay enable"
exp = "| ignore-case include evpn-overlay enable" rc, out, err = exec_command(self.module, cmd)
flags.append(exp) if rc != 0:
return get_config(self.module, flags) self.module.fail_json(msg=err)
return out
def get_current_config(self): def get_current_config(self):
"""get current configuration""" """get current configuration"""
flags = list() cmd = "display current-configuration | section include bgp %s" % self.bgp_instance
exp = "| ignore-case section include bgp %s" % self.bgp_instance rc, out, err = exec_command(self.module, cmd)
flags.append(exp) if rc != 0:
return get_config(self.module, flags) self.module.fail_json(msg=err)
return out
def cli_add_command(self, command, undo=False): def cli_add_command(self, command, undo=False):
"""add command to self.update_cmd and self.commands""" """add command to self.update_cmd and self.commands"""
@ -501,6 +503,10 @@ class EvpnBgp(object):
if not self.config: if not self.config:
return return
self.config_list = self.config.split('l2vpn-family evpn')
if len(self.config_list) == 2:
self.l2vpn_evpn_exist = True
if self.bgp_instance: if self.bgp_instance:
self.end_state["bgp_instance"] = self.bgp_instance self.end_state["bgp_instance"] = self.bgp_instance