Commit d6f1b4ed authored by mengxuan.zhao's avatar mengxuan.zhao
Browse files

OperateVNFWorkflow

parent 3a5608ff
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -16,7 +16,7 @@ Suite Teardown Terminate All Processes kill=true




*** Test Cases ***
*** Test Cases ***
Scale out a VNF Instance
Change VNF Flavour Operation
    [Documentation]    Test ID: 5.x.y.x
    [Documentation]    Test ID: 5.x.y.x
    ...    Test title: Change VNF Flavour Operation
    ...    Test title: Change VNF Flavour Operation
    ...    Test objective: The objective is to test a change flavour operation of an existing VNF instance
    ...    Test objective: The objective is to test a change flavour operation of an existing VNF instance
@@ -25,7 +25,7 @@ Scale out a VNF Instance
    ...    Config ID: Config_prod_VNFM
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: change flavour operation is supported for the VNF (as capability in the VNFD)
    ...    Applicability: change flavour operation is supported for the VNF (as capability in the VNFD)
    ...    Post-Conditions: VNF instance still in INSTANTIATED state and the flavour is changed
    ...    Post-Conditions: VNF instance still in INSTANTIATED state and the flavour is changed
    Send VNF Scale Out Request
    Send Change VNF Flavour Request
    Check HTTP Response Status Code Is    202
    Check HTTP Response Status Code Is    202
    Check HTTP Response Header Contains    Location 
    Check HTTP Response Header Contains    Location 
    Check Operation Occurrence Id
    Check Operation Occurrence Id
+62 −0
Original line number Original line Diff line number Diff line
*** Settings ***
Resource    environment/configuration.txt
Resource    environment/variables.txt
Resource    environment/scaleVariables.txt
Resource    VnfLcmMntOperationKeywords.robot
Resource    SubscriptionKeywords.robot
Library    REST    ${VNFM_SCHEMA}://${VNFM_HOST}:${VNFM_PORT}    
...    spec=SOL003-VNFLifecycleManagement-API.yaml
Library    OperatingSystem
Library    BuiltIn
Library    Collections
Library    JSONLibrary
Library    Process
Suite Setup    Initialize System
Suite Teardown    Terminate All Processes    kill=true


*** Test Cases ***
Operate a VNF Instance
    [Documentation]    Test ID: 5.x.y.x
    ...    Test title: Operate a VNF Instance
    ...    Test objective: The objective is to change the operational state of a VNF instance.
    ...    Pre-conditions: VNF instance in INSTANTIATED state (Test ID: 5.a.b.c)
    ...    Reference: section 5.3.3 - SOL003 v2.4.1
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: change the operational state of a VNF instance is supported for the VNF (as capability in the VNFD)
    ...    Post-Conditions: VNF instance still in INSTANTIATED state and the operational state is changed
    Send Change VNF Operational State Request
    Check HTTP Response Status Code Is    202
    Check HTTP Response Header Contains    Location 
    Check Operation Occurrence Id
    Check Operation Notification For Operate    STARTING
    Create a new Grant - Sync - OPERATE
    Check Operation Notification For Change Flavour    PROCESSING
    Check Operation Notification For Change Flavour    COMPLETED
    Check Postcondition VNF    OPERATE

*** Keywords ***

Initialize System
    Create Sessions
    ${body}=    Get File    json/operateVnFRequest.json
    ${changeVnfOperateRequest}=    evaluate    json.loads('''${body}''')    json
    ${requestedState}=    Get Value From Json    ${changeVnfOperateRequest}    $..changeStateTo 
    
Precondition Checks
    Check resource instantiated
    ${LccnSubscriptions}=    Check subscriptions about one VNFInstance and operation type    ${vnfInstanceId}    VnfLcmOperationOccurrenceNotification    operationType=SCALE

Check Postcondition VNF
    [Arguments]    ${operation}
    Check resource instantiated
    ${newState}=    Get Vnf Operational State Info    ${vnfInstanceId}
    Should be Equal    ${requestedState}    ${newState}
    
Create a new Grant - Sync - OPERATE
    Create a new Grant - Synchronous mode        ${vnfInstanceId}    ${vnfLcmOpOccId}    OPERATE
    
Check Operation Notification For Operate 
    [Arguments]    ${status}
    Check Operation Notification    VnfLcmOperationOccurrenceNotification   ${status}
    
 No newline at end of file
+14 −0
Original line number Original line Diff line number Diff line
@@ -66,6 +66,12 @@ Get Vnf Flavour Info
    ${flavourInfo}=    Get Value From Json    ${vnfInstance}    $..flavourId
    ${flavourInfo}=    Get Value From Json    ${vnfInstance}    $..flavourId
    [Return]    ${flavourInfo}
    [Return]    ${flavourInfo}


Get Vnf Operational State Info
    [Arguments]    ${vnfInstanceId}
    ${vnfInstance}=    Get Vnf Instance    ${vnfInstanceId}
    ${stateInfo}=    Get Value From Json    ${vnfInstance}    $..vnfState
    [Return]    ${stateInfo}

Check HTTP Response Header Contains
Check HTTP Response Header Contains
    [Arguments]    ${CONTENT_TYPE}
    [Arguments]    ${CONTENT_TYPE}
    Should Contain    ${response.headers}    ${CONTENT_TYPE}
    Should Contain    ${response.headers}    ${CONTENT_TYPE}
@@ -113,6 +119,14 @@ Send Change VNF Flavour Request
    ${body}=    Get File    json/changeVnfFlavourRequest.json
    ${body}=    Get File    json/changeVnfFlavourRequest.json
    ${response}=    Post    ${apiRoot}/${apiName}/${apiVersion}/vnf_instances/${vnfInstanceId}/change_flavour    ${body}
    ${response}=    Post    ${apiRoot}/${apiName}/${apiVersion}/vnf_instances/${vnfInstanceId}/change_flavour    ${body}


Send Change VNF Operational State Request
    Log    Trying to change the operational state of a VNF instance.
    Set Headers  {"Accept":"${ACCEPT}"}  
    Set Headers  {"Content-Type": "${CONTENT_TYPE}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    ${body}=    Get File    json/operateVnFRequest.json
    ${response}=    Post    ${apiRoot}/${apiName}/${apiVersion}/vnf_instances/${vnfInstanceId}/operate    ${body}
  
Create a new Grant - Synchronous mode
Create a new Grant - Synchronous mode
    [Arguments]    ${vnfInstanceId}    ${vnfLcmOpOccId}    ${operation}
    [Arguments]    ${vnfInstanceId}    ${vnfLcmOpOccId}    ${operation}
    Log    Request a new Grant for a VNF LCM operation by POST to ${apiRoot}/${apiName}/${apiVersion}/grants
    Log    Request a new Grant for a VNF LCM operation by POST to ${apiRoot}/${apiName}/${apiVersion}/grants