Skip to content

Validating "operationState" gets failure in v2.8.1

[Problem statement]

In api-tests v2.8.1, the testcase "POST Heal a vnfInstance" fails in validating the variable "operationState".

The following is an output in running the testcase as example.

HealVNFTask
==============================================================================
POST Heal a vnfInstance :: Test ID: 7.3.1.8.1 Test title: POST Hea... | FAIL |
Resolving variable '${response['body']['operationState']}' failed: TypeError: string indices must be integers
------------------------------------------------------------------------------
HealVNFTask                                                           | FAIL |
1 test, 0 passed, 1 failed

"POST Heal a vnfInstance" contains a testcase "Check Individual VNF LCM operation occurrence operationState is" to validate "operationState" as below.

<api-tests/SOL003/VNFLifecycleManagement-API/HealVNFTask.robot>

POST Heal a vnfInstance
     [Documentation]    Test ID: 7.3.1.8.1
    ...    Test title: POST Heal a vnfInstance
    ...    Test objective: The objective is to test that POST method heal a VNF instance
    ...    Pre-conditions: the VNF instance resource is not in NOT-INSTANTIATED state
    ...    Reference: Clause 5.4.9.3.1 - ETSI GS NFV-SOL 003 [1] v2.8.1
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
    ...    Post-Conditions: none
    POST Heal VNF
    Check HTTP Response Status Code Is    202
    Check HTTP Response Header Contains    Location
    Check Individual VNF LCM operation occurrence operationState is     STARTING    <==== Calling a testcase to validate "operationState"

In this testcase, ${response['body']['operationState']} is validated with ${status} at the line (B) as below. The error occurs in this step.

<api-tests/SOL003/VNFLifecycleManagement-API/VnfLcmMntOperationKeywords.robot>

Check Individual VNF LCM operation occurrence operationState is
    [Arguments]    ${status}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
    Get    ${response['headers']['Location']}    <==== (A)
    Log    Validate operationState
    Log to console    ${response}
    Should Be Equal as Strings  ${response['body']['operationState']}    ${status}    <==== (B)
    Log    operationState validated

We have also observed that the testcase "POST instantiate individual vnfInstance" gets the same failure.

[Assumed root cause]

The following is our assumption for approaching the root cause.

The line (A) in the above testcase means executing a HTTP request "GET /vnflcm/v1/vnf_lcm_op_occs/{vnfLcmOpOccId}". The response of this API request contains "operationState". However, this line doesn’t obtain any variables from the response such as the variable "response".

On the other hand, the line (B) expects that "response['body']['operationState’]" contains "operationState". However, there is none in fact, so the equality check always fails.

If this assumption is correct, we can avoid this issue by holding a response value in line (A) like below.

${response}= Get ${response['headers']['Location']}

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information