diff --git a/gso/services/kentik_client.py b/gso/services/kentik_client.py index 1f4c7ce2a5f9e21daa07959ed695d3b7e7a6f0e6..3a6da3574006eaec4fc428f5f7229621062a478d 100644 --- a/gso/services/kentik_client.py +++ b/gso/services/kentik_client.py @@ -114,7 +114,8 @@ class KentikClient: plan_id = self.get_plan_by_name(self.config.billing_plans[device.site_tier])["id"] request_body = { "device": { - **device.model_dump(exclude=set("site_tier")), + **device.model_dump(exclude=set("device_name" "site_tier")), + "device_name": device.device_description, "device_type": self.config.device_type, "device_subtype": self.config.device_type, "minimize_snmp": self.config.minimize_snmp, @@ -128,7 +129,14 @@ class KentikClient: } } - return self._send_request("POST", "v5/device", request_body).json() + new_device = self._send_request("POST", "v5/device", request_body).json() + + # The name of the device has to be updated from the subscription ID to its FQDN. + # This is a limitation of the Kentik API that disallows settings device names containing a . symbol. + self.update_device(new_device["device"]["id"], {"device": {"device_name": device.device_name}}) + new_device["device"]["device_name"] = device.device_name + + return new_device def update_device(self, device_id: str, updated_device: dict[str, Any]) -> dict[str, Any]: """Update an existing device in Kentik."""