diff --git a/ocp_resources/user_defined_network.py b/ocp_resources/user_defined_network.py index 7d7f87e934..7951bb51f5 100644 --- a/ocp_resources/user_defined_network.py +++ b/ocp_resources/user_defined_network.py @@ -68,6 +68,22 @@ def to_dict(self) -> None: # End of generated code + def wait_for_network_ready(self, timeout: int = 30) -> None: + """ + Wait for the network to be ready. + + Args: + timeout (int, optional): Maximum time to wait in seconds. Defaults to 30. + + Raises: + TimeoutExpiredError: If the network is not ready within the specified timeout. + """ + self.wait_for_condition( + condition=self.Condition.NETWORK_READY, + status=self.Condition.Status.TRUE, + timeout=timeout, + ) + class Layer2UserDefinedNetwork(UserDefinedNetwork): """ diff --git a/ocp_resources/utils/resource_constants.py b/ocp_resources/utils/resource_constants.py index 8d0351a8e7..5f69a2e1d7 100644 --- a/ocp_resources/utils/resource_constants.py +++ b/ocp_resources/utils/resource_constants.py @@ -27,6 +27,7 @@ class Condition: RECONCILE_COMPLETE: str = "ReconcileComplete" READY: str = "Ready" FAILING: str = "Failing" + NETWORK_READY = "NetworkReady" class Status: TRUE: str = "True"