Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
*** Setting ***
Resource environment/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