30 from docopt
import docopt
33 sys.path.append(
"../")
35 from cFSPlib
import cFSP
42 args=docopt(cFSP.__doc__)
49 print(
"############# Start testing: help ###############\n")
50 args[
'<command>'] =
'help'
54 print(
"############# End testing: help ###############\n\n")
61 print(
"############# Start testing: user load ###############\n")
62 args[
'<command>'] =
'user'
63 args[
'<args>'] = [
'load']
66 print(
"############# End testing: user load ###############\n\n")
68 print(
"############# Start testing: user show ###############\n")
69 args[
'<command>'] =
'user'
70 args[
'<args>'] = [
'show']
73 print(
"############# End testing: user show ###############\n\n")
80 print(
"############# Start testing: get instance ###############\n")
81 args[
'<command>'] =
'instance'
82 args[
'<args>'] = [
'get']
83 cfrm_response=cFSP.main(args)
86 print(
"############# End testing: get instance ###############\n\n")
88 print(
"############# Start testing: post instance ###############\n")
89 args[
'<command>'] =
'instance'
90 args[
'<args>'] = [
'post']
91 args[
'--image_id'] = [
'74462cd5-20e3-4228-a47d-258b7e5e583a']
92 cfrm_response=cFSP.main(args)
94 instance_id=cfrm_response.instance_id
95 print(
"INFO: The new instance has id : " +
str(instance_id))
97 print(
"############# End testing: post instance ###############\n\n")
99 print(
"############# Start testing: restart instance ###############\n")
100 args[
'<command>'] =
'instance'
101 args[
'<args>'] = [
'restart',
str(instance_id)]
102 cfrm_response=cFSP.main(args)
105 print(
"############# End testing: restart instance ###############\n\n")
107 print(
"############# Start testing: debug instance ###############\n")
108 args[
'<command>'] =
'debug'
109 args[
'<args>'] = [
'get',
'flight_recorder_data',
'instance',
str(instance_id)]
110 cfrm_response=cFSP.main(args)
113 print(
"############# End testing: debug instance ###############\n\n")
115 print(
"############# Start testing: delete instance ###############\n")
116 args[
'<command>'] =
'instance'
117 args[
'<args>'] = [
'delete',
str(instance_id)]
118 cfrm_response=cFSP.main(args)
121 print(
"############# End testing: delete instance ###############\n\n")
128 print(
"############# Start testing: get image ###############\n")
129 args[
'<command>'] =
'image'
130 args[
'<args>'] = [
'get']
131 cfrm_response=cFSP.main(args)
134 print(
"############# End testing: get image ###############\n\n")
136 print(
"############# Start testing: post image ###############\n")
137 args[
'<command>'] =
'image'
138 args[
'<args>'] = [
'post']
139 args[
'--image_file'] =
'./4_topFMKU60_impl_monolithic.bit'
140 cfrm_response=cFSP.main(args)
142 print(
"INFO: The uploaded image has id : " +
str(cfrm_response.id))
144 print(
"############# End testing: post image ###############\n\n")
146 print(
"############# Start testing: delete image ###############\n")
147 args[
'<command>'] =
'image'
148 args[
'<args>'] = [
'delete',
str(cfrm_response.id)]
149 cfrm_response=cFSP.main(args)
152 print(
"############# End testing: delete image ###############\n\n")
159 print(
"############# Start testing: get cluster ###############\n")
160 args[
'<command>'] =
'cluster'
161 args[
'<args>'] = [
'get']
162 cfrm_response=cFSP.main(args)
165 print(
"############# End testing: get cluster ###############\n\n")
167 print(
"############# Start testing: post_cluster ###############\n")
168 args[
'<command>'] =
'cluster'
169 args[
'<args>'] = [
'post']
170 args[
'--image_id'] = [
'74462cd5-20e3-4228-a47d-258b7e5e583a']
171 args[
'--node_ip'] = [
'10.12.2.100']
172 cfrm_response=cFSP.main(args)
174 cluster_id = cfrm_response.cluster_id
175 print(
"INFO: The new cluster has id : " +
str(cluster_id))
177 print(
"############# End testing: post_cluster ###############\n\n")
179 print(
"############# Start testing: restart cluster ###############\n")
180 args[
'<command>'] =
'cluster'
181 args[
'<args>'] = [
'restart',
str(cluster_id)]
182 cfrm_response=cFSP.main(args)
185 print(
"############# End testing: restart cluster ###############\n\n")
187 print(
"############# Start testing: debug cluster ###############\n")
188 args[
'<command>'] =
'debug'
189 args[
'<args>'] = [
'get',
'flight_recorder_data',
'cluster',
str(cluster_id)]
190 cfrm_response=cFSP.main(args)
193 print(
"############# End testing: debug cluster ###############\n\n")
195 print(
"############# Start testing: delete cluster ###############\n")
196 args[
'<command>'] =
'cluster'
197 args[
'<args>'] = [
'delete',
str(cluster_id)]
198 cfrm_response=cFSP.main(args)
201 print(
"############# End testing: delete cluster ###############\n\n")
208 if (retval==num_tests):
209 print(
"INFO: Succesfully completed " +
str(num_tests) +
" tests!")
212 print(
"ERROR: Only " +
str(retval) +
" tests out of " +
str(num_tests) +
" completed succesfully.")