From db0f290ca317839978ad22eabb29a8af9e4cb2d8 Mon Sep 17 00:00:00 2001 From: yanzhangi <51999930+yanzhangi@users.noreply.github.com> Date: Wed, 18 Sep 2019 09:45:18 +0800 Subject: [PATCH] Update ce_vrf_af to fix bugs (#61683) --- .../modules/network/cloudengine/ce_vrf_af.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/ansible/modules/network/cloudengine/ce_vrf_af.py b/lib/ansible/modules/network/cloudengine/ce_vrf_af.py index c019e1af8db..c89ed2c5f58 100644 --- a/lib/ansible/modules/network/cloudengine/ce_vrf_af.py +++ b/lib/ansible/modules/network/cloudengine/ce_vrf_af.py @@ -494,6 +494,11 @@ class VrfAf(object): """ set update command""" if not self.changed: return + if self.vpn_target_type: + if self.vpn_target_type == "export_extcommunity": + vpn_target_type = "export-extcommunity" + else: + vpn_target_type = "import-extcommunity" if self.state == "present": self.updates_cmd.append('ip vpn-instance %s' % (self.vrf)) if self.vrf_aftype == 'ipv4uni': @@ -512,18 +517,18 @@ class VrfAf(object): if not self.is_vrf_rt_exist(): if self.evpn is False: self.updates_cmd.append( - 'vpn-target %s %s' % (self.vpn_target_value, self.vpn_target_type)) + 'vpn-target %s %s' % (self.vpn_target_value, vpn_target_type)) else: self.updates_cmd.append( - 'vpn-target %s %s evpn' % (self.vpn_target_value, self.vpn_target_type)) + 'vpn-target %s %s evpn' % (self.vpn_target_value, vpn_target_type)) elif self.vpn_target_state == "absent": if self.is_vrf_rt_exist(): if self.evpn is False: self.updates_cmd.append( - 'undo vpn-target %s %s' % (self.vpn_target_value, self.vpn_target_type)) + 'undo vpn-target %s %s' % (self.vpn_target_value, vpn_target_type)) else: self.updates_cmd.append( - 'undo vpn-target %s %s evpn' % (self.vpn_target_value, self.vpn_target_type)) + 'undo vpn-target %s %s evpn' % (self.vpn_target_value, vpn_target_type)) else: self.updates_cmd.append('ip vpn-instance %s' % (self.vrf)) if self.vrf_aftype == 'ipv4uni':