本文整理汇总了Python中cfme.services.catalogs.catalog_item.CatalogItem.create方法的典型用法代码示例。如果您正苦于以下问题:Python CatalogItem.create方法的具体用法?Python CatalogItem.create怎么用?Python CatalogItem.create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cfme.services.catalogs.catalog_item.CatalogItem
的用法示例。
在下文中一共展示了CatalogItem.create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_remove_template_provisioning
# 需要导入模块: from cfme.services.catalogs.catalog_item import CatalogItem [as 别名]
# 或者: from cfme.services.catalogs.catalog_item.CatalogItem import create [as 别名]
def test_remove_template_provisioning(setup_provider, provider, provisioning,
dialog, catalog, request):
"""Tests stack provisioning
Metadata:
test_flag: provision
"""
dialog_name, template = dialog
method = METHOD_TORSO.replace('"Description" : "AWS',
'"Description" : "Amzn Web Services')
template.create(method)
template.create_service_dialog_from_template(dialog_name, template.template_name)
item_name = fauxfactory.gen_alphanumeric()
catalog_item = CatalogItem(item_type="Orchestration", name=item_name,
description="my catalog", display_in=True, catalog=catalog.name,
dialog=dialog_name, orch_template=template.template_name,
provider_type=provider.name)
catalog_item.create()
stackname = "test-" + fauxfactory.gen_alphanumeric()
stack_data = {'stack_name': stackname}
service_catalogs = ServiceCatalogs("service_name", stack_data)
service_catalogs.order_stack_item(catalog.name, catalog_item)
# This is part of test - remove template and see if provision fails , so not added as finalizer
template.delete_all_templates()
row_description = 'Provisioning Service [{}] from [{}]'.format(item_name, item_name)
cells = {'Description': row_description}
wait_for(lambda: requests.find_request(cells), num_sec=500, delay=20)
row, __ = wait_for(requests.wait_for_request, [cells, True],
fail_func=requests.reload, num_sec=1000, delay=20)
assert row.last_message.text == 'Service_Template_Provisioning failed'
示例2: test_broken_angular_select
# 需要导入模块: from cfme.services.catalogs.catalog_item import CatalogItem [as 别名]
# 或者: from cfme.services.catalogs.catalog_item.CatalogItem import create [as 别名]
def test_broken_angular_select(request):
"""Test that checks the fancy selects do not break.
Prerequisities:
* A fresh downstream appliance
Steps:
1) Create a catalog.
2) Create a catalog item, can be Generic and assign the catalog and OSE Installer dialog
for testing purposes
3) Try ordering the service, but instead of confirming the form, try changing some select.
"""
# OSE Installer dialog, one dropdown from it
the_select = AngularSelect("ose_size")
cat = Catalog("Test_catalog_{}".format(fauxfactory.gen_alpha()))
cat.create()
request.addfinalizer(cat.delete)
item = CatalogItem(
item_type="Generic",
name="Catitem_{}".format(fauxfactory.gen_alpha()),
description=fauxfactory.gen_alpha(),
display_in=True,
catalog=cat.name,
dialog="OSE Installer")
item.create()
request.addfinalizer(item.delete)
# The check itself
pytest.sel.force_navigate(
"order_service_catalog",
context={"catalog": cat.name, "catalog_item": item})
fill(the_select, "Medium")
assert not the_select.is_broken, "The select displayed itself next ot the angular select"
示例3: test_remove_template_provisioning
# 需要导入模块: from cfme.services.catalogs.catalog_item import CatalogItem [as 别名]
# 或者: from cfme.services.catalogs.catalog_item.CatalogItem import create [as 别名]
def test_remove_template_provisioning(provider, provisioning, create_template, catalog, request):
"""Tests stack provisioning
Metadata:
test_flag: provision
"""
dialog_name, template = create_template
item_name = fauxfactory.gen_alphanumeric()
catalog_item = CatalogItem(
item_type="Orchestration",
name=item_name,
description="my catalog",
display_in=True,
catalog=catalog.name,
dialog=dialog_name,
orch_template=template.template_name,
)
catalog_item.create()
stack_data = prepare_stack_data(provider, provisioning)
service_catalogs = ServiceCatalogs("service_name", stack_data)
service_catalogs.order_stack_item(catalog.name, catalog_item)
# This is part of test - remove template and see if provision fails , so not added as finalizer
template.delete_all_templates()
row_description = "Provisioning Service [{}] from [{}]".format(item_name, item_name)
cells = {"Description": row_description}
wait_for(lambda: requests.find_request(cells), num_sec=500, delay=20)
row, __ = wait_for(requests.wait_for_request, [cells, True], fail_func=requests.reload, num_sec=1000, delay=20)
assert row.last_message.text == "Service_Template_Provisioning failed"
示例4: test_broken_angular_select
# 需要导入模块: from cfme.services.catalogs.catalog_item import CatalogItem [as 别名]
# 或者: from cfme.services.catalogs.catalog_item.CatalogItem import create [as 别名]
def test_broken_angular_select(request):
"""Test that checks the fancy selects do not break.
Prerequisities:
* A fresh downstream appliance
Steps:
1) Create a catalog.
2) Create a catalog item, can be Generic and assign the catalog and OSE Installer dialog
for testing purposes
3) Try ordering the service, but instead of confirming the form, try changing some select.
"""
# OSE Installer dialog, one dropdown from it
the_select = AngularSelect("param_operatingSystemType")
cat = Catalog("Test_catalog_{}".format(fauxfactory.gen_alpha()))
cat.create()
request.addfinalizer(cat.delete)
item = CatalogItem(
item_type="Generic",
name="Catitem_{}".format(fauxfactory.gen_alpha()),
description=fauxfactory.gen_alpha(),
display_in=True,
catalog=cat.name,
dialog="azure-single-vm-from-user-image")
item.create()
request.addfinalizer(item.delete)
sc = service_catalogs.ServiceCatalogs(item.name)
navigate_to(sc, 'Order')
# The check itself
fill(the_select, "Linux")
assert not the_select.is_broken, "The select displayed itself next ot the angular select"
示例5: catalog_item
# 需要导入模块: from cfme.services.catalogs.catalog_item import CatalogItem [as 别名]
# 或者: from cfme.services.catalogs.catalog_item.CatalogItem import create [as 别名]
def catalog_item(dialog, catalog):
item_name = fauxfactory.gen_alphanumeric()
catalog_item = CatalogItem(item_type="Generic", name=item_name,
description="my catalog", display_in=True, catalog=catalog.name,
dialog=dialog)
catalog_item.create()
yield catalog_item
示例6: test_retire_stack
# 需要导入模块: from cfme.services.catalogs.catalog_item import CatalogItem [as 别名]
# 或者: from cfme.services.catalogs.catalog_item.CatalogItem import create [as 别名]
def test_retire_stack(setup_provider, provider, provisioning,
dialog, catalog, request):
"""Tests stack provisioning
Metadata:
test_flag: provision
"""
set_default_view("Stacks", "Grid View")
dialog_name, template = dialog
method = METHOD_TORSO.replace('"Description" : "AWS',
'"Description" : "Aamzon Web Services desc')
template.create(method)
template.create_service_dialog_from_template(dialog_name, template.template_name)
item_name = fauxfactory.gen_alphanumeric()
catalog_item = CatalogItem(item_type="Orchestration", name=item_name,
description="my catalog", display_in=True, catalog=catalog.name,
dialog=dialog_name, orch_template=template.template_name,
provider_type=provider.name)
catalog_item.create()
stackname = "test-" + fauxfactory.gen_alphanumeric()
stack_data = {'stack_name': stackname}
service_catalogs = ServiceCatalogs("service_name", stack_data)
service_catalogs.order_stack_item(catalog.name, catalog_item)
request.addfinalizer(lambda: template.delete_all_templates())
logger.info('Waiting for cfme provision request for service %s' % item_name)
row_description = item_name
cells = {'Description': row_description}
row, __ = wait_for(requests.wait_for_request, [cells, True],
fail_func=requests.reload, num_sec=2500, delay=20)
assert row.last_message.text == 'Service Provisioned Successfully'
stack = Stack(stackname)
stack.retire_stack()
示例7: test_reconfigure_service
# 需要导入模块: from cfme.services.catalogs.catalog_item import CatalogItem [as 别名]
# 或者: from cfme.services.catalogs.catalog_item.CatalogItem import create [as 别名]
def test_reconfigure_service(provider, provisioning, create_template, catalog, request):
"""Tests stack provisioning
Metadata:
test_flag: provision
"""
dialog_name, template = create_template
item_name = fauxfactory.gen_alphanumeric()
catalog_item = CatalogItem(item_type="Orchestration", name=item_name,
description="my catalog", display_in=True, catalog=catalog.name,
dialog=dialog_name, orch_template=template.template_name)
catalog_item.create()
stack_data = prepare_stack_data(provider, provisioning)
@request.addfinalizer
def _cleanup_vms():
if provider.mgmt.stack_exist(stack_data['stack_name']):
wait_for(lambda: provider.mgmt.delete_stack(stack_data['stack_name']),
delay=10, num_sec=800, message="wait for stack delete")
template.delete_all_templates()
stack_data['vm_name'].delete_from_provider()
service_catalogs = ServiceCatalogs("service_name", stack_data)
service_catalogs.order_stack_item(catalog.name, catalog_item)
logger.info('Waiting for cfme provision request for service %s', item_name)
row_description = item_name
cells = {'Description': row_description}
row, __ = wait_for(requests.wait_for_request, [cells, True],
fail_func=requests.reload, num_sec=2000, delay=20)
assert row.last_message.text == 'Service Provisioned Successfully'
myservice = MyService(catalog_item.name)
myservice.reconfigure_service()
示例8: test_retire_stack
# 需要导入模块: from cfme.services.catalogs.catalog_item import CatalogItem [as 别名]
# 或者: from cfme.services.catalogs.catalog_item.CatalogItem import create [as 别名]
def test_retire_stack(provider, provisioning, create_template, catalog, request):
"""Tests stack provisioning
Metadata:
test_flag: provision
"""
set_default_view("Stacks", "Grid View")
dialog_name, template = create_template
item_name = fauxfactory.gen_alphanumeric()
catalog_item = CatalogItem(item_type="Orchestration", name=item_name,
description="my catalog", display_in=True, catalog=catalog.name,
dialog=dialog_name, orch_template=template.template_name)
catalog_item.create()
stack_data = prepare_stack_data(provider, provisioning)
service_catalogs = ServiceCatalogs("service_name", stack_data)
service_catalogs.order_stack_item(catalog.name, catalog_item)
logger.info('Waiting for cfme provision request for service %s', item_name)
row_description = item_name
cells = {'Description': row_description}
row, __ = wait_for(requests.wait_for_request, [cells, True],
fail_func=requests.reload, num_sec=2500, delay=20)
assert row.last_message.text == 'Service Provisioned Successfully'
stack = Stack(stack_data['stack_name'])
stack.retire_stack()
@request.addfinalizer
def _cleanup_templates():
template.delete_all_templates()
stack_data['vm_name'].delete_from_provider()
示例9: catalog_item
# 需要导入模块: from cfme.services.catalogs.catalog_item import CatalogItem [as 别名]
# 或者: from cfme.services.catalogs.catalog_item.CatalogItem import create [as 别名]
def catalog_item(dialog, catalog):
item_name = generate_random_string()
catalog_item = CatalogItem(item_type="Generic", name=item_name,
description="my catalog", display_in=True, catalog=catalog.name,
dialog=dialog)
catalog_item.create()
yield catalog_item
示例10: test_dynamicdropdown_dialog
# 需要导入模块: from cfme.services.catalogs.catalog_item import CatalogItem [as 别名]
# 或者: from cfme.services.catalogs.catalog_item.CatalogItem import create [as 别名]
def test_dynamicdropdown_dialog(dialog, catalog):
item_name = fauxfactory.gen_alphanumeric()
catalog_item = CatalogItem(item_type="Generic", name=item_name,
description="my catalog", display_in=True, catalog=catalog.name,
dialog=dialog.label)
catalog_item.create()
service_catalogs = ServiceCatalogs("service_name")
service_catalogs.order(catalog_item.catalog, catalog_item)
示例11: test_delete_catalog_deletes_service
# 需要导入模块: from cfme.services.catalogs.catalog_item import CatalogItem [as 别名]
# 或者: from cfme.services.catalogs.catalog_item.CatalogItem import create [as 别名]
def test_delete_catalog_deletes_service(appliance, dialog, catalog):
item_name = fauxfactory.gen_alphanumeric()
catalog_item = CatalogItem(item_type="Generic", name=item_name,
description="my catalog", display_in=True, catalog=catalog,
dialog=dialog)
catalog_item.create()
catalog.delete()
service_catalogs = ServiceCatalogs(appliance, catalog, catalog_item.name)
with error.expected(NoSuchElementException):
service_catalogs.order()
示例12: test_no_template_catalog_item
# 需要导入模块: from cfme.services.catalogs.catalog_item import CatalogItem [as 别名]
# 或者: from cfme.services.catalogs.catalog_item.CatalogItem import create [as 别名]
def test_no_template_catalog_item(provider, provisioning, setup_provider, vm_name, dialog, catalog):
"""Tests no template catalog item
Metadata:
test_flag: provision
"""
item_name = fauxfactory.gen_alphanumeric()
catalog_item = CatalogItem(item_type=provider.catalog_name, name=item_name,
description="my catalog", display_in=True, catalog=catalog, dialog=dialog)
with error.expected("'Catalog/Name' is required"):
catalog_item.create()
示例13: test_delete_catalog_deletes_service
# 需要导入模块: from cfme.services.catalogs.catalog_item import CatalogItem [as 别名]
# 或者: from cfme.services.catalogs.catalog_item.CatalogItem import create [as 别名]
def test_delete_catalog_deletes_service(dialog, catalog):
item_name = fauxfactory.gen_alphanumeric()
catalog_item = CatalogItem(item_type="Generic", name=item_name,
description="my catalog", display_in=True, catalog=catalog.name,
dialog=dialog)
catalog_item.create()
catalog.delete()
service_catalogs = ServiceCatalogs("service_name")
with error.expected(CandidateNotFound):
service_catalogs.order(catalog.name, catalog_item)
示例14: services
# 需要导入模块: from cfme.services.catalogs.catalog_item import CatalogItem [as 别名]
# 或者: from cfme.services.catalogs.catalog_item.CatalogItem import create [as 别名]
def services(request, a_provider, rest_api, dialog, service_catalogs):
"""
The attempt to add the service entities via web
"""
template, host, datastore, iso_file, vlan, catalog_item_type = map(a_provider.data.get(
"provisioning").get,
('template', 'host', 'datastore', 'iso_file', 'vlan', 'catalog_item_type'))
provisioning_data = {
'vm_name': 'test_rest_{}'.format(fauxfactory.gen_alphanumeric()),
'host_name': {'name': [host]},
'datastore_name': {'name': [datastore]}
}
if a_provider.type == 'rhevm':
provisioning_data['provision_type'] = 'Native Clone'
provisioning_data['vlan'] = vlan
catalog_item_type = version.pick({
version.LATEST: "RHEV",
'5.3': "RHEV",
'5.2': "Redhat"
})
elif a_provider.type == 'virtualcenter':
provisioning_data['provision_type'] = 'VMware'
catalog = service_catalogs[0].name
item_name = fauxfactory.gen_alphanumeric()
catalog_item = CatalogItem(item_type=catalog_item_type, name=item_name,
description="my catalog", display_in=True,
catalog=catalog,
dialog=dialog.label,
catalog_name=template,
provider=a_provider.name,
prov_data=provisioning_data)
catalog_item.create()
service_catalogs = ServiceCatalogs("service_name")
service_catalogs.order(catalog_item.catalog, catalog_item)
row_description = catalog_item.name
cells = {'Description': row_description}
row, __ = wait_for(requests.wait_for_request, [cells, True],
fail_func=requests.reload, num_sec=2000, delay=20)
assert row.last_message.text == 'Request complete'
try:
services = [_ for _ in rest_api.collections.services]
services[0]
except IndexError:
pytest.skip("There is no service to be taken")
@request.addfinalizer
def _finished():
services = [_ for _ in rest_api.collections.services]
if len(services) != 0:
rest_api.collections.services.action.delete(*services)
return services
示例15: test_cloud_catalog_item
# 需要导入模块: from cfme.services.catalogs.catalog_item import CatalogItem [as 别名]
# 或者: from cfme.services.catalogs.catalog_item.CatalogItem import create [as 别名]
def test_cloud_catalog_item(appliance, setup_provider, provider, dialog, catalog, request,
provisioning):
"""Tests cloud catalog item
Metadata:
test_flag: provision
"""
vm_name = 'test{}'.format(fauxfactory.gen_alphanumeric())
# GCE accepts only lowercase letters in VM name
vm_name = vm_name.lower()
request.addfinalizer(lambda: cleanup_vm(vm_name + "_0001", provider))
image = provisioning['image']['name']
item_name = fauxfactory.gen_alphanumeric()
provisioning_data = {
'catalog': {'vm_name': vm_name,
},
'properties': {'instance_type': provisioning['instance_type'],
},
'environment': {'security_groups': [provisioning['security_group']],
},
}
if provider.type == "azure":
env_updates = dict(
cloud_network=provisioning['virtual_private_cloud'],
cloud_subnet=provisioning['cloud_subnet'],
resource_groups=[provisioning['resource_group']],
)
else:
provisioning_data['properties']['guest_keypair'] = provisioning['guest_keypair']
provisioning_data['properties']['boot_disk_size'] = provisioning['boot_disk_size']
env_updates = dict(
availability_zone=provisioning['availability_zone'],
cloud_tenant=provisioning['cloud_tenant'],
cloud_network=provisioning['cloud_network'])
provisioning_data['environment'].update(env_updates)
catalog_item = CatalogItem(item_type=provisioning['item_type'],
name=item_name,
description="my catalog",
display_in=True,
catalog=catalog,
dialog=dialog,
catalog_name=image,
provider=provider,
prov_data=provisioning_data)
catalog_item.create()
service_catalogs = ServiceCatalogs(appliance, catalog_item.catalog, catalog_item.name)
service_catalogs.order()
logger.info('Waiting for cfme provision request for service %s', item_name)
request_description = item_name
provision_request = appliance.collections.requests.instantiate(request_description,
partial_check=True)
provision_request.wait_for_request()
assert provision_request.is_succeeded()