diff --git a/gso/workflows/router/validate_router.py b/gso/workflows/router/validate_router.py index 675def732c33824ac386713707303b5968afef9d..02c4b5c773d0ebe8a1ff19af199538479ce9d310 100644 --- a/gso/workflows/router/validate_router.py +++ b/gso/workflows/router/validate_router.py @@ -17,7 +17,7 @@ from gso.services.librenms_client import LibreNMSClient from gso.services.lso_client import LSOState, anonymous_lso_interaction from gso.services.netbox_client import NetboxClient from gso.services.subscriptions import get_active_layer_3_services_on_router, get_active_vrfs_linked_to_router -from gso.settings import load_oss_params +from gso.settings import EnvironmentEnum, load_oss_params from gso.utils.helpers import generate_inventory_for_routers from gso.utils.shared_enums import Vendor @@ -159,9 +159,15 @@ def check_kentik_entry_exists(subscription: Router) -> None: message="Device not found in Kentik", details={"device": subscription.router.router_fqdn} ) + oss_params = load_oss_params() + # If there are active layer 3 services, check the license type. It may not be the placeholder or archiving license. - if bool(get_active_layer_3_services_on_router(subscription.subscription_id)): - kentik_params = load_oss_params().KENTIK + # This check is only performed in a production environment + if ( + bool(get_active_layer_3_services_on_router(subscription.subscription_id)) + and oss_params.GENERAL.environment == EnvironmentEnum.PRODUCTION + ): + kentik_params = oss_params.KENTIK archive_plan = client.get_plan_by_name(kentik_params.archive_license_key) if any(device["device_name"] == subscription.router.router_fqdn for device in archive_plan["devices"]): raise ProcessFailureError(