def test_project_quota_enforce_via_lifecycle_infra(appliance, provider,
                                                   new_user, set_project_quota,
                                                   extra_msg, custom_prov_data,
                                                   approve, prov_data, vm_name,
                                                   template_name):
    """Test project quota via lifecycle method

    Polarion:
        assignee: ghubale
        casecomponent: Configuration
        initialEstimate: 1/4h
        tags: quota
    """
    with new_user:
        recursive_update(prov_data, custom_prov_data)
        do_vm_provisioning(appliance,
                           template_name=template_name,
                           provider=provider,
                           vm_name=vm_name,
                           provisioning_data=prov_data,
                           wait=False,
                           request=None)

        # nav to requests page to check quota validation
        request_description = 'Provision from [{template}] to [{vm}{msg}]'.format(
            template=template_name, vm=vm_name, msg=extra_msg)
        provision_request = appliance.collections.requests.instantiate(
            request_description)
        if approve:
            provision_request.approve_request(method='ui', reason="Approved")
        provision_request.wait_for_request(method='ui')
        assert provision_request.row.reason.text == "Quota Exceeded"
Example #2
0
def test_cloud_quota_by_lifecycle(request, appliance, provider, set_entity_quota_source_change,
                                  prov_data, vm_name, template_name):
    """Testing cloud quota for user and group by provisioning instance via lifecycle

    Polarion:
        assignee: ghubale
        initialEstimate: 1/4h
        casecomponent: Cloud
        tags: quota
        testSteps:
            1. Navigate to Automation > automate > Explorer
            2. Create new Domain and copy 'quota' and 'quota_source' method
            3. Change 'value' of 'open source type' to 'user' or 'group' (one by one) in 'quota'
               method
            4. Provision instance via lifecycle
            5. Make sure that provisioned 'template' is having more than assigned quota
            6. Check whether instance provision 'Denied' with reason 'Quota Exceeded'
    """
    recursive_update(prov_data, {
        'request': {'email': 'test_{}@example.com'.format(fauxfactory.gen_alphanumeric())}})
    prov_data.update({'template_name': template_name})
    appliance.collections.cloud_instances.create(vm_name, provider, prov_data, override=True)
    # nav to requests page to check quota validation
    request_description = 'Provision from [{template}] to [{vm}]'.format(template=template_name,
                                                                         vm=vm_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"
def test_quota(appliance, provider, custom_prov_data, vm_name, admin_email,
               entities, template_name, prov_data):
    """This test case checks quota limit using the automate's predefine method 'quota source'

    Polarion:
        assignee: ghubale
        casecomponent: Quota
        caseimportance: medium
        initialEstimate: 1/6h
        tags: quota
    """
    recursive_update(prov_data, custom_prov_data)
    do_vm_provisioning(appliance,
                       template_name=template_name,
                       provider=provider,
                       vm_name=vm_name,
                       provisioning_data=prov_data,
                       wait=False,
                       request=None)

    # nav to requests page to check quota validation
    request_description = 'Provision from [{template}] to [{vm}]'.format(
        template=template_name, vm=vm_name)
    provision_request = appliance.collections.requests.instantiate(
        request_description)
    provision_request.wait_for_request(method='ui')
    assert provision_request.row.reason.text == "Quota Exceeded"
Example #4
0
def test_quota_tagging(appliance, provider, setup_provider,
                       set_entity_quota_tag, custom_prov_data, vm_name,
                       template_name, prov_data):
    """Tests quota tagging

    Metadata:
        test_flag: quota
    """
    recursive_update(prov_data, custom_prov_data)

    do_vm_provisioning(appliance,
                       template_name=template_name,
                       provider=provider,
                       vm_name=vm_name,
                       provisioning_data=prov_data,
                       smtp_test=False,
                       wait=False,
                       request=None)

    # nav to requests page to check quota validation
    request_description = 'Provision from [{}] to [{}]'.format(
        template_name, vm_name)
    provision_request = appliance.collections.requests.instantiate(
        request_description)
    provision_request.wait_for_request(method='ui')
    assert provision_request.row.reason.text == "Quota Exceeded"
def test_user_quota_diff_groups(appliance, provider, new_user,
                                set_parent_tenant_quota, extra_msg,
                                custom_prov_data, approve, prov_data, vm_name,
                                template_name):
    """
    Polarion:
        assignee: ghubale
        initialEstimate: 1/4h
        casecomponent: Quota
        caseimportance: high
        tags: quota
    """
    with new_user:
        recursive_update(prov_data, custom_prov_data)
        logger.info("Successfully updated VM provisioning data")
        do_vm_provisioning(appliance,
                           template_name=template_name,
                           provider=provider,
                           vm_name=vm_name,
                           provisioning_data=prov_data,
                           wait=False,
                           request=None)

        # nav to requests page to check quota validation
        request_description = 'Provision from [{template}] to [{vm}{msg}]'.format(
            template=template_name, vm=vm_name, msg=extra_msg)
        provision_request = appliance.collections.requests.instantiate(
            request_description)
        if approve:
            provision_request.approve_request(method='ui', reason="Approved")
        provision_request.wait_for_request(method='ui')
        assert provision_request.row.reason.text == "Quota Exceeded"
def mapping_data_vm_obj_dual_nics(request, appliance, source_provider,
                                  provider):
    source_type = ["VM Network", "DPortGroup"]
    dest_type = ["ovirtmgmt", "Storage - VLAN 33"]

    vmware_nw = source_provider.data.get("vlans", [None])[0]
    rhvm_nw = provider.data.get("vlans", [None])[0]
    cluster = provider.data.get("clusters", [False])[0]
    if not vmware_nw or not rhvm_nw or not cluster:
        pytest.skip("No data for source or target network in providers.")

    infra_mapping_data = infra_mapping_default_data(source_provider, provider)
    recursive_update(
        infra_mapping_data, {
            "description":
            "Dual DS migration of VM from {network1} to {network2}".format(
                network1=source_type, network2=dest_type),
            "networks": [
                component_generator("vlans", source_provider, provider,
                                    source_type[0], dest_type[0]),
                component_generator("vlans", source_provider, provider,
                                    source_type[1], dest_type[1])
            ]
        })
    vm_obj = get_vm(request, appliance, source_provider,
                    Templates.DUAL_NETWORK_TEMPLATE)
    return FormDataVmObj(infra_mapping_data=infra_mapping_data,
                         vm_list=[vm_obj])
Example #7
0
def form_data_dual_vm_obj_dual_datastore(request, appliance, second_provider, provider):
    vmware_nw = second_provider.data.get('vlans', [None])[0]
    rhvm_nw = provider.data.get('vlans', [None])[0]
    cluster = provider.data.get('clusters', [False])[0]
    if not vmware_nw or not rhvm_nw or not cluster:
        pytest.skip("No data for source or target network in providers.")

    form_data = _form_data(second_provider, provider)
    recursive_update(form_data, {
        'general': {
            'description': "Dual Datastore migration of VM from {} to {},& from {} to {}"
                     .format(request.param[0][0], request.param[0][1], request.param[1][0],
                             request.param[1][1])},
        'datastore': {
            'Cluster ({})'.format(provider.data.get('clusters')[0]): {
                'mappings': [_form_data_mapping('datastores', second_provider, provider,
                                                request.param[0][0], request.param[0][1]),
                             _form_data_mapping('datastores', second_provider, provider,
                                                request.param[1][0], request.param[1][1])]
            }
        },
        'network': {
            'Cluster ({})'.format(provider.data.get('clusters')[0]): {
                'mappings': [_form_data_mapping('vlans', second_provider, provider,
                                                second_provider.data.get('vlans')[0],
                                                provider.data.get('vlans')[0])]
            }
        }
    })
    # creating 2 VMs on two different datastores and returning its object list
    vm_obj1 = get_vm(request, appliance, second_provider, request.param[0][2], request.param[0][0])
    vm_obj2 = get_vm(request, appliance, second_provider, request.param[1][2], request.param[1][0])
    return FormDataVmObj(form_data=form_data, vm_list=[vm_obj1, vm_obj2])
Example #8
0
def test_user_quota_diff_groups(request, appliance, provider, setup_provider, new_user,
                                set_parent_tenant_quota, extra_msg, custom_prov_data, approve,
                                prov_data, vm_name, template_name):
    """prerequisite: Provider should be added

    steps:

    1. Provision VM with more than assigned quota

    Polarion:
        assignee: ghubale
        initialEstimate: 1/4h
        casecomponent: Quota
    """
    with new_user:
        recursive_update(prov_data, custom_prov_data)
        logger.info("Successfully updated VM provisioning data")
        do_vm_provisioning(appliance, template_name=template_name, provider=provider,
                           vm_name=vm_name, provisioning_data=prov_data, wait=False, request=None)

        # nav to requests page to check quota validation
        request_description = 'Provision from [{}] to [{}{}]'.format(template_name, vm_name,
                                                                     extra_msg)
        provision_request = appliance.collections.requests.instantiate(request_description)
        if approve:
            provision_request.approve_request(method='ui', reason="Approved")
        provision_request.wait_for_request(method='ui')
        assert provision_request.row.reason.text == "Quota Exceeded"
Example #9
0
def test_child_tenant_quota_enforce_via_lifecycle_infra(appliance, provider, new_user,
                                                        set_child_tenant_quota, extra_msg,
                                                        custom_prov_data, approve, prov_data,
                                                        vm_name, template_name):
    """Test child tenant feature via lifecycle method.

    Polarion:
        assignee: ghubale
        casecomponent: Infra
        caseimportance: medium
        initialEstimate: 1/6h
        tags: quota
    """
    with new_user:
        recursive_update(prov_data, custom_prov_data)
        do_vm_provisioning(appliance, template_name=template_name, provider=provider,
                           vm_name=vm_name, provisioning_data=prov_data, wait=False, request=None)

        # nav to requests page to check quota validation
        request_description = 'Provision from [{template}] to [{vm}{msg}]'.format(
            template=template_name, vm=vm_name, msg=extra_msg)
        provision_request = appliance.collections.requests.instantiate(request_description)
        if approve:
            provision_request.approve_request(method='ui', reason="Approved")
        provision_request.wait_for_request(method='ui')
        assert provision_request.row.reason.text == "Quota Exceeded"
Example #10
0
def form_data_multiple_vm_obj_single_datastore(request, appliance,
                                               second_provider, provider):
    # this fixture will take list of N VM templates via request and call get_vm for each
    cluster = provider.data.get('clusters', [False])[0]
    if not cluster:
        pytest.skip("No data for cluster available on provider.")

    form_data = _form_data(second_provider, provider)
    recursive_update(
        form_data, {
            'general': {
                'description':
                "Single Datastore migration of VM from {ds_type1} to"
                " {ds_type2},".format(ds_type1=request.param[0],
                                      ds_type2=request.param[1])
            },
            'network': {
                'Cluster ({})'.format(provider.data.get('clusters')[0]): {
                    'mappings': [
                        _form_data_mapping('vlans', second_provider, provider,
                                           'VM Network', 'ovirtmgmt')
                    ]
                }
            }
        })
    vm_obj = []
    for template_name in request.param[2]:
        vm_obj.append(
            get_vm(request, appliance, second_provider, template_name))
    return form_data, vm_obj
Example #11
0
def form_data_vm_obj_single_datastore(request, appliance, source_provider, provider):
    """Return Infra Mapping form data and vm object"""
    form_data = _form_data(source_provider, provider)
    recursive_update(
        form_data,
        {
            "general": {
                "description": "Single Datastore migration of VM from {ds_type1} to {ds_type2},".
                format(ds_type1=request.param[0], ds_type2=request.param[1])
            },
            "datastore": {
                "Cluster ({})".format(provider.data.get("clusters")[0]): {
                    "mappings": [
                        _form_data_mapping(
                            "datastores",
                            source_provider,
                            provider,
                            request.param[0],
                            request.param[1],
                        )
                    ]
                }
            },
        },
    )
    vm_obj = get_vm(request, appliance, source_provider, request.param[2], request.param[0])
    return FormDataVmObj(form_data=form_data, vm_list=[vm_obj])
Example #12
0
def test_project_quota_enforce_via_lifecycle_infra(appliance, provider,
                                                   setup_provider, new_user,
                                                   set_project_quota,
                                                   extra_msg, custom_prov_data,
                                                   approve, prov_data, vm_name,
                                                   template_name):
    """Test project quota via lifecycle method

    Metadata:
        test_flag: quota
    """
    with new_user:
        recursive_update(prov_data, custom_prov_data)
        do_vm_provisioning(appliance,
                           template_name=template_name,
                           provider=provider,
                           vm_name=vm_name,
                           provisioning_data=prov_data,
                           smtp_test=False,
                           wait=False,
                           request=None)

        # nav to requests page to check quota validation
        request_description = 'Provision from [{}] to [{}{}]'.format(
            template_name, vm_name, extra_msg)
        provision_request = appliance.collections.requests.instantiate(
            request_description)
        if approve:
            provision_request.approve_request(method='ui', reason="Approved")
        provision_request.wait_for_request(method='ui')
        assert provision_request.row.reason.text == "Quota Exceeded"
Example #13
0
def test_quota_tagging_infra_via_lifecycle(request, appliance, provider,
                                           set_entity_quota_tag,
                                           custom_prov_data, vm_name,
                                           template_name, prov_data):
    """

    Polarion:
        assignee: ghubale
        casecomponent: Quota
        caseimportance: medium
        initialEstimate: 1/6h
        tags: quota
    """
    recursive_update(prov_data, custom_prov_data)
    do_vm_provisioning(appliance,
                       template_name=template_name,
                       provider=provider,
                       vm_name=vm_name,
                       provisioning_data=prov_data,
                       wait=False,
                       request=None)

    # nav to requests page to check quota validation
    request_description = 'Provision from [{template}] to [{vm}]'.format(
        template=template_name, vm=vm_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"
def mapping_data_vm_obj_dual_nics(request, appliance, source_provider, provider):
    vmware_nw = source_provider.data.get("vlans", [None])[0]
    rhvm_nw = provider.data.get("vlans", [None])[0]
    cluster = provider.data.get("clusters", [False])[0]
    if not vmware_nw or not rhvm_nw or not cluster:
        pytest.skip("No data for source or target network in providers.")

    infra_mapping_data = infra_mapping_default_data(source_provider, provider)
    recursive_update(
        infra_mapping_data,
        {
            "description": "Dual DS migration of VM from {dss1} to {dst1},& from {dss2} to {dst2}".
            format(dss1=request.param[0][0],
                   dst1=request.param[0][1],
                   dss2=request.param[1][0],
                   dst2=request.param[1][1]),
            "networks": [
                component_generator(
                    "vlans", source_provider, provider, request.param[0][0], request.param[0][1]
                ),
                component_generator(
                    "vlans", source_provider, provider, request.param[1][0], request.param[1][1]
                ),
            ],
        },
    )
    vm_obj = get_vm(request, appliance, source_provider, request.param[2])
    return FormDataVmObj(infra_mapping_data=infra_mapping_data, vm_list=[vm_obj])
Example #15
0
def test_user_quota_diff_groups(request, appliance, provider, setup_provider, new_user,
                                set_parent_tenant_quota, extra_msg, custom_prov_data, approve,
                                prov_data, vm_name, template_name):
    """prerequisite: Provider should be added

    steps:

    1. Provision VM with more than assigned quota

    Polarion:
        assignee: None
        initialEstimate: None
    """
    with new_user:
        recursive_update(prov_data, custom_prov_data)
        logger.info("Successfully updated VM provisioning data")
        do_vm_provisioning(appliance, template_name=template_name, provider=provider,
                           vm_name=vm_name, provisioning_data=prov_data, wait=False, request=None)

        # nav to requests page to check quota validation
        request_description = 'Provision from [{}] to [{}{}]'.format(template_name, vm_name,
                                                                     extra_msg)
        provision_request = appliance.collections.requests.instantiate(request_description)
        if approve:
            provision_request.approve_request(method='ui', reason="Approved")
        provision_request.wait_for_request(method='ui')
        assert provision_request.row.reason.text == "Quota Exceeded"
Example #16
0
def form_data_single_datastore(request, source_provider, provider):
    form_data = _form_data(source_provider, provider)
    recursive_update(
        form_data,
        {
            "general": {
                "description": "Single Datastore migration of VM from {ds_type1} to"
                " {ds_type2},".format(ds_type1=request.param[0], ds_type2=request.param[1])
            },
            "datastore": {
                "Cluster ({})".format(provider.data.get("clusters")[0]): {
                    "mappings": [
                        _form_data_mapping(
                            "datastores",
                            source_provider,
                            provider,
                            request.param[0],
                            request.param[1],
                        )
                    ]
                }
            },
        },
    )
    return form_data
Example #17
0
def form_data_multiple_vm_obj_single_datastore(request, appliance, source_provider, provider):
    # this fixture will take list of N VM templates via request and call get_vm for each
    cluster = provider.data.get("clusters", [False])[0]
    if not cluster:
        pytest.skip("No data for cluster available on provider.")

    form_data = _form_data(source_provider, provider)
    recursive_update(
        form_data,
        {
            "general": {
                "description": "Single Datastore migration of VM from {ds_type1} to"
                " {ds_type2},".format(ds_type1=request.param[0], ds_type2=request.param[1])
            },
            "network": {
                "Cluster ({})".format(provider.data.get("clusters")[0]): {
                    "mappings": [
                        _form_data_mapping(
                            "vlans", source_provider, provider, "VM Network", "ovirtmgmt"
                        )
                    ]
                }
            },
        },
    )
    vm_list = []
    for template_name in request.param[2]:
        vm_list.append(get_vm(request, appliance, source_provider, template_name))
    return FormDataVmObj(form_data=form_data, vm_list=vm_list)
Example #18
0
def mapping_data_multiple_vm_obj_single_datastore(request, appliance,
                                                  source_provider, provider):
    # this fixture will take list of N VM templates via request and call get_vm for each
    cluster = provider.data.get("clusters", [False])[0]
    if not cluster:
        pytest.skip("No data for cluster available on provider.")

    infra_mapping_data = infra_mapping_default_data(source_provider, provider)
    recursive_update(
        infra_mapping_data,
        {
            "description":
            "Single Datastore migration of VM from {ds_type1} to {ds_type2},".
            format(ds_type1=request.param[0], ds_type2=request.param[1]),
            "networks": [
                component_generator("vlans", source_provider, provider,
                                    "VM Network", "ovirtmgmt")
            ],
        },
    )
    vm_list = []
    for template_name in request.param[2]:
        vm_list.append(
            get_vm(request, appliance, source_provider, template_name))
    return FormDataVmObj(infra_mapping_data=infra_mapping_data,
                         vm_list=vm_list)
Example #19
0
def test_child_tenant_quota_enforce_via_lifecycle_infra(
        appliance, provider, setup_provider, new_user, set_child_tenant_quota,
        extra_msg, custom_prov_data, approve, prov_data, vm_name,
        template_name):
    """Test child tenant feature via lifecycle method.

    Metadata:
        test_flag: quota

    Polarion:
        assignee: ghubale
        casecomponent: infra
        initialEstimate: 1/6h
    """
    with new_user:
        recursive_update(prov_data, custom_prov_data)
        do_vm_provisioning(appliance,
                           template_name=template_name,
                           provider=provider,
                           vm_name=vm_name,
                           provisioning_data=prov_data,
                           wait=False,
                           request=None)

        # nav to requests page to check quota validation
        request_description = 'Provision from [{}] to [{}{}]'.format(
            template_name, vm_name, extra_msg)
        provision_request = appliance.collections.requests.instantiate(
            request_description)
        if approve:
            provision_request.approve_request(method='ui', reason="Approved")
        provision_request.wait_for_request(method='ui')
        assert provision_request.row.reason.text == "Quota Exceeded"
Example #20
0
def test_project_quota_enforce_via_lifecycle_infra(appliance, provider, setup_provider, new_user,
                                                  set_project_quota, extra_msg, custom_prov_data,
                                                  approve, prov_data, vm_name, template_name):
    """Test project quota via lifecycle method

    Metadata:
        test_flag: quota

    Polarion:
        assignee: ghubale
        casecomponent: Configuration
        initialEstimate: 1/4h
    """
    with new_user:
        recursive_update(prov_data, custom_prov_data)
        do_vm_provisioning(appliance, template_name=template_name, provider=provider,
                           vm_name=vm_name, provisioning_data=prov_data, wait=False, request=None)

        # nav to requests page to check quota validation
        request_description = 'Provision from [{}] to [{}{}]'.format(template_name, vm_name,
                                                                     extra_msg)
        provision_request = appliance.collections.requests.instantiate(request_description)
        if approve:
            provision_request.approve_request(method='ui', reason="Approved")
        provision_request.wait_for_request(method='ui')
        assert provision_request.row.reason.text == "Quota Exceeded"
Example #21
0
 def vm_default_args_rest(self):
     inst_args = super(GCEInstance, self).vm_default_args_rest
     provisioning = self.provider.data['provisioning']
     recursive_update(inst_args, {
         'vm_fields': {
             'boot_disk_size': provisioning['boot_disk_size'].replace(' ', '.')}})
     return inst_args
Example #22
0
def form_data_vm_obj_dual_nics(request, appliance, second_provider, provider):
    vmware_nw = second_provider.data.get('vlans', [None])[0]
    rhvm_nw = provider.data.get('vlans', [None])[0]
    cluster = provider.data.get('clusters', [False])[0]
    if not vmware_nw or not rhvm_nw or not cluster:
        pytest.skip("No data for source or target network in providers.")

    form_data = _form_data(second_provider, provider)
    recursive_update(
        form_data, {
            'general': {
                'description':
                "Dual Datastore migration of VM from {} to {},& from {} to {}".
                format(request.param[0][0], request.param[0][1],
                       request.param[1][0], request.param[1][1])
            },
            'network': {
                'Cluster ({})'.format(provider.data.get('clusters')[0]): {
                    'mappings': [
                        _form_data_mapping('vlans', second_provider, provider,
                                           request.param[0][0],
                                           request.param[0][1]),
                        _form_data_mapping('vlans', second_provider, provider,
                                           request.param[1][0],
                                           request.param[1][1])
                    ]
                }
            }
        })
    vm_obj = get_vm(request, appliance, second_provider, request.param[2])
    return FormDataVmObj(form_data=form_data, vm_list=[vm_obj])
Example #23
0
def form_data_single_datastore(request, source_provider, provider):
    form_data = _form_data(source_provider, provider)
    recursive_update(
        form_data,
        {
            "general": {
                "description": "Single Datastore migration of VM from {ds_type1} to"
                " {ds_type2},".format(ds_type1=request.param[0], ds_type2=request.param[1])
            },
            "datastore": {
                "Cluster ({})".format(provider.data.get("clusters")[0]): {
                    "mappings": [
                        _form_data_mapping(
                            "datastores",
                            source_provider,
                            provider,
                            request.param[0],
                            request.param[1],
                        )
                    ]
                }
            },
        },
    )
    return form_data
Example #24
0
def test_quota_tagging_cloud_via_lifecycle(request, appliance, provider,
                                           prov_data, set_entity_quota_tag,
                                           template_name, vm_name):
    """Test Group and User Quota in UI using tagging

    Polarion:
        assignee: ghubale
        casecomponent: Cloud
        initialEstimate: 1/6h
        tags: quota
    """
    recursive_update(
        prov_data, {
            'request': {
                'email':
                'test_{}@example.com'.format(fauxfactory.gen_alphanumeric())
            }
        })
    prov_data.update({'template_name': template_name})
    appliance.collections.cloud_instances.create(vm_name,
                                                 provider,
                                                 prov_data,
                                                 override=True)
    # nav to requests page to check quota validation
    request_description = 'Provision from [{template}] to [{vm}]'.format(
        template=template_name, vm=vm_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"
Example #25
0
    def create(self, form_values, cancel=False):
        """Provisions an instance with the given properties through CFME

        Args:
            form_values: dictionary of form values for provisioning, structured into tabs

        Note:
            Calling create on a sub-class of instance will generate the properly formatted
            dictionary when the correct fields are supplied.
        """
        view = navigate_to(self, 'Provision')

        # Only support 1 security group for now
        # TODO: handle multiple
        if 'environment' in form_values and 'security_groups' in form_values['environment'] and \
                isinstance(form_values['environment']['security_groups'], (list, tuple)):

            first_group = form_values['environment']['security_groups'][0]
            recursive_update(form_values, {'environment': {'security_groups': first_group}})

        view.form.fill(form_values)

        if cancel:
            view.form.cancel_button.click()
            # Redirects to Instance All
            view = self.browser.create_view(InstanceAllView)
            wait_for(lambda: view.is_displayed, timeout=10, delay=2, message='wait for redirect')
            view.entities.flash.assert_success_message(self.PROVISION_CANCEL)
            view.entities.flash.assert_no_error()
        else:
            view.form.submit_button.click()
            # TODO this redirects to service.request, create_view on it when it exists for flash
            wait_for(flash.get_messages, fail_condition=[], timeout=10, delay=2,
                     message='wait for Flash Success')
            flash.assert_success_message(self.PROVISION_START)
Example #26
0
def mapping_data_vm_obj_dual_nics(request, appliance, source_provider,
                                  provider):
    vmware_nw = source_provider.data.get("vlans", [None])[0]
    rhvm_nw = provider.data.get("vlans", [None])[0]
    cluster = provider.data.get("clusters", [False])[0]
    if not vmware_nw or not rhvm_nw or not cluster:
        pytest.skip("No data for source or target network in providers.")

    infra_mapping_data = infra_mapping_default_data(source_provider, provider)
    recursive_update(
        infra_mapping_data,
        {
            "description":
            "Dual DS migration of VM from {dss1} to {dst1},& from {dss2} to {dst2}"
            .format(dss1=request.param[0][0],
                    dst1=request.param[0][1],
                    dss2=request.param[1][0],
                    dst2=request.param[1][1]),
            "networks": [
                component_generator("vlans", source_provider, provider,
                                    request.param[0][0], request.param[0][1]),
                component_generator("vlans", source_provider, provider,
                                    request.param[1][0], request.param[1][1]),
            ],
        },
    )
    vm_obj = get_vm(request, appliance, source_provider, request.param[2])
    return FormDataVmObj(infra_mapping_data=infra_mapping_data,
                         vm_list=[vm_obj])
Example #27
0
def form_data_vm_obj_single_datastore(request, appliance, source_provider, provider):
    """Return Infra Mapping form data and vm object"""
    form_data = _form_data(source_provider, provider)
    recursive_update(
        form_data,
        {
            "general": {
                "description": "Single Datastore migration of VM from {ds_type1} to {ds_type2},".
                format(ds_type1=request.param[0], ds_type2=request.param[1])
            },
            "datastore": {
                "Cluster ({})".format(provider.data.get("clusters")[0]): {
                    "mappings": [
                        _form_data_mapping(
                            "datastores",
                            source_provider,
                            provider,
                            request.param[0],
                            request.param[1],
                        )
                    ]
                }
            },
        },
    )
    vm_obj = get_vm(request, appliance, source_provider, request.param[2], request.param[0])
    return FormDataVmObj(form_data=form_data, vm_list=[vm_obj])
Example #28
0
 def vm_default_args(self):
     inst_args = super(OpenStackInstance, self).vm_default_args
     provisioning = self.provider.data['provisioning']
     recursive_update(inst_args, {
         'environment': {
             'cloud_tenant': provisioning.get('cloud_tenant'),
         }})
     return inst_args
Example #29
0
def test_project_quota_enforce_via_lifecycle_cloud(
    request,
    appliance,
    provider,
    new_user_project,
    set_project_quota,
    extra_msg,
    approve,
    custom_prov_data,
    prov_data,
    provisioning,
):
    """Test Project Quota in UI

    Polarion:
        assignee: ghubale
        casecomponent: Cloud
        caseimportance: high
        initialEstimate: 1/8h
        tags: quota
        testSteps:
            1. Create a project
            2. Assign quota to project
            3. Provision instance over the assigned project's quota
            4. Check whether quota is exceeded or not
    """
    with new_user_project:
        recursive_update(prov_data, custom_prov_data)
        recursive_update(
            prov_data,
            {
                "request": {
                    "email": fauxfactory.gen_email(),
                    "first_name": fauxfactory.gen_alphanumeric(start="first_"),
                    "last_name": fauxfactory.gen_alphanumeric(start="last_"),
                    "manager_name":
                    fauxfactory.gen_alphanumeric(start="manager_"),
                }
            },
        )
        prov_data.update({"template_name": provisioning["image"]["name"]})
        request_description = "Provision from [{template}] to [{vm}{msg}]".format(
            template=provisioning["image"]["name"],
            vm=prov_data['catalog']['vm_name'],
            msg=extra_msg)
        appliance.collections.cloud_instances.create(
            prov_data['catalog']['vm_name'],
            provider,
            prov_data,
            auto_approve=approve,
            override=True,
            request_description=request_description,
        )
        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"
Example #30
0
def form_data_dual_vm_obj_dual_datastore(request, appliance, source_provider, provider):
    vmware_nw = source_provider.data.get("vlans", [None])[0]
    rhvm_nw = provider.data.get("vlans", [None])[0]
    cluster = provider.data.get("clusters", [False])[0]
    if not vmware_nw or not rhvm_nw or not cluster:
        pytest.skip("No data for source or target network in providers.")

    form_data = _form_data(source_provider, provider)
    recursive_update(
        form_data,
        {
            "general": {
                "description": "Dual Datastore migration of VM from {} to {},& from {} to {}".
                format(request.param[0][0],
                       request.param[0][1],
                       request.param[1][0],
                       request.param[1][1])
            },
            "datastore": {
                "Cluster ({})".format(provider.data.get("clusters")[0]): {
                    "mappings": [
                        _form_data_mapping(
                            "datastores",
                            source_provider,
                            provider,
                            request.param[0][0],
                            request.param[0][1],
                        ),
                        _form_data_mapping(
                            "datastores",
                            source_provider,
                            provider,
                            request.param[1][0],
                            request.param[1][1],
                        ),
                    ]
                }
            },
            "network": {
                "Cluster ({})".format(provider.data.get("clusters")[0]): {
                    "mappings": [
                        _form_data_mapping(
                            "vlans",
                            source_provider,
                            provider,
                            source_provider.data.get("vlans")[0],
                            provider.data.get("vlans")[0],
                        )
                    ]
                }
            },
        },
    )
    # creating 2 VMs on two different datastores and returning its object list
    vm_obj1 = get_vm(request, appliance, source_provider, request.param[0][2], request.param[0][0])
    vm_obj2 = get_vm(request, appliance, source_provider, request.param[1][2], request.param[1][0])
    return FormDataVmObj(form_data=form_data, vm_list=[vm_obj1, vm_obj2])
Example #31
0
def form_data_dual_vm_obj_dual_datastore(request, appliance, source_provider, provider):
    vmware_nw = source_provider.data.get("vlans", [None])[0]
    rhvm_nw = provider.data.get("vlans", [None])[0]
    cluster = provider.data.get("clusters", [False])[0]
    if not vmware_nw or not rhvm_nw or not cluster:
        pytest.skip("No data for source or target network in providers.")

    form_data = _form_data(source_provider, provider)
    recursive_update(
        form_data,
        {
            "general": {
                "description": "Dual Datastore migration of VM from {} to {},& from {} to {}".
                format(request.param[0][0],
                       request.param[0][1],
                       request.param[1][0],
                       request.param[1][1])
            },
            "datastore": {
                "Cluster ({})".format(provider.data.get("clusters")[0]): {
                    "mappings": [
                        _form_data_mapping(
                            "datastores",
                            source_provider,
                            provider,
                            request.param[0][0],
                            request.param[0][1],
                        ),
                        _form_data_mapping(
                            "datastores",
                            source_provider,
                            provider,
                            request.param[1][0],
                            request.param[1][1],
                        ),
                    ]
                }
            },
            "network": {
                "Cluster ({})".format(provider.data.get("clusters")[0]): {
                    "mappings": [
                        _form_data_mapping(
                            "vlans",
                            source_provider,
                            provider,
                            source_provider.data.get("vlans")[0],
                            provider.data.get("vlans")[0],
                        )
                    ]
                }
            },
        },
    )
    # creating 2 VMs on two different datastores and returning its object list
    vm_obj1 = get_vm(request, appliance, source_provider, request.param[0][2], request.param[0][0])
    vm_obj2 = get_vm(request, appliance, source_provider, request.param[1][2], request.param[1][0])
    return FormDataVmObj(form_data=form_data, vm_list=[vm_obj1, vm_obj2])
Example #32
0
 def vm_default_args(self):
     inst_args = super(OpenStackInstance, self).vm_default_args
     provisioning = self.provider.data['provisioning']
     recursive_update(inst_args, {
         'environment': {
             'cloud_tenant': provisioning.get('cloud_tenant'),
         }
     })
     return inst_args
Example #33
0
def test_cloud_provision_from_template_with_attached_disks(
        appliance, request, instance_args, provider, disks, soft_assert,
        domain, modified_request_class, copy_domains, provisioning):
    """ Tests provisioning from a template and attaching disks

    Metadata:
        test_flag: provision

    Polarion:
        assignee: jhenner
        caseimportance: high
        initialEstimate: 1/4h
    """
    vm_name, inst_args = instance_args
    # Modify availiability_zone for Azure provider
    if provider.one_of(AzureProvider):
        recursive_update(
            inst_args,
            {'environment': {
                'availability_zone': provisioning("av_set")
            }})

    device_name = "/dev/sd{}"
    device_mapping = []

    with provider.mgmt.with_volumes(1, n=disks) as volumes:
        for i, volume in enumerate(volumes):
            device_mapping.append(
                (volume, device_name.format(chr(ord("b") + i))))
        # Set up automate

        method = modified_request_class.methods.instantiate(
            name="openstack_PreProvision")

        with update(method):
            disk_mapping = []
            for mapping in device_mapping:
                disk_mapping.append(ONE_FIELD.format(*mapping))
            method.script = VOLUME_METHOD.format(", ".join(disk_mapping))

        def _finish_method():
            with update(method):
                method.script = """prov = $evm.root["miq_provision"]"""

        request.addfinalizer(_finish_method)

        instance = appliance.collections.cloud_instances.create(
            vm_name, provider, form_values=inst_args)

        for volume_id in volumes:
            soft_assert(vm_name in provider.mgmt.volume_attachments(volume_id))
        for volume, device in device_mapping:
            soft_assert(
                provider.mgmt.volume_attachments(volume)[vm_name] == device)
        instance.mgmt.delete()  # To make it possible to delete the volume
        wait_for(lambda: not instance.exists_on_provider, num_sec=180, delay=5)
Example #34
0
 def vm_default_args_rest(self):
     inst_args = super(AzureInstance, self).vm_default_args_rest
     provisioning = self.provider.data['provisioning']
     vm_user = provisioning.get('customize_username')
     vm_password = provisioning.get('customize_password')
     recursive_update(inst_args, {
         'vm_fields': {
             'root_username': vm_user,
             'root_password': vm_password}})
     return inst_args
Example #35
0
 def vm_default_args_rest(self):
     inst_args = super(AzureInstance, self).vm_default_args_rest
     provisioning = self.provider.data['provisioning']
     vm_user = provisioning.get('customize_username')
     vm_password = provisioning.get('customize_password')
     recursive_update(inst_args, {
         'vm_fields': {
             'root_username': vm_user,
             'root_password': vm_password}})
     return inst_args
def mapping_data_dual_vm_obj_dual_datastore(request, appliance,
                                            source_provider, provider):
    # Picking two datastores on Vmware and Target provider for this test
    source_type = dest_type = ['nfs', 'iscsi']

    vmware_nw = source_provider.data.get("vlans", [None])[0]
    rhvm_nw = provider.data.get("vlans", [None])[0]
    cluster = provider.data.get("clusters", [False])[0]
    if not vmware_nw or not rhvm_nw or not cluster:
        pytest.skip("No data for source or target network in providers.")

    infra_mapping_data = infra_mapping_default_data(source_provider, provider)
    recursive_update(
        infra_mapping_data,
        {
            "description":
            "Dual DS migration of VM from {dss1} to {dst1},& from {dss2} to {dst2}"
            .format(dss1=source_type[0],
                    dst1=source_type[1],
                    dss2=dest_type[0],
                    dst2=dest_type[1]),
            "datastores": [
                component_generator(
                    "datastores",
                    source_provider,
                    provider,
                    source_type[0],
                    source_type[1],
                ),
                component_generator(
                    "datastores",
                    source_provider,
                    provider,
                    dest_type[0],
                    dest_type[1],
                ),
            ],
            "networks": [
                component_generator(
                    "vlans",
                    source_provider,
                    provider,
                    source_provider.data.get("vlans")[0],
                    provider.data.get("vlans")[0],
                )
            ],
        },
    )
    # creating 2 VMs on two different datastores and returning its object list
    vm_obj1 = get_vm(request, appliance, source_provider,
                     Templates.RHEL7_MINIMAL, source_type[0])
    vm_obj2 = get_vm(request, appliance, source_provider,
                     Templates.RHEL7_MINIMAL, dest_type[0])
    return FormDataVmObj(infra_mapping_data=infra_mapping_data,
                         vm_list=[vm_obj1, vm_obj2])
def test_project_quota_enforce_via_lifecycle_cloud(
    request,
    appliance,
    provider,
    new_user_project,
    set_project_quota,
    extra_msg,
    approve,
    custom_prov_data,
    prov_data,
    provisioning,
):
    """Test Project Quota in UI

    Polarion:
        assignee: ghubale
        casecomponent: Cloud
        caseimportance: high
        initialEstimate: 1/8h
        tags: quota
        testSteps:
            1. Create a project
            2. Assign quota to project
            3. Provision instance over the assigned project's quota
            4. Check whether quota is exceeded or not
    """
    with new_user_project:
        recursive_update(prov_data, custom_prov_data)
        recursive_update(
            prov_data,
            {
                "request": {
                    "email": fauxfactory.gen_email(),
                    "first_name": fauxfactory.gen_alphanumeric(),
                    "last_name": fauxfactory.gen_alphanumeric(),
                    "manager_name": "{name}".format(name=fauxfactory.gen_alphanumeric()),
                }
            },
        )
        prov_data.update({"template_name": provisioning["image"]["name"]})
        request_description = "Provision from [{template}] to [{vm}{msg}]".format(
            template=provisioning["image"]["name"], vm=prov_data['catalog']['vm_name'],
            msg=extra_msg)
        appliance.collections.cloud_instances.create(
            prov_data['catalog']['vm_name'],
            provider,
            prov_data,
            auto_approve=approve,
            override=True,
            request_description=request_description,
        )
        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"
Example #38
0
    def create(self, vm_name, provider, form_values, cancel=False):
        """Provisions an instance with the given properties through CFME

        Args:
            vm_name: the instance's name
            form_values: dictionary of form values for provisioning, structured into tabs
            cancel: boolean, whether or not to cancel form filling

        Note:
            Calling create on a sub-class of instance will generate the properly formatted
            dictionary when the correct fields are supplied.
        """
        instance = self.instantiate(vm_name, provider,
                                    form_values.get('template_name'))
        form_values.update({'provider_name': provider.name})
        view = navigate_to(self, 'Provision')

        # Only support 1 security group for now
        # TODO: handle multiple
        if ('environment' in form_values
                and 'security_groups' in form_values['environment']
                and isinstance(form_values['environment']['security_groups'],
                               (list, tuple))):

            first_group = form_values['environment']['security_groups'][0]
            recursive_update(form_values,
                             {'environment': {
                                 'security_groups': first_group
                             }})

        view.form.fill(form_values)

        if cancel:
            view.form.cancel_button.click()
            # Redirects to Instance All
            view = self.browser.create_view(InstanceAllView)
            wait_for(lambda: view.is_displayed,
                     timeout=10,
                     delay=2,
                     message='wait for redirect')
            view.flash.assert_success_message(self.ENTITY.PROVISION_CANCEL)
            view.flash.assert_no_error()
        else:
            view.form.submit_button.click()

            view = self.appliance.browser.create_view(RequestsView)
            wait_for(lambda: view.flash.messages,
                     fail_condition=[],
                     timeout=10,
                     delay=2,
                     message='wait for Flash Success')
            view.flash.assert_no_error()

        return instance
Example #39
0
 def vm_default_args_rest(self):
     inst_args = super(GCEInstance, self).vm_default_args_rest
     provisioning = self.provider.data['provisioning']
     recursive_update(
         inst_args, {
             'vm_fields': {
                 'boot_disk_size':
                 provisioning['boot_disk_size'].replace(' ', '.')
             }
         })
     return inst_args
Example #40
0
def test_quota(appliance, provider, setup_provider, custom_prov_data, vm_name, admin_email,
               entities, template_name, prov_data):
    """This test case checks quota limit using the automate's predefine method 'quota source'"""
    recursive_update(prov_data, custom_prov_data)
    do_vm_provisioning(appliance, template_name=template_name, provider=provider, vm_name=vm_name,
                       provisioning_data=prov_data, smtp_test=False, wait=False, request=None)

    # nav to requests page to check quota validation
    request_description = 'Provision from [{}] to [{}]'.format(template_name, vm_name)
    provision_request = appliance.collections.requests.instantiate(request_description)
    provision_request.wait_for_request(method='ui')
    assert provision_request.row.reason.text == "Quota Exceeded"
Example #41
0
def test_quota_tagging_cloud_via_lifecycle(request, appliance, provider, prov_data, setup_provider,
                                           set_entity_quota_tag, template_name, vm_name):
    """Test Group and User Quota in UI using tagging"""
    recursive_update(prov_data, {
        'request': {'email': 'test_{}@example.com'.format(fauxfactory.gen_alphanumeric())}})
    prov_data.update({'template_name': template_name})
    appliance.collections.cloud_instances.create(vm_name, provider, prov_data)
    # nav to requests page to check quota validation
    request_description = 'Provision from [{}] to [{}]'.format(template_name, vm_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"
Example #42
0
def test_quota_tagging_infra_via_lifecycle(request, appliance, provider, setup_provider,
                                           set_entity_quota_tag, custom_prov_data,
                                           vm_name, template_name, prov_data):
    recursive_update(prov_data, custom_prov_data)
    do_vm_provisioning(appliance, template_name=template_name, provider=provider, vm_name=vm_name,
                       provisioning_data=prov_data, smtp_test=False, wait=False, request=None)

    # nav to requests page to check quota validation
    request_description = 'Provision from [{}] to [{}]'.format(template_name, vm_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"
Example #43
0
 def vm_default_args(self):
     inst_args = super(AzureInstance, self).vm_default_args
     provisioning = self.provider.data['provisioning']
     vm_user = provisioning.get('customize_username')
     vm_password = provisioning.get('customize_password')
     recursive_update(inst_args, {
         'environment': {
             'public_ip_address': '<None>',
         },
         'customize': {
             'admin_username': vm_user,
             'root_password': vm_password}})
     return inst_args
def mapping_data_single_network(request, source_provider, provider):
    infra_mapping_data = infra_mapping_default_data(source_provider, provider)
    recursive_update(
        infra_mapping_data, {
            "description":
            "Single Network migration of VM from {vlan1} to {vlan2},".format(
                vlan1=request.param[0], vlan2=request.param[1]),
            "networks": [
                component_generator("vlans", source_provider, provider,
                                    request.param[0], request.param[1])
            ],
        })
    return infra_mapping_data
def test_quota_tagging_infra_via_lifecycle(request, appliance, provider, setup_provider,
                                           set_entity_quota_tag, custom_prov_data,
                                           vm_name, template_name, prov_data):
    recursive_update(prov_data, custom_prov_data)
    do_vm_provisioning(appliance, template_name=template_name, provider=provider, vm_name=vm_name,
                       provisioning_data=prov_data, wait=False, request=None)

    # nav to requests page to check quota validation
    request_description = 'Provision from [{}] to [{}]'.format(template_name, vm_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"
Example #46
0
def form_data_single_network(request, second_provider, provider):
    form_data = _form_data(second_provider, provider)
    recursive_update(form_data, {
        'general': {
            'description': "Single Network migration of VM from {vlan1} to {vlan2},".
                     format(vlan1=request.param[0], vlan2=request.param[1])},
        'network': {
            'Cluster ({})'.format(provider.data.get('clusters')[0]): {
                'mappings': [_form_data_mapping('vlans', second_provider, provider,
                                                request.param[0], request.param[1])]
            }
        }
    })
    return form_data
Example #47
0
def form_data_single_network(request, second_provider, provider):
    form_data = _form_data(second_provider, provider)
    recursive_update(form_data, {
        'general': {
            'description': "Single Network migration of VM from {vlan1} to {vlan2},".
                     format(vlan1=request.param[0], vlan2=request.param[1])},
        'network': {
            'Cluster ({})'.format(provider.data.get('clusters')[0]): {
                'mappings': [_form_data_mapping('vlans', second_provider, provider,
                                                request.param[0], request.param[1])]
            }
        }
    })
    return form_data
Example #48
0
def test_cloud_provision_from_template_with_attached_disks(
        appliance, request, instance_args, provider, disks, soft_assert, domain,
        modified_request_class, copy_domains, provisioning):
    """ Tests provisioning from a template and attaching disks

    Metadata:
        test_flag: provision

    Polarion:
        assignee: jhenner
        caseimportance: high
        casecomponent: Provisioning
        initialEstimate: 1/4h
    """
    vm_name, inst_args = instance_args
    # Modify availiability_zone for Azure provider
    if provider.one_of(AzureProvider):
        recursive_update(inst_args, {'environment': {'availability_zone': provisioning("av_set")}})

    device_name = "/dev/sd{}"
    device_mapping = []

    with provider.mgmt.with_volumes(1, n=disks) as volumes:
        for i, volume in enumerate(volumes):
            device_mapping.append((volume, device_name.format(chr(ord("b") + i))))
        # Set up automate

        method = modified_request_class.methods.instantiate(name="openstack_PreProvision")

        with update(method):
            disk_mapping = []
            for mapping in device_mapping:
                disk_mapping.append(ONE_FIELD.format(*mapping))
            method.script = VOLUME_METHOD.format(", ".join(disk_mapping))

        def _finish_method():
            with update(method):
                method.script = """prov = $evm.root["miq_provision"]"""
        request.addfinalizer(_finish_method)

        instance = appliance.collections.cloud_instances.create(vm_name,
                                                                provider,
                                                                form_values=inst_args)

        for volume_id in volumes:
            soft_assert(vm_name in provider.mgmt.volume_attachments(volume_id))
        for volume, device in device_mapping:
            soft_assert(provider.mgmt.volume_attachments(volume)[vm_name] == device)
        instance.mgmt.delete()  # To make it possible to delete the volume
        wait_for(lambda: not instance.exists_on_provider, num_sec=180, delay=5)
def mapping_data_single_datastore(request, source_provider, provider):
    infra_mapping_data = infra_mapping_default_data(source_provider, provider)
    recursive_update(
        infra_mapping_data,
        {
            "description":
            "Single Datastore migration of VM from {ds_type1} to {ds_type2},".
            format(ds_type1=request.param[0], ds_type2=request.param[1]),
            "datastores": [
                component_generator("datastores", source_provider, provider,
                                    request.param[0], request.param[1])
            ],
        },
    )
    return infra_mapping_data
Example #50
0
def form_data_vm_obj_single_network(request, appliance, second_provider, provider):
    form_data = _form_data(second_provider, provider)
    recursive_update(form_data, {
        'general': {
            'description': "Single Network migration of VM from {vlan1} to {vlan2},".
                     format(vlan1=request.param[0], vlan2=request.param[1])},
        'network': {
            'Cluster ({})'.format(provider.data.get('clusters')[0]): {
                'mappings': [_form_data_mapping('vlans', second_provider, provider,
                                                request.param[0], request.param[1])]
            }
        }
    })
    vm_obj = get_vm(request, appliance, second_provider, request.param[2])
    return FormDataVmObj(form_data=form_data, vm_list=[vm_obj])
Example #51
0
def form_data_vm_obj_single_network(request, appliance, second_provider, provider):
    form_data = _form_data(second_provider, provider)
    recursive_update(form_data, {
        'general': {
            'description': "Single Network migration of VM from {vlan1} to {vlan2},".
                     format(vlan1=request.param[0], vlan2=request.param[1])},
        'network': {
            'Cluster ({})'.format(provider.data.get('clusters')[0]): {
                'mappings': [_form_data_mapping('vlans', second_provider, provider,
                                                request.param[0], request.param[1])]
            }
        }
    })
    vm_obj = get_vm(request, appliance, second_provider, request.param[2])
    return FormDataVmObj(form_data=form_data, vm_list=[vm_obj])
Example #52
0
def form_data_single_datastore(request, second_provider, provider):
    form_data = _form_data(second_provider, provider)
    recursive_update(form_data, {
        'general': {
            'description': "Single Datastore migration of VM from {ds_type1} to"
                           " {ds_type2},".format(ds_type1=request.param[0],
                                                 ds_type2=request.param[1])
        },
        'datastore': {
            'Cluster ({})'.format(provider.data.get('clusters')[0]): {
                'mappings': [_form_data_mapping('datastores', second_provider, provider,
                                                request.param[0], request.param[1])]
            }
        }
    })
    return form_data
Example #53
0
def form_data_vm_obj_single_datastore(request, appliance, second_provider, provider):
    """Return Infra Mapping form data and vm object"""
    form_data = _form_data(second_provider, provider)
    recursive_update(form_data, {
        'general': {
            'description': "Single Datastore migration of VM from {ds_type1} to {ds_type2},"
                     .format(ds_type1=request.param[0], ds_type2=request.param[1])},
        'datastore': {
            'Cluster ({})'.format(provider.data.get('clusters')[0]): {
                'mappings': [_form_data_mapping('datastores', second_provider, provider,
                                                request.param[0], request.param[1])]
            }
        }
    })
    vm_obj = get_vm(request, appliance, second_provider, request.param[2], request.param[0])
    return FormDataVmObj(form_data=form_data, vm_list=[vm_obj])
def mapping_data_single_datastore(request, source_provider, provider):
    infra_mapping_data = infra_mapping_default_data(source_provider, provider)
    recursive_update(
        infra_mapping_data,
        {
            "description": "Single Datastore migration of VM from {ds_type1} to {ds_type2},".format(
                ds_type1=request.param[0], ds_type2=request.param[1]
            ),
            "datastores": [
                component_generator(
                    "datastores", source_provider, provider, request.param[0], request.param[1]
                )
            ],
        },
    )
    return infra_mapping_data
def mapping_data_single_network(request, source_provider, provider):
    infra_mapping_data = infra_mapping_default_data(source_provider, provider)
    recursive_update(
        infra_mapping_data,
        {
            "description": "Single Network migration of VM from {vlan1} to {vlan2},".format(
                vlan1=request.param[0], vlan2=request.param[1]
            ),
            "networks": [
                component_generator(
                    "vlans", source_provider, provider, request.param[0], request.param[1]
                )
            ],
        },
    )
    return infra_mapping_data
def mapping_data_vm_obj_single_network(request, appliance, source_provider, provider):
    infra_mapping_data = infra_mapping_default_data(source_provider, provider)
    recursive_update(
        infra_mapping_data,
        {
            "description": "Single Network migration of VM from {vlan1} to {vlan2},".format(
                vlan1=request.param[0], vlan2=request.param[1]
            ),
            "networks": [
                component_generator(
                    "vlans", source_provider, provider, request.param[0], request.param[1]
                )
            ],
        },
    )
    vm_obj = get_vm(request, appliance, source_provider, request.param[2])
    return FormDataVmObj(infra_mapping_data=infra_mapping_data, vm_list=[vm_obj])
def mapping_data_vm_obj_single_datastore(request, appliance, source_provider, provider):
    """Return Infra Mapping form data and vm object"""
    infra_mapping_data = infra_mapping_default_data(source_provider, provider)
    recursive_update(
        infra_mapping_data,
        {
            "description": "Single DS migration of VM from {ds_type1} to {ds_type2},".format(
                ds_type1=request.param[0], ds_type2=request.param[1]
            ),
            "datastores": [
                component_generator(
                    "datastores", source_provider, provider, request.param[0], request.param[1]
                )
            ],
        },
    )
    vm_obj = get_vm(request, appliance, source_provider, request.param[2], request.param[0])
    return FormDataVmObj(infra_mapping_data=infra_mapping_data, vm_list=[vm_obj])
Example #58
0
 def vm_default_args(self):
     inst_args = super(AzureInstance, self).vm_default_args
     provisioning = self.provider.data['provisioning']
     vm_user = provisioning.get('customize_username')
     vm_password = provisioning.get('customize_password')
     if self.appliance.version >= '5.10':
         instance_type = provisioning.get('instance_type').title()
     else:
         instance_type = provisioning.get('instance_type')
     recursive_update(inst_args, {
         'environment': {
             'public_ip_address': '<None>',
         },
         'customize': {
             'admin_username': vm_user,
             'root_password': vm_password
         },
         'properties': {
             'instance_type': instance_type}})
     return inst_args
Example #59
0
def test_quota(appliance, provider, custom_prov_data, vm_name, admin_email, entities, template_name,
               prov_data):
    """This test case checks quota limit using the automate's predefine method 'quota source'

    Polarion:
        assignee: ghubale
        casecomponent: Quota
        caseimportance: medium
        initialEstimate: 1/6h
        tags: quota
    """
    recursive_update(prov_data, custom_prov_data)
    do_vm_provisioning(appliance, template_name=template_name, provider=provider, vm_name=vm_name,
                       provisioning_data=prov_data, wait=False, request=None)

    # nav to requests page to check quota validation
    request_description = 'Provision from [{template}] to [{vm}]'.format(template=template_name,
                                                                         vm=vm_name)
    provision_request = appliance.collections.requests.instantiate(request_description)
    provision_request.wait_for_request(method='ui')
    assert provision_request.row.reason.text == "Quota Exceeded"