Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion tests/03-deviations/21-sros-nonrevertive.robot
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion tests/03-deviations/22-srl-nonrevertive.robot
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 15 additions & 4 deletions tests/Keywords/deviation.robot
Original file line number Diff line number Diff line change
Expand Up @@ -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-<config-name>" (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
Expand All @@ -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}
RETURN ${rc} ${output}
Loading