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

New resource added in SOL012 PolicyManagement-API

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

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

GET Information about the Particular Version of an Individual Policy - Successful
     [Documentation]    Test ID: 10.3.1.5.2
    ...    Test title: GET Information about the Particular Version of an Individual Policy - Successful
    ...    Test objective: The objective is to test The GET method fetches the content of the Particular version of an individual policy.
    ...    Pre-conditions: Individual policy is available in the NFV-MANO.
    ...    Reference: Clause 5.5.6.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Post-Conditions: none
    GET Particular Version of an Individual Policy
    Check HTTP Response Status Code Is    200
    
GET Information about the Particular Version of an Individual Policy - NOT FOUND
     [Documentation]    Test ID: 10.3.1.5.3
    ...    Test title: GET Information about the Particular Version of an Individual Policy - NOT FOUND
    ...    Test objective: The objective is to test that the information about the Particular version of an individual policy fails when using an invalid resource identifier.
    ...    Pre-conditions: The API producer did not find the current representation for the target resource.
    ...    Reference: Clause 5.5.6.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Post-Conditions: none
    GET Particular Version of an Individual Policy
    Check HTTP Response Status Code Is    404
    Check HTTP Response Body Json Schema Is   ProblemDetails

PUT Particular Version of an individual policy - Successful
     [Documentation]    Test ID: 10.3.1.5.4
    ...    Test title: PUT Particular Version of an individual policy - Successful
    ...    Test objective: The objective is to test that the PUT method transfers the content of a particular version of an individual policy.
    ...    Pre-conditions: none
    ...    Reference: Clause 5.5.6.3.3 - ETSI GS NFV-SOL 012 [7] v3.4.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: The policy content type is either JSON, YAML or ZIP.
    ...    Post-Conditions: none
    PUT Particular Version of an Individual Policy
    Check HTTP Response Status Code Is    201

PUT Particular Version of an individual policy - CONFLICT
     [Documentation]    Test ID: 10.3.1.5.5
    ...    Test title: PUT Particular Version of an individual policy - CONFLICT
    ...    Test objective: The objective is to test that the PUT method does not transfer the content of a particular version in case of a conflict.
    ...    Pre-conditions: The particular version has already been transferred to the API producer.
    ...    Reference: Clause 5.5.6.3.3 - ETSI GS NFV-SOL 012 [7] v3.4.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: The policy content type is either JSON, YAML or ZIP.
    ...    Post-Conditions: none
    PUT Particular Version of an Individual Policy
    Check HTTP Response Status Code Is    409
    Check HTTP Response Body Json Schema Is   ProblemDetails

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

DELETE Particular Version of an individual policy - Successful 
     [Documentation]    Test ID: 10.3.1.5.7
    ...    Test title: DELETE Particular Version of an individual policy - Successful
    ...    Test objective: The objective is to test that the DELETE method deletes a particular version of an individual policy.
    ...    Pre-conditions: none
    ...    Reference: Clause 5.5.6.3.5 - ETSI GS NFV-SOL 012 [7] v3.4.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Post-Conditions: none
    DELETE Particular Version of an Individual Policy
    Check HTTP Response Status Code Is    204

DELETE Particular Version of an individual policy - CONFLICT
     [Documentation]    Test ID: 10.3.1.5.8
    ...    Test title: DELETE Particular Version of an individual policy - CONFLICT
    ...    Test objective: The objective is to test that the DELETE method does not delete a particular version of an individual policy in case of a conflict.
    ...    Pre-conditions:  The requested version of the individual policy is the selected version.
    ...    Reference: Clause 5.5.6.3.5 - ETSI GS NFV-SOL 012 [7] v3.4.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Post-Conditions: none
    DELETE Particular Version of an Individual Policy
    Check HTTP Response Status Code Is    409
    Check HTTP Response Body Json Schema Is   ProblemDetails
+52 −7
Original line number Diff line number Diff line
@@ -539,10 +539,55 @@ DELETE Selected Version of an Individual Policy
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}  
    
Check HTTP Content-Type Is Set
    Log    Checking that the Content-Type HTTP header is set according to the type of policy content.
    GET individual Policy
    ${PolicyContentType}=    Get Value From Json    ${response['headers']}    $..Content-Type
    GET Selected Version of an Individual Policy
    ${HTTPContentType}=    Get Value From Json    ${response['headers']}    $..Content-Type
    Should be equal as strings    ${HTTPContentType}    ${PolicyContentType}
 No newline at end of file
POST Particular Version of an 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}/versions/${policyVersion}
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}  

GET Particular Version of an Individual Policy
    log    Trying to get information about a particular version of an individual policy
    Set Headers    {"Accept":"${ACCEPT}"}  
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Get    ${apiRoot}/${apiName}/${apiVersion}/policies/${policyId}/versions/${policyVersion}
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}
	
PUT Particular Version of an Individual Policy
    Log    Using PUT method to transfer the content of a particular version of an individual policy.
    Set Headers  {"Accept":"${ACCEPT}"}  
    Determine Policy Content Type
    Set Headers  {"Content-Type": "${POLICY_CONTENT_TYPE}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    ${body}=    Get File    ${POLICY_CONTENT_FILENAME}
    Put    ${apiRoot}/${apiName}/${apiVersion}/policies/${policyId}/versions/${policyVersion}    ${body}    
	${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}

PATCH Particular Version of an Individual Policy
    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}/policies/${policyId}/versions/${policyVersion} 
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}  

DELETE Particular Version of an Individual Policy
    Log    Trying to DELETE a particular version of an individual policy.
    Set Headers  {"Accept":"${ACCEPT}"}  
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Delete    ${apiRoot}/${apiName}/${apiVersion}/policies/${policyId}/versions/${policyVersion} 
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}  

Determine Policy Content Type
    ${json}=    Run keyword and return status    Should end with    ${POLICY_CONTENT_FILENAME}    .json
    ${yaml}=    Run keyword and return status    Should end with    ${POLICY_CONTENT_FILENAME}    .yaml
    ${zip}=    Run keyword and return status    Should end with    ${POLICY_CONTENT_FILENAME}    .zip
    Run Keyword If    ${json}    Set Global Variable   ${POLICY_CONTENT_TYPE}    application/json
    Run Keyword If    ${yaml}    Set Global Variable   ${POLICY_CONTENT_TYPE}    application/yaml
    Run Keyword If    ${zip}    Set Global Variable   ${POLICY_CONTENT_TYPE}    application/zip
    
 No newline at end of file
+6 −7
Original line number Diff line number Diff line
@@ -20,20 +20,19 @@ GET Information about the Selected Version of an Individual Policy - Successful
    ...    Test title: GET Information about the Selected Version of an Individual Policy - Successful
    ...    Test objective: The objective is to test The GET method fetches the content of the selected version of an individual policy.
    ...    Pre-conditions: Individual policy is available in the NFV-MANO.
    ...    Reference: Clause 5.5.4.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1
    ...    Reference: Clause 5.5.5.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Post-Conditions: none
    GET Selected Version of an Individual Policy
    Check HTTP Response Status Code Is    200
    Check HTTP Content-Type Is Set
    
GET Information about the Selected Version of an Individual Policy - NOT FOUND
     [Documentation]    Test ID: 10.3.1.4.3
    ...    Test title: GET Information about the Selected Version of an Individual Policy - NOT FOUND
    ...    Test objective: The objective is to test that the information about the selected version of an individual policy fails when using an invalid resource identifier.
    ...    Pre-conditions: The API producer did not find the current representation for the target resource.
    ...    Reference: Clause 5.5.4.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1
    ...    Reference: Clause 5.5.5.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Post-Conditions: none
@@ -46,7 +45,7 @@ GET Information about the Selected Version of an Individual Policy - CREATED STA
    ...    Test title: GET Information about the Selected Version of an Individual Policy - NOT FOUND
    ...    Test objective: The objective is to test that the information about the selected version of an individual policy is not retrieved when it is in CREATED state.
    ...    Pre-conditions: The individual policy is in CREATED state.
    ...    Reference: Clause 5.5.4.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1
    ...    Reference: Clause 5.5.5.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Post-Conditions: none
@@ -59,7 +58,7 @@ PUT Selected Version of an individual policy - Method not implemented
    ...    Test title: PUT Selected Version of an individual policy - Method not implemented
    ...    Test objective: The objective is to test that PUT method is not implemented for this resource.
    ...    Pre-conditions: none
    ...    Reference: Clause 5.5.4.3.3 - ETSI GS NFV-SOL 012 [7] v3.4.1
    ...    Reference: Clause 5.5.5.3.3 - ETSI GS NFV-SOL 012 [7] v3.4.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Post-Conditions: none
@@ -71,7 +70,7 @@ PATCH Selected Version of an individual policy - Method not implemented
    ...    Test title: PATCH Selected Version of an individual policy - Method not implemented
    ...    Test objective: The objective is to test that PATCH method is not implemented for this resource.
    ...    Pre-conditions: none
    ...    Reference: Clause 5.5.4.3.4 - ETSI GS NFV-SOL 012 [7] v3.4.1
    ...    Reference: Clause 5.5.5.3.4 - ETSI GS NFV-SOL 012 [7] v3.4.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Post-Conditions: none
@@ -83,7 +82,7 @@ DELETE Selected Version of an individual policy - Method not implemented
    ...    Test title: DELETE Selected Version of an individual policy - Method not implemented
    ...    Test objective: The objective is to test that DELETE method is not implemented for this resource.
    ...    Pre-conditions: none
    ...    Reference: Clause 5.5.4.3.5 - ETSI GS NFV-SOL 012 [7] v3.4.1
    ...    Reference: Clause 5.5.5.3.5 - ETSI GS NFV-SOL 012 [7] v3.4.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Post-Conditions: none
+4 −11
Original line number Diff line number Diff line
@@ -3,10 +3,8 @@ ${NFVMANO_HOST} localhost # Hostname of the NFVO
${NFVMANO_PORT}      8081    # Listening port of the NFVO
${NFVMANO_SCHEMA}    https
${AUTHORIZATION}    Bearer    QWxhZGRpbjpvcGVuIHNlc2FtZQ==
${WRONG_AUTHORIZATION}    Bearer    XXXXXWRONGXXXXX
${CONTENT_TYPE}    application/json
${CONTENT_TYPE_JSON}    application/json
${CONTENT_TYPE_PATCH}    application/merge-patch+json
${ACCEPT}         application/json
${ACCEPT_JSON}         application/json
${AUTH_USAGE}     1
@@ -15,20 +13,14 @@ ${apiRoot} /
${apiName}        nfvpolicy
${apiVersion}     v1

${SYNC_MODE}    1
#Add file name along with the full path containing policy contents
${POLICY_CONTENT_FILENAME}    jsons/PolicyContent/policyContent.json
${POLICY_CONTENT_TYPE}    application/json

${response}    {}

${NFVMANO_DUPLICATION}    1

${SINGLE_FILE_VNFD}    1    # If VNFD is PLAIN TEXT
${ACCEPT_PLAIN}    text/plain
${ACCEPT_ZIP}     application/zip
${vnfPkgId_processing}    007c111c-38a1-42c0-a666-7475ecb1567c
${ARTIFACT_TYPE}    application/octet-stream
${ARTIFACT_ID}    artifactId
${WRONG_ACCEPT}    application/json

${sub_filter}    filter
${sub_filter_invalid}    filter_invalid
${fields}         criteria,objectInstanceIds
@@ -51,6 +43,7 @@ ${notification_response} []
${policyId}
${policyId1}
${policyId2}
${policyVersion}

${callbackResp}		127.0.0.1

+10 −0
Original line number Diff line number Diff line
{
	"description": "This is a JSON example template for Policy content. Replace with your specific policy content.",
	"type": "object",
	"properties": {
		"id": {
			"description": "An identifier with the intention of being globally unique.\n",
			"type": "string"
		}
	}
}
 No newline at end of file
Loading