lag config changes (#61361)

Signed-off-by: rohitthakur2590 <rohitthakur2590@outlook.com>
pull/61368/head
Rohit 5 years ago committed by GitHub
parent ee05d6bde2
commit b24e1c0077
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -286,12 +286,14 @@ class Lag_interfaces(ConfigBase):
if 'interval' in arp_monitor: if 'interval' in arp_monitor:
commands.append( commands.append(
self._compute_command(key, 'interval', str(arp_monitor['interval'])) self._compute_command(
key=want['name'] + ' arp-monitor', attrib='interval', value=str(arp_monitor['interval'])
)
) )
if diff_targets: if diff_targets:
for target in diff_targets: for target in diff_targets:
commands.append( commands.append(
self._compute_commands(key, 'target', target) self._compute_command(key=want['name'] + ' arp-monitor', attrib='target', value=target)
) )
return commands return commands
@ -311,7 +313,6 @@ class Lag_interfaces(ConfigBase):
have_arp_target = [] have_arp_target = []
want_arp_monitor = want.get(key) or {} want_arp_monitor = want.get(key) or {}
have_arp_monitor = have.get(key) or {} have_arp_monitor = have.get(key) or {}
del_cmd = 'delete interface bonding ' + have['name']
if want_arp_monitor and 'target' in want_arp_monitor: if want_arp_monitor and 'target' in want_arp_monitor:
want_arp_target = want_arp_monitor['target'] want_arp_target = want_arp_monitor['target']
@ -320,12 +321,20 @@ class Lag_interfaces(ConfigBase):
have_arp_target = have_arp_monitor['target'] have_arp_target = have_arp_monitor['target']
if 'interval' in have_arp_monitor and not want_arp_monitor: if 'interval' in have_arp_monitor and not want_arp_monitor:
commands.append(del_cmd + ' ' + key + ' interval') commands.append(
self._compute_command(
key=have['name'] + ' arp-monitor', attrib='interval', remove=True
)
)
if 'target' in have_arp_monitor: if 'target' in have_arp_monitor:
target_diff = list_diff_have_only(want_arp_target, have_arp_target) target_diff = list_diff_have_only(want_arp_target, have_arp_target)
if target_diff: if target_diff:
for target in target_diff: for target in target_diff:
commands.append(del_cmd + ' ' + key + ' target ' + target) commands.append(
self._compute_command(
key=have['name'] + ' arp-monitor', attrib='target', value=target, remove=True
)
)
return commands return commands
@ -339,7 +348,7 @@ class Lag_interfaces(ConfigBase):
for member in members_diff: for member in members_diff:
commands.append( commands.append(
self._compute_command( self._compute_command(
member[key], 'bond-group', have['name'], False, 'ethernet' member['member'], 'bond-group', have['name'], True, 'ethernet'
) )
) )
return commands return commands

Loading…
Cancel
Save