Commit 6a6b036f authored by AHMADABB's avatar AHMADABB
Browse files

SOL003 LCOG API Grants

parent a969c4ac
Loading
Loading
Loading
Loading
+121 −64
Original line number Original line Diff line number Diff line
@@ -11,99 +11,111 @@ Documentation This resource represents grants. The client can use this resour
${response}    {}
${response}    {}


*** Test Cases ***
*** Test Cases ***
Request a new Grant - Synchronous mode
Requests a grant for a particular VNF lifecycle operation - Synchronous mode
    [Documentation]    Test ID: 9.4.2.1
    [Documentation]    Test ID: 7.3.2.1.1
    ...    Test title: Requests a grant for a particular VNF lifecycle operation - Synchronous mode
    ...    Test title: Requests a grant for a particular VNF lifecycle operation - Synchronous mode
    ...    Test objective: The objective is to request a grant for a particular VNF lifecycle operation 
    ...    Test objective: The objective is to request a grant for a particular VNF lifecycle operation  and perform a JSON schema validation on the returned grant data structure
    ...    Pre-conditions: 
    ...    Pre-conditions: 
    ...    Reference: section 9.4.2 - SOL003 v2.4.1
    ...    Reference: section 9.4.2.3.1 - SOL003 v2.4.1
    ...    Config ID: Config_prod_VNFM
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: The NFVO can decide immediately what to respond to a grant request
    ...    Applicability: The NFVO can decide immediately what to respond to a grant request
    ...    Post-Conditions: The grant information is available to the VNFM.
    ...    Post-Conditions: The grant information is available to the VNFM.
    Log    Request a new Grant for a VNF LCM operation by POST to ${apiRoot}/${apiName}/${apiVersion}/grants
    Send Request Grant Request in Synchronous mode
    Pass Execution If    ${SYNC_MODE} == 0    The Granting process is asynchronous mode. Skipping the test
    Send Request Grant Request
    Check HTTP Response Status Code Is    201
    Check HTTP Response Status Code Is    201
    Check HTTP Response Header Contains    Location
    Check HTTP Response Header Contains    Location
    Check HTTP Response Body Json Schema Is    grant.schema.json
    Check HTTP Response Body Json Schema Is    grant
    Log    Validation OK


Request a new Grant - Asynchronous mode
Requests a grant for a particular VNF lifecycle operation - Asynchronous mode
    [Documentation]    Test ID: 9.4.2.2
    [Documentation]    Test ID: 7.3.2.1.2
    ...    Test title: Requests a grant for a particular VNF lifecycle operation - Asynchronous mode
    ...    Test title: Requests a grant for a particular VNF lifecycle operation - Asynchronous mode
    ...    Test objective: The objective is to request a grant for a particular VNF lifecycle operation 
    ...    Test objective: The objective is to request a grant for a particular VNF lifecycle operation 
    ...    Pre-conditions: 
    ...    Pre-conditions: 
    ...    Reference: section 9.4.2 - SOL003 v2.4.1
    ...    Reference: section 9.4.2.3.1 - SOL003 v2.4.1
    ...    Config ID: Config_prod_VNFM
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: The NFVO can not decide immediately what to respond to a grant request
    ...    Applicability: The NFVO can not decide immediately what to respond to a grant request
    ...    Post-Conditions: The grant information is available to the VNFM.
    ...    Post-Conditions: The grant information is available to the VNFM.
    Log    Request a new Grant for a VNF LCM operation by POST to ${apiRoot}/${apiName}/${apiVersion}/grants
    Send Request Grant Request in Asynchronous mode
    Pass Execution If    ${SYNC_MODE} == 1    The Granting process is synchronous mode. Skipping the test
    Send Request Grant Request
    Check HTTP Response Status Code Is    202
    Check HTTP Response Status Code Is    202
    Check HTTP Response Header Contains    Location
    Check HTTP Response Header Contains    Location
    Check HTTP Response Body Json Schema Is    grant.schema.json
    Check HTTP Response Body Json Schema Is    grant
    Wait Until Keyword Succeeds    2 min   10 sec    Get an individual grant - Successful
    Wait Until Keyword Succeeds    2 min   10 sec    Get an individual grant - Successful
    Log    Validation OK


Request a new Grant - Forbidden
Request a new Grant - Forbidden
    [Documentation]    Test ID: 9.4.2.3
    [Documentation]    Test ID: 7.3.2.1.3
    ...    Test title: Requests a grant for a particular VNF lifecycle operation - Forbidden 
    ...    Test title: Requests a grant for a particular VNF lifecycle operation - Forbidden 
    ...    Test objective: The objective is to request a grant for a particular VNF lifecycle operation 
    ...    Test objective: The objective is to request a grant for a particular VNF lifecycle operation and check the content of the problem details data structure returned
    ...    Pre-conditions: The grant should not be accorded
    ...    Pre-conditions: The grant should not be accorded
    ...    Reference: section 9.4.2 - SOL003 v2.4.1
    ...    Reference: section 9.4.2.3.2 - SOL003 v2.4.1
    ...    Config ID: Config_prod_VNFM
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: 
    ...    Applicability: 
    ...    Post-Conditions: 
    ...    Post-Conditions: 
    Log    Request a new Grant for a VNF LCM operation by POST to ${apiRoot}/${apiName}/${apiVersion}/grants
    Send Request a new Grant Forbiden
    Log    The grant request should be rejected
    Check HTTP Response Status Code Is    403
    Set Headers    {"Accept": "${ACCEPT}"}
    Check HTTP Response Body Json Schema Is    ProblemDetails
    Set Headers    {"Content-Type": "${CONTENT_TYPE}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    ${body}=    Get File    jsons/grantRejectedRequest.json
    Post    ${apiRoot}/${apiName}/${apiVersion}/grants    ${body}
    Integer    response status    403
    Log    Status code validated
    ${problemDetails}=    Output    response body
    Validate Json    ProblemDetails.schema.json    ${problemDetails}
    Log    Validation OK


GET Grants - Method not implemented
GET Grants - Method not implemented
    Log    Trying to perform a GET. This method should not be implemented
    [Documentation]    Test ID: 7.3.2.1.4
    Set Headers  {"Accept":"${ACCEPT}"} 
    ...    Test title: GET Grants - Method not implemented
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    ...    Test objective: The objective is to test that GET method is not allowed to for Life cycle operation granting 
    Get    ${apiRoot}/${apiName}/${apiVersion}/grants
    ...    Pre-conditions: none
    Log    Validate Status code
    ...    Reference: section 9.4.2.3.2 - SOL003 v2.4.1
    Integer    response status    405
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
    ...    Post-Conditions:   none
    Get Grants
    Check HTTP Response Status Code Is    405
    
    
PUT Grants - Method not implemented
PUT Grants - Method not implemented
    log    Trying to perform a PUT. This method should not be implemented
     [Documentation]    Test ID: 7.3.2.1.5
    Set Headers  {"Accept":"${ACCEPT}"}  
    ...    Test title: PUT Grants - Method not implemented
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    ...    Test objective: The objective is to test that PUT method is not allowed to for Life cycle operation granting 
    Put    ${apiRoot}/${apiName}/${apiVersion}/grants    
    ...    Pre-conditions: none
    Log    Validate Status code
    ...    Reference: section 9.4.2.3.3 - SOL003 v2.4.1
    Integer    response status    405
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
    ...    Post-Conditions: none
    Put Grants
    Check HTTP Response Status Code Is    405
    
    
PATCH Grants - Method not implemented
PATCH Grants - Method not implemented
    log    Trying to perform a PATCH. This method should not be implemented
    [Documentation]    Test ID: 7.3.2.1.6
    Set Headers  {"Accept":"${ACCEPT}"}  
    ...    Test title: PATCH Grants - Method not implemented
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    ...    Test objective: The objective is to test that PATCH method is not allowed to for Life cycle operation granting  
    Patch    ${apiRoot}/${apiName}/${apiVersion}/grants    
    ...    Pre-conditions: none
    Log    Validate Status code
    ...    Reference: section 9.4.2.3.4 - SOL003 v2.4.1
    Output    response
    ...    Config ID: Config_prod_VNFM
    Integer    response status    405
    ...    Applicability: none
    ...    Post-Conditions: none 
    Patch Grants
    Check HTTP Response Status Code Is    405
    
    
DELETE Grants - Method not implemented
DELETE Grants - Method not implemented
    log    Trying to perform a DELETE. This method should not be implemented
    [Documentation]    Test ID: 7.3.2.1.7
    ...    Test title: DELETE Grants - Method not implemented
    ...    Test objective: The objective is to test that DELETE method is not allowed to for Life cycle operation granting  
    ...    Pre-conditions: none
    ...    Reference: section 9.4.2.3.5 - SOL003 v2.4.1
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
    ...    Post-Conditions: none
    Delete Grants
    Check HTTP Response Status Code Is    405
    
*** Keywords ***
Send Request Grant Request in Synchronous mode
    Log    Request a new Grant for a VNF LCM operation by POST to ${apiRoot}/${apiName}/${apiVersion}/grants
    Pass Execution If    ${SYNC_MODE} == 0    The Granting process is asynchronous mode. Skipping the test
    Set Headers    {"Accept": "${ACCEPT}"}
    Set Headers    {"Accept": "${ACCEPT}"}
    Set Headers    {"Content-Type": "${CONTENT_TYPE}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    Delete    ${apiRoot}/${apiName}/${apiVersion}/grants
    ${body}=    Get File    jsons/grantRequest.json
    Log    Validate Status code
    Post    ${apiRoot}/${apiName}/${apiVersion}/grants    ${body}
    Integer    response status    405
    ${body}=    Output    response
    
    Set Suite Variable    &{response}    ${body}
    
    
*** Keywords ***
Send Request Grant Request in Asynchronous mode
Send Request Grant Request
    Log    Request a new Grant for a VNF LCM operation by POST to ${apiRoot}/${apiName}/${apiVersion}/grants
    Pass Execution If    ${SYNC_MODE} == 1    The Granting process is synchronous mode. Skipping the test
    Set Headers    {"Accept": "${ACCEPT}"}
    Set Headers    {"Accept": "${ACCEPT}"}
    Set Headers    {"Content-Type": "${CONTENT_TYPE}"}
    Set Headers    {"Content-Type": "${CONTENT_TYPE}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
@@ -112,6 +124,17 @@ Send Request Grant Request
    ${body}=    Output    response
    ${body}=    Output    response
    Set Suite Variable    &{response}    ${body}
    Set Suite Variable    &{response}    ${body}
    
    
Send Request a new Grant Forbiden    
    Log    Request a new Grant for a VNF LCM operation by POST to ${apiRoot}/${apiName}/${apiVersion}/grants
    Log    The grant request should be rejected
    Set Headers    {"Accept": "${ACCEPT}"}
    Set Headers    {"Content-Type": "${CONTENT_TYPE}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    ${body}=    Get File    jsons/grantRejectedRequest.json
    Post    ${apiRoot}/${apiName}/${apiVersion}/grants    ${body}
    ${body}=    Output    response
    Set Suite Variable    &{response}    ${body}

Check HTTP Response Status Code Is
Check HTTP Response Status Code Is
    [Arguments]    ${expected_status}    
    [Arguments]    ${expected_status}    
    Should Be Equal as Strings   ${response[0]['status_code']}    ${expected_status}
    Should Be Equal as Strings   ${response[0]['status_code']}    ${expected_status}
@@ -123,7 +146,8 @@ Check HTTP Response Header Contains
    Log    Header is present
    Log    Header is present
    
    
Check HTTP Response Body Json Schema Is
Check HTTP Response Body Json Schema Is
    [Arguments]    ${schema}
    [Arguments]    ${input}
    ${schema} =    Catenate    ${input}    .schema.json
    Validate Json    ${schema}    ${response[0]['body']}
    Validate Json    ${schema}    ${response[0]['body']}
    Log    Json Schema Validation OK
    Log    Json Schema Validation OK
    
    
@@ -138,4 +162,37 @@ Get an individual grant - Successful
    Validate Json    grant.schema.json    ${result}
    Validate Json    grant.schema.json    ${result}
    Log    Validation OK
    Log    Validation OK
    
    
Get Grants
    Log    Trying to perform a GET. This method should not be implemented
    Set Headers  {"Accept":"${ACCEPT}"} 
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Get    ${apiRoot}/${apiName}/${apiVersion}/grants
    ${body}=    Output    response
    Set Suite Variable    &{response}    ${body}
    
Put Grants
    Log    Trying to perform a GET. This method should not be implemented
    Set Headers  {"Accept":"${ACCEPT}"} 
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Put    ${apiRoot}/${apiName}/${apiVersion}/grants
    ${body}=    Output    response
    Set Suite Variable    &{response}    ${body}
    
Patch Grants
    Log    Trying to perform a GET. This method should not be implemented
    Set Headers  {"Accept":"${ACCEPT}"} 
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Patch    ${apiRoot}/${apiName}/${apiVersion}/grants
    ${body}=    Output    response
    Set Suite Variable    &{response}    ${body}
    
    
Delete Grants
    Log    Trying to perform a GET. This method should not be implemented
    Set Headers  {"Accept":"${ACCEPT}"} 
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Delete    ${apiRoot}/${apiName}/${apiVersion}/grants
    ${body}=    Output    response
    Set Suite Variable    &{response}    ${body}
    
    
    
 No newline at end of file