IndividualSubscription.robot 7.04 KB
Newer Older
1
*** Settings ***
2
Resource    environment/variables.txt 
3
4
5
6
7
Library    JSONLibrary
Library    JSONSchemaLibrary    schemas/
Library    REST    ${VNFM_SCHEMA}://${VNFM_HOST}:${VNFM_PORT}    
Documentation    This resource represents an individual subscription for VNF alarms. 
...    The client can use this resource to read and to terminate a subscription to notifications related to VNF fault management.
8
Suite Setup    Check resource existence
9
10

*** Test Cases ***
11
POST Individual Subscription - Method not implemented
12
    [Documentation]    Test ID: 6.3.4.5.1
13
    ...    Test title: POST Individual Subscription - Method not implemented
14
15
    ...    Test objective: The objective is to test that the method is not implemented
    ...    Pre-conditions: 
16
    ...    Reference: clause 7.4.6.3.1 - ETSI GS NFV-SOL 002 [2] v2.4.1
17
18
19
20
21
22
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: 
    ...    Post-Conditions: 
    Post Create individual subscription
    Check HTTP Response Status Code Is    405
    
23
GET Information about an individual subscription
24
    [Documentation]    Test ID: 6.3.4.5.2
25
    ...    Test title: GET Information about an individual subscription
26
27
    ...    Test objective: The objective is to read an individual subscription for VNF alarms subscribed by the client
    ...    Pre-conditions: The subscription with the given id exists
28
    ...    Reference: clause 7.4.6.3.2 - ETSI GS NFV-SOL 002 [2] v2.4.1
29
30
31
    ...    Config ID: Config_prod_VNFM
    ...    Applicability:  
    ...    Post-Conditions: 
32
33
34
35
36
37
    Get individual subscription
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is   FmSubscription

PUT an individual subscription - Method not implemented
    [Documentation]    Test ID: 6.3.4.5.3
38
    ...    Test title: PUT an individual subscription - Method not implemented
39
40
    ...    Test objective: The objective is to test that the method is not implemented
    ...    Pre-conditions: 
41
    ...    Reference: clause 7.4.6.3.3 - ETSI GS NFV-SOL 002 [2] v2.4.1
42
43
44
45
46
47
48
49
50
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: 
    ...    Post-Conditions: 
    Put individual subscription
    Check HTTP Response Status Code Is    405
    

PATCH an individual subscription - Method not implemented
    [Documentation]    Test ID: 6.3.4.5.4
51
    ...    Test title: PATCH an individual subscription - Method not implemented
52
53
    ...    Test objective: The objective is to test that the method is not implemented
    ...    Pre-conditions: 
54
    ...    Reference: clause 7.4.6.3.4 - ETSI GS NFV-SOL 002 [2] v2.4.1
55
56
57
58
59
60
61
62
63
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: 
    ...    Post-Conditions: 
    Patch individual subscription
    Check HTTP Response Status Code Is    405
    
    
DELETE an individual subscription
    [Documentation]    Test ID: 6.3.4.5.5
64
    ...    Test title: DELETE an individual subscription
65
66
    ...    Test objective: The objective is to test that the deletion of a subscription
    ...    Pre-conditions: an existing subscription
67
    ...    Reference: clause 7.4.6.3.5 - ETSI GS NFV-SOL 002 [2] v2.4.1
68
69
70
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: 
    ...    Post-Conditions: the subscription is deleted
71
    Check resource existence
72
73
74
75
    Delete individual subscription
    Check HTTP Response Status Code Is    204
    
*** Keywords ***
76
Check resource existence
77
78
79
80
81
82
83
84
85
86
87
88
    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 Create individual subscription
    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}/subscriptions/${subscriptionId}  
    ${outputResponse}=    Output    response
	Set Global Variable    @{response}    ${outputResponse}				
Get individual subscription
89
90
91
92
    log    Trying to get information about an individual subscription
    Set Headers    {"Accept":"${ACCEPT}"}  
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Get    ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${subscriptionId}
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
    ${outputResponse}=    Output    response
	Set Global Variable    @{response}    ${outputResponse}	
Get individual subscription - filter
    Log    Get the list of active individual subscription using a filter
    Set Headers    {"Accept": "${ACCEPT}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    GET    ${apiRoot}/${apiName}/${apiVersion}/subscriptions?${sub_filter}
    ${outputResponse}=    Output    response
	Set Global Variable    @{response}    ${outputResponse}		
Get individual subscription - invalid filter  
    Log    Get the list of active individual subscription using an invalid filter
    Set Headers    {"Accept": "${ACCEPT}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    GET    ${apiRoot}/${apiName}/${apiVersion}/subscriptions?${sub_filter_invalid}
    ${outputResponse}=    Output    response
	Set Global Variable    @{response}    ${outputResponse}		
PUT individual subscription
110
111
112
    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}"}
113
114
115
116
    Put    ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${subscriptionId}        
    ${outputResponse}=    Output    response
	Set Global Variable    @{response}    ${outputResponse}	
PATCH individual subscription
117
118
119
120
    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}"}
121
122
123
124
    Patch    ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${subscriptionId} 
    ${outputResponse}=    Output    response
	Set Global Variable    @{response}    ${outputResponse}		
DELETE individual subscription
125
126
127
    log    Try to delete an individual subscription
    Set Headers  {"Accept":"${ACCEPT}"}  
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
128
129
    Delete    ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${subscriptionId}    	   
    ${outputResponse}=    Output    response
Giacomo Bernini's avatar
Giacomo Bernini committed
130
131
132
133
134
135
136
137
138
139
140
141
142
	Set Global Variable    @{response}    ${outputResponse}	      
	
Check HTTP Response Status Code Is
    [Arguments]    ${expected_status}    
    Should Be Equal    ${response.status_code}    ${expected_status}
    Log    Status code validated 
    
Check HTTP Response Body Json Schema Is
    [Arguments]    ${input}
    Should Contain    ${response['headers']['Content-Type']}    application/json
    ${schema} =    Catenate    SEPARATOR=    ${input}	.schema.json
    Validate Json    ${schema}    ${response['body']}
    Log    Json Schema Validation OK