mirror of
				https://github.com/xcat2/xcat-core.git
				synced 2025-11-03 21:02:34 +00:00 
			
		
		
		
	Add REST test cases, a new bundle and this bundle to the ppcle daily.bundle
This commit is contained in:
		@@ -307,3 +307,4 @@ xcatstanzafile_objtype
 | 
			
		||||
xcatstanzafile_specificvalue
 | 
			
		||||
xcatstanzafile_tab
 | 
			
		||||
go_xcat_devel_from_repo
 | 
			
		||||
#INCLUDE:rhels_ppcle_restapi.bundle#
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										24
									
								
								xCAT-test/autotest/bundle/rhels_ppcle_restapi.bundle
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								xCAT-test/autotest/bundle/rhels_ppcle_restapi.bundle
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,24 @@
 | 
			
		||||
restapi_setup_on_MN_SN_CN
 | 
			
		||||
restapi_list_all_resources
 | 
			
		||||
restapi_list_globalconf
 | 
			
		||||
restapi_list_groups
 | 
			
		||||
restapi_list_nodes
 | 
			
		||||
restapi_list_node_CN
 | 
			
		||||
restapi_list_networks
 | 
			
		||||
restapi_list_osimages
 | 
			
		||||
restapi_list_policy
 | 
			
		||||
restapi_create_temp_CN_put
 | 
			
		||||
restapi_delete_temp_CN_put
 | 
			
		||||
restapi_create_temp_CN_post
 | 
			
		||||
restapi_create_temp_CN_put
 | 
			
		||||
restapi_delete_temp_CN_2
 | 
			
		||||
restapi_create_temp_CN_put
 | 
			
		||||
restapi_add_id_temp_CN
 | 
			
		||||
restapi_modify_vmmemory_temp_CN
 | 
			
		||||
restapi_delete_id_temp_CN
 | 
			
		||||
restapi_show_temp_CN_osimage
 | 
			
		||||
restapi_list_nodes_wrong_password
 | 
			
		||||
restapi_list_wrong_osimage
 | 
			
		||||
restapi_modify_wrong_field_CN
 | 
			
		||||
restapi_delete_temp_CN_put
 | 
			
		||||
restapi_cleanup_on_MN_SN_CN
 | 
			
		||||
							
								
								
									
										184
									
								
								xCAT-test/autotest/testcase/restapi/cases0
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										184
									
								
								xCAT-test/autotest/testcase/restapi/cases0
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,184 @@
 | 
			
		||||
start:restapi_setup_on_MN_SN_CN
 | 
			
		||||
description: Set up the REST API on MN and CN
 | 
			
		||||
label:restapi
 | 
			
		||||
cmd:yum install mod_ssl -y
 | 
			
		||||
check:rc==0
 | 
			
		||||
cmd:sed -i 's/^\(\s*\)SSLCertificateFile.*$/\1SSLCertificateFile \/etc\/xcat\/cert\/server-cred.pem/' /etc/httpd/conf.d/ssl.conf
 | 
			
		||||
cmd:sed -i 's/^\(\s*SSLCertificateKeyFile.*\)$/#\1/' /etc/httpd/conf.d/ssl.conf
 | 
			
		||||
cmd:service httpd restart
 | 
			
		||||
check:rc==0
 | 
			
		||||
cmd:scp /install/postscripts/ca/ca-cert.pem $$CN:/root
 | 
			
		||||
check:rc==0
 | 
			
		||||
cmd:tabch key=xcat,username=root passwd.password=cluster
 | 
			
		||||
check:rc==0
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
start:restapi_cleanup_on_MN_SN_CN
 | 
			
		||||
description: Set up the REST API on MN and CN
 | 
			
		||||
label:restapi
 | 
			
		||||
cmd:xdsh $$CN "rm /root/ca-cert.pem"
 | 
			
		||||
check:rc==0
 | 
			
		||||
cmd:tabch -d key=xcat passwd
 | 
			
		||||
check:rc==0
 | 
			
		||||
cmd:yum remove mod_ssl -y
 | 
			
		||||
check:rc==0
 | 
			
		||||
cmd:service httpd restart
 | 
			
		||||
check:rc==0
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
start:restapi_list_all_resources
 | 
			
		||||
description: List all resources on the management node with "curl -X GET"
 | 
			
		||||
label:restapi
 | 
			
		||||
cmd:username=__GETTABLEVALUE(key,system,username,passwd)__;password=__GETTABLEVALUE(key,system,password,passwd)__;xdsh $$CN "curl -X GET -s --cacert /root/ca-cert.pem 'https://$$MN/xcatws?userName=$username&userPW=$password'"
 | 
			
		||||
check:rc==0
 | 
			
		||||
check:output=~nodes
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
start:restapi_list_globalconf
 | 
			
		||||
description: List globalconf on the management node with "curl -X GET"
 | 
			
		||||
label:restapi
 | 
			
		||||
cmd:username=__GETTABLEVALUE(key,system,username,passwd)__;password=__GETTABLEVALUE(key,system,password,passwd)__;xdsh $$CN "curl -X GET -s --cacert /root/ca-cert.pem 'https://$$MN/xcatws/globalconf?debug=2&userName=$username&userPW=$password'"
 | 
			
		||||
check:rc==0
 | 
			
		||||
check:output=~"tftpdir":"/tftpboot"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
start:restapi_list_groups
 | 
			
		||||
description: List groups on the management node with "curl -X GET"
 | 
			
		||||
label:restapi
 | 
			
		||||
cmd:username=__GETTABLEVALUE(key,system,username,passwd)__;password=__GETTABLEVALUE(key,system,password,passwd)__;xdsh $$CN "curl -X GET -s -k --cacert /root/ca-cert.pem 'https://$$MN/xcatws/groups?userName=$username&userPW=$password'"
 | 
			
		||||
check:rc==0
 | 
			
		||||
check:output=~__GETTABLEVALUE(node,$$CN,groups,nodelist)__
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
start:restapi_list_nodes
 | 
			
		||||
description: List nodes on the management node with "curl -X GET"
 | 
			
		||||
label:restapi
 | 
			
		||||
cmd:username=__GETTABLEVALUE(key,system,username,passwd)__;password=__GETTABLEVALUE(key,system,password,passwd)__;xdsh $$CN "curl -X GET -s --cacert /root/ca-cert.pem 'https://$$MN/xcatws/nodes?&userName=$username&userPW=$password'"
 | 
			
		||||
check:rc==0
 | 
			
		||||
check:output=~$$CN
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
start:restapi_list_node_CN
 | 
			
		||||
description: Display details of the compute node with "curl -X GET"
 | 
			
		||||
label:restapi
 | 
			
		||||
cmd:username=__GETTABLEVALUE(key,system,username,passwd)__;password=__GETTABLEVALUE(key,system,password,passwd)__;xdsh $$CN "curl -X GET -s --cacert /root/ca-cert.pem 'https://$$MN/xcatws/nodes/$$CN?pretty=1&xcoll=1&userName=$username&userPW=$password'"
 | 
			
		||||
check:rc==0
 | 
			
		||||
check:output=~__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
start:restapi_list_networks
 | 
			
		||||
description: List networks on the management node with "curl -X GET"
 | 
			
		||||
label:restapi
 | 
			
		||||
cmd:username=__GETTABLEVALUE(key,system,username,passwd)__;password=__GETTABLEVALUE(key,system,password,passwd)__;xdsh $$CN "curl -X GET -s -k --cacert /root/ca-cert.pem 'https://$$MN/xcatws/networks?userName=$username&userPW=$password'"
 | 
			
		||||
check:rc==0
 | 
			
		||||
check:output!=""
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
start:restapi_list_osimages
 | 
			
		||||
description: List osimages on the management node with "curl -X GET"
 | 
			
		||||
label:restapi
 | 
			
		||||
cmd:username=__GETTABLEVALUE(key,system,username,passwd)__;password=__GETTABLEVALUE(key,system,password,passwd)__;xdsh $$CN "curl -X GET -s --cacert /root/ca-cert.pem 'https://$$MN/xcatws/osimages?userName=$username&userPW=$password'"
 | 
			
		||||
check:output=~__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
start:restapi_list_policy
 | 
			
		||||
description: List policies on the management node with "curl -X GET"
 | 
			
		||||
label:restapi
 | 
			
		||||
cmd:username=__GETTABLEVALUE(key,system,username,passwd)__;password=__GETTABLEVALUE(key,system,password,passwd)__;xdsh $$CN "curl -X GET -s --cacert /root/ca-cert.pem 'https://$$MN/xcatws/policy?userName=$username&userPW=$password'"
 | 
			
		||||
check:rc==0
 | 
			
		||||
check:output=~__GETTABLEVALUE(rule,trusted,priority,policy)__
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
start:restapi_create_temp_CN_put
 | 
			
		||||
description: Created a temporary compute node with "curl -X PUT"
 | 
			
		||||
label:restapi
 | 
			
		||||
cmd:username=__GETTABLEVALUE(key,system,username,passwd)__;password=__GETTABLEVALUE(key,system,password,passwd)__;xdsh $$CN "curl -X PUT -s --cacert /root/ca-cert.pem 'https://$$MN/xcatws/nodes/temp_node1?userName=$username&userPW=$password' -H Content-Type:application/json --data '{\"groups\":\"all\",\"mgt\":\"kvm\",\"vmmemory\":\"2048\"}'"
 | 
			
		||||
check:rc==0
 | 
			
		||||
cmd:lsdef
 | 
			
		||||
check:output=~temp_node1
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
start:restapi_delete_temp_CN_put
 | 
			
		||||
description: Delete a temporary compute node with "curl -X DELETE"
 | 
			
		||||
label:restapi
 | 
			
		||||
cmd:username=__GETTABLEVALUE(key,system,username,passwd)__;password=__GETTABLEVALUE(key,system,password,passwd)__;xdsh $$CN "curl -X DELETE -s --cacert /root/ca-cert.pem 'https://$$MN/xcatws/nodes/temp_node1?userName=$username&userPW=$password'"
 | 
			
		||||
check:rc==0
 | 
			
		||||
cmd:lsdef
 | 
			
		||||
check:output!=temp_node1
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
start:restapi_delete_temp_CN_2
 | 
			
		||||
description: Delete a temporary compute node with "curl -X DELETE"
 | 
			
		||||
label:restapi
 | 
			
		||||
cmd:username=__GETTABLEVALUE(key,system,username,passwd)__;password=__GETTABLEVALUE(key,system,password,passwd)__;xdsh $$CN "curl -X DELETE -s --cacert /root/ca-cert.pem 'https://$$MN/xcatws/nodes/temp_node[1-2]?userName=$username&userPW=$password'"
 | 
			
		||||
check:rc==0
 | 
			
		||||
cmd:lsdef
 | 
			
		||||
check:output!=temp_node1
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
start:restapi_create_temp_CN_post
 | 
			
		||||
description: Created a temporary compute node with "curl -X POST"
 | 
			
		||||
label:restapi
 | 
			
		||||
cmd:username=__GETTABLEVALUE(key,system,username,passwd)__;password=__GETTABLEVALUE(key,system,password,passwd)__;xdsh $$CN "curl -X POST -s --cacert /root/ca-cert.pem 'https://$$MN/xcatws/nodes/temp_node2?userName=$username&userPW=$password' -H Content-Type:application/json --data '{\"groups\":\"all\",\"mgt\":\"kvm\",\"vmmemory\":\"2048\"}'"
 | 
			
		||||
check:rc==0
 | 
			
		||||
cmd:lsdef
 | 
			
		||||
check:output=~temp_node2
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
start:restapi_add_id_temp_CN
 | 
			
		||||
description: Add an id field of a temporary compute node with "curl -X PUT"
 | 
			
		||||
label:restapi
 | 
			
		||||
cmd:username=__GETTABLEVALUE(key,system,username,passwd)__;password=__GETTABLEVALUE(key,system,password,passwd)__;xdsh $$CN "curl -X PUT -s --cacert /root/ca-cert.pem 'https://$$MN/xcatws/nodes/temp_node1?userName=$username&userPW=$password' -H Content-Type:application/json --data '{\"id\":\"100\"}'"
 | 
			
		||||
check:rc==0
 | 
			
		||||
cmd:lsdef temp_node1
 | 
			
		||||
check:output=~id=100
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
start:restapi_modify_vmmemory_temp_CN
 | 
			
		||||
description: Modify the vmmemory field of a temporary computer node with "curl -X PUT"
 | 
			
		||||
label:restapi
 | 
			
		||||
cmd:username=__GETTABLEVALUE(key,system,username,passwd)__;password=__GETTABLEVALUE(key,system,password,passwd)__;xdsh $$CN "curl -X PUT -s --cacert /root/ca-cert.pem 'https://$$MN/xcatws/nodes/temp_node1?xcoll=1&userName=$username&userPW=$password' -H Content-Type:application/json --data '{\"vmmemory\":\"4096\"}'"
 | 
			
		||||
check:rc==0
 | 
			
		||||
cmd:lsdef temp_node1
 | 
			
		||||
check:output=~vmmemory=4096
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
start:restapi_delete_id_temp_CN
 | 
			
		||||
description: Delete the id field of a temporary compute node with "curl -X DELETE"
 | 
			
		||||
label:restapi
 | 
			
		||||
cmd:username=__GETTABLEVALUE(key,system,username,passwd)__;password=__GETTABLEVALUE(key,system,password,passwd)__;xdsh $$CN "curl -X PUT -s --cacert /root/ca-cert.pem 'https://$$MN/xcatws/nodes/temp_node1?userName=$username&userPW=$password' -H Content-Type:application/json --data '{\"id\":\" \"}'"
 | 
			
		||||
check:rc==0
 | 
			
		||||
cmd:lsdef temp_node1
 | 
			
		||||
check:output!~id=
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
start:restapi_show_temp_CN_osimage
 | 
			
		||||
description: Show the detail of the osimage of CN with "curl -X GET"
 | 
			
		||||
label:restapi
 | 
			
		||||
cmd:username=__GETTABLEVALUE(key,system,username,passwd)__;password=__GETTABLEVALUE(key,system,password,passwd)__;xdsh $$CN "curl -X GET -s --cacert /root/ca-cert.pem 'https://$$MN/xcatws/osimages/__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute?pretty=1&userName=$username&userPW=$password'"
 | 
			
		||||
check:rc==0
 | 
			
		||||
check:output=~__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
start:restapi_list_nodes_wrong_password
 | 
			
		||||
description: List nodes on the management node with an invalid password with "curl -X GET"
 | 
			
		||||
label:restapi
 | 
			
		||||
cmd:username=__GETTABLEVALUE(key,system,username,passwd)__;password=__GETTABLEVALUE(key,system,password,passwd)__;xdsh $$CN "curl -X GET -s --cacert /root/ca-cert.pem 'https://$$MN/xcatws/nodes?userName=$username&userPW=invalid_password'"
 | 
			
		||||
check:rc==0
 | 
			
		||||
check:output=~Authentication failure
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
start:restapi_list_wrong_osimage
 | 
			
		||||
description: List a wrong osimage on the management node with "curl -X GET"
 | 
			
		||||
label:restapi
 | 
			
		||||
cmd:username=__GETTABLEVALUE(key,system,username,passwd)__;password=__GETTABLEVALUE(key,system,password,passwd)__;xdsh $$CN "curl -X GET -s --cacert /root/ca-cert.pem 'https://$$MN/xcatws/osimages/wrong_image?userName=$username&userPW=$password'"
 | 
			
		||||
check:output=~Could not find an object named 'wrong_image'
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
start:restapi_modify_wrong_field_CN
 | 
			
		||||
description: Modify the vmmemori field of the computer node with "curl -X PUT"
 | 
			
		||||
label:restapi
 | 
			
		||||
cmd:username=__GETTABLEVALUE(key,system,username,passwd)__;password=__GETTABLEVALUE(key,system,password,passwd)__;xdsh $$CN "curl -X PUT -s --cacert /root/ca-cert.pem 'https://$$MN/xcatws/nodes/$$CN?debug=1&userName=$username&userPW=$password' -H Content-Type:application/json --data '{\"vmmemori\":\"4096\"}'"
 | 
			
		||||
check:rc==0
 | 
			
		||||
check:output=~'vmmemori' is not a valid attribute name for an object type
 | 
			
		||||
end
 | 
			
		||||
		Reference in New Issue
	
	Block a user