[Backport/2.9/61683]Update ce_vrf_af to fix bugs (#62654)

* Update ce_vrf_af to fix bugs

(cherry picked from commit 0c65db1a23)

* Update ce_vrf_af modified information
pull/64281/head
yanzhangi 5 years ago committed by Toshio Kuratomi
parent 8c0e7bfb25
commit d869985a4c

@ -0,0 +1,2 @@
bugfixes:
- ce_vrf_af - update to fix some bugs - Add some update statements. (https://github.com/ansible/ansible/pull/61683)

@ -494,6 +494,11 @@ class VrfAf(object):
""" set update command""" """ set update command"""
if not self.changed: if not self.changed:
return 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": if self.state == "present":
self.updates_cmd.append('ip vpn-instance %s' % (self.vrf)) self.updates_cmd.append('ip vpn-instance %s' % (self.vrf))
if self.vrf_aftype == 'ipv4uni': if self.vrf_aftype == 'ipv4uni':
@ -512,18 +517,18 @@ class VrfAf(object):
if not self.is_vrf_rt_exist(): if not self.is_vrf_rt_exist():
if self.evpn is False: if self.evpn is False:
self.updates_cmd.append( 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: else:
self.updates_cmd.append( 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": elif self.vpn_target_state == "absent":
if self.is_vrf_rt_exist(): if self.is_vrf_rt_exist():
if self.evpn is False: if self.evpn is False:
self.updates_cmd.append( 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: else:
self.updates_cmd.append( 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: else:
self.updates_cmd.append('ip vpn-instance %s' % (self.vrf)) self.updates_cmd.append('ip vpn-instance %s' % (self.vrf))
if self.vrf_aftype == 'ipv4uni': if self.vrf_aftype == 'ipv4uni':

Loading…
Cancel
Save