Skip to content
Snippets Groups Projects
Commit 90d1209f authored by Karel van Klink's avatar Karel van Klink :smiley_cat: Committed by Mohammad Torkashvand
Browse files

When removing a device from Kentik, also attempt delimiting the FQDN with...

When removing a device from Kentik, also attempt delimiting the FQDN with underscores if it's a Juniper device
parent 114b239b
No related branches found
No related tags found
1 merge request!396Update Kentik handling in router validation and termination
...@@ -260,8 +260,15 @@ def kentik_apply_archive_license(subscription: Router) -> State: ...@@ -260,8 +260,15 @@ def kentik_apply_archive_license(subscription: Router) -> State:
kentik_client = KentikClient() kentik_client = KentikClient()
kentik_archive_plan_id = kentik_client.get_plan_by_name(load_oss_params().KENTIK.archive_license_key)["id"] kentik_archive_plan_id = kentik_client.get_plan_by_name(load_oss_params().KENTIK.archive_license_key)["id"]
kentik_device = kentik_client.get_device_by_name(subscription.router.router_fqdn) kentik_device = kentik_client.get_device_by_name(subscription.router.router_fqdn)
if "id" not in kentik_device and subscription.router.vendor == Vendor.JUNIPER:
# If the device is a Juniper, there is a chance that the FQDN is written with underscores as delimiter.
kentik_device = kentik_client.get_device_by_name(subscription.router.router_fqdn.replace(".", "_"))
if "id" not in kentik_device: if "id" not in kentik_device:
return {"kentik_device": "Device not found, no license applied"} return {
"kentik_device": f"Device {subscription.router.router_fqdn} not found in Kentik, no license applied! "
f"Also when replacing periods with underscores in the FQDN."
}
updated_device = {"device": {"plan_id": kentik_archive_plan_id, "device_sample_rate": 1}} updated_device = {"device": {"plan_id": kentik_archive_plan_id, "device_sample_rate": 1}}
kentik_device = kentik_client.update_device(kentik_device["id"], updated_device) kentik_device = kentik_client.update_device(kentik_device["id"], updated_device)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment