def test_delete_region(self,login_domain): dr = login_domain p_data = datainfo.get_xls_to_dict("res_node_data.xlsx", "region")["创建资源节点"] arn = resnodeaction.Add_Res_Node(dr) srmpg = sys_regionMgrPage.SysRegionMgrPage(dr) arn.delete_res_node(p_data["regionname"], p_data["nodename"]) # 搜索项目 add_image(dr,"删除资源节点") srmpg.open_sys_regionMgr_page() flag = dr.element_exist( "xpath->//a[contains(text(),'%s')]" % p_data["nodename"]) assert flag is False
def test_delete_service_openstack(self, login_domain): dr = login_domain self.arn = resnodeaction.Add_Res_Node(dr) self.srmpg = sys_regionMgrPage.SysRegionMgrPage(dr) p_data = datainfo.get_xls_to_dict("res_node_data.xlsx", "openstackapi")["创建service-keystone"] self.arn.delete_service(p_data["regionname"], p_data["nodename"], p_data["servicename"]) self.srmpg.open_sys_regionMgr_page() dr.wait(5) add_image(dr, "删除openstack服务") flag = dr.element_exist("xpath->(//a[contains(text(),'%s')])" % p_data["servicename"]) assert flag is False
def test_create_service_openstack(self, login_domain): dr = login_domain self.arn = resnodeaction.Add_Res_Node(dr) self.srmpg = sys_regionMgrPage.SysRegionMgrPage(dr) p_data = datainfo.get_xls_to_dict("res_node_data.xlsx", "openstackapi")["创建service-keystone"] self.arn.add_resource_service_node_vmware( p_data["regionname"], p_data["nodename"], p_data["servicename"], p_data["servicetype"], p_data["username"], p_data["passwrd"]) # 校验 self.srmpg.open_sys_regionMgr_page() add_image(dr, "创建opentack服务") flag = dr.element_exist("xpath->(//a[contains(text(),'%s')])" % p_data["servicename"]) assert flag
def test_vmware_endpoint(self, login_domain): """ 测试添加vmware,endpoint 依赖已添加vmware服务 :return: """ dr = login_domain self.arn = resnodeaction.Add_Res_Node(dr) self.srmpg = sys_regionMgrPage.SysRegionMgrPage(dr) p_data = datainfo.get_xls_to_dict("res_node_data.xlsx", "endpoint")["创建vmware-endpoint"] self.arn.add_endpoint(p_data["regionname"], p_data["nodename"], p_data["servicename"], p_data["url"]) time.sleep(globalparam.tiny) add_image(dr, "VMware创建endpoint") text = dr.get_text("xpath->//table[@id='accessPoint']/tbody/tr[2]") assert p_data["url"] in text
def test_delete_openstack_endpoint(self, login_domain): """ 测试删除openstack,endpoint :return: """ dr = login_domain self.arn = resnodeaction.Add_Res_Node(dr) self.srmpg = sys_regionMgrPage.SysRegionMgrPage(dr) p_data = datainfo.get_xls_to_dict("res_node_data.xlsx", "endpoint")["创建os-l-endpoint"] self.arn.delete_endpoint(p_data["regionname"], p_data["nodename"], p_data["servicename"]) time.sleep(globalparam.small) dr.wait(5) add_image(dr, "openstack删除endpoint") flag = dr.element_exist( "xpath->//table[@id='accessPoint']/tbody/tr[2]") assert flag is False
def test_create_region(self, login_domain): dr = login_domain p_data = datainfo.get_xls_to_dict("res_node_data.xlsx", "region")["创建资源节点"] arn = resnodeaction.Add_Res_Node(dr) srmpg = sys_regionMgrPage.SysRegionMgrPage(dr) arn.add_res_node(p_data["regionname"], p_data["nodename"], business_type=p_data["business_type"], platform=p_data["platform"], virtual_type=p_data["virtual_type"], regDesc=p_data["regDesc"]) srmpg.open_sys_regionMgr_page() time.sleep(globalparam.small) dr.wait(5) add_image(dr, "创建资源节点") flag = dr.element_exist("xpath->//a[contains(text(),'%s')]" % p_data["nodename"]) assert flag, "未查询到资源节点%s" % p_data["nodename"]
def test_openstack_endpoint(self,login_domain): """ 测试添加openstack,endpoint 依赖已添加openstack服务 :return: """ dr = login_domain self.arn = resnodeaction.Add_Res_Node(dr) self.srmpg = sys_regionMgrPage.SysRegionMgrPage(dr) p_data = datainfo.get_xls_to_dict( "res_node_data.xlsx", "endpoint")["创建os-l-endpoint"] self.arn.add_endpoint( p_data["regionname"], p_data["nodename"], p_data["servicename"], p_data["url"]) time.sleep(0.5) dr.wait(5) add_image(dr,"openstack创建endpoint") text = dr.get_text( "xpath->//table[@id='accessPoint']/tbody/tr[2]") assert p_data["url"] in text