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

added doc for VNF Indicator tests

parent fc34183a
Loading
Loading
Loading
Loading
+49 −74
Original line number Original line Diff line number Diff line
@@ -11,81 +11,56 @@ Library String




*** Test Cases ***
*** Test Cases ***
Check Notification Endpoint
VNF Indicator Value Change Notification
    &{req}=  Create Mock Request Matcher	GET  ${callback_endpoint}    
    [Documentation]    Test ID: 6.3.2.6.1
    &{rsp}=  Create Mock Response	headers="Content-Type: application/json"  status_code=204
    ...    Test title: VNF Indicator Value Change Notification
    Create Mock Expectation  ${req}  ${rsp}
    ...    Test objective: The objective is to test the dispatch of VNF Indicator Value Change Notification when new indicator values are available in the VNF, and perform a JSON schema and content validation of the delivered notification
    Sleep  ${sleep_interval}
    ...    Pre-conditions: A VNF is instantiated, and a subscription for indicator value change notifications is available in the VNF.
    Verify Mock Expectation  ${req}
    ...    Reference:  section 8.4.7.3.1 - SOL002 v2.4.1
    Clear Requests  ${callback_endpoint}
    ...    Config ID: Config_prod_VNF
    ...    Applicability: none
    ...    Post-Conditions: none 
    Trigger the availability of new indicator value in the VNF (external action) 
    Check Indicator Value Change Notification Http POST Request Body Json Schema Is    VnfIndicatorValueChangeNotification
    Check Indicator Value Change Notification Http POST Request Body notificationType attribute Is    VnfIndicatorValueChangeNotification


Post VNF Indicator Notification
    ${json}=	Get File	schemas/VnfIndicatorValueChangeNotification.schema.json
    ${BODY}=	evaluate	json.loads('''${json}''')	json
    Log  Creating mock request and response to handle VNF Indicator Notification
    &{req}=  Create Mock Request Matcher	POST  ${callback_endpoint}  body_type="JSON_SCHEMA"    body=${BODY}
    &{rsp}=  Create Mock Response	headers="Content-Type: application/json"  status_code=204
    Create Mock Expectation  ${req}  ${rsp}
    Sleep  ${sleep_interval}
    Log  Verifying results
    Verify Mock Expectation  ${req}
    Log  Cleaning the endpoint
    Clear Requests  ${callback_endpoint}


Post VNF Indicator Notification Negative 404 
*** Keywords ***
    ${json}=	Get File	schemas/ProblemDetails.schema.json
Trigger the availability of new indicator value in the VNF (external action) 
    ${BODY}=	evaluate	json.loads('''${json}''')	json
    #do nothing
    Log  Creating mock request and response to handle VNF Indicator Notification to handle 404 error
    Log    do nothing
    &{req}=  Create Mock Request Matcher	POST  ${callback_endpoint_error}  body_type="JSON_SCHEMA"    body=${BODY}
    &{rsp}=  Create Mock Response	headers="Content-Type: application/json"  status_code=404
    Create Mock Expectation  ${req}  ${rsp}
    Sleep  ${sleep_interval}
    Log  Verifying results
    Verify Mock Expectation  ${req}
    Log  Cleaning the endpoint
    Clear Requests  ${callback_endpoint}
 
 
  
  
Check Indicator Value Change 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}


PUT VNF Indicator Notification 
Check Indicator Value Change Notification Http POST Request Body notificationType attribute Is
    Log  PUT Method not implemented
    [Arguments]    ${type}
    &{req}=  Create Mock Request Matcher	PUT  ${callback_endpoint}
    Configure Notification Indicator Value Change 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 Indicator Value Change 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}


PATCH VNF Indicator Notification 
Configure Notification Forward
    Log  PATCH Method not implemented
    [Arguments]    ${schema}    ${endpoint}    ${endpoint_fwd}    
    &{req}=  Create Mock Request Matcher	PATCH  ${callback_endpoint}
    Log  Creating mock Http POST forward to handle ${schema}
    &{rsp}=  Create Mock Response  status_code=405
    &{notification_tmp}=  Create Mock Request Matcher	POST  ${endpoint}  body_type="JSON_SCHEMA"    body=${schema}
    Create Mock Expectation  ${req}  ${rsp}
    &{notification_fwd}=  Create Mock Http Forward	${endpoint_fwd}
    Sleep  ${sleep_interval}
    Create Mock Expectation With Http Forward  ${notification_tmp}  ${notification_fwd}
    Log  Verifying results
    Verify Mock Expectation  ${req}
    Log  Cleaning the endpoint
    Clear Requests  ${callback_endpoint}
    


DELETE VNF Indicator Notification 
    Log  PATCH Method not implemented
    &{req}=  Create Mock Request Matcher	DELETE  ${callback_endpoint}
    &{rsp}=  Create Mock Response  status_code=405
    Create Mock Expectation  ${req}  ${rsp}
    Sleep  ${sleep_interval}
    Log  Verifying results
    Verify Mock Expectation  ${req}
    Log  Cleaning the endpoint
    Clear Requests  ${callback_endpoint}
    

*** Keywords ***
Create Sessions
Create Sessions
    Start Process  java  -jar  ${MOCK_SERVER_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}
    Create Mock Session  ${callback_uri}:${callback_port}
 No newline at end of file
    
 No newline at end of file
+8 −1
Original line number Original line Diff line number Diff line
@@ -2,6 +2,13 @@
${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
${MOCK_SERVER_JAR}    ../../../bin/mockserver-netty-5.5.0-jar-with-dependencies.jar
+48 −65
Original line number Original line Diff line number Diff line
@@ -11,73 +11,56 @@ Library String




*** Test Cases ***
*** Test Cases ***
Post VNF Indicator Notification
VNF Indicator Value Change Notification
    ${json}=	Get File	schemas/VnfIndicatorValueChangeNotification.schema.json
    [Documentation]    Test ID: 7.3.6.6.1
    ${BODY}=	evaluate	json.loads('''${json}''')	json
    ...    Test title: VNF Indicator Value Change Notification
    Log  Creating mock request and response to handle VNF Indicator Notification
    ...    Test objective: The objective is to test the dispatch of VNF Indicator Value Change Notification when new indicator values are available in the VNFM, and perform a JSON schema and content validation of the delivered notification
    &{req}=  Create Mock Request Matcher	POST  ${callback_endpoint}  body_type="JSON_SCHEMA"    body=${BODY}
    ...    Pre-conditions: A VNF is instantiated, and a subscription for indicator value change notifications is available in the VNFM.
    &{rsp}=  Create Mock Response	headers="Content-Type: application/json"  status_code=204
    ...    Reference:  section 8.4.7.3.1 - SOL003 v2.4.1
    Create Mock Expectation  ${req}  ${rsp}
    ...    Config ID: Config_prod_VNFM
    Wait Until Keyword Succeeds    ${total_polling_time}   ${polling_interval}   Verify Mock Expectation    ${req}
    ...    Applicability: none
    Log  Verifying results
    ...    Post-Conditions: none 
    Verify Mock Expectation  ${req}
    Trigger the availability of new indicator value in the VNFM (external action) 
    Log  Cleaning the endpoint
    Check Indicator Value Change Notification Http POST Request Body Json Schema Is    VnfIndicatorValueChangeNotification
    Clear Requests  ${callback_endpoint}
    Check Indicator Value Change Notification Http POST Request Body notificationType attribute Is    VnfIndicatorValueChangeNotification

Post VNF Indicator Notification Negative 404 
    ${json}=	Get File	schemas/ProblemDetails.schema.json
    ${BODY}=	evaluate	json.loads('''${json}''')	json
    Log  Creating mock request and response to handle VNF Indicator Notification to handle 404 error
    &{req}=  Create Mock Request Matcher	POST  ${callback_endpoint_error}  body_type="JSON_SCHEMA"    body=${BODY}
    &{rsp}=  Create Mock Response	headers="Content-Type: application/json"  status_code=404
    Create Mock Expectation  ${req}  ${rsp}
    Wait Until Keyword Succeeds    ${total_polling_time}   ${polling_interval}   Verify Mock Expectation    ${req}
    Log  Verifying results
    Verify Mock Expectation  ${req}
    Log  Cleaning the endpoint
    Clear Requests  ${callback_endpoint}




*** Keywords ***
Trigger the availability of new indicator value in the VNFM (external action) 
    #do nothing
    Log    do nothing
 
 
Put VNF Indicator Notification 
    Log  PUT Method not implemented
    &{req}=  Create Mock Request Matcher	PUT  ${callback_endpoint}
    &{rsp}=  Create Mock Response  status_code=405
    Create Mock Expectation  ${req}  ${rsp}
    Wait Until Keyword Succeeds    ${total_polling_time}   ${polling_interval}   Verify Mock Expectation    ${req}
    Log  Verifying results
    Verify Mock Expectation  ${req}
    Log  Cleaning the endpoint
    Clear Requests  ${callback_endpoint}
  
  
Check Indicator Value Change 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}


Patch VNF Indicator Notification 
Check Indicator Value Change Notification Http POST Request Body notificationType attribute Is
    Log  PATCH Method not implemented
    [Arguments]    ${type}
    &{req}=  Create Mock Request Matcher	PATCH  ${callback_endpoint}
    Configure Notification Indicator Value Change 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}
    Wait Until Keyword Succeeds    ${total_polling_time}   ${polling_interval}   Verify Mock Expectation    ${req}
    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 Indicator Value Change 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}


Delete VNF Indicator Notification 
Configure Notification Forward
    Log  DELETE Method not implemented
    [Arguments]    ${schema}    ${endpoint}    ${endpoint_fwd}    
    &{req}=  Create Mock Request Matcher	DELETE  ${callback_endpoint}
    Log  Creating mock Http POST forward to handle ${schema}
    &{rsp}=  Create Mock Response  status_code=405
    &{notification_tmp}=  Create Mock Request Matcher	POST  ${endpoint}  body_type="JSON_SCHEMA"    body=${schema}
    Create Mock Expectation  ${req}  ${rsp}
    &{notification_fwd}=  Create Mock Http Forward	${endpoint_fwd}
    Wait Until Keyword Succeeds    ${total_polling_time}   ${polling_interval}   Verify Mock Expectation    ${req}
    Create Mock Expectation With Http Forward  ${notification_tmp}  ${notification_fwd}
    Log  Verifying results
    Verify Mock Expectation  ${req}
    Log  Cleaning the endpoint
    Clear Requests  ${callback_endpoint}
    


*** Keywords ***
Create Sessions
Create Sessions
    Start Process  java  -jar  ${MOCK_SERVER_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}
    Create Mock Session  ${callback_uri}:${callback_port}
    
 No newline at end of file
 No newline at end of file
+9 −3
Original line number Original line Diff line number Diff line
@@ -20,10 +20,16 @@ ${VNFM_ALLOWS_DUPLICATE_SUBS} 1


${response}
${response}


${callback_uri}    http://localhost
${callback_port}    9091
${callback_port}    9091
${callback_uri}    http://172.22.1.7:${callback_port}
${callback_endpoint}    /endpoint
${callback_endpoint}    /vnfind/subscriptions
${callback_endpoint_fwd}    /endpoint/check
${callback_endpoint_error}    /subs_404
${callback_endpoint_error}    /endpoint_404
${sleep_interval}    20s
${total_polling_time}   2 min
${total_polling_time}   2 min
${polling_interval}     10 sec
${polling_interval}     10 sec

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

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