*** Settings ***
Resource    environment/variables.txt
Resource    VnfLcmMntOperationKeywords.robot
Resource    SubscriptionKeywords.robot
Library    REST    ${VNFM_SCHEMA}://${VNFM_HOST}:${VNFM_PORT}    ssl_verify=false
Library    OperatingSystem
Library    BuiltIn
Library    Collections
Library    JSONLibrary
Library    Process
Suite Setup    Initialize System
Suite Teardown    Terminate All Processes    kill=true

*** Test Cases ***
Fail a VNF LCM Operation Workflow
    [Documentation]    Test ID: 7.3.1.24.1
    ...    Test title: Fail a VNF LCM Operation Workflow
    ...    Test objective: The objective is to test the workflow for a Fail VNF LCM Operation
    ...    Pre-conditions: The VNF lifecycle management operation occurrence is in FAILED_TEMP state. NFVO is subscribed to VNF LCM Operation Occurrence notifications 
    ...    Reference: Clause 5.4.16 - ETSI GS NFV-SOL 003 [1] v2.8.1
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: NFVO is able to receive notifications from VNFM
    ...    Post-Conditions: The VNF lifecycle management operation occurrence is in FAILED state
    Send Fail Operation Request
    Check Operation Notification For Fail    FAILED
    Check HTTP Response Status Code Is    200
    Check Postcondition VNF Fail 

*** Keywords ***
Initialize System
    Create Sessions

Check Postcondition VNF Fail
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
    Get    ${apiRoot}/${apiName}/${apiMajorVersion}/vnf_lcm_op_occs/${vnfLcmOpOccId} 
    String    response body operationState    FAILED
 
Check Operation Notification For Fail 
    [Arguments]    ${status}
    Check Operation Notification    VnfLcmOperationOccurrenceNotification   ${status}