Commit 91f8fa35 authored by AHMADABB's avatar AHMADABB
Browse files

SOL3 grants

parent bc3f5d8d
Loading
Loading
Loading
Loading
+10 −10
Original line number Diff line number Diff line
@@ -41,15 +41,15 @@ Requests a grant for a particular VNF lifecycle operation - Asynchronous mode
    Check HTTP Response Body Json Schema Is    grant
    Wait Until Keyword Succeeds    2 min   10 sec    Get an individual grant - Successful

Request a new Grant - Forbidden
Requests a grant for a particular VNF lifecycle operation - Forbidden 
    [Documentation]    Test ID: 7.3.2.1.3
    ...    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 and check the content of the problem details data structure returned
    ...    Pre-conditions: The grant should not be accorded
    ...    Reference: section 9.4.2.3.2 - SOL003 v2.4.1
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: 
    ...    Post-Conditions: 
    ...    Applicability: none
    ...    Post-Conditions: none
    Send Request a new Grant Forbiden
    Check HTTP Response Status Code Is    403
    Check HTTP Response Body Json Schema Is    ProblemDetails
@@ -57,7 +57,7 @@ Request a new Grant - Forbidden
GET Grants - Method not implemented
    [Documentation]    Test ID: 7.3.2.1.4
    ...    Test title: GET Grants - Method not implemented
    ...    Test objective: The objective is to test that GET method is not allowed to for Life cycle operation granting 
    ...    Test objective: The objective is to test that GET method is not allowed for Life cycle operation granting 
    ...    Pre-conditions: none
    ...    Reference: section 9.4.2.3.2 - SOL003 v2.4.1
    ...    Config ID: Config_prod_VNFM
@@ -69,7 +69,7 @@ GET Grants - Method not implemented
PUT Grants - Method not implemented
     [Documentation]    Test ID: 7.3.2.1.5
    ...    Test title: PUT Grants - Method not implemented
    ...    Test objective: The objective is to test that PUT method is not allowed to for Life cycle operation granting 
    ...    Test objective: The objective is to test that PUT method is not allowed for Life cycle operation granting 
    ...    Pre-conditions: none
    ...    Reference: section 9.4.2.3.3 - SOL003 v2.4.1
    ...    Config ID: Config_prod_VNFM
@@ -81,7 +81,7 @@ PUT Grants - Method not implemented
PATCH Grants - Method not implemented
    [Documentation]    Test ID: 7.3.2.1.6
    ...    Test title: PATCH Grants - Method not implemented
    ...    Test objective: The objective is to test that PATCH method is not allowed to for Life cycle operation granting  
    ...    Test objective: The objective is to test that PATCH method is not allowed for Life cycle operation granting  
    ...    Pre-conditions: none
    ...    Reference: section 9.4.2.3.4 - SOL003 v2.4.1
    ...    Config ID: Config_prod_VNFM
@@ -93,7 +93,7 @@ PATCH Grants - Method not implemented
DELETE Grants - Method not 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  
    ...    Test objective: The objective is to test that DELETE method is not allowed for Life cycle operation granting  
    ...    Pre-conditions: none
    ...    Reference: section 9.4.2.3.5 - SOL003 v2.4.1
    ...    Config ID: Config_prod_VNFM
@@ -182,7 +182,7 @@ Get Grants
    Set Suite Variable    &{response}    ${body}
    
Put Grants
    Log    Trying to perform a GET. This method should not be implemented
    Log    Trying to perform a PUT. 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
@@ -190,7 +190,7 @@ Put Grants
    Set Suite Variable    &{response}    ${body}
    
Patch Grants
    Log    Trying to perform a GET. This method should not be implemented
    Log    Trying to perform a PATCH. 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
@@ -199,7 +199,7 @@ Patch Grants
    
    
Delete Grants
    Log    Trying to perform a GET. This method should not be implemented
    Log    Trying to perform a DELETE. 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
+138 −67
Original line number Diff line number Diff line
@@ -8,102 +8,173 @@ Documentation This resource represents an individual grant. The client can us
...    It is determined by means outside the scope of the present document, such as configuration or policy,
...    how long an individual grant is available.

*** Variables ***
${response}    {}

*** Test Cases ***
Post Individual Grant - Method not implemented
    log    Trying to perform a POST. This method should not be implemented
    Set Headers  {"Accept":"${ACCEPT}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Post    ${apiRoot}/${apiName}/${apiVersion}/grants/${grantId}  
    Log    Validate Status code
    Integer    response status    405
    [Documentation]    Test ID: 7.3.2.2.1
    ...    Test title: Post Individual Grant - Method not implemented
    ...    Test objective: The objective is to test that POST method is not allowed for Life cycle operation granting  
    ...    Pre-conditions: none
    ...    Reference: section 9.4.2.3.4 - SOL003 v2.4.1
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
    ...    Post-Conditions: none 
    Post individual Grant
    Check HTTP Response Status Code Is    405

Get an individual grant - Successful
    [Documentation]    Test ID: 9.4.3.1
    ...    Test title: Requests a grant for a particular VNF lifecycle operation - Successful
    [Documentation]    Test ID: 7.3.2.2.2
    ...    Test title: Requests a grant for a particular VNF lifecycle operation - Successful  and perform a JSON schema validation on the returned grant data structure
    ...    Test objective: The objective is to request a grant for a particular VNF lifecycle operation 
    ...    Pre-conditions: The related grant information is available to the VNFM
    ...    Reference: section 9.4.3 - SOL003 v2.4.1
    ...    Reference: section 9.4.3.3.2 - SOL003 v2.4.1
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: 
    ...    Post-Conditions: 
    log    Trying to read an individual grant
    Set Headers    {"Accept":"${ACCEPT}"}  
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Get    ${apiRoot}/${apiName}/${apiVersion}/grants/${grantId}
    Log    Validate Status code
    Integer    response status    200
    ${contentType}=    Output    response headers Content-Type
    Should Contain    ${contentType}    ${CONTENT_TYPE}
    ${result}=    Output    response body
    Validate Json    grant.schema.json    ${result}
    Log    Validation OK
    ...    Applicability: none
    ...    Post-Conditions: none
    Get individual grant success
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is    grant
    
Get an individual grant - Process ongoing
    [Tags]    no-synchronous-mode
    [Documentation]    Test ID: 9.4.3.2
    [Documentation]    Test ID: 7.3.2.2.3
    ...    Test title: Requests a grant for a particular VNF lifecycle operation - Process ongoing
    ...    Test objective: The objective is to request a grant for a particular VNF lifecycle operation 
    ...    Pre-conditions: The process of creating the grant is ongoing, no grant is available yet.
    ...    Reference: section 9.4.3 - SOL003 v2.4.1
    ...    Reference: section 9.4.3.3.2 - SOL003 v2.4.1
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: 
    ...    Post-Conditions: 
    log    Trying to read an individual grant
    Pass Execution If    ${SYNC_MODE} == 1   Skipping. Synchronous mode is supported    
    Set Headers    {"Accept":"${ACCEPT}"}  
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Get    ${apiRoot}/${apiName}/${apiVersion}/grants/${grantId}
    Log    Validate Status code
    Integer    response status    202
    ...    Applicability: none
    ...    Post-Conditions: none
    Get individual grant on-going
    Check HTTP Response Status Code Is    202
    Check HTTP Response Body Json Schema Is    grant
    
Get an individual grant - grant rejected
    [Tags]    no-synchronous-mode
    [Documentation]    Test ID: 9.4.3.3
    [Documentation]    Test ID: 7.3.2.2.4
    ...    Test title: Requests a grant for a particular VNF lifecycle operation - grant rejected
    ...    Test objective: The objective is to request a grant for a particular VNF lifecycle operation 
    ...    Pre-conditions: The related grant is rejected
    ...    Reference: section 9.4.3 - SOL003 v2.4.1
    ...    Reference: section 9.4.3.3.2 - SOL003 v2.4.1
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: 
    ...    Post-Conditions: 
    ...    Applicability: none
    ...    Post-Conditions: none
    Get individual grant rejected
    Check HTTP Response Status Code Is    403
	Check HTTP Response Body Json Schema Is    ProblemDetails

PUT an individual grant - Method not implemented
    [Documentation]    Test ID: 7.3.2.2.5
    ...    Test title: PUT an individual grant - Method not implemented
    ...    Test objective: The objective is to test that PUT method is not allowed to for Life cycle operation granting  
    ...    Pre-conditions: none
    ...    Reference: section 9.4.3.3.3 - SOL003 v2.4.1
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
    ...    Post-Conditions: none 
    PUT individual Grant
    Check HTTP Response Status Code Is    405

PATCH an individual grant - Method not implemented
    [Documentation]    Test ID: 7.3.2.2.6
    ...    Test title: PATCH an individual grant - Method not implemented
    ...    Test objective: The objective is to test that PATCH method is not allowed to for Life cycle operation granting  
    ...    Pre-conditions: none
    ...    Reference: section 9.4.3.3.4 - SOL003 v2.4.1
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
    ...    Post-Conditions: none 
    Patch individual Grant
    Check HTTP Response Status Code Is    405
    
DELETE an individual grant - Method not implemented
    [Documentation]    Test ID: 7.3.2.2.7
    ...    Test title: DELETE an individual grant - 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.3.3.5 - SOL003 v2.4.1
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
    ...    Post-Conditions: none 
    Delete individual Grant
    Check HTTP Response Status Code Is    405

*** Keywords ***
Get individual grant rejected
    log    Trying to read an individual grant
    Set Headers    {"Accept":"${ACCEPT}"}  
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Get    ${apiRoot}/${apiName}/${apiVersion}/grants/${grantId}
    ${body}=    Output    response
    Set Suite Variable    &{response}    ${body}
Get individual grant on-going
    log    Trying to read an individual grant
    Set Headers    {"Accept":"${ACCEPT}"}  
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Get    ${apiRoot}/${apiName}/${apiVersion}/grants/${grantId}
    Log    Validate Status code
    Integer    response status    403
    ${problemDetails}=    Output    response body
    Validate Json    ProblemDetails.schema.json    ${problemDetails}
    Log    Validation OK
    ${body}=    Output    response
    Set Suite Variable    &{response}    ${body}
    
PUT an individual grant - Method not implemented
    log    Trying to perform a PUT. This method should not be implemented
Get individual grant success
    log    Trying to read an individual grant
    Set Headers    {"Accept":"${ACCEPT}"}  
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Get    ${apiRoot}/${apiName}/${apiVersion}/grants/${grantId}
    ${body}=    Output    response
    Set Suite Variable    &{response}    ${body}
    
Check resource existance
    Set Headers    {"Accept":"${ACCEPT}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Get    ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${subscriptionId} 
    Integer    response status    200
    
Post individual Grant
    log    Trying to read an individual grant
    Pass Execution If    ${SYNC_MODE} == 1   Skipping. Synchronous mode is supported    
    Set Headers    {"Accept":"${ACCEPT}"}  
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Get    ${apiRoot}/${apiName}/${apiVersion}/grants/${grantId}
    ${body}=    Output    response
    Set Suite Variable    &{response}    ${body}
    
Put individual Grant
    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/${grantId}
    Log    Validate Status code
    Integer    response status    405
    ${body}=    Output    response
    Set Suite Variable    &{response}    ${body}
    
PATCH an individual grant - Method not implemented
    log    Trying to perform a PATCH. This method should not be implemented
Patch individual Grant
    Log    Trying to perform a GET. This method should not be implemented
    Set Headers  {"Accept":"${ACCEPT}"} 
    Set Headers  {"Content-Type": "${CONTENT_TYPE}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Patch    ${apiRoot}/${apiName}/${apiVersion}/grants/${grantId}
    Log    Validate Status code
    Integer    response status    405
    ${body}=    Output    response
    Set Suite Variable    &{response}    ${body}
    
DELETE an individual grant - Method not implemented
    log    Trying to perform a PATCH. This method should not be implemented
Delete individual Grant
    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/${grantId}
    Log    Validate Status code
    Integer    response status    405
    ${body}=    Output    response
    Set Suite Variable    &{response}    ${body}
    
*** Keywords ***
Check resource existance
    Set Headers    {"Accept":"${ACCEPT}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Get    ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${subscriptionId} 
    Integer    response status    200
 No newline at end of file
Check HTTP Response Status Code Is
    [Arguments]    ${expected_status}    
    Should Be Equal As Strings    ${response['status']}    ${expected_status}
    Log    Status code validated

Check HTTP Response Header Contains
    [Arguments]    ${CONTENT_TYPE}
    Should Contain    ${response['headers']}    ${CONTENT_TYPE}
    Log    Header is present
    
Check HTTP Response Body Json Schema Is
    [Arguments]    ${input}
    ${schema} =    Catenate    ${input}    .schema.json
    Validate Json    ${schema}    ${response[0]['body']}
 No newline at end of file