Commit 6fc5a7b7 authored by Giacomo Bernini's avatar Giacomo Bernini
Browse files

Added doc for NS and VNF LCM notification tests

parent b3c7c4d9
Loading
Loading
Loading
Loading
+172 −81
Original line number Original line Diff line number Diff line
@@ -5,96 +5,187 @@ Resource environment/variables.txt
Library    MockServerLibrary
Library    MockServerLibrary
Library    Process
Library    Process
Library    OperatingSystem
Library    OperatingSystem

Library    Collections


*** Test Cases ***
*** Test Cases ***
Deliver a notification - Operation Occurence
VNF LCM Operation Occurrence Start Notification
    log    The POST method delivers a notification from the server to the client.
    [Documentation]    Test ID: 6.3.5.19.1
    ${json}=	Get File	schemas/vnfLcmOperationOccurrenceNotification.schema.json
    ...    Test title: VNF LCM Operation Occurrence Start Notification
    ${BODY}=	evaluate	json.loads('''${json}''')	json
    ...    Test objective: The objective is to test the dispatch of VNF LCM Operation Occurrence Start Notification when a new VNF LCM operation is started in the VNFM, and perform a JSON schema and content validation of the delivered notification
    Log  Creating mock request and response to handle vnfLcmOperationOccurrenceNotification
    ...    Pre-conditions: A subscription for VNF LCM Operation Occurrence notifications is available in the VNFM.
    &{req}=  Create Mock Request Matcher	POST  ${callback_endpoint}  body_type="JSON_SCHEMA"    body=${BODY}
    ...    Reference:  section 5.4.20.3.1 - SOL002 v2.4.1
    &{rsp}=  Create Mock Response	headers="Content-Type: application/json"  status_code=204
    ...    Config ID: Config_prod_VNFM
    Create Mock Expectation  ${req}  ${rsp}
    ...    Applicability: none
    Sleep  ${sleep_interval}
    ...    Post-Conditions: none 
    Log  Verifying results
    Trigger a VNF LCM operation (external action) 
    Verify Mock Expectation  ${req}
    Check VNF LCM Operation Occurrence Start Notification Http POST Request Body Json Schema Is    VnfLcmOperationOccurrenceNotification
    Log  Cleaning the endpoint
    Check VNF LCM Operation Occurrence Start Notification Http POST Request Body notificationType attribute Is    VnfLcmOperationOccurrenceNotification
    Clear Requests  ${callback_endpoint}
    Check VNF LCM Operation Occurrence Start Notification Http POST Request Body notificationStatus attribute Is    START
    
    
Deliver a notification - Id Creation
VNF LCM Operation Occurrence Result Notification
    log    The POST method delivers a notification from the server to the client.
    [Documentation]    Test ID: 6.3.5.19.2
    ${json}=	Get File	schemas/vnfIdentifierCreationNotification.schema.json
    ...    Test title: VNF LCM Operation Occurrence Result Notification
    ${BODY}=	evaluate	json.loads('''${json}''')	json
    ...    Test objective: The objective is to test the dispatch of VNF LCM Operation Occurrence Result Notification when a VNF LCM operation is completed in the VNFM, and perform a JSON schema and content validation of the delivered notification
    Log  Creating mock request and response to handle vnfLcmOperationOccurrenceNotification
    ...    Pre-conditions: An VNF LCM operation is in progress, and a subscription for VNF LCM Operation Occurrence notifications is available in the VNFM.
    &{req}=  Create Mock Request Matcher	POST  ${callback_endpoint}}  body_type="JSON_SCHEMA"    body=${BODY}
    ...    Reference:  section 5.4.20.3.1 - SOL002 v2.4.1
    &{rsp}=  Create Mock Response	headers="Content-Type: application/json"  status_code=204
    ...    Config ID: Config_prod_VNFM
    Create Mock Expectation  ${req}  ${rsp}
    ...    Applicability: none
    Sleep  ${sleep_interval}
    ...    Post-Conditions: none 
    Log  Verifying results
    Trigger the completion of an VNF LCM operation (external action)
    Verify Mock Expectation  ${req}
    Check VNF LCM Operation Occurrence Result Notification Http POST Request Body Json Schema Is    VnfLcmOperationOccurrenceNotification
    Log  Cleaning the endpoint
    Check VNF LCM Operation Occurrence Result Notification Http POST Request Body notificationType attribute Is    VnfLcmOperationOccurrenceNotification
    Clear Requests  ${callback_endpoint}
    Check VNF LCM Operation Occurrence Start Notification Http POST Request Body notificationStatus attribute Is    RESULT
    
    
Deliver a notification - Id deletion
VNF Identifier Creation Notification
    log    The POST method delivers a notification from the server to the client.
    [Documentation]    Test ID: 6.3.5.19.3
    ${json}=	Get File	schemas/vnfIdentifierCreationNotification.schema.json
    ...    Test title: VNF Identifier Creation Notification
    ${BODY}=	evaluate	json.loads('''${json}''')	json
    ...    Test objective: The objective is to test the dispatch of VNF Identifier Creation Notification when a new VNF instance resource is created in the VNFM, and perform a JSON schema and content validation of the delivered notification
    Log  Creating mock request and response to handle vnfLcmOperationOccurrenceNotification
    ...    Pre-conditions: A subscription for VNF identifier creation notifications is available in the VNFM.
    &{req}=  Create Mock Request Matcher	POST  ${callback_endpoint}  body_type="JSON_SCHEMA"    body=${BODY}
    ...    Reference:  section 5.4.20.3.1 - SOL002 v2.4.1
    &{rsp}=  Create Mock Response	headers="Content-Type: application/json"  status_code=204
    ...    Config ID: Config_prod_VNFM
    Create Mock Expectation  ${req}  ${rsp}
    ...    Applicability: none
    Sleep  ${sleep_interval}
    ...    Post-Conditions: none 
    Log  Verifying results
    Trigger the creation of a VNF instance resource (external action)
    Verify Mock Expectation  ${req}
    Check VNF Identifier Creation Notification Http POST Request Body Json Schema Is    VnfIdentifierCreationNotification
    Log  Cleaning the endpoint
    Check VNF Identifier Creation Notification Http POST Request Body notificationType attribute Is    VnfIdentifierCreationNotification
    Clear Requests  ${callback_endpoint}
    
VNF Identifier Deletion Notification
    [Documentation]    Test ID: 6.3.5.19.4
    ...    Test title: VNF Identifier Deletion Notification
    ...    Test objective: The objective is to test the dispatch of VNF Identifier Deletion Notification when a VNF instance resource is deleted in the VNFM, and perform a JSON schema and content validation of the delivered notification
    ...    Pre-conditions: A VNF instance resource is created, and a subscription for VNF identifier creation notifications is available in the VNFM.
    ...    Reference:  section 6.4.18.3.1 - SOL002 v2.4.1
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
    ...    Post-Conditions: none 
    Trigger the deletion of a VNF instance resource (external action)
    Check VNF Identifier Deletion Notification Http POST Request Body Json Schema Is    VnfIdentifierDeletionNotification
    Check VNF Identifier Deletion Notification Http POST Request Body notificationType attribute Is    VnfIdentifierDeletionNotification
    
*** Keywords ***
Trigger a VNF LCM operation (external action) 
    #do nothing
    Log    do nothing

Trigger the completion of an VNF LCM operation (external action)
    #do nothing
    Log    do nothing   
    
Trigger the creation of a VNF instance resource (external action)
    #do nothing
    Log    do nothing     
  
Trigger the deletion of a VNF instance resource (external action)
    #do nothing
    Log    do nothing     
    
Check VNF LCM Operation Occurrence Start Notification Http POST Request Body Json Schema Is  
    [Arguments]    ${element}
    ${schema}=	Get File	schemas/${element}.schema.json
    Configure Notification Forward    ${schema}    ${callback_endpoint}    ${callback_endpoint_fwd}


Test a notification end point
Check VNF LCM Operation Occurrence Start Notification Http POST Request Body notificationType attribute Is
    log    The GET method allows the server to test the notification endpoint
    [Arguments]    ${type}
    &{req}=  Create Mock Request Matcher	GET  ${callback_endpoint}    
    Configure Notification VNF LCM Operation Occurrence Start Handler    ${callback_endpoint_fwd}    ${type}    START
    &{rsp}=  Create Mock Response	headers="Content-Type: application/json"  status_code=204
    Wait Until Keyword Succeeds    2 min   10 sec   Verify Mock Expectation    ${notification_request}
    Create Mock Expectation  ${req}  ${rsp}
    Sleep  ${sleep_interval}
    Verify Mock Expectation  ${req}
    Clear Requests    ${callback_endpoint}
    Clear Requests    ${callback_endpoint}
    Clear Requests    ${callback_endpoint_fwd}
    
    
PUT notification - Method not implemented
Configure Notification VNF LCM Operation Occurrence Start Handler
    Log  PUT Method not implemented
    [Arguments]    ${endpoint}    ${type}    ${status}
    &{req}=  Create Mock Request Matcher	PUT  ${callback_endpoint}
    ${json}=    evaluate    {}
    &{rsp}=  Create Mock Response  status_code=405
    set to dictionary   ${json}    notificationType    ${type}    changeType    ${status}
    Create Mock Expectation  ${req}  ${rsp}
    ${BODY}=    evaluate    json.dumps(${json})    json
    Sleep  ${sleep_interval}
    Log  Creating mock request and response to handle status notification
    Log  Verifying results
    &{notification_request}=  Create Mock Request Matcher	POST  ${endpoint}  body_type="JSON"    body=${BODY}
    Verify Mock Expectation  ${req}
    &{notification_response}=  Create Mock Response	headers="Content-Type: application/json"  status_code=204
    Log  Cleaning the endpoint
    Create Mock Expectation  ${notification_request}  ${notification_response}

Check VNF LCM Operation Occurrence Result Notification Http POST Request Body Json Schema Is  
    [Arguments]    ${element}
    ${schema}=	Get File	schemas/${element}.schema.json
    Configure Notification Forward    ${schema}    ${callback_endpoint}    ${callback_endpoint_fwd}

Check VNF LCM Operation Occurrence Result Notification Http POST Request Body notificationType attribute Is
    [Arguments]    ${type}
    Configure Notification VNF LCM Operation Occurrence Result Handler    ${callback_endpoint_fwd}    ${type}    RESULT
    Wait Until Keyword Succeeds    2 min   10 sec   Verify Mock Expectation    ${notification_request}
    Clear Requests    ${callback_endpoint}
    Clear Requests    ${callback_endpoint}
    Clear Requests    ${callback_endpoint_fwd}
    
Configure Notification VNF LCM Operation Occurrence Result Handler
    [Arguments]    ${endpoint}    ${type}    ${status}
    ${json}=    evaluate    {}
    set to dictionary   ${json}    notificationType    ${type}    changeType    ${status}
    ${BODY}=    evaluate    json.dumps(${json})    json
    Log  Creating mock request and response to handle status notification
    &{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}


PATCH subscriptions - Method not implemented
Check VNF Identifier Creation Notification Http POST Request Body Json Schema Is  
    Log  PATCH Method not implemented
    [Arguments]    ${element}
    &{req}=  Create Mock Request Matcher	PATCH  ${callback_endpoint}
    ${schema}=	Get File	schemas/${element}.schema.json
    &{rsp}=  Create Mock Response  status_code=405
    Configure Notification Forward    ${schema}    ${callback_endpoint}    ${callback_endpoint_fwd}
    Create Mock Expectation  ${req}  ${rsp}

    Sleep  ${sleep_interval}
Check VNF Identifier Creation Notification Http POST Request Body notificationType attribute Is
    Log  Verifying results
    [Arguments]    ${type}
    Verify Mock Expectation  ${req}
    Configure Notification VNF Identifier Creation Handler    ${callback_endpoint_fwd}    ${type}
    Log  Cleaning the endpoint
    Wait Until Keyword Succeeds    2 min   10 sec   Verify Mock Expectation    ${notification_request}
    Clear Requests    ${callback_endpoint}
    Clear Requests    ${callback_endpoint}
    Clear Requests    ${callback_endpoint_fwd}

Configure Notification VNF Identifier Creation Handler
    [Arguments]    ${endpoint}    ${type}
    ${json}=    evaluate    {}
    set to dictionary   ${json}    notificationType    ${type}
    ${BODY}=    evaluate    json.dumps(${json})    json
    Log  Creating mock request and response to handle status notification
    &{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 VNF Identifier Deletion Notification Http POST Request Body Json Schema Is  
    [Arguments]    ${element}
    ${schema}=	Get File	schemas/${element}.schema.json
    Configure Notification Forward    ${schema}    ${callback_endpoint}    ${callback_endpoint_fwd}


DELETE subscriptions - Method not implemented
Check VNF Identifier Deletion Notification Http POST Request Body notificationType attribute Is
    Log  DELETE Method not implemented
    [Arguments]    ${type}
    &{req}=  Create Mock Request Matcher	DELETE  ${callback_endpoint}
    Configure Notification VNF Identifier Deletion Handler    ${callback_endpoint_fwd}    ${type}
    &{rsp}=  Create Mock Response  status_code=405
    Wait Until Keyword Succeeds    2 min   10 sec   Verify Mock Expectation    ${notification_request}
    Create Mock Expectation  ${req}  ${rsp}
    Sleep  ${sleep_interval}
    Log  Verifying results
    Verify Mock Expectation  ${req}
    Log  Cleaning the endpoint
    Clear Requests    ${callback_endpoint}
    Clear Requests    ${callback_endpoint}
    Clear Requests    ${callback_endpoint_fwd}

Configure Notification VNF Identifier Deletion Handler
    [Arguments]    ${endpoint}    ${type}
    ${json}=    evaluate    {}
    set to dictionary   ${json}    notificationType    ${type}
    ${BODY}=    evaluate    json.dumps(${json})    json
    Log  Creating mock request and response to handle status notification
    &{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 VNF LCM Operation Occurrence Start Notification Http POST Request Body notificationStatus attribute Is
    [Arguments]    ${type}
    #do nothing
    Log    do nothing
    
Check VNF LCM Operation Occurrence Result Notification Http POST Request Body notificationStatus attribute Is
    [Arguments]    ${type}
    #do nothing
    Log    do nothing

Configure Notification Forward
    [Arguments]    ${schema}    ${endpoint}    ${endpoint_fwd}    
    Log  Creating mock Http POST forward to handle ${schema}
    &{notification_tmp}=  Create Mock Request Matcher	POST  ${endpoint}  body_type="JSON_SCHEMA"    body=${schema}
    &{notification_fwd}=  Create Mock Http Forward	${endpoint_fwd}
    Create Mock Expectation With Http Forward  ${notification_tmp}  ${notification_fwd}


*** Keywords ***
Create Sessions
Create Sessions
    Start Process  java  -jar  ../../bin/mockserver-netty-5.5.0-jar-with-dependencies.jar  -serverPort  ${callback_port}  alias=mockInstance
    Start Process  java  -jar  ${MOCK_SERVER_JAR}  -serverPort  ${callback_port}  alias=mockInstance
    Wait For Process  handle=mockInstance  timeout=5s  on_timeout=continue
    Wait For Process  handle=mockInstance  timeout=5s  on_timeout=continue
    Create Mock Session  ${callback_uri}:${callback_port}     #The API producer is set to NFVO according to SOL003-5.3.9
    Create Mock Session  ${callback_uri}:${callback_port}
+9 −1
Original line number Original line Diff line number Diff line
@@ -41,5 +41,13 @@ ${VnfIdentifierDeletionNotification} {}
${callback_uri}    http://localhost
${callback_uri}    http://localhost
${callback_port}    9091
${callback_port}    9091
${callback_endpoint}    /endpoint
${callback_endpoint}    /endpoint
${callback_endpoint_fwd}    /endpoint/check
${callback_endpoint_error}    /endpoint_404
${callback_endpoint_error}    /endpoint_404
${sleep_interval}    20s
${sleep_interval}    20s
${total_polling_time}   2 min
${polling_interval}     10 sec

${notification_request}    []
${notification_response}    []

${MOCK_SERVER_JAR}    ../../../bin/mockserver-netty-5.5.0-jar-with-dependencies.jar
 No newline at end of file
+0 −0

File moved.

+166 −75

File changed.

Preview size limit exceeded, changes collapsed.

Loading