blob: 7e6759fe2581fb262b57610f21879c18bc2b1a50 (
plain)
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
*** settings ***
Resource ../../common.robot
Library Collections
Library RequestsLibrary
Library OperatingSystem
Library json
Library HttpLibrary.HTTP
*** Variables ***
${catalog_port} 8806
${cataloghealthcheck_url} /api/catalog/v1/health_check
${vnfpkgmhealthcheck_url} /api/vnfpkgm/v1/health_check
${nsdhealthcheck_url} /api/nsd/v1/health_check
${parserhealthcheck_url} /api/parser/v1/health_check
${service_packages_url} /api/parser/v1/service_packages
${vnfpackages_url} /api/catalog/v1/vnfpackages
${nspackages_url} /api/catalog/v1/nspackages
${jobs_url} /api/catalog/v1/jobs
#json files
${ns_packages_json} ${SCRIPTS}/../tests/vfc/nfvo-catalog/jsons/ns_packages.json
${vnfpackages_catalog_json} ${SCRIPTS}/../tests/vfc/nfvo-catalog/jsons/vnf_packages.json
#global variables
${jobId}
*** Test Cases ***
Check Health Catalog
Log Check Health Catalog
[Documentation] check health for catalog by MSB
Check Health ${cataloghealthcheck_url}
Check Health Vnfpkgm
Log Check Health Vnfpkgm
[Documentation] check health for Vnfpkgm by MSB
Check Health ${vnfpkgmhealthcheck_url}
Check Health Nsd
Log Check Health Nsd
[Documentation] check health for Nsd by MSB
Check Health ${nsdhealthcheck_url}
Check Health Parser
Log Check Health Parser
[Documentation] check health for Parser by MSB
Check Health ${parserhealthcheck_url}
Check distribute catalog NS pacakages
Log Check distribute catalog NS pacakages
[Documentation] check distribute catalog NS pacakages
Check distribute package ${ns_packages_json} ${nspackages_url}
Check query catalog all NS package
Log Query catalog all NS package
[Documentation] check query catalog all NS package
Check query all packages ${nspackages_url}
Check query all Service package
Log Query all Service packages
[Documentation] check query Service packages by MSB
${headers} Create Dictionary Content-Type=application/json Accept=application/json
Check query all packages ${service_packages_url}
Check distribute VNF package
Log Check distribute VNF packagee
[Documentation] check distribute VNF package
${json_value}= json_from_file ${vnfpackages_catalog_json}
${json_string}= string_from_json ${json_value}
${headers} Create Dictionary Content-Type=application/json Accept=application/json
Create Session web_session http://${CATALOG_IP}:${catalog_port} headers=${headers}
Set Request Body ${json_string}
${resp}= Post Request web_session ${vnfpackages_url} ${json_string}
Should Be Equal As Strings 202 ${resp.status_code}
${response_json} json.loads ${resp.content}
${jobId}= Convert To String ${response_json['jobId']}
Set Global Variable ${jobId}
Check query job status
Log Check query job status
[Documentation] check query job status
${headers} Create Dictionary Content-Type=application/json Accept=application/json
Create Session web_session http://${CATALOG_IP}:${catalog_port} headers=${headers}
${resp}= Get Request web_session ${jobs_url}/${jobId}
Should Be Equal As Strings 200 ${resp.status_code}
Check query all VNF package
Log Query all VNF packages
[Documentation] check query VNF packages
${headers} Create Dictionary Content-Type=application/json Accept=application/json
Create Session web_session http://${CATALOG_IP}:${catalog_port} headers=${headers}
${resp}= Get Request web_session ${vnfpackages_url}
Should Be Equal As Strings 200 ${resp.status_code}
${response_json} json.loads ${resp.content}
*** Keywords ***
Check Health
[Arguments] ${url}
${headers} Create Dictionary Content-Type=application/json Accept=application/json
Create Session web_session http://${CATALOG_IP}:${catalog_port} headers=${headers}
${resp}= Get Request web_session ${url}
Should Be Equal As Strings 200 ${resp.status_code}
${response_json} json.loads ${resp.content}
Should Be Equal As Strings active ${response_json['status']}
Check distribute package
[Arguments] ${json_file} ${url}
${json_value}= json_from_file ${json_file}
${json_string}= string_from_json ${json_value}
${headers} Create Dictionary Content-Type=application/json Accept=application/json
Create Session web_session http://${CATALOG_IP}:${catalog_port} headers=${headers}
Set Request Body ${json_string}
${resp}= Post Request web_session ${url} ${json_string}
Should Be Equal As Strings 202 ${resp.status_code}
Check query all packages
[Arguments] ${url}
${headers} Create Dictionary Content-Type=application/json Accept=application/json
Create Session web_session http://${CATALOG_IP}:${catalog_port} headers=${headers}
${resp}= Get Request web_session ${url}
Should Be Equal As Strings 200 ${resp.status_code}
|