From 400b78b9bb5857dd9258aed4f85f419c53d4ebfc Mon Sep 17 00:00:00 2001 From: Alexander North Date: Fri, 22 May 2026 17:26:53 +0200 Subject: [PATCH] align deviation names --- .../03-deviations/21-sros-nonrevertive.robot | 3 ++- tests/03-deviations/22-srl-nonrevertive.robot | 3 ++- tests/Keywords/deviation.robot | 19 +++++++++++++++---- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/tests/03-deviations/21-sros-nonrevertive.robot b/tests/03-deviations/21-sros-nonrevertive.robot index 268a377..c2e9fc4 100644 --- a/tests/03-deviations/21-sros-nonrevertive.robot +++ b/tests/03-deviations/21-sros-nonrevertive.robot @@ -295,9 +295,10 @@ Partial Revert Deviations For Intent by Admin State @{targetnodes} = Get Target Nodes For Intent ${intent} ${SDCIO_SROS_NODES} ${targetnode} = Get From List ${targetnodes} 0 ${deviation_name} = Get Deviation Name ${intent} ${targetnode} + ${deviation_resource} = Get Config Deviation Resource Name ${deviation_name} ${filter_path} = Set Variable /configure/service/vprn[service-name=${intents.${intent}}]/admin-state ${rc} ${output} = Run And Return Rc And Output - ... kubectl sdc deviation --deviation ${deviation_name} --filter-path ${filter_path} --revert + ... kubectl sdc deviation --deviation ${deviation_resource} --filter-path ${filter_path} --revert Log ${output} Should Be Equal As Integers ${rc} 0 Wait Until Keyword Succeeds diff --git a/tests/03-deviations/22-srl-nonrevertive.robot b/tests/03-deviations/22-srl-nonrevertive.robot index 6e75f57..b356350 100644 --- a/tests/03-deviations/22-srl-nonrevertive.robot +++ b/tests/03-deviations/22-srl-nonrevertive.robot @@ -326,9 +326,10 @@ Partial Revert Deviations For Intent by Interface @{targetnodes} = Get Target Nodes For Intent ${intent} ${SDCIO_SRL_NODES} ${targetnode} = Get From List ${targetnodes} 0 ${deviation_name} = Get Deviation Name ${intent} ${targetnode} + ${deviation_resource} = Get Config Deviation Resource Name ${deviation_name} ${interface_path} = Set Variable /interface[name=${intentsinterfaces.${intent}}] ${rc} ${output} = Run And Return Rc And Output - ... kubectl sdc deviation --deviation ${deviation_name} --filter-path ${interface_path} --revert + ... kubectl sdc deviation --deviation ${deviation_resource} --filter-path ${interface_path} --revert Log ${output} Should Be Equal As Integers ${rc} 0 Wait Until Keyword Succeeds diff --git a/tests/Keywords/deviation.robot b/tests/Keywords/deviation.robot index 6d6b1dd..30a53cb 100644 --- a/tests/Keywords/deviation.robot +++ b/tests/Keywords/deviation.robot @@ -3,17 +3,27 @@ Resource k8s/kubectl.robot Library RPA.JSON *** Keywords *** +Get Config Deviation Resource Name + [Documentation] Returns the canonical Deviation CR name for a given Config CR name. + ... config-server names Deviations of type "config" as "config-" (see + ... apis/config/v1alpha1/deviation_helpers.go: DeviationName), so the test inputs + ... (which carry the underlying Config name) need this prefix to address the actual + ... Deviation resource on k8s. + [Arguments] ${config_name} + RETURN config-${config_name} + Verify Deviation on k8s [Documentation] Verify the deviation CR on k8s, check if the deviation counter is increased [Arguments] ${name} ${match} + ${deviation_name} = Get Config Deviation Resource Name ${name} ${rc} ${output} = Run And Return Rc And Output - ... kubectl get deviation.config.sdcio.dev/${name} -n ${SDCIO_RESOURCE_NAMESPACE} -o json + ... kubectl get deviation.config.sdcio.dev/${deviation_name} -n ${SDCIO_RESOURCE_NAMESPACE} -o json Log ${output} ${rc} ${output} = Run And Return Rc And Output ... kubectl get configs.config.sdcio.dev/${name} -n ${SDCIO_RESOURCE_NAMESPACE} -o json Log ${output} ${rc} ${output} = Run And Return Rc And Output - ... kubectl get deviation.config.sdcio.dev/${name} -n ${SDCIO_RESOURCE_NAMESPACE} -o json | jq '.spec.deviations // [] | length' + ... kubectl get deviation.config.sdcio.dev/${deviation_name} -n ${SDCIO_RESOURCE_NAMESPACE} -o json | jq '.spec.deviations // [] | length' Log ${output} ${result} = Convert To Integer ${output} Should Be Equal As Integers ${rc} 0 @@ -22,8 +32,9 @@ Verify Deviation on k8s Delete Deviation [Documentation] Delete the deviation CR on k8s [Arguments] ${name} + ${deviation_name} = Get Config Deviation Resource Name ${name} ${rc} ${output} = Run And Return Rc And Output - ... kubectl sdc deviation --deviation ${name} --revert -n ${SDCIO_RESOURCE_NAMESPACE} + ... kubectl sdc deviation --deviation ${deviation_name} --revert -n ${SDCIO_RESOURCE_NAMESPACE} Log ${output} Should Be Equal As Integers ${rc} 0 - RETURN ${rc} ${output} \ No newline at end of file + RETURN ${rc} ${output}