Skip to content
Snippets Groups Projects

Update IPtrunk migration IPAM step behaviour

Merged Karel van Klink requested to merge feature/update-trunk-migration-ipam into develop
All threads resolved!
Files
2
@@ -542,26 +542,25 @@ def delete_old_config_real(
@@ -542,26 +542,25 @@ def delete_old_config_real(
@step("Update IP records in IPAM")
@step("Update IP records in IPAM")
def update_ipam(subscription: Iptrunk, old_side_data: dict, new_node: Router, new_lag_interface: str) -> State:
def update_ipam(subscription: Iptrunk, replace_index: int, new_node: Router, new_lag_interface: str) -> State:
"""Update :term:`IPAM` resources.
"""Update :term:`IPAM` resources.
Move the DNS record pointing to the old side of the trunk, to the new side.
Move the DNS record pointing to the old side of the trunk, to the new side.
"""
"""
old_fqdn = f"{old_side_data['iptrunk_side_ae_iface']}.{old_side_data['iptrunk_side_node']['router_fqdn']}"
v4_addr = subscription.iptrunk.iptrunk_ipv4_network[replace_index]
trunk_v4 = infoblox.find_host_by_fqdn(old_fqdn)
v6_addr = subscription.iptrunk.iptrunk_ipv6_network[replace_index]
trunk_v6 = infoblox.find_v6_host_by_fqdn(old_fqdn)
# Out with the old
# Out with the old
try:
try:
infoblox.delete_host_by_fqdn(old_fqdn)
infoblox.delete_host_by_ip(subscription.iptrunk.iptrunk_ipv4_network[replace_index])
except DeletionError as e:
except DeletionError as e:
msg = "Failed to delete record from Infoblox."
msg = "Failed to delete record from Infoblox."
raise ProcessFailureError(msg) from e
raise ProcessFailureError(msg) from e
# And in with the new
# And in with the new
new_fqdn = f"{new_lag_interface}.{new_node.router.router_fqdn}"
new_fqdn = f"{new_lag_interface}-0.{new_node.router.router_fqdn}"
comment = str(subscription.subscription_id)
comment = str(subscription.subscription_id)
infoblox.create_host_by_ip(new_fqdn, trunk_v4.ipv4addr, trunk_v6.ipv6addr, service_type="TRUNK", comment=comment)
infoblox.create_host_by_ip(new_fqdn, v4_addr, v6_addr, "TRUNK", comment)
return {"subscription": subscription}
return {"subscription": subscription}
Loading