Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
NFV - Network Functions Virtualisation
api-tests
Commits
342cfe5f
Commit
342cfe5f
authored
Dec 03, 2018
by
Elian Kraja
Browse files
Added creation tests examples with explicit get operation to check result
parent
5bd9a483
Changes
2
Hide whitespace changes
Inline
Side-by-side
SOL003/VNFLifecycleManagement-API_egm/VnfInstancesWithChecks.robot
0 → 100644
View file @
342cfe5f
*** Setting ***
Resource
variables.txt
Library
OperatingSystem
Library
BuiltIn
Library
Collections
Library
String
Library
JSONSchemaLibrary
schemas/
Library
JSONLibrary
Library
REST
${VNFM_SCHEMA}
://
${VNFM_HOST}
:
${VNFM_PORT}
*** Test Cases ***
Create VNFInstantiation
${post_response}
=
Instantiate VNF
Validate Status Code
${post_response.status_code}
201
Validate Header
${post_response.headers}
Location
Validate Header
${post_response.headers}
Content-Type
Validate JsonSchema
${post_response.body}
vnfInstance.schema.json
${get_response}
=
Retrieve VNFinstance
${post_response.body.id}
Should Not Be Empty
${get_response}
Validate Status Code
${get_response.status_code}
200
Should Be Equal
${post_response.body.id}
${get_response.body.id}
Validate Header
${get_response.headers}
Content-Type
Validate JsonSchema
${get_response.body}
vnfInstance.schema.json
*** Keywords ***
Instantiate VNF
Log
Create VNF instance by POST to
${apiRoot}
/
${apiName}
/
${apiVersion}
/vnf_instances
Set Headers
{"Accept":"
${ACCEPT}
"}
Set Headers
{"Content-Type": "
${CONTENT_TYPE}
"}
Run Keyword If
${AUTH_USAGE}
=
= 1
Set Headers
{"Authorization":"
${AUTHORIZATION}
"}
${body}
=
Get File
json/createVnfRequest.json
Post
${apiRoot}
/
${apiName}
/
${apiVersion}
/vnf_instances
${body}
[
Return
]
response
Validate Status Code
[
Arguments
]
${curr_status}
${exp_status}
Should Be Equal
${curr_status}
${exp_status}
Log
Status code validated
Validate Header
[
Arguments
]
${headers}
${CONTENT_TYPE}
Should Contain
${headers}
${CONTENT_TYPE}
Log
Header is present
Validate JsonSchema
[
Arguments
]
${body}
${schema}
${json}
=
evaluate
json.loads('''
${body}
''')
json
Validate Json
${schema}
${json}
Log
Validation OK
Retrieve VNFinstance
[
Arguments
]
${vnfId}
Set Headers
{"Accept":"
${ACCEPT}
"}
Set Headers
{"Content-Type": "
${CONTENT_TYPE}
"}
Run Keyword If
${AUTH_USAGE}
=
= 1
Set Headers
{"Authorization":"
${AUTHORIZATION}
"}
Get
${apiRoot}
/
${apiName}
/
${apiVersion}
/vnf_instances/
${vnfId}
[
Return
]
response
\ No newline at end of file
SOL003/VNFPerformanceManagement-API_nxw/PMJobsWithChecks.robot
0 → 100644
View file @
342cfe5f
*** Setting ***
Resource
variables.txt
Library
OperatingSystem
Library
BuiltIn
Library
Collections
Library
String
Library
JSONSchemaLibrary
schemas/
Library
JSONLibrary
Library
REST
${VNFM_SCHEMA}
://
${VNFM_HOST}
:
${VNFM_PORT}
*** Test Cases ***
Create PMJob
${post_response}
=
Create PMJob
Validate Status Code
${post_response.status_code}
201
Validate Header
${post_response.headers}
Content-Type
Validate JsonSchema
${post_response.body}
PmJob.schema.json
${get_response}
=
Retrieve PMJob
${post_response.body.id}
Should Not Be Empty
${get_response}
Validate Status Code
${get_response.status_code}
200
Should Be Equal
${post_response.body.id}
${get_response.body.id}
Validate Header
${get_response.headers}
Content-Type
Validate JsonSchema
${get_response.body}
PmJob.schema.json
*** Keywords ***
Create PMJob
Log
Creating a new PM Job
Set Headers
{"Accept": "
${ACCEPT_JSON}
"}
Set Headers
{"Content-Type": "
${CONTENT_TYPE}
"}
Run Keyword If
${VNFM_AUTH_USAGE}
=
= 1
Set Headers
{"Authorization": "
${VNFM_AUTHENTICATION}
"}
${body}
=
Get File
jsons/CreatePmJobRequest.json
POST
${apiRoot}
/
${apiName}
/
${apiVersion}
/pm_jobs
${body}
[
Return
]
response
Validate Status Code
[
Arguments
]
${curr_status}
${exp_status}
Should Be Equal
${curr_status}
${exp_status}
Log
Status code validated
Validate Header
[
Arguments
]
${headers}
${CONTENT_TYPE}
Should Contain
${headers}
${CONTENT_TYPE}
Log
Header is present
Validate JsonSchema
[
Arguments
]
${body}
${schema}
${json}
=
evaluate
json.loads('''
${body}
''')
json
Validate Json
${schema}
${json}
Log
Validation OK
Retrieve PMJob
[
Arguments
]
${pmJobId}
Set Headers
{"Accept":"
${ACCEPT}
"}
Set Headers
{"Content-Type": "
${CONTENT_TYPE}
"}
Run Keyword If
${AUTH_USAGE}
=
= 1
Set Headers
{"Authorization":"
${AUTHORIZATION}
"}
Get
${apiRoot}
/
${apiName}
/
${apiVersion}
/vnf_instances/
${pmJobId}
[
Return
]
response
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment