blob: 7e6759fe2581fb262b57610f21879c18bc2b1a50 [file] [log] [blame]
Gary Wu9abb61c2018-09-27 10:38:50 -07001*** settings ***
fujinhuaf2490e72019-04-28 10:32:40 +08002Resource ../../common.robot
Gary Wu9abb61c2018-09-27 10:38:50 -07003Library Collections
4Library RequestsLibrary
5Library OperatingSystem
6Library json
fujinhuaf2490e72019-04-28 10:32:40 +08007Library HttpLibrary.HTTP
Gary Wu9abb61c2018-09-27 10:38:50 -07008
9*** Variables ***
fujinhua73c74802019-04-28 16:27:22 +080010${catalog_port} 8806
Olivia.Zhan4881bf32019-07-11 09:27:06 +080011${cataloghealthcheck_url} /api/catalog/v1/health_check
12${vnfpkgmhealthcheck_url} /api/vnfpkgm/v1/health_check
13${nsdhealthcheck_url} /api/nsd/v1/health_check
14${parserhealthcheck_url} /api/parser/v1/health_check
zhaoliping12339b397e2019-10-25 11:22:39 +080015${service_packages_url} /api/parser/v1/service_packages
16${vnfpackages_url} /api/catalog/v1/vnfpackages
17${nspackages_url} /api/catalog/v1/nspackages
18${jobs_url} /api/catalog/v1/jobs
19
20#json files
21${ns_packages_json} ${SCRIPTS}/../tests/vfc/nfvo-catalog/jsons/ns_packages.json
22${vnfpackages_catalog_json} ${SCRIPTS}/../tests/vfc/nfvo-catalog/jsons/vnf_packages.json
23
24#global variables
25${jobId}
fujinhua73c74802019-04-28 16:27:22 +080026
Gary Wu9abb61c2018-09-27 10:38:50 -070027*** Test Cases ***
Olivia.Zhan4881bf32019-07-11 09:27:06 +080028Check Health Catalog
29 Log Check Health Catalog
fujinhuae23e0472019-04-04 16:24:48 +080030 [Documentation] check health for catalog by MSB
Olivia.Zhan4881bf32019-07-11 09:27:06 +080031 Check Health ${cataloghealthcheck_url}
fujinhuaf2490e72019-04-28 10:32:40 +080032
Olivia.Zhan4881bf32019-07-11 09:27:06 +080033Check Health Vnfpkgm
34 Log Check Health Vnfpkgm
35 [Documentation] check health for Vnfpkgm by MSB
36 Check Health ${vnfpkgmhealthcheck_url}
fujinhua73c74802019-04-28 16:27:22 +080037
Olivia.Zhan4881bf32019-07-11 09:27:06 +080038Check Health Nsd
39 Log Check Health Nsd
40 [Documentation] check health for Nsd by MSB
41 Check Health ${nsdhealthcheck_url}
42
43Check Health Parser
44 Log Check Health Parser
45 [Documentation] check health for Parser by MSB
46 Check Health ${parserhealthcheck_url}
47
zhaoliping12339b397e2019-10-25 11:22:39 +080048Check distribute catalog NS pacakages
49 Log Check distribute catalog NS pacakages
50 [Documentation] check distribute catalog NS pacakages
51 Check distribute package ${ns_packages_json} ${nspackages_url}
52
53Check query catalog all NS package
54 Log Query catalog all NS package
55 [Documentation] check query catalog all NS package
56 Check query all packages ${nspackages_url}
57
58Check query all Service package
59 Log Query all Service packages
60 [Documentation] check query Service packages by MSB
61 ${headers} Create Dictionary Content-Type=application/json Accept=application/json
62 Check query all packages ${service_packages_url}
63
64Check distribute VNF package
65 Log Check distribute VNF packagee
66 [Documentation] check distribute VNF package
67 ${json_value}= json_from_file ${vnfpackages_catalog_json}
68 ${json_string}= string_from_json ${json_value}
69 ${headers} Create Dictionary Content-Type=application/json Accept=application/json
70 Create Session web_session http://${CATALOG_IP}:${catalog_port} headers=${headers}
71 Set Request Body ${json_string}
72 ${resp}= Post Request web_session ${vnfpackages_url} ${json_string}
73 Should Be Equal As Strings 202 ${resp.status_code}
74 ${response_json} json.loads ${resp.content}
75 ${jobId}= Convert To String ${response_json['jobId']}
76 Set Global Variable ${jobId}
77
78Check query job status
79 Log Check query job status
80 [Documentation] check query job status
81 ${headers} Create Dictionary Content-Type=application/json Accept=application/json
82 Create Session web_session http://${CATALOG_IP}:${catalog_port} headers=${headers}
83 ${resp}= Get Request web_session ${jobs_url}/${jobId}
84 Should Be Equal As Strings 200 ${resp.status_code}
85
86Check query all VNF package
87 Log Query all VNF packages
88 [Documentation] check query VNF packages
89 ${headers} Create Dictionary Content-Type=application/json Accept=application/json
90 Create Session web_session http://${CATALOG_IP}:${catalog_port} headers=${headers}
91 ${resp}= Get Request web_session ${vnfpackages_url}
92 Should Be Equal As Strings 200 ${resp.status_code}
93 ${response_json} json.loads ${resp.content}
94
Olivia.Zhan4881bf32019-07-11 09:27:06 +080095*** Keywords ***
96Check Health
97 [Arguments] ${url}
fujinhua73c74802019-04-28 16:27:22 +080098 ${headers} Create Dictionary Content-Type=application/json Accept=application/json
99 Create Session web_session http://${CATALOG_IP}:${catalog_port} headers=${headers}
Olivia.Zhan4881bf32019-07-11 09:27:06 +0800100 ${resp}= Get Request web_session ${url}
101 Should Be Equal As Strings 200 ${resp.status_code}
zhaoliping12339b397e2019-10-25 11:22:39 +0800102 ${response_json} json.loads ${resp.content}
Olivia.Zhan4881bf32019-07-11 09:27:06 +0800103 Should Be Equal As Strings active ${response_json['status']}
zhaoliping12339b397e2019-10-25 11:22:39 +0800104
105Check distribute package
106 [Arguments] ${json_file} ${url}
107 ${json_value}= json_from_file ${json_file}
108 ${json_string}= string_from_json ${json_value}
109 ${headers} Create Dictionary Content-Type=application/json Accept=application/json
110 Create Session web_session http://${CATALOG_IP}:${catalog_port} headers=${headers}
111 Set Request Body ${json_string}
112 ${resp}= Post Request web_session ${url} ${json_string}
113 Should Be Equal As Strings 202 ${resp.status_code}
114
115Check query all packages
116 [Arguments] ${url}
117 ${headers} Create Dictionary Content-Type=application/json Accept=application/json
118 Create Session web_session http://${CATALOG_IP}:${catalog_port} headers=${headers}
119 ${resp}= Get Request web_session ${url}
120 Should Be Equal As Strings 200 ${resp.status_code}