Update the subscription model of an R&E LHCOne subscription.
Source code in gso/workflows/l3_core_service/r_and_e_lhcone/shared.py
| @step("Update R&E LHCOne-specific attributes")
def update_r_and_e_lhcone_subscription_model(
subscription: SubscriptionModel,
v4_bgp_local_preference: NonNegativeInt,
v4_bgp_med: MultiExitDiscriminator,
v6_bgp_local_preference: NonNegativeInt,
v6_bgp_med: MultiExitDiscriminator,
) -> State:
"""Update the subscription model of an R&E LHCOne subscription."""
subscription.r_and_e_lhcone.v4_bgp_local_preference = v4_bgp_local_preference # type: ignore[attr-defined]
subscription.r_and_e_lhcone.v4_bgp_med = v4_bgp_med # type: ignore[attr-defined]
subscription.r_and_e_lhcone.v6_bgp_local_preference = v6_bgp_local_preference # type: ignore[attr-defined]
subscription.r_and_e_lhcone.v6_bgp_med = v6_bgp_med # type: ignore[attr-defined]
scoped_subscription = json.loads(json_dumps(subscription))
scoped_subscription["l3_core"] = scoped_subscription[subscription.service_name_attribute]["l3_core"] # type: ignore[attr-defined]
return {"subscription": subscription, "scoped_subscription": scoped_subscription}
|