Commit a03ecbe9 authored by Giacomo Bernini's avatar Giacomo Bernini
Browse files

Merge branch 'master' into 'master'

Master

See merge request !13
parents de19ec43 3caff1e2
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
*** Settings ***
Resource    environment/variables.txt 
Resource   NSLCMOperationKeywords.robot   
Library    REST    ${NFVO_SCHEMA}://${NFVO_HOST}:${NFVO_PORT} 
Library    OperatingSystem
Library    JSONLibrary
Library    JSONSchemaLibrary    schemas/


*** Test Cases ***
NS Instance Creation
    Do POST New nsInstance
    Check HTTP Response Status Code Is    201
    Check HTTP Response Header Contains    Location
    Check HTTP Response Body Json Schema Is    NsIdentifierCreationNotification.schema.json
    Check resource not_instantiated
    
    
 No newline at end of file
+18 −0
Original line number Diff line number Diff line
*** Settings ***
Resource    environment/variables.txt 
Resource   NSLCMOperationKeywords.robot   
Library    REST    ${NFVO_SCHEMA}://${NFVO_HOST}:${NFVO_PORT} 
Library    OperatingSystem
Library    JSONLibrary
Library    JSONSchemaLibrary    schemas/
Suite Setup    Check resource existance

*** Test Cases ***
NS Instance Deletion
    Check resource not_instantiated
    Do DELETE IndividualNSInstance
    Check HTTP Response Status Code Is    204
    Check HTTP Response Body Json Schema Is    NsIdentifierDeletionNotification.schema.json
   
    
    
 No newline at end of file
+31 −0
Original line number Diff line number Diff line
*** Settings ***
Resource    environment/variables.txt 
Resource   NSLCMOperationKeywords.robot   
Library    REST    ${NFVO_SCHEMA}://${NFVO_HOST}:${NFVO_PORT} 
Library    OperatingSystem
Library    JSONLibrary
Library    JSONSchemaLibrary    schemas/
Suite Setup    Check resource existance
Suite Setup       Initialize System
Suite Teardown    Terminate All Processes    kill=true

*** Test Cases ***
Heal Flow of NS lifecycle management operations
    Check resource instantiated
    Do POST Heal NSInstance
    Check HTTP Response Status Code Is    202
    Check Operation Occurrence Id
    Check Operation Notification Status is    START
    Check Operation Notification Status is    RESULT
    Check resource instantiated
    
    
    
    
    
    
    
    
    
    
    
 No newline at end of file
+29 −0
Original line number Diff line number Diff line
*** Settings ***
Resource    environment/variables.txt 
Resource   NSLCMOperationKeywords.robot   
Library    REST    ${NFVO_SCHEMA}://${NFVO_HOST}:${NFVO_PORT} 
Library    OperatingSystem
Library    JSONLibrary
Library    JSONSchemaLibrary    schemas/
Suite Setup    Check resource existance
Suite Setup       Initialize System
Suite Teardown    Terminate All Processes    kill=true

*** Test Cases ***
Instantiate Flow of NS lifecycle management operations
    Check resource not_instantiated
    Do POST Instatiate nsInstance
    Check HTTP Response Status Code Is    202
    Check Operation Occurrence Id
    Check Operation Notification Status is    START
    Check Operation Notification Status is    RESULT
    Check resource instantiated
    
    
    
    
    
    
    
    
    
 No newline at end of file
+45 −5
Original line number Diff line number Diff line
@@ -8,6 +8,16 @@ Library OperatingSystem
Library    MockServerLibrary

*** Keywords ***
Initialize System
    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}
    
Check Operation Occurrence Id
    ${occid}=    Get Value From Json    ${response[0]['headers']['Location']} 
    Set Global Variable    @{nsLcmOpOccId}    ${occid}
    Should Not Be Empty    ${nsLcmOpOccId}
    
Create Sessions
    Start Process  java  -jar  ../../bin/mockserver-netty-5.5.0-jar-with-dependencies.jar  -serverPort  ${callback_port}  alias=mockInstance
    Wait For Process  handle=mockInstance  timeout=5s  on_timeout=continue
@@ -20,7 +30,6 @@ Check subscription existance
    Get    ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${subscriptionId} 
    Integer    response status    200
    

Check Fail not supported
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Get    ${apiRoot}/${apiName}/${apiVersion}/ns_lcm_op_occs/${nsLcmOpOccId}
@@ -51,6 +60,40 @@ Check resource FAILED_TEMP
    Get    ${apiRoot}/${apiName}/${apiVersion}/ns_lcm_op_occs/${nsLcmOpOccId} 
    String    response body operationState    FAILED_TEMP

Check Operation Notification Status is
    [Arguments]    ${status}
    Check Operation Notification    NsLcmOperationOccurrenceNotification   ${status}

Check Operation Notification
    [Arguments]    ${element}    ${status}=""
    ${json}=	Get File	schemas/${element}.schema.json
    Configure Notification Forward    ${element}    ${callback_endpoint}    ${callback_endpoint_fwd}
    Configure Notification Status Handler    ${callback_endpoint_fwd}    ${status}
    Wait Until Keyword Succeeds    2 min   10 sec   Verify Mock Expectation    ${notification_request}
    Clear Requests    ${callback_endpoint}
    Clear Requests    ${callback_endpoint_fwd}
    
Configure Notification Forward
    [Arguments]    ${element}    ${endpoint}    ${endpoint_fwd}    
    ${BODY}=	evaluate	json.loads('''${json}''')	json
    Log  Creating mock HTTP forward to handle ${element}
    &{notification_tmp}=  Create Mock Request Matcher	POST  ${endpoint}  body_type="JSON_SCHEMA"    body=${BODY}
    &{notification_fwd}=  Create Mock Http Forward	${endpoint_fwd}
    Create Mock Expectation With Http Forward  ${notification_tmp}  ${notification_fwd}
    
Configure Notification Status Handler
    [Arguments]    ${endpoint}    ${status}=""
    Run Keyword If   ${status}!=""  set to dictionary    ${json["notificationStatus"]}    dp=${status}    
    ${BODY}=    evaluate    json.dumps(${json})    json
    Log  Creating mock request and response to handle ${element}
    &{notification_request}=  Create Mock Request Matcher	POST  ${endpoint}  body_type="JSON"    body=${BODY}
    &{notification_response}=  Create Mock Response	headers="Content-Type: application/json"  status_code=204
    Create Mock Expectation  ${notification_request}  ${notification_response}    
        
Check resource operationState is
    [Arguments]    ${state} 
    String    ${response[0]['body']['operationState']}   ${state}
    
Check resource instantiated
    Set Headers    {"Accept":"${ACCEPT}"}  
    Set Headers    {"Content-Type": "${CONTENT_TYPE}"}
@@ -255,7 +298,6 @@ Do GET Instantiate NSInstance
    ${outputResponse}=    Output    response
	Set Global Variable    @{response}    ${outputResponse}
	
	
Do DELETE Scale NSInstance
    log    Trying to delete an Scale NS instance. This method should not be implemented
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
@@ -300,7 +342,6 @@ Do POST scale nsInstance
    ${outputResponse}=    Output    response
	Set Global Variable    @{response}    ${outputResponse} 
	
	
Do DELETE Update NSInstance
    log    Trying to delete an Update NS instance. This method should not be implemented
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
@@ -789,7 +830,6 @@ Do GET Subscriptions with filter
    ${outputResponse}=    Output    response
	Set Global Variable    @{response}    ${outputResponse}


Do POST Individual Subscription
    log    Trying to perform a POST. This method should not be implemented
    Set Headers  {"Accept":"${ACCEPT}"}  
Loading