Commit 269ee115 authored by Hammad Zafar's avatar Hammad Zafar Committed by Giacomo Bernini
Browse files

IndividualPolicy resource added in PolicyManagement-API

parent 0b550e1b
Loading
Loading
Loading
Loading
+109 −0
Original line number Diff line number Diff line
*** Settings ***
Resource   environment/variables.txt 
Resource   PolicyManagementKeywords.robot  

*** Test Cases ***
POST Individual Policy - Method not implemented
    [Documentation]    Test ID: 10.3.1.3.1
    ...    Test title: POST Individual Policy - Method not implemented
    ...    Test objective: The objective is to test that POST method is not implemented.
    ...    Pre-conditions: none
    ...    Reference: Clause 5.5.4.3.1 - ETSI GS NFV-SOL 012 [7] v3.4.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Post-Conditions: none
    POST Individual Policy
    Check HTTP Response Status Code Is    405

GET Information about an individual policy - Successful
     [Documentation]    Test ID: 10.3.1.3.2
    ...    Test title: GET Information about an individual policy - Successful
    ...    Test objective: The objective is to test the retrieval of Individual Policy and perform a JSON schema validation of the returned Policy data structure.
    ...    Pre-conditions: At least one policy is available in the NFV-MANO.
    ...    Reference: Clause 5.5.4.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Post-Conditions: none
    GET Individual Policy
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is   Policy

PUT an individual policy - Method not implemented
     [Documentation]    Test ID: 10.3.1.3.3
    ...    Test title: PUT an individual policy - Method not implemented
    ...    Test objective: The objective is to test that PUT method is not implemented.
    ...    Pre-conditions: none
    ...    Reference: Clause 5.5.4.3.3 - ETSI GS NFV-SOL 012 [7] v3.4.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Post-Conditions: none
    PUT Individual Policy
    Check HTTP Response Status Code Is    405

PATCH an individual ploicy - Successful 
     [Documentation]    Test ID: 10.3.1.3.4
    ...    Test title: PATCH an individual ploicy - Successful
    ...    Test objective: The objective is to test that an individual policy is modified successfully when there is no conflict using PATCH method.
    ...    Pre-conditions: There should not exist a conflict as described in Reference.
    ...    Reference: Clause 5.5.4.3.4 - ETSI GS NFV-SOL 012 [7] v3.4.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Post-Conditions: none
    PATCH Individual Policy
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is   PolicyModifications
    
PATCH an individual ploicy - Conflict 
     [Documentation]    Test ID: 10.3.1.3.5
    ...    Test title: PATCH an individual ploicy - Conflict
    ...    Test objective: The objective is to test that an individual policy is not modified when there is a conflict using PATCH method.
    ...    Pre-conditions: There exists a conflict as described in Reference.
    ...    Reference: Clause 5.5.4.3.4 - ETSI GS NFV-SOL 012 [7] v3.4.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Post-Conditions: none
    PATCH Individual Subscription
    Check HTTP Response Status Code Is    409
    Check HTTP Response Body Json Schema Is   ProblemDetails


DELETE an individual policy - Successful
     [Documentation]    Test ID: 10.3.1.3.6
    ...    Test title: DELETE an individual policy - Successful
    ...    Test objective: The objective is to test that DELETE method deletes a deactivated individual policy.
    ...    Pre-conditions: The activation status of individual policy to be deleted is not set to ACTIVATED.
    ...    Reference: Clause 5.5.8.3.5 - ETSI GS NFV-SOL 012 [7] v3.4.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Post-Conditions: The individual policy is not available anymore in the NFV-MANO.
    DELETE Individual Policy
    Check HTTP Response Status Code Is    204
    Check Postcondition Individual Policy is Deleted

DELETE an individual policy - CONFLICT
     [Documentation]    Test ID: 10.3.1.3.7
    ...    Test title: DELETE an individual policy - CONFLICT
    ...    Test objective: The objective is to test that DELETE method does not delete an activated individual policy.
    ...    Pre-conditions: The activation status of individual policy to be deleted is set to ACTIVATED.
    ...    Reference: Clause 5.5.8.3.5 - ETSI GS NFV-SOL 012 [7] v3.4.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Post-Conditions: The individual policy is not deleted.
    Check Activation Status of Policy Is    ACTIVATED
    DELETE Individual Policy
    Check HTTP Response Status Code Is    409
    Check HTTP Response Body Json Schema Is   ProblemDetails    
    Check Postcondition Individual Policy is Not Deleted
    
GET Information about an individual policy - NOT FOUND
     [Documentation]    Test ID: 10.3.1.3.8
    ...    Test title: GET Information about an individual policy - NOT FOUND
    ...    Test objective: The objective is to test that the retrieval of individual policy fails when using an invalid resource identifier.
    ...    Pre-conditions: At least one individual policy is available in the NFV-MANO.
    ...    Reference: Clause 5.5.8.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Post-Conditions: none
    GET Individual Policy
    Check HTTP Response Status Code Is    404
    Check HTTP Response Body Json Schema Is   ProblemDetails
 No newline at end of file
+61 −1
Original line number Diff line number Diff line
@@ -434,3 +434,63 @@ DELETE Policies
Check Postcondition Policies Exist
    Log    Checking that Policies exist
    Get Policies 
    
POST Individual Policy
    log    Trying to perform a POST. 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}"}
    Post    ${apiRoot}/${apiName}/${apiVersion}/policies/${policyId}
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}  

GET Individual Policy
    log    Trying to get information about an individual policy
    Set Headers    {"Accept":"${ACCEPT}"}  
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Get    ${apiRoot}/${apiName}/${apiVersion}/policies/${policyId}  
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}
	
PUT Individual Policy
    log    Trying to perform a PUT. 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}"}
    Put    ${apiRoot}/${apiName}/${apiVersion}/policies/${policyId}
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}  
	
PATCH Individual Policy
    Log    Modify individual policy instance by PATCH to ${apiRoot}/${apiName}/${apiVersion}/policies/${policyId}
    Set Headers  {"Accept":"${ACCEPT}"}  
    Set Headers  {"Content-Type": "${CONTENT_TYPE}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    ${body}=    Get File    jsons/PolicyModifications.json
    Patch    ${apiRoot}/${apiName}/${apiVersion}/policies/${policyId}    ${body}    
	${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}
	
DELETE Individual Policy
    log    Trying to delete an individual policy, no conflict
    Set Headers  {"Accept":"${ACCEPT}"}  
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Delete    ${apiRoot}/${apiName}/${apiVersion}/policies/${policyId}   
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}
	
Check Postcondition Individual Policy is Deleted
    Log    Check Postcondition individual policy is deleted
    GET individual Policy
    Check HTTP Response Status Code Is    404 

Check Activation Status of Policy Is
    [Arguments]    ${status}
    Get Individual Policy
    Check HTTP Response Body Json Schema Is   Policy
    Should be equal as strings    ${response['body']['activationStatus']}    ${status}

Check Postcondition Individual Policy is Not Deleted
    Log    Check Postcondition individual policy is not deleted
    GET individual Policy
    Check HTTP Response Status Code Is    200
 No newline at end of file
+1 −0
Original line number Diff line number Diff line
@@ -48,6 +48,7 @@ ${polling_interval} 10 sec
${notification_request}    []
${notification_response}    []

${policyId}
${policyId1}
${policyId2}