parent
7ddf7474d3
commit
87fd93f140
1 changed files with 3 additions and 8 deletions
|
@ -122,7 +122,6 @@ class L3_interfaces(ConfigBase):
|
||||||
extant = have[interface_name]
|
extant = have[interface_name]
|
||||||
else:
|
else:
|
||||||
extant = dict()
|
extant = dict()
|
||||||
|
|
||||||
intf_commands = set_interface(desired, extant)
|
intf_commands = set_interface(desired, extant)
|
||||||
intf_commands.extend(clear_interface(desired, extant))
|
intf_commands.extend(clear_interface(desired, extant))
|
||||||
|
|
||||||
|
@ -177,7 +176,6 @@ class L3_interfaces(ConfigBase):
|
||||||
extant = dict()
|
extant = dict()
|
||||||
|
|
||||||
intf_commands = set_interface(desired, extant)
|
intf_commands = set_interface(desired, extant)
|
||||||
|
|
||||||
if intf_commands:
|
if intf_commands:
|
||||||
commands.append("interface {0}".format(interface_name))
|
commands.append("interface {0}".format(interface_name))
|
||||||
commands.extend(intf_commands)
|
commands.extend(intf_commands)
|
||||||
|
@ -231,7 +229,6 @@ def set_interface(want, have):
|
||||||
for address in want_ipv6 - have_ipv6:
|
for address in want_ipv6 - have_ipv6:
|
||||||
address = dict(address)
|
address = dict(address)
|
||||||
commands.append("ipv6 address {0}".format(address["address"]))
|
commands.append("ipv6 address {0}".format(address["address"]))
|
||||||
|
|
||||||
return commands
|
return commands
|
||||||
|
|
||||||
|
|
||||||
|
@ -240,7 +237,7 @@ def clear_interface(want, have):
|
||||||
|
|
||||||
want_ipv4 = set(tuple(address.items()) for address in want.get("ipv4") or [])
|
want_ipv4 = set(tuple(address.items()) for address in want.get("ipv4") or [])
|
||||||
have_ipv4 = set(tuple(address.items()) for address in have.get("ipv4") or [])
|
have_ipv4 = set(tuple(address.items()) for address in have.get("ipv4") or [])
|
||||||
if not want_ipv4:
|
if not want_ipv4 and have_ipv4:
|
||||||
commands.append("no ip address")
|
commands.append("no ip address")
|
||||||
else:
|
else:
|
||||||
for address in have_ipv4 - want_ipv4:
|
for address in have_ipv4 - want_ipv4:
|
||||||
|
@ -250,9 +247,8 @@ def clear_interface(want, have):
|
||||||
if tuple(address.items()) in want_ipv4:
|
if tuple(address.items()) in want_ipv4:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
address_cmd = "no ip address"
|
|
||||||
if address.get("secondary"):
|
if address.get("secondary"):
|
||||||
address_cmd += " {0} secondary".format(address["address"])
|
address_cmd = " {0} secondary".format(address["address"])
|
||||||
commands.append(address_cmd)
|
commands.append(address_cmd)
|
||||||
|
|
||||||
if "secondary" not in address:
|
if "secondary" not in address:
|
||||||
|
@ -264,5 +260,4 @@ def clear_interface(want, have):
|
||||||
for address in have_ipv6 - want_ipv6:
|
for address in have_ipv6 - want_ipv6:
|
||||||
address = dict(address)
|
address = dict(address)
|
||||||
commands.append("no ipv6 address {0}".format(address["address"]))
|
commands.append("no ipv6 address {0}".format(address["address"]))
|
||||||
|
|
||||||
return commands
|
return commands
|
||||||
|
|
Loading…
Reference in a new issue