Commit 759c0e1c authored by Eisha Ayaz's avatar Eisha Ayaz
Browse files

[test-upd][SOL003][VNF-PKG-MGMT][v5.3.1][7.3.3.8.1,2,3...

[test-upd][SOL003][VNF-PKG-MGMT][v5.3.1][7.3.3.8.1,2,3 Test-IDs][NFVSOL(26)000019r3​] Add support of received notification validation
parent ab61808d
Loading
Loading
Loading
Loading
+62 −12
Original line number Diff line number Diff line
@@ -8,6 +8,7 @@ Library OperatingSystem
Library    BuiltIn
Library    Collections
Library    String
Library    REST    ${NFVO_SCHEMA}://${NFVO_HOST}:${NFVO_PORT}    ssl_verify=false


*** Test Cases ***
@@ -23,6 +24,7 @@ VNF Package Onboarding Notification
    Trigger the completion of VNF Package Onboarding (external action) 
    Check Onboarding Notification Http POST Request Body Json Schema Is    VnfPackageOnboardingNotification
    Check Onboarding Notification Http POST Request Body notificationType attribute Is    VnfPackageOnboardingNotification
    Check Onboarding Notification validation

VNF Package Operational State Change Notification
    [Documentation]    Test ID: 7.3.3.8.2
@@ -36,7 +38,7 @@ VNF Package Operational State Change Notification
    Trigger the change of VNF Package Operational State (external action) 
    Check State Change Notification Http POST Request Body Json Schema Is    VnfPackageChangeNotification
    Check State Change Notification Http POST Request Body notificationType attribute Is    VnfPackageChangeNotification
    Check State Change Notification Http POST Request Body changeType attribute Is    OP_STATE_CHANGE 
    Check State Change Notification validation    OP_STATE_CHANGE

VNF Package Deletion Notification
    [Documentation]    Test ID: 7.3.3.8.3
@@ -50,7 +52,7 @@ VNF Package Deletion Notification
    Trigger the deletion of VNF Package (external action) 
    Check Deletion Notification Http POST Request Body Json Schema Is    VnfPackageChangeNotification
    Check Deletion Notification Http POST Request Body notificationType attribute Is    VnfPackageChangeNotification
    Check Deletion Notification Http POST Request Body changeType attribute Is    PKG_DELETE 
    Check Deletion Notification validation    PKG_DELETE


*** Keywords ***
@@ -90,27 +92,75 @@ Check Deletion Notification Http POST Request Body Json Schema Is

Check State Change Notification Http POST Request Body notificationType attribute Is
    [Arguments]    ${type}
    Configure Notification Change Status Handler    ${callback_endpoint_fwd}    ${type}    PKG_DELETE
    Configure Notification Change Status Handler    ${callback_endpoint_fwd}    ${type}    OP_STATE_CHANGE
    Wait Until Keyword Succeeds    2 min   10 sec   Verify Mock Expectation    ${notification_request}
    Clear Requests    ${callback_endpoint}
    Clear Requests    ${callback_endpoint_fwd}
    
Check Deletion Notification Http POST Request Body notificationType attribute Is
    [Arguments]    ${type}
    Configure Notification Change Status Handler    ${callback_endpoint_fwd}    ${type}    OP_STATE_CHANGE
    Configure Notification Change Status Handler    ${callback_endpoint_fwd}    ${type}    PKG_DELETE
    Wait Until Keyword Succeeds    2 min   10 sec   Verify Mock Expectation    ${notification_request}
    Clear Requests    ${callback_endpoint}
    Clear Requests    ${callback_endpoint_fwd}

Check State Change Notification Http POST Request Body changeType attribute Is
    [Arguments]    ${type}
    #do nothing
    Log    do nothing 
Check State Change Notification validation
    [Arguments]    ${expected_change}
    ${requests}=    Retrieve Requests    ${callback_endpoint_fwd}
    Should Not Be Empty    ${requests}
    ${last_request}=    Get From List    ${requests}    -1
    ${body}=    Get From Dictionary    ${last_request}    body
    ${body_text}=    Get From Dictionary    ${body}    string
    ${notification}=    Evaluate    json.loads(r'''${body_text}''')    json
    Should Be Equal As Strings    ${notification['changeType']}    ${expected_change}
    ${subscriptionId}=    Get From Dictionary    ${notification}    subscriptionId
    ${vnfPkgId}=    Get From Dictionary    ${notification}    vnfPkgId
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
    GET    ${apiRoot}/${apiName}/${apiMajorVersion}/subscriptions/${subscriptionId}
    Integer    response status    200
    GET    ${apiRoot}/${apiName}/${apiMajorVersion}/vnf_packages/${vnfPkgId}
    Integer    response status    200
    Clear Requests    ${callback_endpoint}
    Clear Requests    ${callback_endpoint_fwd}

Check Deletion Notification Http POST Request Body changeType attribute Is
    [Arguments]    ${type}
    #do nothing
    Log    do nothing
Check Deletion Notification validation
    [Arguments]    ${expected_change}
    ${requests}=    Retrieve Requests    ${callback_endpoint_fwd}
    Should Not Be Empty    ${requests}
    ${last_request}=    Get From List    ${requests}    -1
    ${body}=    Get From Dictionary    ${last_request}    body
    ${body_text}=    Get From Dictionary    ${body}    string
    ${notification}=    Evaluate    json.loads(r'''${body_text}''')    json
    Should Be Equal As Strings    ${notification['changeType']}    ${expected_change}
    ${subscriptionId}=    Get From Dictionary    ${notification}    subscriptionId
    ${vnfPkgId}=    Get From Dictionary    ${notification}    vnfPkgId
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
    GET    ${apiRoot}/${apiName}/${apiMajorVersion}/subscriptions/${subscriptionId}
    Integer    response status    200
    GET    ${apiRoot}/${apiName}/${apiMajorVersion}/vnf_packages/${vnfPkgId}
    Integer    response status    200
    Clear Requests    ${callback_endpoint}
    Clear Requests    ${callback_endpoint_fwd}

Check Onboarding Notification validation
    ${requests}=    Retrieve Requests    ${callback_endpoint_fwd}
    Should Not Be Empty    ${requests}
    ${last_request}=    Get From List    ${requests}    -1
    ${body}=    Get From Dictionary    ${last_request}    body
    ${body_text}=    Get From Dictionary    ${body}    string
    ${notification}=    Evaluate    json.loads(r'''${body_text}''')    json
    ${subscriptionId}=    Get From Dictionary    ${notification}    subscriptionId
    ${vnfPkgId}=    Get From Dictionary    ${notification}    vnfPkgId
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
    GET    ${apiRoot}/${apiName}/${apiMajorVersion}/subscriptions/${subscriptionId}
    Integer    response status    200
    GET    ${apiRoot}/${apiName}/${apiMajorVersion}/vnf_packages/${vnfPkgId}
    Integer    response status    200
    Clear Requests    ${callback_endpoint}
    Clear Requests    ${callback_endpoint_fwd}

Configure Notification Onboarding Handler
    [Arguments]    ${endpoint}    ${type}