IndividualSubscription.robot 7.31 KB
Newer Older
1
*** Settings ***
2
Resource    environment/variables.txt 
3
4
Library    JSONLibrary
Library    JSONSchemaLibrary    schemas/
5
Library    REST    ${VNFM_SCHEMA}://${VNFM_HOST}:${VNFM_PORT}       ssl_verify=false 
6
7
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: 
Michele Carignani's avatar
Michele Carignani committed
16
    ...    Reference: Clause 7.4.6.3.1 - ETSI GS NFV-SOL 002 [2] v2.6.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
Michele Carignani's avatar
Michele Carignani committed
28
    ...    Reference: Clause 7.4.6.3.2 - ETSI GS NFV-SOL 002 [2] v2.6.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: 
Michele Carignani's avatar
Michele Carignani committed
41
    ...    Reference: Clause 7.4.6.3.3 - ETSI GS NFV-SOL 002 [2] v2.6.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: 
Michele Carignani's avatar
Michele Carignani committed
54
    ...    Reference: Clause 7.4.6.3.4 - ETSI GS NFV-SOL 002 [2] v2.6.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
Michele Carignani's avatar
Michele Carignani committed
67
    ...    Reference: Clause 7.4.6.3.5 - ETSI GS NFV-SOL 002 [2] v2.6.1
68
69
70
71
72
73
74
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: 
    ...    Post-Conditions: the subscription is deleted
    Delete individual subscription
    Check HTTP Response Status Code Is    204
    
*** Keywords ***
75
Check resource existence
76
    Set Headers    {"Accept":"${ACCEPT}"}
77
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
78
79
80
81
82
    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}"}
83
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
84
85
    Post    ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${subscriptionId}  
    ${outputResponse}=    Output    response
Elian Kraja's avatar
Elian Kraja committed
86
	Set Global Variable    ${response}    ${outputResponse}				
87
Get individual subscription
88
89
    log    Trying to get information about an individual subscription
    Set Headers    {"Accept":"${ACCEPT}"}  
90
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
91
    Get    ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${subscriptionId}
92
    ${outputResponse}=    Output    response
Elian Kraja's avatar
Elian Kraja committed
93
	Set Global Variable    ${response}    ${outputResponse}	
94
95
96
Get individual subscription - filter
    Log    Get the list of active individual subscription using a filter
    Set Headers    {"Accept": "${ACCEPT}"}
97
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
98
99
    GET    ${apiRoot}/${apiName}/${apiVersion}/subscriptions?${sub_filter}
    ${outputResponse}=    Output    response
Elian Kraja's avatar
Elian Kraja committed
100
	Set Global Variable    ${response}    ${outputResponse}		
101
102
103
Get individual subscription - invalid filter  
    Log    Get the list of active individual subscription using an invalid filter
    Set Headers    {"Accept": "${ACCEPT}"}
104
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
105
106
    GET    ${apiRoot}/${apiName}/${apiVersion}/subscriptions?${sub_filter_invalid}
    ${outputResponse}=    Output    response
Elian Kraja's avatar
Elian Kraja committed
107
	Set Global Variable    ${response}    ${outputResponse}		
108
PUT individual subscription
109
110
    log    Trying to perform a PUT. This method should not be implemented
    Set Headers  {"Accept":"${ACCEPT}"}
111
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
112
113
    Put    ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${subscriptionId}        
    ${outputResponse}=    Output    response
Elian Kraja's avatar
Elian Kraja committed
114
	Set Global Variable    ${response}    ${outputResponse}	
115
PATCH individual subscription
116
117
118
    log    Trying to perform a PATCH. This method should not be implemented
    Set Headers  {"Accept":"${ACCEPT}"}  
    Set Headers  {"Content-Type": "${CONTENT_TYPE}"}
119
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
120
121
    Patch    ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${subscriptionId} 
    ${outputResponse}=    Output    response
Elian Kraja's avatar
Elian Kraja committed
122
	Set Global Variable    ${response}    ${outputResponse}		
123
DELETE individual subscription
124
125
    log    Try to delete an individual subscription
    Set Headers  {"Accept":"${ACCEPT}"}  
126
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
127
128
    Delete    ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${subscriptionId}    	   
    ${outputResponse}=    Output    response
Elian Kraja's avatar
Elian Kraja committed
129
	Set Global Variable    ${response}    ${outputResponse}	      
Giacomo Bernini's avatar
Giacomo Bernini committed
130
131
132
	
Check HTTP Response Status Code Is
    [Arguments]    ${expected_status}    
Elian Kraja's avatar
Elian Kraja committed
133
    Should Be Equal As Strings    ${response['status']}    ${expected_status}
Giacomo Bernini's avatar
Giacomo Bernini committed
134
135
136
137
    Log    Status code validated 
    
Check HTTP Response Body Json Schema Is
    [Arguments]    ${input}
138
139
    Run Keyword If    '${input}' == 'ProblemDetails'    Should Contain    ${response['headers']['Content-Type']}    application/problem+json
    ...    ELSE    Should Contain    ${response['headers']['Content-Type']}    application/json
Giacomo Bernini's avatar
Giacomo Bernini committed
140
141
    ${schema} =    Catenate    SEPARATOR=    ${input}	.schema.json
    Validate Json    ${schema}    ${response['body']}
root's avatar
root committed
142
    Log    Json Schema Validation OK