Commit 86cb9876 authored by mengxuan.zhao's avatar mengxuan.zhao
Browse files

add delete and changflavour workflow

parent 00027262
Loading
Loading
Loading
Loading
+63 −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 ***
Scale out a VNF Instance
    [Documentation]    Test ID: 5.x.y.x
    ...    Test title: Change VNF Flavour Operation
    ...    Test objective: The objective is to test a change flavour operation of an existing 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 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
    Send VNF Scale Out Request
    Check HTTP Response Status Code Is    202
    Check HTTP Response Header Contains    Location 
    Check Operation Occurrence Id
    Check Operation Notification For Change Flavour    STARTING
    Create a new Grant - Sync - CHANGE_FLAVOUR
    Check Operation Notification For Change Flavour    PROCESSING
    Check Operation Notification For Change Flavour    COMPLETED
    Check Postcondition VNF    CHANGE_FLAVOUR

*** Keywords ***

Initialize System
    Create Sessions
    ${body}=    Get File    json/changeVnfFlavourRequest.json
    ${changeVnfFlavourRequest}=    evaluate    json.loads('''${body}''')    json
    ${requestedFlavour}=    Get Value From Json    ${changeVnfFlavourRequest}    $..newFlavourId
    
Precondition Checks
    Check resource instantiated
    ${LccnSubscriptions}=    Check subscriptions about one VNFInstance and operation type    ${vnfInstanceId}    VnfLcmOperationOccurrenceNotification    operationType=SCALE
    ${scaleInfo}=    Get Vnf Scale Info        ${vnfInstanceId}

Check Postcondition VNF
    [Arguments]    ${operation}
    Check resource instantiated
    ${newFlavour}=    Get Vnf Flavour Info    ${vnfInstanceId}
    Should be Equal    ${requestedFlavour}    ${newFlavour}
    
Create a new Grant - Sync - CHANGE_FLAVOUR
    Create a new Grant - Synchronous mode        ${vnfInstanceId}    ${vnfLcmOpOccId}    CHANGE_FLAVOUR
    
Check Operation Notification For Change Flavour
    [Arguments]    ${status}
    Check Operation Notification    VnfLcmOperationOccurrenceNotification   ${status}
    
 No newline at end of file
+47 −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 ***
Create a VNF Instance
    [Documentation]    Test ID: 5.x.y.x
    ...    Test title: Delete a VNF instance procedure
    ...    Test objective: The objective is to test the procedure for the deletion of a VNF instance resource.
    ...    Pre-conditions: The resource representing the VNF instance to be deleted needs to be in NOT_INSTANTIATED state
    ...    Reference: section 5.3.2 - SOL003 v2.4.1
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: 
    ...    Post-Conditions: The resource representing the VNF instance has been removed from the list of VNF instance resources
    Send VNF delete Request
    Check HTTP Response Status Code Is    204 
    Check Operation Notification For Create   VnfIdentifierDeletionNotification
    Check Postcondition VNF    DELETE

*** Keywords ***

Initialize System
    Create Sessions

Check Postcondition VNF
    [Arguments]    ${operation}
    Check VNF Instance    ${vnfInstanceId}
    Check HTTP Response Status Code Is    404
   
Check Operation Notification For Create
    [Arguments]    ${element}
    ${json}=	Get File	schemas/${element}.schema.json
    Configure Notification Handler    ${notification_ep}       
    
 No newline at end of file
+3 −3
Original line number Original line Diff line number Diff line
@@ -31,7 +31,7 @@ Scale out a VNF Instance
    Check HTTP Response Header Contains    Location 
    Check HTTP Response Header Contains    Location 
    Check Operation Occurrence Id
    Check Operation Occurrence Id
    Check Operation Notification For Scale   STARTING
    Check Operation Notification For Scale   STARTING
    Create a new Grant - Sync - Scale
    Create a new Grant - Sync - ScaleToLevel
    Check Operation Notification For Scale    PROCESSING
    Check Operation Notification For Scale    PROCESSING
    Check Operation Notification For Scale    COMPLETED
    Check Operation Notification For Scale    COMPLETED
    Check Postcondition VNF    
    Check Postcondition VNF    
@@ -63,8 +63,8 @@ Compare ScaleInfos
    Should be true    ${old_level_value}==${new_level_value}
    Should be true    ${old_level_value}==${new_level_value}
    
    
   
   
Create a new Grant - Sync - Scale
Create a new Grant - Sync - ScaleToLevel
    Create a new Grant - Synchronous mode        ${vnfInstanceId}    ${vnfLcmOpOccId}    SCALE
    Create a new Grant - Synchronous mode        ${vnfInstanceId}    ${vnfLcmOpOccId}    SCALE_TO_LEVEL
    
    
Check Operation Notification For Scale
Check Operation Notification For Scale
    [Arguments]    ${status}
    [Arguments]    ${status}
+19 −0
Original line number Original line Diff line number Diff line
@@ -60,6 +60,12 @@ Get Vnf Scale Info
    ${scaleInfo}=    Get Value From Json    ${vnfInstance}    $..scaleStatus
    ${scaleInfo}=    Get Value From Json    ${vnfInstance}    $..scaleStatus
    [Return]   ${scaleInfo} 
    [Return]   ${scaleInfo} 


Get Vnf Flavour Info
    [Arguments]    ${vnfInstanceId}
    ${vnfInstance}=    Get Vnf Instance    ${vnfInstanceId}
    ${flavourInfo}=    Get Value From Json    ${vnfInstance}    $..flavourId
    [Return]    ${flavourInfo}

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}
@@ -94,6 +100,19 @@ Send VNF Create Request
    ${body}=    Get File    json/createVnfRequest.json
    ${body}=    Get File    json/createVnfRequest.json
    ${response}=    Post    ${apiRoot}/${apiName}/${apiVersion}/vnf_instances    ${body}
    ${response}=    Post    ${apiRoot}/${apiName}/${apiVersion}/vnf_instances    ${body}


Send VNF Delete Request
    log    Delete an individual VNF instance
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    ${response}=    Delete    ${apiRoot}/${apiName}/${apiVersion}/vnf_instances/${vnfInstanceId}

Send Change VNF Flavour Request
    Log    Trying to change the deployment flavour 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/changeVnfFlavourRequest.json
    ${response}=    Post    ${apiRoot}/${apiName}/${apiVersion}/vnf_instances/${vnfInstanceId}/change_flavour    ${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