diff --git a/python/understack-workflows/tests/json_samples/event-interface-update.json b/python/understack-workflows/tests/json_samples/event-interface-update.json index 468d653c..9c322387 100644 --- a/python/understack-workflows/tests/json_samples/event-interface-update.json +++ b/python/understack-workflows/tests/json_samples/event-interface-update.json @@ -71,7 +71,6 @@ "natural_slug": "1327198-gp2s-3-understack-iad3_core-5836965_spine1-1_iad3_iad_company_global_0ccd", "custom_fields": { "core_number": 1327198, - "connected_to_network": "provisioning", "ironic_provision_state": "" }, "secrets_group": null, @@ -231,7 +230,6 @@ "natural_slug": "1327198-gp2s-3-understack-iad3_core-5836965_spine1-1_iad3_iad_company_global_0ccd", "custom_fields": { "core_number": 1327198, - "connected_to_network": "provisioning", "ironic_provision_state": "" }, "secrets_group": null, @@ -391,7 +389,6 @@ "natural_slug": "1327198-gp2s-3-understack-iad3_core-5836965_spine1-1_iad3_iad_company_global_0ccd", "custom_fields": { "core_number": 1327198, - "connected_to_network": "provisioning", "ironic_provision_state": "" }, "secrets_group": null, diff --git a/python/understack-workflows/understack_workflows/main/undersync_device.py b/python/understack-workflows/understack_workflows/main/undersync_device.py index 449754a6..886cb88c 100644 --- a/python/understack-workflows/understack_workflows/main/undersync_device.py +++ b/python/understack-workflows/understack_workflows/main/undersync_device.py @@ -12,10 +12,8 @@ logger = setup_logger(__name__) -network_name_status = { - "tenant": "Active", - "provisioning": "Provisioning Interface" -} +network_name_status = {"tenant": "Active", "provisioning": "Provisioning Interface"} + def update_nautobot(args) -> UUID: device_id = args.device_id @@ -29,7 +27,9 @@ def update_nautobot(args) -> UUID: nautobot = Nautobot(nb_url, nb_token, logger=logger) logger.info(f"Updating Nautobot {device_id=!s} {interface_mac=!s} {network_name=}") - interface = nautobot.update_switch_interface_status(device_id, interface_mac, new_status) + interface = nautobot.update_switch_interface_status( + device_id, interface_mac, new_status + ) logger.info(f"Updated Nautobot {device_id=!s} {interface_mac=!s} {network_name=}") switch_id = interface.device.id @@ -45,7 +45,9 @@ def call_undersync(args, switch_id: UUID): undersync = Undersync(undersync_token) try: - return undersync.sync_devices([switch_id], dry_run=args.dry_run, force=args.force) + return undersync.sync_devices( + [str(switch_id)], dry_run=args.dry_run, force=args.force + ) except Exception as error: logger.error(error) sys.exit(2) @@ -81,11 +83,11 @@ def argument_parser(): def main(): - """Updates connected_to_network and triggers Undersync. + """Updates Interface status in Nautobot triggers Undersync. - Updates Nautobot Device's 'connected_to_network' field and follows with - request to Undersync service, requesting sync for all of the - uplink_switches that the device is connected to. + Updates Nautobot Interfaces's status field and follows with request to + Undersync service, requesting sync for all of the uplink_switches that the + device is connected to. """ args = argument_parser().parse_args()