コード例 #1
0
def test_service_rbac_request(appliance, role_user_group, catalog_item):
    """ Test service rbac with only request module permissions

    Polarion:
        assignee: apagac
        initialEstimate: 1/4h
        casecomponent: Services
    """
    role, user = role_user_group
    product_features = [
        (['Everything'], True), (['Everything'], False),
        ([
            'Everything',
            'Services',
            'Requests',
        ], True),
        (['Everything', 'Automation', 'Automate', 'Customization'], True)
    ]
    product_features.extend([
        (['Everything', 'Services', 'Catalogs Explorer', k], True)
        for k in ['Catalog Items', 'Service Catalogs', 'Catalogs']
    ])
    role.update({'product_features': product_features})
    with user:
        # Without below line, service_order only works here via admin, not via user
        # TODO: Remove below line when this behavior gets fixed
        appliance.server.login(user)
        service_catalogs = ServiceCatalogs(appliance, catalog_item.catalog,
                                           catalog_item.name)
        service_catalogs.order()
        cells = {'Description': catalog_item.name}
        order_request = appliance.collections.requests.instantiate(
            cells=cells, partial_check=True)
        order_request.wait_for_request(method='ui')
        assert order_request.is_succeeded(method='ui')
コード例 #2
0
def test_order_tower_catalog_item(appliance, config_manager, catalog_item, request, job_type):
    """Tests ordering of catalog items for Ansible Template and Workflow jobs
    Metadata:
        test_flag: provision

    Polarion:
        assignee: nachandr
        initialEstimate: 1/4h
        casecomponent: Services
        caseimportance: high
    """
    if job_type == 'template_limit':
        host = config_manager.yaml_data['provisioning_data']['inventory_host']
        dialog_values = {'limit': host}
        service_catalogs = ServiceCatalogs(appliance, catalog_item.catalog, catalog_item.name,
            dialog_values=dialog_values)
    else:
        service_catalogs = ServiceCatalogs(appliance, catalog_item.catalog, catalog_item.name)

    service_catalogs.order()
    logger.info('Waiting for cfme provision request for service %s', catalog_item.name)
    cells = {'Description': catalog_item.name}
    order_request = appliance.collections.requests.instantiate(cells=cells, partial_check=True)
    order_request.wait_for_request(method='ui')
    msg = 'Request failed with the message {}'.format(order_request.row.last_message.text)
    assert order_request.is_succeeded(method='ui'), msg
    appliance.user.my_settings.default_views.set_default_view('Configuration Management Providers',
                                                              'List View')
コード例 #3
0
def test_tenant_quota_enforce_via_service_cloud(request, appliance, provider,
                                                setup_provider, context,
                                                set_roottenant_quota,
                                                custom_prov_data, extra_msg,
                                                template_name, catalog_item):
    """Test Tenant Quota in UI and SSUI

    Polarion:
        assignee: ghubale
        casecomponent: cloud
        initialEstimate: 1/10h
    """
    with appliance.context.use(context):
        service_catalogs = ServiceCatalogs(appliance, catalog_item.catalog,
                                           catalog_item.name)
        if context is ViaSSUI:
            service_catalogs.add_to_shopping_cart()
        service_catalogs.order()
    # nav to requests page to check quota validation
    request_description = 'Provisioning Service [{0}] from [{0}]'.format(
        catalog_item.name)
    provision_request = appliance.collections.requests.instantiate(
        request_description)
    provision_request.wait_for_request(method='ui')
    assert provision_request.row.reason.text == "Quota Exceeded"

    @request.addfinalizer
    def delete():
        provision_request.remove_request()
        catalog_item.delete()
コード例 #4
0
def test_tenant_quota_enforce_via_service_infra(request, appliance, context,
                                                set_roottenant_quota,
                                                extra_msg, set_default,
                                                custom_prov_data,
                                                catalog_item):
    """Tests quota enforcement via service infra

    Polarion:
        assignee: ghubale
        casecomponent: Infra
        caseimportance: high
        initialEstimate: 1/8h
        tags: quota
    """
    with appliance.context.use(context):
        service_catalogs = ServiceCatalogs(appliance, catalog_item.catalog,
                                           catalog_item.name)
        if context is ViaSSUI:
            service_catalogs.add_to_shopping_cart()
        service_catalogs.order()
    # nav to requests page to check quota validation
    request_description = 'Provisioning Service [{0}] from [{0}]'.format(
        catalog_item.name)
    provision_request = appliance.collections.requests.instantiate(
        request_description)
    provision_request.wait_for_request(method='ui')
    request.addfinalizer(provision_request.remove_request)
    assert provision_request.row.reason.text == "Quota Exceeded"
コード例 #5
0
def test_pxe_servicecatalog(appliance, setup_provider, provider, catalog_item, request):
    """Tests RHEV PXE service catalog

    Metadata:
        test_flag: pxe, provision

    Polarion:
        assignee: nansari
        initialEstimate: 1/4h
    """
    vm_name = catalog_item.prov_data['catalog']["vm_name"]
    request.addfinalizer(
        lambda: appliance.collections.infra_vms.instantiate(
            "{}0001".format(vm_name), provider).cleanup_on_provider()
    )
    service_catalogs = ServiceCatalogs(appliance, catalog_item.catalog, catalog_item.name)
    service_catalogs.order()
    # nav to requests page happens on successful provision
    logger.info('Waiting for cfme provision request for service %s', catalog_item.name)
    request_description = catalog_item.name
    provision_request = appliance.collections.requests.instantiate(request_description,
                                                                   partial_check=True)
    provision_request.wait_for_request(num_sec=3600)
    msg = "Provisioning failed with the message {}".format(provision_request.rest.message)
    assert provision_request.is_succeeded(), msg
コード例 #6
0
def test_order_catalog_item(appliance, provider, catalog_item, request,
                            register_event):
    """Tests order catalog item
    Metadata:
        test_flag: provision

    Polarion:
        assignee: nansari
        casecomponent: Services
        initialEstimate: 1/4h
        tags: service
    """
    vm_name = catalog_item.prov_data['catalog']["vm_name"]
    request.addfinalizer(lambda: appliance.collections.infra_vms.instantiate(
        "{}0001".format(vm_name), provider).cleanup_on_provider())

    register_event(target_type='Service',
                   target_name=catalog_item.name,
                   event_type='service_provisioned')

    service_catalogs = ServiceCatalogs(appliance, catalog_item.catalog,
                                       catalog_item.name)
    service_catalogs.order()
    logger.info("Waiting for cfme provision request for service {}".format(
        catalog_item.name))
    request_description = catalog_item.name
    provision_request = appliance.collections.requests.instantiate(
        request_description, partial_check=True)
    provision_request.wait_for_request()
    msg = "Provisioning failed with the message {}".format(
        provision_request.rest.message)
    assert provision_request.is_succeeded(), msg
コード例 #7
0
def test_service_manual_approval(appliance, provider, modify_instance,
                                 catalog_item, request):
    """Tests order catalog item
    Metadata:
        test_flag: provision

    Polarion:
        assignee: nansari
        initialEstimate: 1/4h
        casecomponent: Services
        tags: service
    """
    vm_name = catalog_item.prov_data['catalog']["vm_name"]
    request.addfinalizer(
        lambda: appliance.collections.infra_vms.instantiate(vm_name,
                                                            provider).cleanup_on_provider()
    )

    service_catalogs = ServiceCatalogs(appliance, catalog_item.catalog, catalog_item.name)
    service_catalogs.order()
    logger.info("Waiting for cfme provision request for service {}".format(catalog_item.name))
    request_description = catalog_item.name
    service_request = appliance.collections.requests.instantiate(description=request_description,
                                                                 partial_check=True)
    service_request.update(method='ui')
    assert service_request.row.approval_state.text == 'Pending Approval'
コード例 #8
0
def test_retire_ansible_service(appliance, catalog_item, request, job_type):
    """Tests retiring of catalog items for Ansible Template and Workflow jobs
    Metadata:
        test_flag: provision

    Polarion:
        assignee: nachandr
        casecomponent: Services
        caseimportance: medium
        initialEstimate: 1/4h
    """
    service_catalogs = ServiceCatalogs(appliance, catalog_item.catalog,
                                       catalog_item.name)
    service_catalogs.order()
    logger.info('Waiting for cfme provision request for service %s',
                catalog_item.name)
    cells = {'Description': catalog_item.name}
    order_request = appliance.collections.requests.instantiate(
        cells=cells, partial_check=True)
    order_request.wait_for_request(method='ui')
    msg = "Request failed with the message {}".format(
        order_request.row.last_message.text)
    assert order_request.is_succeeded(method='ui'), msg
    myservice = MyService(appliance, catalog_item.name)
    myservice.retire()
コード例 #9
0
def get_quota_message(request,
                      appliance,
                      catalog,
                      catalog_item_name,
                      dialog_values=None):
    """Returns the quota requested by particular type of flavor type"""
    service_catalogs = ServiceCatalogs(appliance, catalog, catalog_item_name,
                                       dialog_values)
    service_catalogs.order()
    # nav to requests page to check quota validation
    request_description = 'Provisioning Service [{0}] from [{0}]'.format(
        catalog_item_name)
    provision_request = appliance.collections.requests.instantiate(
        request_description)
    provision_request.wait_for_request(method='ui')
    request.addfinalizer(provision_request.remove_request)
    assert provision_request.row.reason.text == "Quota Exceeded"
    last_message = provision_request.row.last_message.text
    result = re.findall(r'requested.*\w', last_message)

    # Service request needs to delete because we are not able to order same catalog item multiple
    # times using automation.
    delete_request = appliance.rest_api.collections.service_requests.get(
        description=request_description)
    delete_request.action.delete()

    return result
コード例 #10
0
def test_service_manual_approval(appliance, provider, modify_instance,
                                 catalog_item, request):
    """Tests order catalog item
    Metadata:
        test_flag: provision

    Polarion:
        assignee: nansari
        initialEstimate: 1/4h
        casecomponent: Services
        tags: service
    """
    vm_name = catalog_item.prov_data['catalog']["vm_name"]
    request.addfinalizer(
        lambda: appliance.collections.infra_vms.instantiate(vm_name,
                                                            provider).cleanup_on_provider()
    )

    service_catalogs = ServiceCatalogs(appliance, catalog_item.catalog, catalog_item.name)
    service_catalogs.order()
    logger.info(f"Waiting for cfme provision request for service {catalog_item.name}")
    request_description = catalog_item.name
    service_request = appliance.collections.requests.instantiate(description=request_description,
                                                                 partial_check=True)
    service_request.update(method='ui')
    assert service_request.row.approval_state.text == 'Pending Approval'
コード例 #11
0
def test_order_catalog_item(appliance, provider, catalog_item, request,
                            register_event):
    """Tests order catalog item
    Metadata:
        test_flag: provision

    Polarion:
        assignee: nansari
        casecomponent: Services
        initialEstimate: 1/4h
        tags: service
    """
    vm_name = catalog_item.prov_data['catalog']["vm_name"]
    request.addfinalizer(
        lambda: appliance.collections.infra_vms.instantiate(
            "{}0001".format(vm_name), provider).cleanup_on_provider()
    )

    register_event(target_type='Service', target_name=catalog_item.name,
                   event_type='service_provisioned')

    service_catalogs = ServiceCatalogs(appliance, catalog_item.catalog, catalog_item.name)
    service_catalogs.order()
    logger.info("Waiting for cfme provision request for service {}".format(catalog_item.name))
    request_description = catalog_item.name
    provision_request = appliance.collections.requests.instantiate(request_description,
                                                                   partial_check=True)
    provision_request.wait_for_request()
    msg = "Provisioning failed with the message {}".format(provision_request.rest.message)
    assert provision_request.is_succeeded(), msg
コード例 #12
0
def test_quota_tagging_cloud_via_services(appliance, request, context,
                                          admin_email, set_entity_quota_tag,
                                          catalog_item):
    """Test Group and User Quota in UI and SSUI using tagging

    Polarion:
        assignee: ghubale
        casecomponent: Cloud
        initialEstimate: 1/6h
        tags: quota
    """
    with appliance.context.use(context):
        service_catalogs = ServiceCatalogs(appliance, catalog_item.catalog,
                                           catalog_item.name)
        if context is ViaSSUI:
            service_catalogs.add_to_shopping_cart()
        service_catalogs.order()
    # nav to requests page to check quota validation
    request_description = 'Provisioning Service [{0}] from [{0}]'.format(
        catalog_item.name)
    provision_request = appliance.collections.requests.instantiate(
        request_description)
    provision_request.wait_for_request(method='ui')
    request.addfinalizer(provision_request.remove_request)
    assert provision_request.row.reason.text == "Quota Exceeded"
コード例 #13
0
def test_quota_cloud_via_services(appliance, request, setup_provider,
                                  admin_email, entities, prov_data,
                                  catalog_item, context):
    """This test case verifies the quota assigned by automation method for user and group
       is working correctly for the cloud providers.

       Steps:
           1. Navigate to Automation > Automate > Explorer
           2. Add quota automation methods to domain
           3. Change 'quota_source_type' to 'user' or 'group'
           4. Test quota by provisioning instances over quota limit via UI or
              SSUI for user and group
           5. Check whether quota is exceeded or not

    Polarion:
        assignee: None
        initialEstimate: None
    """
    with appliance.context.use(context):
        service_catalogs = ServiceCatalogs(appliance, catalog_item.catalog,
                                           catalog_item.name)
        if context is ViaSSUI:
            service_catalogs.add_to_shopping_cart()
        service_catalogs.order()
    # nav to requests page to check quota validation
    request_description = (
        "Provisioning Service [{catalog_item_name}] from [{catalog_item_name}]"
        .format(catalog_item_name=catalog_item.name))
    provision_request = appliance.collections.requests.instantiate(
        request_description)
    provision_request.wait_for_request(method='ui')
    request.addfinalizer(provision_request.remove_request)
    assert provision_request.row.reason.text == "Quota Exceeded"
コード例 #14
0
def test_bundles_in_bundle(appliance, catalog_item):
    """
    Polarion:
        assignee: nansari
        casecomponent: Services
        caseimportance: low
        initialEstimate: 1/8h
        tags: service
    """
    bundle_name = "first_" + fauxfactory.gen_alphanumeric()
    appliance.collections.catalog_bundles.create(
        bundle_name, description="catalog_bundle",
        display_in=True, catalog=catalog_item.catalog, dialog=catalog_item.dialog,
        catalog_items=[catalog_item.name])
    sec_bundle_name = "sec_" + fauxfactory.gen_alphanumeric()
    appliance.collections.catalog_bundles.create(
        sec_bundle_name, description="catalog_bundle",
        display_in=True, catalog=catalog_item.catalog, dialog=catalog_item.dialog,
        catalog_items=[bundle_name])
    third_bundle_name = "third_" + fauxfactory.gen_alphanumeric()
    third_catalog_bundle = appliance.collections.catalog_bundles.create(
        third_bundle_name, description="catalog_bundle",
        display_in=True, catalog=catalog_item.catalog, dialog=catalog_item.dialog,
        catalog_items=[bundle_name, sec_bundle_name])
    service_catalogs = ServiceCatalogs(appliance, third_catalog_bundle.catalog, third_bundle_name)
    service_catalogs.order()
    logger.info('Waiting for cfme provision request for service %s', bundle_name)
    request_description = third_bundle_name
    provision_request = appliance.collections.requests.instantiate(request_description,
                                                                   partial_check=True)
    provision_request.wait_for_request()
    msg = "Request failed with the message {}".format(provision_request.rest.message)
    assert provision_request.is_succeeded(), msg
コード例 #15
0
def test_rhev_iso_servicecatalog(appliance, provider, setup_provider,
                                 setup_iso_datastore, catalog_item, request):
    """Tests RHEV ISO service catalog

    Metadata:
        test_flag: iso, provision

    Polarion:
        assignee: None
        initialEstimate: None
    """
    vm_name = catalog_item.prov_data['catalog']["vm_name"]
    request.addfinalizer(lambda: appliance.collections.infra_vms.instantiate(
        "{}0001".format(vm_name), provider).cleanup_on_provider())
    service_catalogs = ServiceCatalogs(appliance, catalog_item.catalog,
                                       catalog_item.name)
    service_catalogs.order()
    # nav to requests page happens on successful provision
    logger.info('Waiting for cfme provision request for service %s',
                catalog_item.name)
    request_description = catalog_item.name
    provision_request = appliance.collections.requests.instantiate(
        request_description, partial_check=True)
    provision_request.wait_for_request()
    msg = "Provisioning failed with the message {}".format(
        provision_request.rest.message)
    assert provision_request.is_succeeded(), msg
コード例 #16
0
def myservice(appliance, setup_provider, provider, catalog_item, request):
    """Tests my service

    Metadata:
        test_flag: provision
    """
    vm_name = version.pick({
        version.LOWEST:
        catalog_item.provisioning_data["vm_name"] + '_0001',
        '5.7':
        catalog_item.provisioning_data["vm_name"] + '0001'
    })
    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',
                catalog_item.name)
    request_description = catalog_item.name
    service_request = appliance.collections.requests.instantiate(
        request_description, partial_check=True)
    service_request.wait_for_request()
    assert service_request.is_succeeded()

    yield catalog_item.name, vm_name

    cleanup_vm(vm_name, provider)
def test_tagdialog_catalog_item(appliance, setup_provider, provider,
                                catalog_item, request, service_dialog,
                                widget_name):
    """Tests tag dialog catalog item

    Bugzilla:
        1633540

    Metadata:
        test_flag: provision

    Polarion:
        assignee: nansari
        initialEstimate: 1/4h
        casecomponent: Services
        tags: service
    """
    sd, element_data = service_dialog
    vm_name = catalog_item.prov_data['catalog']["vm_name"]
    request.addfinalizer(lambda: appliance.collections.infra_vms.instantiate(
        f"{vm_name}0001", provider).cleanup_on_provider())
    dialog_values = {element_data['element_information']['ele_name']: 'Gold'}
    service_catalogs = ServiceCatalogs(appliance,
                                       catalog=catalog_item.catalog,
                                       name=catalog_item.name,
                                       dialog_values=dialog_values)
    service_catalogs.order()
    logger.info(
        f'Waiting for cfme provision request for service {catalog_item.name}')
    provision_request = appliance.collections.requests.instantiate(
        catalog_item.name, partial_check=True)
    provision_request.wait_for_request()
    msg = f"Request failed with the message {provision_request.rest.message}"
    assert provision_request.is_succeeded(), msg
コード例 #18
0
def test_tenant_quota_enforce_via_service_cloud(request, appliance, provider, setup_provider,
                                                context, set_roottenant_quota, set_default,
                                                custom_prov_data, extra_msg, template_name,
                                                catalog_item):
    """Test Tenant Quota in UI and SSUI

    Polarion:
        assignee: ghubale
        casecomponent: Cloud
        initialEstimate: 1/10h
    """
    with appliance.context.use(context):
        service_catalogs = ServiceCatalogs(appliance, catalog_item.catalog, catalog_item.name)
        if context is ViaSSUI:
            service_catalogs.add_to_shopping_cart()
        service_catalogs.order()
    # nav to requests page to check quota validation
    request_description = 'Provisioning Service [{0}] from [{0}]'.format(catalog_item.name)
    provision_request = appliance.collections.requests.instantiate(request_description)
    provision_request.wait_for_request(method='ui')
    assert provision_request.row.reason.text == "Quota Exceeded"

    @request.addfinalizer
    def delete():
        provision_request.remove_request()
        catalog_item.delete()
コード例 #19
0
def test_tagdialog_catalog_item(appliance, provider, catalog_item, request):
    """Tests tag dialog catalog item
    Metadata:
        test_flag: provision

    Polarion:
        assignee: nansari
        initialEstimate: 1/4h
        casecomponent: Services
        tags: service
    """
    vm_name = catalog_item.prov_data['catalog']["vm_name"]
    request.addfinalizer(
        lambda: appliance.collections.infra_vms.instantiate(
            "{}0001".format(vm_name), provider).cleanup_on_provider()
    )
    dialog_values = {'service_level': "Gold"}
    service_catalogs = ServiceCatalogs(appliance, catalog=catalog_item.catalog,
                                       name=catalog_item.name,
                                       dialog_values=dialog_values)
    service_catalogs.order()
    logger.info('Waiting for cfme provision request for service {}'.format(catalog_item.name))
    request_description = catalog_item.name
    provision_request = appliance.collections.requests.instantiate(request_description,
                                                                   partial_check=True)
    provision_request.wait_for_request()
    msg = "Request failed with the message {}".format(provision_request.rest.message)
    assert provision_request.is_succeeded(), msg
コード例 #20
0
def order_catalog_item_in_ops_ui(appliance, provider, provisioning, vm_name,
                                 dialog, catalog, console_template, request):
    """
        Fixture for SSUI tests.
        Orders catalog item in OPS UI.
    """
    if hasattr(request, 'param'):
        catalog_item = create_catalog_item(
            provider, provisioning, vm_name, dialog, catalog,
            console_template if 'console_test' in request.param else None)
    else:
        catalog_item = create_catalog_item(provider, provisioning, vm_name,
                                           dialog, catalog)
    vm_name = catalog_item.provisioning_data['catalog']["vm_name"]
    request.addfinalizer(
        lambda: cleanup_vm("{}0001".format(vm_name), provider))
    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 {}".format(
        catalog_item.name))
    request_description = catalog_item.name
    provision_request = appliance.collections.requests.instantiate(
        request_description, partial_check=True)
    provision_request.wait_for_request()
    assert provision_request.is_finished()
    return catalog_item
コード例 #21
0
def test_order_catalog_item(appliance, provider, setup_provider, catalog_item,
                            request, register_event):
    """Tests order catalog item
    Metadata:
        test_flag: provision
    """
    vm_name = catalog_item.provisioning_data['catalog']["vm_name"]
    request.addfinalizer(lambda: cleanup_vm(vm_name + "_0001", provider))
    catalog_item.create()

    register_event(target_type='Service',
                   target_name=catalog_item.name,
                   event_type='service_provisioned')

    service_catalogs = ServiceCatalogs(appliance, catalog_item.catalog,
                                       catalog_item.name)
    service_catalogs.order()
    logger.info("Waiting for cfme provision request for service {}".format(
        catalog_item.name))
    request_description = catalog_item.name
    provision_request = appliance.collections.requests.instantiate(
        request_description, partial_check=True)
    provision_request.wait_for_request()
    msg = "Provisioning failed with the message {}".format(
        provision_request.rest.message)
    assert provision_request.is_succeeded(), msg
コード例 #22
0
def test_service_catalog_crud_ssui(appliance, setup_provider, context,
                                   order_service):
    """Tests Service Catalog in SSUI.

    Metadata:
        test_flag: ssui

    Polarion:
        assignee: sshveta
        initialEstimate: None
    """

    catalog_item = order_service
    with appliance.context.use(context):
        if appliance.version >= '5.9':
            dialog_values = {
                'service_name':
                "ssui_{}".format(fauxfactory.gen_alphanumeric())
            }
            service = ServiceCatalogs(appliance,
                                      name=catalog_item.name,
                                      dialog_values=dialog_values)
        else:
            service = ServiceCatalogs(appliance, name=catalog_item.name)
        service.add_to_shopping_cart()
        service.order()
コード例 #23
0
def test_quota_tagging_infra_via_services(request, appliance, admin_email, context,
                                          set_entity_quota_tag, custom_prov_data, prov_data,
                                          catalog_item):
    """This test case verifies the quota tagging is working correctly for the infra providers.

    Polarion:
        assignee: ghubale
        casecomponent: Quota
        caseimportance: medium
        initialEstimate: 1/6h
        tags: quota
    """

    prov_data.update(custom_prov_data)
    with appliance.context.use(context):
        service_catalogs = ServiceCatalogs(appliance, catalog_item.catalog, catalog_item.name)
        if context is ViaSSUI:
            service_catalogs.add_to_shopping_cart()
        service_catalogs.order()
    # nav to requests page to check quota validation
    request_description = 'Provisioning Service [{0}] from [{0}]'.format(catalog_item.name)
    provision_request = appliance.collections.requests.instantiate(request_description)
    provision_request.wait_for_request(method='ui')
    request.addfinalizer(provision_request.remove_request)
    assert provision_request.row.reason.text == "Quota Exceeded"
コード例 #24
0
def test_service_rbac_service_catalog(appliance, role_user_group, catalog,
                                      catalog_item):
    """ Test service rbac with service catalog

    Polarion:
        assignee: None
        initialEstimate: None
    """
    role, user = role_user_group
    product_features = [
        (['Everything'], True), (['Everything'], False),
        (['Everything', 'Services', 'Requests'], True),
        (['Everything', 'Automation', 'Automate', 'Customization'], True)
    ]
    product_features.extend([
        (['Everything', 'Services', 'Catalogs Explorer', k], True)
        for k in ['Catalog Items', 'Service Catalogs', 'Catalogs']
    ])
    role.update({'product_features': product_features})
    # Without below line, service_order only works here via admin, not via user
    # TODO: Remove below line when this behavior gets fixed
    with user:
        appliance.server.login(user)
        service_catalogs = ServiceCatalogs(appliance, catalog_item.catalog,
                                           catalog_item.name)
        service_catalogs.order()
        service_request = appliance.collections.requests.instantiate(
            catalog_item.name, partial_check=True)
        service_request.wait_for_request()
        assert service_request.is_succeeded()
コード例 #25
0
def test_service_rbac_service_catalog(appliance, role_user_group, catalog, catalog_item):
    """ Test service rbac with service catalog

    Polarion:
        assignee: apagac
        initialEstimate: 1/4h
        casecomponent: Services
    """
    role, user = role_user_group
    product_features = [
        (['Everything'], True), (['Everything'], False),
        (['Everything', 'Services', 'Requests'], True),
        (['Everything', 'Automation', 'Automate', 'Customization'], True)
    ]
    product_features.extend([(['Everything', 'Services', 'Catalogs Explorer', k], True)
                             for k in ['Catalog Items', 'Service Catalogs', 'Catalogs']])
    role.update({'product_features': product_features})
    # Without below line, service_order only works here via admin, not via user
    # TODO: Remove below line when this behavior gets fixed
    with user:
        appliance.server.login(user)
        service_catalogs = ServiceCatalogs(appliance, catalog_item.catalog, catalog_item.name)
        service_catalogs.order()
        service_request = appliance.collections.requests.instantiate(catalog_item.name,
                                                                     partial_check=True)
        service_request.wait_for_request()
        assert service_request.is_succeeded()
コード例 #26
0
def test_service_generic_catalog_bundle(appliance, catalog_item):
    """
    Polarion:
        assignee: nansari
        casecomponent: Services
        caseimportance: medium
        initialEstimate: 1/8h
        tags: service
    """
    bundle_name = fauxfactory.gen_alphanumeric(12, start="generic_")
    appliance.collections.catalog_bundles.create(
        bundle_name,
        description="catalog_bundle",
        display_in=True,
        catalog=catalog_item.catalog,
        dialog=catalog_item.dialog,
        catalog_items=[catalog_item.name])
    service_catalogs = ServiceCatalogs(appliance, catalog_item.catalog,
                                       bundle_name)
    service_catalogs.order()
    logger.info('Waiting for cfme provision request for service %s',
                bundle_name)
    request_description = bundle_name
    provision_request = appliance.collections.requests.instantiate(
        request_description, partial_check=True)
    provision_request.wait_for_request()
    msg = f"Request failed with the message {provision_request.rest.message}"
    assert provision_request.is_succeeded(), msg
コード例 #27
0
def test_quota_cloud_via_services(appliance, request, admin_email, entities, prov_data,
                                  catalog_item, context):
    """This test case verifies the quota assigned by automation method for user and group
       is working correctly for the cloud providers.

    Polarion:
        assignee: ghubale
        initialEstimate: 1/4h
        casecomponent: Cloud
        tags: quota
        testSteps:
           1. Navigate to Automation > Automate > Explorer
           2. Add quota automation methods to domain
           3. Change 'quota_source_type' to 'user' or 'group'
           4. Test quota by provisioning instances over quota limit via UI or
              SSUI for user and group
           5. Check whether quota is exceeded or not
    """
    with appliance.context.use(context):
        service_catalogs = ServiceCatalogs(appliance, catalog_item.catalog, catalog_item.name)
        if context is ViaSSUI:
            service_catalogs.add_to_shopping_cart()
        service_catalogs.order()
    # nav to requests page to check quota validation
    request_description = ("Provisioning Service [{catalog_item_name}] from [{catalog_item_name}]"
                           .format(catalog_item_name=catalog_item.name))
    provision_request = appliance.collections.requests.instantiate(request_description)
    provision_request.wait_for_request(method='ui')
    request.addfinalizer(provision_request.remove_request)
    assert provision_request.row.reason.text == "Quota Exceeded"
コード例 #28
0
def test_tagdialog_catalog_item(appliance, provider, catalog_item, request):
    """Tests tag dialog catalog item
    Metadata:
        test_flag: provision

    Polarion:
        assignee: nansari
        initialEstimate: 1/4h
        casecomponent: Services
        tags: service
    """
    vm_name = catalog_item.prov_data['catalog']["vm_name"]
    request.addfinalizer(
        lambda: appliance.collections.infra_vms.instantiate(
            "{}0001".format(vm_name), provider).cleanup_on_provider()
    )
    dialog_values = {'service_level': "Gold"}
    service_catalogs = ServiceCatalogs(appliance, catalog=catalog_item.catalog,
                                       name=catalog_item.name,
                                       dialog_values=dialog_values)
    service_catalogs.order()
    logger.info('Waiting for cfme provision request for service {}'.format(catalog_item.name))
    request_description = catalog_item.name
    provision_request = appliance.collections.requests.instantiate(request_description,
                                                                   partial_check=True)
    provision_request.wait_for_request()
    msg = "Request failed with the message {}".format(provision_request.rest.message)
    assert provision_request.is_succeeded(), msg
コード例 #29
0
def test_order_catalog_bundle(appliance, provider, setup_provider,
                              catalog_item, request):
    """Tests ordering a catalog bundle
    Metadata:
        test_flag: provision
    """

    vm_name = catalog_item.provisioning_data['catalog']["vm_name"]
    request.addfinalizer(lambda: cleanup_vm(vm_name + "_0001", provider))
    catalog_item.create()
    bundle_name = fauxfactory.gen_alphanumeric()
    catalog_bundle = CatalogBundle(name=bundle_name,
                                   description="catalog_bundle",
                                   display_in=True,
                                   catalog=catalog_item.catalog,
                                   dialog=catalog_item.dialog,
                                   catalog_items=[catalog_item.name])
    catalog_bundle.create()
    service_catalogs = ServiceCatalogs(appliance, catalog_item.catalog,
                                       catalog_bundle.name)
    service_catalogs.order()
    logger.info("Waiting for cfme provision request for service {}".format(
        bundle_name))
    request_description = bundle_name
    provision_request = appliance.collections.requests.instantiate(
        request_description, partial_check=True)
    provision_request.wait_for_request()
    assert provision_request.is_succeeded()
コード例 #30
0
def test_retire_stack(appliance, provider, provisioning, catalog, catalog_item,
                      request, stack_data):
    """Tests stack provisioning

    Metadata:
        test_flag: provision
    """
    catalog_item, template = catalog_item

    @request.addfinalizer
    def _cleanup_vms():
        clean_up(stack_data, provider)

    DefaultView.set_default_view("Stacks", "Grid View")

    service_catalogs = ServiceCatalogs(appliance, catalog_item.catalog,
                                       catalog_item.name, stack_data)
    service_catalogs.order()
    logger.info('Waiting for cfme provision request for service {}'.format(
        catalog_item.name))
    request_description = catalog_item.name
    provision_request = appliance.collections.requests.instantiate(
        request_description, partial_check=True)
    provision_request.wait_for_request()
    assert provision_request.is_succeeded()
    stack = StackCollection(appliance).instantiate(stack_data['stack_name'],
                                                   provider=provider)
    stack.wait_for_exists()
    stack.retire_stack()
コード例 #31
0
def test_tenant_quota_enforce_via_service_infra(request, appliance, provider,
                                                setup_provider, context,
                                                set_roottenant_quota,
                                                extra_msg, custom_prov_data,
                                                catalog_item):
    """Tests quota enforcement via service infra

    Metadata:
        test_flag: quota
    """
    with appliance.context.use(context):
        service_catalogs = ServiceCatalogs(appliance, catalog_item.catalog,
                                           catalog_item.name)
        if context is ViaSSUI:
            service_catalogs.add_to_shopping_cart()
        service_catalogs.order()
    # nav to requests page to check quota validation
    request_description = 'Provisioning Service [{0}] from [{0}]'.format(
        catalog_item.name)
    provision_request = appliance.collections.requests.instantiate(
        request_description)
    provision_request.wait_for_request(method='ui')
    assert provision_request.row.reason.text == "Quota Exceeded"

    @request.addfinalizer
    def delete():
        provision_request.remove_request()
        catalog_item.delete()
コード例 #32
0
def test_reconfigure_service(appliance, provider, provisioning, catalog,
                             catalog_item, request, stack_data):
    """Tests stack provisioning

    Metadata:
        test_flag: provision
    """
    catalog_item, template = catalog_item

    @request.addfinalizer
    def _cleanup_vms():
        clean_up(stack_data, provider)

    service_catalogs = ServiceCatalogs(appliance, catalog_item.catalog,
                                       catalog_item.name, stack_data)
    service_catalogs.order()
    logger.info('Waiting for cfme provision request for service {}'.format(
        catalog_item.name))
    request_description = catalog_item.name
    provision_request = appliance.collections.requests.instantiate(
        request_description, partial_check=True)
    provision_request.wait_for_request(method='ui')
    assert provision_request.is_succeeded()
    last_message = provision_request.get_request_row_from_ui(
    )['Last Message'].text
    service_name = last_message.split()[2].strip('[]')
    myservice = MyService(appliance, service_name)
    myservice.reconfigure_service()
コード例 #33
0
def test_bundles_in_bundle(appliance, catalog_item):
    bundle_name = "first_" + fauxfactory.gen_alphanumeric()
    catalog_bundle = CatalogBundle(name=bundle_name, description="catalog_bundle",
                   display_in=True, catalog=catalog_item.catalog, dialog=catalog_item.dialog,
                   catalog_items=[catalog_item.name])
    catalog_bundle.create()
    sec_bundle_name = "sec_" + fauxfactory.gen_alphanumeric()
    sec_catalog_bundle = CatalogBundle(name=sec_bundle_name, description="catalog_bundle",
                   display_in=True, catalog=catalog_item.catalog, dialog=catalog_item.dialog,
                   catalog_items=[bundle_name])
    sec_catalog_bundle.create()
    third_bundle_name = "third_" + fauxfactory.gen_alphanumeric()
    third_catalog_bundle = CatalogBundle(name=third_bundle_name, description="catalog_bundle",
                   display_in=True, catalog=catalog_item.catalog, dialog=catalog_item.dialog,
                   catalog_items=[bundle_name, sec_bundle_name])
    third_catalog_bundle.create()
    service_catalogs = ServiceCatalogs(appliance, third_catalog_bundle.catalog, third_bundle_name)
    service_catalogs.order()
    logger.info('Waiting for cfme provision request for service %s', bundle_name)
    request_description = third_bundle_name
    provision_request = appliance.collections.requests.instantiate(request_description,
                                                                   partial_check=True)
    provision_request.wait_for_request()
    msg = "Request failed with the message {}".format(provision_request.rest.message)
    assert provision_request.is_succeeded(), msg
コード例 #34
0
def test_bundles_in_bundle(appliance, catalog_item):
    """
    Polarion:
        assignee: nansari
        casecomponent: Services
        caseimportance: low
        initialEstimate: 1/8h
        tags: service
    """
    bundle_name = "first_" + fauxfactory.gen_alphanumeric()
    appliance.collections.catalog_bundles.create(
        bundle_name, description="catalog_bundle",
        display_in=True, catalog=catalog_item.catalog, dialog=catalog_item.dialog,
        catalog_items=[catalog_item.name])
    sec_bundle_name = "sec_" + fauxfactory.gen_alphanumeric()
    appliance.collections.catalog_bundles.create(
        sec_bundle_name, description="catalog_bundle",
        display_in=True, catalog=catalog_item.catalog, dialog=catalog_item.dialog,
        catalog_items=[bundle_name])
    third_bundle_name = "third_" + fauxfactory.gen_alphanumeric()
    third_catalog_bundle = appliance.collections.catalog_bundles.create(
        third_bundle_name, description="catalog_bundle",
        display_in=True, catalog=catalog_item.catalog, dialog=catalog_item.dialog,
        catalog_items=[bundle_name, sec_bundle_name])
    service_catalogs = ServiceCatalogs(appliance, third_catalog_bundle.catalog, third_bundle_name)
    service_catalogs.order()
    logger.info('Waiting for cfme provision request for service %s', bundle_name)
    request_description = third_bundle_name
    provision_request = appliance.collections.requests.instantiate(request_description,
                                                                   partial_check=True)
    provision_request.wait_for_request()
    msg = "Request failed with the message {}".format(provision_request.rest.message)
    assert provision_request.is_succeeded(), msg
コード例 #35
0
def test_service_provisioning_email(request, appliance, catalog_item):
    """
    Polarion:
        assignee: nansari
        casecomponent: Services
        caseposneg: negative
        initialEstimate: 1/4h

    Bugzilla:
        1668004
    """
    result = LogValidator("/var/www/miq/vmdb/log/automation.log",
                          failure_patterns=[".*Error during substitution.*"])
    result.start_monitoring()
    service_catalogs = ServiceCatalogs(appliance, catalog_item.catalog,
                                       catalog_item.name)
    service_catalogs.order()
    request_description = (
        "Provisioning Service [{catalog_item_name}] from [{catalog_item_name}]"
        .format(catalog_item_name=catalog_item.name))
    provision_request = appliance.collections.requests.instantiate(
        request_description)
    provision_request.wait_for_request(method='ui')
    request.addfinalizer(provision_request.remove_request)
    assert result.validate(wait="60s")
コード例 #36
0
def test_order_catalog_bundle(appliance, provider, catalog_item, request):
    """Tests ordering a catalog bundle
    Metadata:
        test_flag: provision
    """

    vm_name = catalog_item.prov_data['catalog']["vm_name"]
    request.addfinalizer(
        lambda: appliance.collections.infra_vms.instantiate(
            "{}0001".format(vm_name), provider).cleanup_on_provider()
    )
    bundle_name = fauxfactory.gen_alphanumeric()
    catalog_bundle = appliance.collections.catalog_bundles.create(
        bundle_name, description="catalog_bundle",
        display_in=True, catalog=catalog_item.catalog,
        dialog=catalog_item.dialog, catalog_items=[catalog_item.name])
    service_catalogs = ServiceCatalogs(appliance, catalog_item.catalog, catalog_bundle.name)
    service_catalogs.order()
    logger.info("Waiting for cfme provision request for service {}".format(bundle_name))
    request_description = bundle_name
    provision_request = appliance.collections.requests.instantiate(request_description,
                                                                   partial_check=True)
    provision_request.wait_for_request()
    msg = "Provisioning failed with the message {}".format(provision_request.rest.message)
    assert provision_request.is_succeeded(), msg
コード例 #37
0
def test_quota_tagging_infra_via_services(request, appliance, admin_email,
                                          context, set_entity_quota_tag,
                                          custom_prov_data, prov_data,
                                          catalog_item):
    """This test case verifies the quota tagging is working correctly for the infra providers.

    Polarion:
        assignee: ghubale
        casecomponent: Quota
        caseimportance: medium
        initialEstimate: 1/6h
        tags: quota
    """

    prov_data.update(custom_prov_data)
    with appliance.context.use(context):
        service_catalogs = ServiceCatalogs(appliance, catalog_item.catalog,
                                           catalog_item.name)
        if context is ViaSSUI:
            service_catalogs.add_to_shopping_cart()
        service_catalogs.order()
    # nav to requests page to check quota validation
    request_description = 'Provisioning Service [{0}] from [{0}]'.format(
        catalog_item.name)
    provision_request = appliance.collections.requests.instantiate(
        request_description)
    provision_request.wait_for_request(method='ui')
    request.addfinalizer(provision_request.remove_request)
    assert provision_request.row.reason.text == "Quota Exceeded"
コード例 #38
0
def test_retire_stack(appliance, provider, provisioning, catalog, catalog_item, request):
    """Tests stack provisioning

    Metadata:
        test_flag: provision
    """
    catalog_item, template = catalog_item
    DefaultView.set_default_view("Stacks", "Grid View")

    stack_data = prepare_stack_data(provider, provisioning)
    service_catalogs = ServiceCatalogs(appliance, catalog_item.catalog,
                                       catalog_item.name, stack_data)
    service_catalogs.order()
    logger.info('Waiting for cfme provision request for service {}'.format(catalog_item.name))
    request_description = catalog_item.name
    provision_request = appliance.collections.requests.instantiate(request_description,
                                                                   partial_check=True)
    provision_request.wait_for_request()
    assert provision_request.is_succeeded()
    stack = StackCollection(appliance).instantiate(stack_data['stack_name'], provider=provider)
    stack.wait_for_exists()
    stack.retire_stack()

    @request.addfinalizer
    def _cleanup_vms():
        clean_up(stack_data, provider)
コード例 #39
0
def test_quota_catalog_bundle_infra(request, appliance, admin_email, entities, custom_prov_data,
                                    prov_data, catalog_bundle, context, vm_name, template_name):
    """This test case verifies the quota assigned by automation method for user and group
       is working correctly for the infra providers by ordering catalog bundle.

    Polarion:
        assignee: ghubale
        initialEstimate: 1/4h
        casecomponent: Quota
        caseimportance: high
        tags: quota
        testSteps:
            1. Navigate to Automation > Automate > Explorer
            2. Add quota automation methods to domain
            3. Change 'quota_source_type' to 'user' or 'group'
            4. Create one or more catalogs to test quota by provisioning VMs over quota limit via UI
               or SSUI for user and group
            5. Add more than one catalog to catalog bundle and order catalog bundle
            6. Check whether quota is exceeded or not
    """
    prov_data.update(custom_prov_data)
    with appliance.context.use(context):
        service_catalogs = ServiceCatalogs(appliance, catalog_bundle.catalog, catalog_bundle.name)
        if context is ViaSSUI:
            service_catalogs.add_to_shopping_cart()
        service_catalogs.order()
    # nav to requests page to check quota validation
    request_description = 'Provisioning Service [{0}] from [{0}]'.format(catalog_bundle.name)
    provision_request = appliance.collections.requests.instantiate(request_description)
    provision_request.wait_for_request(method='ui')
    request.addfinalizer(provision_request.remove_request)
    assert provision_request.row.reason.text == "Quota Exceeded"
コード例 #40
0
def test_reconfigure_service(appliance, provider, provisioning, catalog, catalog_item, request):
    """Tests stack provisioning

    Metadata:
        test_flag: provision
    """
    catalog_item, template = catalog_item
    stack_data = prepare_stack_data(provider, provisioning)

    @request.addfinalizer
    def _cleanup_vms():
        clean_up(stack_data, provider)

    service_catalogs = ServiceCatalogs(appliance, catalog_item.catalog,
                                       catalog_item.name, stack_data)
    service_catalogs.order()
    logger.info('Waiting for cfme provision request for service {}'.format(catalog_item.name))
    request_description = catalog_item.name
    provision_request = appliance.collections.requests.instantiate(request_description,
                                                                   partial_check=True)
    provision_request.wait_for_request()
    assert provision_request.is_succeeded()

    myservice = MyService(appliance, catalog_item.name)
    myservice.reconfigure_service()
コード例 #41
0
def test_retire_ansible_workflow(appliance, ansible_workflow_catitem,
                                 workflow_type, ansible_api_version_change):
    """Tests retiring of catalog items for Ansible Workflow templates
    Metadata:
        test_flag: provision

    Polarion:
        assignee: jhenner
        casecomponent: Services
        caseimportance: medium
        initialEstimate: 1/4h
    """
    service_catalogs = ServiceCatalogs(appliance,
                                       ansible_workflow_catitem.catalog,
                                       ansible_workflow_catitem.name)
    service_catalogs.order()
    logger.info('Waiting for cfme provision request for service %s',
                ansible_workflow_catitem.name)
    cells = {'Description': ansible_workflow_catitem.name}
    order_request = appliance.collections.requests.instantiate(
        cells=cells, partial_check=True)
    order_request.wait_for_request(method='ui')
    msg = f"Request failed with the message {order_request.row.last_message.text}"
    assert order_request.is_succeeded(method='ui'), msg
    myservice = MyService(appliance, ansible_workflow_catitem.name)
    myservice.retire()
コード例 #42
0
def test_tower_workflow_item(appliance, ansible_workflow_catitem,
                             workflow_type, ansible_api_version_change):
    """Tests ordering of catalog items for Ansible Workflow templates
    Metadata:
        test_flag: provision

    Polarion:
        assignee: jhenner
        initialEstimate: 1/4h
        casecomponent: Services
        caseimportance: high
    """
    service_catalogs = ServiceCatalogs(appliance,
                                       ansible_workflow_catitem.catalog,
                                       ansible_workflow_catitem.name)
    service_catalogs.order()
    logger.info('Waiting for cfme provision request for service %s',
                ansible_workflow_catitem.name)
    cells = {'Description': ansible_workflow_catitem.name}
    order_request = appliance.collections.requests.instantiate(
        cells=cells, partial_check=True)
    order_request.wait_for_request(method='ui')
    msg = f'Request failed with the message {order_request.row.last_message.text}'
    assert order_request.is_succeeded(method='ui'), msg
    appliance.user.my_settings.default_views.set_default_view(
        'Configuration Management Providers', 'List View')
コード例 #43
0
def test_order_catalog_bundle(appliance, provider, catalog_item, request):
    """Tests ordering a catalog bundle
    Metadata:
        test_flag: provision

    Polarion:
        assignee: nansari
        casecomponent: Services
        initialEstimate: 1/4h
        tags: service
    """

    vm_name = catalog_item.prov_data['catalog']["vm_name"]
    request.addfinalizer(lambda: appliance.collections.infra_vms.instantiate(
        "{}0001".format(vm_name), provider).cleanup_on_provider())
    bundle_name = fauxfactory.gen_alphanumeric()
    catalog_bundle = appliance.collections.catalog_bundles.create(
        bundle_name,
        description="catalog_bundle",
        display_in=True,
        catalog=catalog_item.catalog,
        dialog=catalog_item.dialog,
        catalog_items=[catalog_item.name])
    service_catalogs = ServiceCatalogs(appliance, catalog_item.catalog,
                                       catalog_bundle.name)
    service_catalogs.order()
    logger.info("Waiting for cfme provision request for service {}".format(
        bundle_name))
    request_description = bundle_name
    provision_request = appliance.collections.requests.instantiate(
        request_description, partial_check=True)
    provision_request.wait_for_request()
    msg = "Provisioning failed with the message {}".format(
        provision_request.rest.message)
    assert provision_request.is_succeeded(), msg
コード例 #44
0
def test_quota_infra(request, appliance, admin_email, entities,
                     custom_prov_data, prov_data, catalog_item, context,
                     vm_name, template_name):
    """This test case verifies the quota assigned by automation method for user and group
       is working correctly for the infra providers.

    Polarion:
        assignee: ghubale
        initialEstimate: 1/4h
        casecomponent: Quota
        caseimportance: medium
        tags: quota
        testSteps:
            1. Navigate to Automation > Automate > Explorer
            2. Add quota automation methods to domain
            3. Change 'quota_source_type' to 'user' or 'group'
            4. Test quota by provisioning VMs over quota limit via UI or SSUI for user and group
            5. Check whether quota is exceeded or not
    """
    prov_data.update(custom_prov_data)
    with appliance.context.use(context):
        service_catalogs = ServiceCatalogs(appliance, catalog_item.catalog,
                                           catalog_item.name)
        if context is ViaSSUI:
            service_catalogs.add_to_shopping_cart()
        service_catalogs.order()
    # nav to requests page to check quota validation
    request_description = 'Provisioning Service [{0}] from [{0}]'.format(
        catalog_item.name)
    provision_request = appliance.collections.requests.instantiate(
        request_description)
    provision_request.wait_for_request(method='ui')
    request.addfinalizer(provision_request.remove_request)
    assert provision_request.row.reason.text == "Quota Exceeded"
コード例 #45
0
def test_dynamicdropdown_dialog(appliance, dialog, catalog):
    item_name = fauxfactory.gen_alphanumeric()
    catalog_item = appliance.collections.catalog_items.create(
        appliance.collections.catalog_items.GENERIC, name=item_name,
        description="my catalog", display_in=True, catalog=catalog,
        dialog=dialog)
    service_catalogs = ServiceCatalogs(appliance, catalog_item.catalog, catalog_item.name)
    service_catalogs.order()
コード例 #46
0
def test_dynamicdropdown_dialog(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()
    service_catalogs = ServiceCatalogs(appliance, catalog_item.catalog, catalog_item.name)
    service_catalogs.order()
コード例 #47
0
def test_service_catalog_crud(appliance, setup_provider, context, order_catalog_item_in_ops_ui):
    """Tests Service Catalog in SSUI."""

    service_name = order_catalog_item_in_ops_ui.name
    with appliance.context.use(context):
        appliance.server.login()
        service = ServiceCatalogs(appliance, name=service_name)
        service.add_to_shopping_cart()
        service.order()
コード例 #48
0
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()
コード例 #49
0
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()
コード例 #50
0
def test_delete_catalog_deletes_service(appliance, dialog, catalog):
    item_name = fauxfactory.gen_alphanumeric()
    catalog_item = appliance.collections.catalog_items.create(
        appliance.collections.catalog_items.GENERIC,
        name=item_name,
        description="my catalog", display_in=True, catalog=catalog,
        dialog=dialog)
    catalog.delete()
    service_catalogs = ServiceCatalogs(appliance, catalog, catalog_item.name)
    with pytest.raises(NoSuchElementException):
        service_catalogs.order()
コード例 #51
0
def test_copy_request_bz1194479(appliance, setup_provider, provider, catalog_item, request):
    """Automate BZ 1194479"""
    vm_name = catalog_item.prov_data["catalog"]["vm_name"]
    request.addfinalizer(lambda: VM.factory(vm_name + "_0001", provider).cleanup_on_provider())
    catalog_item.create()
    service_catalogs = ServiceCatalogs(appliance, catalog_item.catalog, catalog_item.name)
    service_catalogs.order()
    request_description = catalog_item.name
    service_request = appliance.collections.requests.instantiate(request_description,
                                                                 partial_check=True)
    service_request.wait_for_request()
    assert navigate_to(service_request, 'Details')
コード例 #52
0
def test_service_catalog_crud_ui(appliance, context, order_ansible_service_in_ops_ui, request):
    """Tests Ansible Service Catalog in SSUI."""

    service_name = order_ansible_service_in_ops_ui
    with appliance.context.use(context):
        service = ServiceCatalogs(appliance, name=service_name)
        service.add_to_shopping_cart()
        service.order()

        @request.addfinalizer
        def _finalize():
            _service = MyService(appliance, service_name)
            _service.delete()
コード例 #53
0
def test_delete_catalog_item_deletes_service(appliance, catalog_item):
    """
    Polarion:
        assignee: nansari
        casecomponent: Services
        caseimportance: medium
        initialEstimate: 1/8h
        tags: service
    """
    catalog_item.delete()
    service_catalogs = ServiceCatalogs(appliance, catalog_item.catalog, catalog_item.name)
    with pytest.raises(CandidateNotFound):
        service_catalogs.order()
コード例 #54
0
def test_quota_tagging_cloud_via_services(appliance, request, provider, setup_provider, context,
                                          admin_email, set_entity_quota_tag, catalog_item):
    """Test Group and User Quota in UI and SSUI using tagging"""
    with appliance.context.use(context):
        service_catalogs = ServiceCatalogs(appliance, catalog_item.catalog, catalog_item.name)
        if context is ViaSSUI:
            service_catalogs.add_to_shopping_cart()
        service_catalogs.order()
    # nav to requests page to check quota validation
    request_description = 'Provisioning Service [{0}] from [{0}]'.format(catalog_item.name)
    provision_request = appliance.collections.requests.instantiate(request_description)
    provision_request.wait_for_request(method='ui')
    request.addfinalizer(provision_request.remove_request)
    assert provision_request.row.reason.text == "Quota Exceeded"
コード例 #55
0
def test_service_catalog_crud_ssui(appliance, setup_provider,
                                   context, order_service):
    """Tests Service Catalog in SSUI."""

    catalog_item = order_service
    with appliance.context.use(context):
        if appliance.version >= '5.9':
            dialog_values = {'service_name': "ssui_{}".format(fauxfactory.gen_alphanumeric())}
            service = ServiceCatalogs(appliance, name=catalog_item.name,
                                      dialog_values=dialog_values)
        else:
            service = ServiceCatalogs(appliance, name=catalog_item.name)
        service.add_to_shopping_cart()
        service.order()
コード例 #56
0
def test_service_generic_catalog_bundle(appliance, catalog_item):
    bundle_name = "generic_" + fauxfactory.gen_alphanumeric()
    catalog_bundle = CatalogBundle(name=bundle_name, description="catalog_bundle",
                   display_in=True, catalog=catalog_item.catalog, dialog=catalog_item.dialog,
                   catalog_items=[catalog_item.name])
    catalog_bundle.create()
    service_catalogs = ServiceCatalogs(appliance, catalog_item.catalog, bundle_name)
    service_catalogs.order()
    logger.info('Waiting for cfme provision request for service %s', bundle_name)
    request_description = bundle_name
    provision_request = appliance.collections.requests.instantiate(request_description,
                                                                   partial_check=True)
    provision_request.wait_for_request()
    assert provision_request.is_succeeded()
コード例 #57
0
def test_order_tower_catalog_item(appliance, catalog_item, request):
    """Tests order catalog item
    Metadata:
        test_flag: provision
    """
    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', catalog_item.name)
    cells = {'Description': catalog_item.name}
    order_request = appliance.collections.requests.instantiate(cells=cells, partial_check=True)
    order_request.wait_for_request(method='ui')
    assert order_request.is_succeeded(method='ui')
    DefaultView.set_default_view("Configuration Management Providers", "List View")
コード例 #58
0
def test_retire_ansible_service(appliance, catalog_item, request):
    """Tests order catalog item
    Metadata:
        test_flag: provision
    """
    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', catalog_item.name)
    cells = {'Description': catalog_item.name}
    order_request = appliance.collections.requests.instantiate(cells=cells, partial_check=True)
    order_request.wait_for_request(method='ui')
    assert order_request.is_succeeded(method='ui')
    myservice = MyService(appliance, catalog_item.name)
    myservice.retire()
コード例 #59
0
def test_request_with_orphaned_template(appliance, provider, catalog_item):
    """Tests edit catalog item after deleting provider
    Metadata:
        test_flag: provision
    """
    service_catalogs = ServiceCatalogs(appliance, catalog_item.catalog, catalog_item.name)
    service_catalogs.order()
    logger.info("Waiting for cfme provision request for service {}".format(catalog_item.name))
    request_description = catalog_item.name
    provision_request = appliance.collections.requests.instantiate(request_description,
                                                                   partial_check=True)
    provider.delete(cancel=False)
    provider.wait_for_delete()
    provision_request.wait_for_request(method='ui')
    assert provision_request.row.status.text == 'Error'