Exemplo n.º 1
0
def assign_custom_compute_rate(obj_type, chargeback_rate, provider):
    """Assign custom Compute rate for Labeled Container Images
    Args:
        :py:type:`str` obj_type: Object being tested; only 'Project' and 'Image' are supported
        :py:class:`ComputeRate` chargeback_rate: The chargeback rate object
        :py:class:`ContainersProvider` provider: The containers provider
    """
    if obj_type == 'Image':
        asignment = assignments.Assign(
            assign_to="Labeled Container Images",
            docker_labels="architecture",
            selections={'x86_64': {
                'Rate': chargeback_rate.description
            }})
        logger.info('ASSIGNING COMPUTE RATE FOR LABELED CONTAINER IMAGES')
    elif obj_type == 'Project':
        asignment = assignments.Assign(
            assign_to="Selected Containers Providers",
            selections={provider.name: {
                'Rate': chargeback_rate.description
            }})
        logger.info('ASSIGNING CUSTOM COMPUTE RATE FOR PROJECT CHARGEBACK')
    else:
        raise Exception("Unknown object type: {}".format(obj_type))

    asignment.computeassign()
    logger.info('Rate - {}: {}'.format(chargeback_rate.description,
                                       chargeback_rate.fields))

    return chargeback_rate
def assign_compute_custom_rate(new_chargeback_fixed_rate, provider):
    # Assign custom Compute rate to the Selected Containers Provider
    asignment = assignments.Assign(
        assign_to="Labeled Container Images",
        docker_labels="Architecture",
        selections={'x86_64': new_chargeback_fixed_rate.description})
    asignment.computeassign()
    logger.info('ASSIGNING COMPUTE RATE FOR LABELED CONTAINER IMAGES')

    yield new_chargeback_fixed_rate.description

    asignment = assignments.Assign(assign_to="Selected Containers Providers",
                                   selections={provider.name: "Default"})
    asignment.computeassign()
Exemplo n.º 3
0
def assign_default_rate(provider):
    # Assign default Compute rate to the Enterprise and then queue the Chargeback report.
    enterprise = cb.Assign(assign_to="The Enterprise",
                           selections={"Enterprise": "Default"})
    enterprise.computeassign()
    enterprise.storageassign()
    logger.info('Assigning DEFAULT Compute rate')

    yield

    # Resetting the Chargeback rate assignment
    enterprise = cb.Assign(assign_to="The Enterprise",
                           selections={"Enterprise": "<Nothing>"})
    enterprise.computeassign()
    enterprise.storageassign()
Exemplo n.º 4
0
def assign_custom_rate(new_compute_rate, provider):
    # Assign custom Compute rate to the Enterprise and then queue the Chargeback report.
    description = new_compute_rate
    enterprise = cb.Assign(assign_to="The Enterprise",
                           selections={"Enterprise": description})
    enterprise.computeassign()
    enterprise.storageassign()
    logger.info('Assigning CUSTOM Compute rate')

    yield

    # Resetting the Chargeback rate assignment
    enterprise = cb.Assign(assign_to="The Enterprise",
                           selections={"Enterprise": "<Nothing>"})
    enterprise.computeassign()
    enterprise.storageassign()
Exemplo n.º 5
0
def assign_chargeback_rate(new_compute_rate):
    """Assign custom Compute rate to the Enterprise and then queue the Chargeback report."""
    enterprise = cb.Assign(
        assign_to="The Enterprise",
        selections={'Enterprise': {
            'Rate': new_compute_rate
        }})
    enterprise.computeassign()
    enterprise.storageassign()
    logger.info('Assigning CUSTOM Compute and Storage rates')
    yield
    # Resetting the Chargeback rate assignment
    enterprise = cb.Assign(assign_to="The Enterprise",
                           selections={'Enterprise': {
                               'Rate': '<Nothing>'
                           }})
    enterprise.computeassign()
    enterprise.storageassign()
def assign_compute_custom_rate(new_chargeback_fixed_rate, provider):
    # Assign custom Compute rate to the Selected Containers Provider
    asignment = assignments.Assign(
        assign_to="Selected Containers Providers",
        selections={
            provider.name: new_chargeback_fixed_rate.description
        })
    asignment.computeassign()
    logger.info('ASSIGNING CUSTOM COMPUTE RATE')

    yield new_chargeback_fixed_rate.description

    asignment = assignments.Assign(
        assign_to="Selected Containers Providers",
        selections={
            provider.name: "Default"
        })
    asignment.computeassign()
def test_assign_storage_enterprise(appliance, virtualcenter_provider):
    view = navigate_to(appliance.server, 'Chargeback')

    enterprise = cb.Assign(assign_to="The Enterprise",
                           selections={'Enterprise': {
                               'Rate': 'Default'
                           }})

    enterprise.storageassign()

    assign_view = view.browser.create_view(AssignmentsView)
    row = assign_view.selections.row(name='Enterprise')
    selected_option = row.rate.widget.selected_option
    assert selected_option == "Default", 'Selection does not match'
def test_assign_compute_taggedvm(appliance, virtualcenter_provider):
    view = navigate_to(appliance.server, 'Chargeback')

    tagged_vm = cb.Assign(assign_to="Tagged VMs and Instances",
                          tag_category="Location",
                          selections={'Chicago': {
                              'Rate': 'Default'
                          }})
    tagged_vm.computeassign()

    assign_view = view.browser.create_view(AssignmentsView)
    row = assign_view.selections.row(name='Chicago')
    selected_option = row.rate.widget.selected_option
    assert selected_option == "Default", 'Selection does not match'
Exemplo n.º 9
0
def test_assign_compute_enterprise(virtualcenter_provider):
    view = navigate_to(Server, 'Chargeback')

    enterprise = cb.Assign(assign_to="The Enterprise",
                           selections={'Enterprise': {
                               'Rate': 'Default'
                           }})
    enterprise.computeassign()

    # Assert that the selection made is listed on the UI
    assign_view = view.browser.create_view(AssignmentsView)
    row = assign_view.selections.row(name='Enterprise')
    selected_option = row.rate.widget.selected_option
    assert selected_option == "Default", 'Selection does not match'
Exemplo n.º 10
0
def test_assign_storage_tagged_datastores(virtualcenter_provider):
    view = navigate_to(Server, 'Chargeback')

    tagged_datastore = cb.Assign(assign_to="Tagged Datastores",
                                 tag_category="Location",
                                 selections={'Chicago': {
                                     'Rate': 'Default'
                                 }})
    tagged_datastore.storageassign()

    assign_view = view.browser.create_view(AssignmentsView)
    row = assign_view.selections.row(name='Chicago')
    selected_option = row.rate.widget.selected_option
    assert selected_option == "Default", 'Selection does not match'
Exemplo n.º 11
0
def test_assign_compute_provider(appliance, virtualcenter_provider):
    view = navigate_to(appliance.server, 'Chargeback')

    compute_provider = cb.Assign(
        assign_to='Selected Providers',
        selections={virtualcenter_provider.name: {
            'Rate': 'Default'
        }})
    compute_provider.computeassign()

    assign_view = view.browser.create_view(AssignmentsView)
    row = assign_view.selections.row(name=virtualcenter_provider.name)
    selected_option = row.rate.widget.selected_option
    assert selected_option == "Default", 'Selection does not match'
def test_assign_compute_cluster(appliance, virtualcenter_provider):
    view = navigate_to(appliance.server, 'Chargeback')

    cluster_name = random.choice(
        virtualcenter_provider.get_yaml_data()["clusters"])

    cluster = cb.Assign(assign_to='Selected Cluster / Deployment Roles',
                        selections={cluster_name: {
                            'Rate': 'Default'
                        }})
    cluster.computeassign()

    assign_view = view.browser.create_view(AssignmentsView)
    row = assign_view.selections.row(name=cluster_name)
    selected_option = row.rate.widget.selected_option
    assert selected_option == "Default", 'Selection does not match'
def test_assign_storage_datastores(appliance, virtualcenter_provider):
    view = navigate_to(appliance.server, 'Chargeback')

    datastore = random.choice(
        virtualcenter_provider.get_yaml_data()["datastores"])["name"]

    sel_datastore = cb.Assign(assign_to="Selected Datastores",
                              selections={datastore: {
                                  'Rate': 'Default'
                              }})
    sel_datastore.storageassign()

    assign_view = view.browser.create_view(AssignmentsView)
    row = assign_view.selections.row(name=datastore)
    selected_option = row.rate.widget.selected_option
    assert selected_option == "Default", 'Selection does not match'
Exemplo n.º 14
0
def test_assign_compute_provider(virtualcenter_provider):
    view = navigate_to(Server, 'Chargeback')

    compute_provider = cb.Assign(
        assign_to=version.pick({
            version.LOWEST: 'Selected Cloud/Infrastructure Providers',
            '5.7': 'Selected Providers'
        }),
        selections={virtualcenter_provider.name: {
            'Rate': 'Default'
        }})
    compute_provider.computeassign()

    assign_view = view.browser.create_view(AssignmentsView)
    row = assign_view.selections.row(name=virtualcenter_provider.name)
    selected_option = row.rate.widget.selected_option
    assert selected_option == "Default", 'Selection does not match'
Exemplo n.º 15
0
def assign_compute_rate(obj_type, compute_rate, provider):
    assign_custom_compute_rate(obj_type, compute_rate, provider)
    yield compute_rate
    assignments.Assign(assign_to="<Nothing>").computeassign()