Commit 9c850edd authored by Elian Kraja's avatar Elian Kraja
Browse files

Adding missing notifications TCs and an example for unauthorized cases

parent a69f1e4a
......@@ -233,7 +233,23 @@ Remove a APP Package subscription using non existant subscription id
Delete an App Package Subscription identified by ${NON_EXISTENT_SUBSCRIPTION_ID}
Check HTTP Response Status Code Is 404
Post Application Package Notification
[Documentation] TP_MEC_MEO_PKGM_011_OK
... Check that the MEO service sends a application package notification
... if the MEO service has an associated subscription and the event is generated
... ETSI GS MEC 010-2 2.0.10, clause 7.3.5.1
${json}= Get File schemas/AppPkgNotification.schema.json
Log Creating mock request and response to handle Application Package Notification
&{req}= Create Mock Request Matcher POST ${callback_endpoint} body_type="JSON_SCHEMA" body=${json}
&{rsp}= Create Mock Response headers="Content-Type: application/json" status_code=204
Create Mock Expectation ${req} ${rsp}
Wait Until Keyword Succeeds ${total_polling_time} ${polling_interval} Verify Mock Expectation ${req}
Log Verifying results
Verify Mock Expectation ${req}
Log Cleaning the endpoint
Clear Requests ${callback_endpoint}
*** Keywords ***
Post Request to create new App Package Resource
......
......@@ -178,7 +178,21 @@ Remove a APP Package subscription using non existant subscription id
Check HTTP Response Status Code Is 404
Post Application Package Notification
[Documentation] TP_MEC_MEPM_PKGM_009_OK
... Check that the MEPM service sends a application package notification
... if the MEPM service has an associated subscription and the event is generated
... ETSI GS MEC 010-2 2.0.10, clause 7.4.7.3.1
${json}= Get File schemas/AppPkgNotification.schema.json
Log Creating mock request and response to handle Application Package Notification
&{req}= Create Mock Request Matcher POST ${callback_endpoint} body_type="JSON_SCHEMA" body=${json}
&{rsp}= Create Mock Response headers="Content-Type: application/json" status_code=204
Create Mock Expectation ${req} ${rsp}
Wait Until Keyword Succeeds ${total_polling_time} ${polling_interval} Verify Mock Expectation ${req}
Log Verifying results
Verify Mock Expectation ${req}
Log Cleaning the endpoint
Clear Requests ${callback_endpoint}
*** Keywords ***
GET all APP Packages
......
......@@ -4,31 +4,165 @@ Resource ../../GenericKeywords.robot
Library REST ${PROVIDER_SCHEMA}://${PROVIDER_HOST}:${PROVIDER_PORT} ssl_verify=false
Library BuiltIn
Library OperatingSystem
Library Collections
Library String
*** Variable ***
@{data} https|localhost|8080|/alcmi/v1/app_instances|POST|{"key":"value"} https|localhost|8080|/alcmi/v1/app_instances|GET https|localhost|8080|/alcmi/v1/app_instances|PUT
${token} Bearer InvalidToken
*** Test Cases ***
Request access to a generic resource not using token
Request access to all resources using no token
[Documentation] TP_MEC_MEX_ANY_001_NT
... Check that a MEC API provider responds with an error when it
... receives a request without token
... ETSI GS MEC 009 1.1.1, clause 6.16.1
[Tags] GENERIC_TESTS INCLUDE_UNDEFINED_SCHEMAS
: FOR ${INDEX} IN RANGE 0 3
\ @{list} Split String ${data[${INDEX}]} separator=| max_split=-1
\ Perform a generic request using no token @{list[${INDEX}]}
: FOR ${INDEX} IN RANGE 0 3
\ @{list} Split String ${data[${INDEX}]} separator=| max_split=-1
\ Perform a generic request using invalid token @{data[${INDEX}]}
*** Keywords ***
Perform a generic request using no token
[Arguments] @{params}
Run Keyword If '@{params[4]}' == "POST"
... Perform a POST using no token ${params[0]} ${params[1]} ${params[2]} ${params[3]} ${params[5]}
Run Keyword If '@{params[4]}' == "GET"
... Perform a GET using no token ${params[0]} ${params[1]} ${params[2]} ${params[3]}
Run Keyword If '@{params[4]}' == "DELETE"
... Perform a DELETE using no token ${params[0]} ${params[1]} ${params[2]} ${params[3]}
Run Keyword If '@{params[4]}' == "PUT"
... Perform a PUT using no token ${params[0]} ${params[1]} ${params[2]} ${params[3]} ${params[5]}
Run Keyword If '@{params[4]}' == "PATCH"
... Perform a PATCH using no token ${params[0]} ${params[1]} ${params[2]} ${params[3]} ${params[5]}
Perform a generic request using invalid token
[Arguments] @{params}
Run Keyword If '@{params[4]}' == "POST"
... Perform a POST using invalid token ${token} ${params[0]} ${params[1]} ${params[2]} ${params[3]} ${params[5]}
Run Keyword If '@{params[4]}' == "GET"
... Perform a GET using invalid token ${token} ${params[0]} ${params[1]} ${params[2]} ${params[3]}
Run Keyword If '@{params[4]}' == "DELETE"
... Perform a DELETE using invalid token ${token} ${params[0]} ${params[1]} ${params[2]} ${params[3]}
Run Keyword If '@{params[4]}' == "PUT"
... Perform a PUT using invalid token ${token} ${params[0]} ${params[1]} ${params[2]} ${params[3]} ${params[5]}
Run Keyword If '@{params[4]}' == "PATCH"
... Perform a PATCH using invalid token ${token} ${params[0]} ${params[1]} ${params[2]} ${params[3]} ${params[5]}
Perform a POST using no token
[Arguments] ${schema} ${ip} ${port} ${uri} ${payload}
Log "Running post"
Set Headers {"Accept":"application/json"}
Set Headers {"Content-Type":"application/json"}
Get ${apiRoot}/${apiName}/${apiVersion}/app_packages
POST ${schema}://${ip}:${port}/${uri} ${payload}
Log ${schema}://${ip}:${port}/${uri} ${payload}
${output}= Output response
Should Be Equal As Strings 401 ${output['status']}
Request access to a generic resource using an invalid token
[Documentation] TP_MEC_MEX_ANY_001_WT
... Check that a MEC API provider responds with an error
... when it receives a request with a wrong token
... ETSI GS MEC 009 1.1.1, clause 6.16.1
[Tags] GENERIC_TESTS INCLUDE_UNDEFINED_SCHEMAS
Perform a GET using no token
[Arguments] ${schema} ${ip} ${port} ${uri}
Set Headers {"Accept":"application/json"}
Set Headers {"Content-Type":"application/json"}
Log ${schema}://${ip}:${port}/${uri}
GET ${schema}://${ip}:${port}/${uri}
${output}= Output response
Should Be Equal As Strings 401 ${output['status']}
Perform a DELETE using no token
[Arguments] ${schema} ${ip} ${port} ${uri}
Set Headers {"Accept":"application/json"}
Set Headers {"Content-Type":"application/json"}
Log ${schema}://${ip}:${port}/${uri}
DELETE ${schema}://${ip}:${port}/${uri}
${output}= Output response
Should Be Equal As Strings 401 ${output['status']}
Perform a PUT using no token
[Arguments] ${schema} ${ip} ${port} ${uri} ${payload}=None
Log "Running post"
Set Headers {"Accept":"application/json"}
Set Headers {"Content-Type":"application/json"}
Log ${schema}://${ip}:${port}/${uri} ${payload}
PUT ${schema}://${ip}:${port}/${uri} ${payload}
${output}= Output response
Should Be Equal As Strings 401 ${output['status']}
Perform a PATCH using no token
[Arguments] ${schema} ${ip} ${port} ${uri} ${payload}=None
Log "Running post"
Set Headers {"Accept":"application/json"}
Set Headers {"Content-Type":"application/json"}
Log ${schema}://${ip}:${port}/${uri} ${payload}
PATCH ${schema}://${ip}:${port}/${uri} ${payload}
${output}= Output response
Should Be Equal As Strings 401 ${output['status']}
Perform a POST using invalid token
[Arguments] ${token} ${schema} ${ip} ${port} ${uri} ${payload}=None
Set Headers {"Accept":"application/json"}
Set Headers {"Authorization":"${token}"}
Set Headers {"Content-Type":"application/json"}
Log ${schema}://${ip}:${port}/${uri} ${payload}
POST ${schema}://${ip}:${port}/${uri} ${payload}
${output}= Output response
Should Be Equal As Strings 401 ${output['status']}
Perform a GET using invalid token
[Arguments] ${token} ${schema} ${ip} ${port} ${uri}
Set Headers {"Accept":"application/json"}
Set Headers {"Authorization":"${token}"}
Set Headers {"Content-Type":"application/json"}
Log ${schema}://${ip}:${port}/${uri}
GET ${schema}://${ip}:${port}/${uri}
${output}= Output response
Should Be Equal As Strings 401 ${output['status']}
Perform a DELETE using invalid token
[Arguments] ${token} ${schema} ${ip} ${port} ${uri}
Set Headers {"Accept":"application/json"}
Set Headers {"Authorization":"${token}"}
Set Headers {"Content-Type":"application/json"}
Log ${schema}://${ip}:${port}/${uri}
DELETE ${schema}://${ip}:${port}/${uri}
${output}= Output response
Should Be Equal As Strings 401 ${output['status']}
Perform a PUT using invalid token
[Arguments] ${token} ${schema} ${ip} ${port} ${uri} ${payload}=None
Set Headers {"Accept":"application/json"}
Set Headers {"Authorization":"${token}"}
Set Headers {"Content-Type":"application/json"}
Log ${schema}://${ip}:${port}/${uri} ${payload}
PUT ${schema}://${ip}:${port}/${uri} ${payload}
${output}= Output response
Should Be Equal As Strings 401 ${output['status']}
Perform a PATCH using invalid token
[Arguments] ${token} ${schema} ${ip} ${port} ${uri} ${payload}=None
Set Headers {"Accept":"application/json"}
Set Headers {"Authorization":"${token}"}
Set Headers {"Content-Type":"application/json"}
Set Headers {"Authorization":"${INVALID_TOKEN}"}
Get ${apiRoot}/${apiName}/${apiVersion}/app_packages
Log ${schema}://${ip}:${port}/${uri} ${payload}
PATCH ${schema}://${ip}:${port}/${uri} ${payload}
${output}= Output response
Should Be Equal As Strings 401 ${output['status']}
{
["https", "localhost", "8080", "/alcmi/v1/app_instances", "POST", "{}"],
["https", "localhost", "8080", "/alcmi/v1/app_instances", "GET", ""],
["https", "localhost", "8080", "/alcmi/v1/app_instances", "PUT", "{}"],
["https", "localhost", "8080", "/alcmi/v1/app_instances", "DELETE", ""]
}
\ No newline at end of file
......@@ -322,7 +322,23 @@ Remove a APP Package subscription using non existant subscription id
Delete an LCM Subscription identified by ${NON_EXISTENT_SUBSCRIPTION_ID}
Check HTTP Response Status Code Is 404
Post Application Package Notification
[Documentation] TP_MEC_MEX_LCM_014_OK
... Check that MEC API provider sends a notification to the subscriber when an application lcm change event occurs
... ETSI GS MEC 010-2 2.0.10, clause 7.5.5.3.1
... ETSI GS MEC 010-2 2.0.10, table 6.2.2.18.2-1, // AppLcmOpOccNotification
... ETSI GS MEC 010-2 2.0.10, table 6.2.2.12.2-1 // AppInstNotification
${json}= Get File schemas/LCMNotification.schema.json
Log Creating mock request and response to handle LCM Notification
&{req}= Create Mock Request Matcher POST ${callback_endpoint} body_type="JSON_SCHEMA" body=${json}
&{rsp}= Create Mock Response headers="Content-Type: application/json" status_code=204
Create Mock Expectation ${req} ${rsp}
Wait Until Keyword Succeeds ${total_polling_time} ${polling_interval} Verify Mock Expectation ${req}
Log Verifying results
Verify Mock Expectation ${req}
Log Cleaning the endpoint
Clear Requests ${callback_endpoint}
*** Keywords ***
Post Request to create new App instance
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment