Commit 392b71fa authored by Giacomo Bernini's avatar Giacomo Bernini
Browse files

udpated VNF instance creation and query test ID 11.3.1

parent 5297a36d
Loading
Loading
Loading
Loading
+119 −0
Original line number Diff line number Diff line
@@ -7,11 +7,20 @@ Library Process
Library           String
Library           Collections
Library           String
Library           MockServerLibrary
Variables         descriptors/SOL001/VNFD/vnfd_SOL001.yaml
Variables         descriptors/SOL006/VNFD/vnfd_SOL006.yaml
Library           REST    ${None}    ssl_verify=${False}

*** Keywords ***
Initialize System
    Create Sessions

Create Sessions   
    Start Process  java  -jar  ${MOCK_SERVER_JAR}    -serverPort  ${callback_port}  alias=mockInstance
    Wait For Process  handle=mockInstance  timeout=5s  on_timeout=continue
    Create Mock Session  ${callback_uri}:${callback_port}

GET Individual VNF Package
    [Documentation]    Test ID: 7.3.3.2.1
    ...    Test title: GET Individual VNF Package
@@ -107,6 +116,24 @@ Instantiate a vnfInstance
    Check HTTP Response Header Contains    Location
    Check Individual VNF LCM operation occurrence operationState is    STARTING

VNF Instantiation
    [Documentation]    Test ID: 7.3.1.26.1
    ...    Test title: VNF Instantiation workflow
    ...    Test objective: The objective is to test the workflow for the instantiation of a VNF instance
    ...    Pre-conditions: VNF instance resources is already created. NFVO is subscribed to VNF LCM Operation Occurrence notifications 
    ...    Reference: Clause 5.4.4 - ETSI GS NFV-SOL 003 [1] v4.4.1
    ...    Config ID: Config_prod_VNFM
    ...    Applicability:  NFVO is able to receive notifications from VNFM
    ...    Post-Conditions: VNF instance in INSTANTIATED state
    Send VNF Instantiation Request
    Check HTTP Response Status Code Is    202
    Check HTTP Response Header Contains    Location
    Check Operation Occurrence Id existence
    Check Operation Notification For Instantiation  STARTING
    Check Operation Notification For Instantiation  PROCESSING
    Check Operation Notification For Instantiation  COMPLETED
    Check Postcondition VNF Status  INSTANTIATED

POST Terminate a vnfInstance
    [Documentation]    Test ID: 7.3.1.7.1
    ...    Test title: POST Terminate a vnfInstance
@@ -413,3 +440,95 @@ Check Individual VNF LCM operation occurrence operationState is
    Log    Validate operationState
    Should Be Equal as Strings    ${opOccResponse['body']['operationState']}    ${status}
    Log    operationState validated

Send VNF Instantiation Request
    Log    Instantiate a VNF Instance
    Set Headers  {"Accept":"${ACCEPT}"}  
    Set Headers  {"Content-Type": "${CONTENT_TYPE}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
    ${body}=    Get File    jsons/instantiateVnfRequest.json
    Post    ${VNFM_API_ROOT}/${VNFM_API_NAME}/${VNFM_API_MAJOR_VERSION}/vnf_instances/${vnfid}/instantiate    ${body}
    ${outputResponse}=    Output    response
    Set Global Variable    ${response}    ${outputResponse}

Configure Notification Status Handler
    [Arguments]    ${endpoint}    ${status}=""
    ${json}=     Create Dictionary
    ${value}=    Run Keyword And Return Status    Should Not Be Equal As Strings    ${status}        ""
    Run Keyword If   ${value} == True      Set to dictionary    ${json}    operationState    ${status}
    Log  Creating mock request and response to handle ${element}
    ${notification_request}=  Create Mock Request Matcher	POST  ${endpoint}  body_type='JSON'    body=${json}
    &{headers}=  Create Dictionary  Content-Type=application/json
    ${notification_response}=  Create Mock Response	    status_code=${status}    headers=${headers}     
    Create Mock Expectation  ${notification_request}  ${notification_response}
    [Return]    ${notification_request}
    
Configure Notification VNF Instance Handler
    [Arguments]    ${endpoint}    ${instanceId}=""
    ${json}=     Create Dictionary
    ${value}=    Run Keyword And Return Status    Should Not Be Equal As Strings    ${instanceId}        ""
    Run Keyword If   ${value} == True      Set to dictionary    ${json}    vnfInstanceId    ${instanceId}
    Log  Creating mock request and response to handle ${element}
    ${notification_request}=  Create Mock Request Matcher	POST  ${endpoint}    body_type='JSON'  body=${json}
    &{headers}=  Create Dictionary  Content-Type=application/json
    ${notification_response}=  Create Mock Response     204    headers=${headers}    
    Log    ${notification_request}
    Log    ${notification_response}
    Create Mock Expectation  ${notification_request}  ${notification_response}
    [Return]    ${notification_request}

Configure Notification Forward
    [Arguments]    ${element}    ${endpoint}    ${endpoint_fwd}
    ${json}=    Get File    schemas/${element}.schema.json
    Log  Creating mock HTTP forward to handle ${element}
    ${notification_tmp}=  Create Mock Request Matcher	POST  ${endpoint}  body_type='JSON_SCHEMA'    body=${json}
    ${notification_fwd}=  Create Mock Http Forward	${endpoint_fwd}
    Create Mock Expectation With Http Forward  ${notification_tmp}  ${notification_fwd}
    [Return]  ${notification_tmp}

Check Operation Notification
    [Arguments]    ${element}    ${status}=""
    ${json}=	Get File	schemas/${element}.schema.json
    ${req1}=    Configure Notification Forward    ${element}    ${callback_endpoint}    ${callback_endpoint_fwd}
    ${req2}=    Configure Notification Status Handler    ${callback_endpoint_fwd}    ${status}
    Wait Until Keyword Succeeds    12 sec   3 sec   Verify Mock Expectation    ${req2}
    Clear Requests    ${callback_endpoint}
    Clear Requests    ${callback_endpoint_fwd}
    
Check VNF Instance Operation Notification
    [Arguments]    ${element}   ${instance_id}
    ${json}=	Get File	schemas/${element}.schema.json
    ${req1}=  Configure Notification Forward   ${element}    ${callback_endpoint}    ${callback_endpoint_fwd}
    ${req2}=  Configure Notification VNF Instance Handler    ${callback_endpoint_fwd}    ${instance_id}
    Wait Until Keyword Succeeds    12 sec  3 sec   Verify Mock Expectation    ${req2}
    Clear Requests    ${callback_endpoint}
    Clear Requests    ${callback_endpoint_fwd}

Check Operation Notification For Instantiation
    [Arguments]    ${status}
    Check Operation Notification    VnfLcmOperationOccurrenceNotification   ${status}

Check Postcondition VNF Status
    [Arguments]    ${status}
    Log    Retrieve VNF Instance
    Check VNF Instance    ${vnfid}
    Should Not Be Empty    ${response}
    Check HTTP Response Status Code Is    200
    Should Be Equal    ${response['body']['id']}    ${vnfInstanceId}    
    Check HTTP Response Header Contains    Content-Type
    Check HTTP Response Body Json Schema Is    vnfInstance.schema.json
    Check VNF Status    ${response['body']['instantiationState']}    ${status}

Check VNF Instance
    [Arguments]    ${vnfid}
    Set Headers  {"Accept":"${ACCEPT}"}  
    Set Headers  {"Content-Type": "${CONTENT_TYPE}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
    Get    ${VNFM_API_ROOT}/${VNFM_API_NAME}/${VNFM_API_MAJOR_VERSION}/vnf_instances/${vnfid}
    ${outputResponse}=    Output    response
    Set Global Variable    ${response}    ${outputResponse}

Check VNF Status
    [Arguments]    ${current}    ${expected}
    Should Be Equal As Strings    ${current}    ${expected}
    Log    VNF Status in the correct status
+7 −0
Original line number Diff line number Diff line
@@ -7,6 +7,13 @@ Library JSONLibrary

Create a new VNF instance resource and query information about multiple and individual VNF instance​
    [Documentation]    Test ID: 11.3.1
    ...    Test title: Create a new VNF instance resource and query information about multiple and individual VNF instance​
    ...    Test objective: The objective is to test the interconnected case of VNF instance resource creation and query multiple and individual resources
    ...    Pre-conditions: none
    ...    Reference: ETSI GS NFV-SOL 003 [1] v4.5.1
    ...    Config ID: Config_prod_NFVO, Config_prod_VNFM
    ...    Applicability: none
    ...    Post-Conditions: none
    GET Individual VNF Package
    POST Create a new vnfInstance
    GET information about multiple VNF instances