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

Policies resource added in PolicyManagement-API

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

*** Test Cases ***
POST Create a new Policy
    [Documentation]    Test ID: 10.3.1.2.1
    ...    Test title: POST Create a new Policy
    ...    Test objective: The objective is to test that POST method creates a policy.
    ...    Pre-conditions: none
    ...    Reference: Clause 5.5.3.3.1 - ETSI GS NFV-SOL 012 [7] v3.4.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Post-Conditions: Policy is created.     
    POST Policies
    Check HTTP Response Status Code Is    201
    Check HTTP Response Body Json Schema Is    Policy
    Check HTTP Response Header Contains    Location
                
GET Policies
    [Documentation]    Test ID: 10.3.1.2.2
    ...    Test title: GET Policies
    ...    Test objective: The objective is to test that GET method retrieves the list of existing policies.
    ...    Pre-conditions: none
    ...    Reference: Clause 5.5.3.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Post-Conditions: none    
    GET Policies
    Check HTTP Response Status Code Is  200
    Check HTTP Response Body Json Schema Is  Policies

GET Policies - Filter
    [Documentation]    Test ID: 10.3.1.2.3
    ...    Test title: GET Policies - Filter
    ...    Test objective: The objective is GET the list of existing policies using a filter.
    ...    Pre-conditions: none
    ...    Reference: Clause 5.5.3.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Post-Conditions: none    
    GET Policies with filter
    Check HTTP Response Status Code Is  200
    Check HTTP Response Body Json Schema Is  Policies
    
GET Policies - Bad Request Invalid attribute-based filtering parameters
    [Documentation]    Test ID: 10.3.1.2.4
    ...    Test title: GET Policies - Bad Request Invalid attribute-based filtering parameters
    ...    Test objective: The objective is GET the list of existing policies using an invalid filter.
    ...    Pre-conditions: none
    ...    Reference: Clause 5.5.3.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Post-Conditions: none 
    Get Policies - invalid filter
    Check HTTP Response Status Code Is    400
    Check HTTP Response Body Json Schema Is    ProblemDetails

GET Policies - Bad Request Response too Big
    [Documentation]    Test ID: 10.3.1.2.5
    ...    Test title: GET Policies - Bad Request Response too Big
    ...    Test objective: The objective is test that the retrieval of existing policies list fails because response is too big, and perform the JSON schema validation of the failed operation HTTP response.
    ...    Pre-conditions: none
    ...    Reference: Clause 5.5.3.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Post-Conditions: none 
    GET Policies
    Check HTTP Response Status Code Is    400
    Check HTTP Response Body Json Schema Is    ProblemDetails
    
GET Policies with "all_fields" attribute selector
    [Documentation]    Test ID: 10.3.1.2.6
    ...    Test title: GET Policies with "all_fields" attribute selector
    ...    Test objective: The objective is to retrieve the list of existing policies with "all_fields" attribute selector.
    ...    Pre-conditions: none
    ...    Reference: Clause 5.5.3.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none 
    ...    Post-Conditions: none
    Get Policies with all_fields attribute selector
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is   Policies

GET Policies with "exclude_default" attribute selector
    [Documentation]    Test ID: 10.3.1.2.7
    ...    Test title: GET policies with "exclude_default" attribute selector
    ...    Test objective: The objective is to retrieve the list of existing policies with "exclude_default"s attribute selector.
    ...    Pre-conditions: none
    ...    Reference: Clause 5.5.3.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability:  none
    ...    Post-Conditions: none
    Get Policies with exclude_default attribute selector
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is   Policies

GET Policies with "fields" attribute selector
    [Documentation]    Test ID: 10.3.1.2.8
    ...    Test title: GET Policies with "fields" attribute selector
    ...    Test objective: The objective is to retrieve the list of existing policies with "fields" attribute selector.
    ...    Pre-conditions: none
    ...    Reference: Clause 5.5.3.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability:  none
    ...    Post-Conditions: none
    Get Policies with fields attribute selector
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is   Policies

GET Policies with "exclude_fields" attribute selector
    [Documentation]    Test ID: 10.3.1.2.9
    ...    Test title: GET Policies with "exclude_fields" attribute selector
    ...    Test objective: The objective is to retrieve the list of existing policies with "exclude_fields" attribute selector.
    ...    Pre-conditions: none
    ...    Reference: Clause 5.5.3.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability:  none
    ...    Post-Conditions: none
    Get Policies with exclude_fields attribute selector
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is   Policies   
    
GET Policies with "exclude_default" and "fields" attribute selector
    [Documentation]    Test ID: 10.3.1.2.10
    ...    Test title: GET Policies with "exclude_default" and "fields" attribute selector
    ...    Test objective: The objective is to retrieve the list of existing policies with "exclude_default" and "fields" attribute selector
    ...    Pre-conditions: 
    ...    Reference: Clause 5.5.3.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none 
    ...    Post-Conditions: none
    Get Policies with exclude_default and fields attribute selector
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is   Policies  
        
GET Policies as Paged Response
    [Documentation]    Test ID: 10.3.1.2.11
    ...    Test title: GET Policies as Paged Response
    ...    Test objective: The objective is to test that GET method  retrieve the list of existing policies as paged response.
    ...    Pre-conditions: none
    ...    Reference: Clause 5.5.3.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: NFV-MANO supports paged response
    ...    Post-Conditions: none    
    GET Policies
    Check HTTP Response Status Code Is  200
    Check HTTP Response Header Contains Link
        
PUT Policies - Method not implemented
     [Documentation]    Test ID: 10.3.1.2.12
    ...    Test title: PUT Policies - Method not implemented
    ...    Test objective: The objective is to test that PUT method cannot modify policies.
    ...    Pre-conditions: none
    ...    Reference: Clause 5.5.3.3.3 - ETSI GS NFV-SOL 012 [7] v3.4.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Post-Conditions: none
    PUT Policies
    Check HTTP Response Status Code Is    405

PATCH Policies - Method not implemented
    [Documentation]    Test ID: 10.3.1.2.13
    ...    Test title: PATCH Policies - Method not implemented
    ...    Test objective: The objective is to test that PATCH method cannot modify policies.
    ...    Pre-conditions: none
    ...    Reference: Clause 5.5.3.3.4 - ETSI GS NFV-SOL 012 [7] v3.4.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Post-Conditions: none
    PATCH Policies
    Check HTTP Response Status Code Is    405

DELETE Policies - Method not implemented
    [Documentation]    Test ID: 10.3.1.2.14
    ...    Test title: DELETE Policies - Method not implemented
    ...    Test objective: The objective is to test that DELETE method cannot delete policies.
    ...    Pre-conditions: none
    ...    Reference: Clause 5.5.3.3.5 - ETSI GS NFV-SOL 012 [7] v3.4.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Post-Conditions: Policies are not deleted
    DELETE Policies
    Check HTTP Response Status Code Is    405
    Check Postcondition Policies Exist
+107 −0
Original line number Diff line number Diff line
@@ -327,3 +327,110 @@ POST Policy Conflict Notification
    Post    ${callbackResp}    ${body}
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}

POST Policies
    Log    Create policy instance by POST to ${apiRoot}/${apiName}/${apiVersion}/policies
    Set Headers  {"Accept":"${ACCEPT}"}  
    Set Headers  {"Content-Type": "${CONTENT_TYPE}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    ${body}=    Get File    jsons/CreatePolicyRequest.json
    Post    ${apiRoot}/${apiName}/${apiVersion}/policies    ${body}    
	${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}

GET Policies
    Log    Get the list of existing policies
    Set Headers  {"Accept":"${ACCEPT}"}  
    Set Headers  {"Content-Type": "${CONTENT_TYPE}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Log    Execute Query and validate response
    Get    ${apiRoot}/${apiName}/${apiVersion}/policies
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}

GET Policies with filter  
    Log    Get the list of existing policies using a filter
    Set Headers    {"Accept": "${ACCEPT}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    GET    ${apiRoot}/${apiName}/${apiVersion}/policies?${sub_filter}
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}
	
Get Policies - invalid filter
    Log    Get the list of existing policies using an invalid filter
    Set Headers    {"Accept": "${ACCEPT}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    GET    ${apiRoot}/${apiName}/${apiVersion}/policies?${sub_filter_invalid} 
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}

Get Policies with all_fields attribute selector
    Log    Get the list of existing policies, using fields
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    GET    ${apiRoot}/${apiName}/${apiVersion}/policies?all_fields
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
    
Get Policies with exclude_default attribute selector
    Log    Get the list of existing policies, using fields
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    GET    ${apiRoot}/${apiName}/${apiVersion}/policies?exclude_default
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
    
Get Policies with fields attribute selector
    Log    Get the list of existing policies, using fields
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    GET    ${apiRoot}/${apiName}/${apiVersion}/policies?fields=${fields}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}	
    
Get Policies with exclude_fields attribute selector
    Log    Get the list of existing policies, using fields
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    GET    ${apiRoot}/${apiName}/${apiVersion}/policies?exclude_fields=${fields}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}     
    
Get Policies with exclude_default and fields attribute selector
    Log    Get the list of existing policies, using fields
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    GET    ${apiRoot}/${apiName}/${apiVersion}/policies?fields=${fields}&exclude_default
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
	
PUT Policies
    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    
	${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}
	
PATCH Policies
    Log    Trying to perform a PATCH. 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}/policies    
	${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}
	
DELETE Policies
    Log    Trying to perform a DELETE. 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}"}
    Delete    ${apiRoot}/${apiName}/${apiVersion}/policies    
	${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}

Check Postcondition Policies Exist
    Log    Checking that Policies exist
    Get Policies 
 No newline at end of file
+3 −3
Original line number Diff line number Diff line
@@ -166,7 +166,7 @@ GET Subscriptions as Paged Response
PUT subscriptions - Method not implemented
     [Documentation]    Test ID: 10.3.1.6.13
    ...    Test title: PUT subscriptions - Method not implemented
    ...    Test objective: The objective is to test that PUT method cannot modify a NS instance usage subscription
    ...    Test objective: The objective is to test that PUT method cannot modify a policy management subscription.
    ...    Pre-conditions: none
    ...    Reference: Clause 5.5.7.3.3 - ETSI GS NFV-SOL 012 [7] v3.4.1
    ...    Config ID: Config_prod_NFV-MANO
@@ -178,7 +178,7 @@ PUT subscriptions - Method not implemented
PATCH subscriptions - Method not implemented
    [Documentation]    Test ID: 10.3.1.6.14
    ...    Test title: PATCH subscriptions - Method not implemented
    ...    Test objective: The objective is to test that PUT method cannot modify a NS instance usage subscription
    ...    Test objective: The objective is to test that PATCH method cannot modify a policy management subscription.
    ...    Pre-conditions: none
    ...    Reference: Clause 5.5.7.3.4 - ETSI GS NFV-SOL 012 [7] v3.4.1
    ...    Config ID: Config_prod_NFV-MANO
@@ -190,7 +190,7 @@ PATCH subscriptions - Method not implemented
DELETE subscriptions - Method not implemented
    [Documentation]    Test ID: 10.3.1.6.15
    ...    Test title: DELETE subscriptions - Method not implemented
    ...    Test objective: The objective is to test that DELETE method cannot delete a NS instance usage subscription
    ...    Test objective: The objective is to test that DELETE method cannot delete a policy management subscription.
    ...    Pre-conditions: none
    ...    Reference: Clause 5.5.7.3.5 - ETSI GS NFV-SOL 012 [7] v3.4.1
    ...    Config ID: Config_prod_NFV-MANO
+6 −0
Original line number Diff line number Diff line
{
  "designer": "",
  "name": "",
  "pfId": "",
  "associations": []
}
 No newline at end of file
+121 −0
Original line number Diff line number Diff line
{  "type": "array",
   "items":
   {
	"description": "This type represents an individual policy. It shall comply with the provisions defined in table 5.6.2.3-1.",
	"type": "object",
	"properties": {
		"id": {
			"description": "An identifier with the intention of being globally unique.\n",
			"type": "string"
		},
		"designer": {
			"description": "Human readable name of the designer of the policy.\n",
			"type": "string"
		},
		"name": {
			"description": "Human readable name of the policy.\n",
			"type": "string"
		},
		"pfId": {
			"description": "An identifier with the intention of being globally unique.\n",
			"type": "string"
		},
		"versions": {
			"description": "Versions of the policy. Shall be present if at least one version of the policy has been transferred.\n",
			"type": "array",
			"items": {
				"description": "A version.\n",
				"type": "string"
			}
		},
		"selectedVersion": {
			"description": "A version.\n",
			"type": "string"
		},
		"activationStatus": {
			"description": "The enumeration ActivationStatus shall comply with the provisions defined in table 5.6.4.3-1. It indicates the activation status of a policy.\n",
			"type": "string",
			"enum": [
				"ACTIVATED",
				"DEACTIVATED"
			]
		},
		"transferStatus": {
			"description": "The enumeration TransferStatus shall comply with the provisions defined in table 5.6.4.4-1. It indicates the transfer status of a policy\n",
			"type": "string",
			"enum": [
				"CREATED",
				"TRANSFERRED"
			]
		},
		"associations": {
			"description": "Identifiers of the entities that the PF manages and to which the policy associates to. Shall be absent when the association feature is not applicable for the PF. The associations refer to identifiers of entities that the PF manages. E.g., if the PF is a VNFM, the policy can associate to VNF instances; if the PF is NFVO, the policy can associate to an NS instances. How the PF determines the scope of applicability of the policy when this attribute is absent is outside the scope of the present document.\n",
			"type": "array",
			"items": {
				"description": "An identifier with the intention of being globally unique.\n",
				"type": "string"
			}
		},
		"_links": {
			"description": "Links for this resource\n",
			"type": "object",
			"properties": {
				"self": {
					"description": "This type represents a link to a resource using an absolute URI.\n",
					"type": "object",
					"required": [
						"href"
					],
					"properties": {
						"href": {
							"description": "String formatted according to IETF RFC 3986.\n",
							"type": "string"
						}
					}
				},
				"selected": {
					"description": "This type represents a link to a resource using an absolute URI.\n",
					"type": "object",
					"required": [
						"href"
					],
					"properties": {
						"href": {
							"description": "String formatted according to IETF RFC 3986.\n",
							"type": "string"
						}
					}
				},
				"versions": {
					"description": "URIs of all the transferred versions of this policy, if exists.\n",
					"type": "array",
					"items": {
						"description": "This type represents a link to a resource using an absolute URI.\n",
						"type": "object",
						"required": [
							"href"
						],
						"properties": {
							"href": {
								"description": "String formatted according to IETF RFC 3986.\n",
								"type": "string"
							}
						}
					}
				}
			},
			"required": [
				"self"
			]
		}
	},
	"required": [
		"id",
		"designer",
		"name",
		"activationStatus",
		"transferStatus",
		"_links"
	]
  }
}
 No newline at end of file
Loading