コード例 #1
0
def select_scope(scope_name):
    """ Select Scope  """
    logger.info("Selecting scope %s :" % scope_name)
    navigate()
    CommonOperationScopes.select_scope(scope_name)
    VerifyScopes.verify_scope_created(scope_name)
    return True
コード例 #2
0
def validate_resource_assigned_to_scope(*scopes_obj):
    """ validate resource
        Example:
        | `validate resource assigned to scope`      | ${myScopeList}    |
    """

    logger.info("validate resource assigned to scope")
    navigate()
    if isinstance(scopes_obj, test_data.DataObj):
        scopes_obj = [scopes_obj]
    elif isinstance(scopes_obj, tuple):
        scopes_obj = list(scopes_obj[0])

    #    Scope category verify function map
    categories = {'Enclosures': VerifyEnclosures.verify_enclosure_exist,
                  'Server Hardware': VerifyHardware.verify_server_hardware_exist,
                  'Ethernet Networks': CommonOperationNetworks.verify_network_exist,
                  'Fibre Channel Networks': CommonOperationNetworks.verify_network_exist,
                  'FCoE Networks': CommonOperationNetworks.verify_network_exist,
                  'Network Sets': VerifyNetworkSets.verify_network_set_existed,
                  'Logical Interconnect Groups': VerifyLogicalInterconnectGroups.verify_lig_exist,
                  'Logical Interconnects': VerifyLogicalInterconnects.verify_logical_interconnect_exist,
                  'Interconnects': VerifyInterconnects.verify_interconnect_exist}

    #    Scope category convert map
    get_category = {'Enclosures': 'enclosure',
                    'Server Hardware': 'server hardware',
                    'Ethernet Networks': 'ethernet network',
                    'Fibre Channel Networks': 'fibre channel network',
                    'FCoE Networks': 'fcoe network',
                    'Network Sets': 'network set',
                    'Logical Interconnect Groups': 'logical interconnect group',
                    'Logical Interconnects': 'logical interconnect',
                    'Interconnects': 'interconnect'
                    }

    for scope in scopes_obj:
        if hasattr(scope, 'resources'):
            resource_categories = []
            for n, resource in enumerate(scope.resources):
                if resource.category not in resource_categories:
                    resource_categories.append(resource.category)

            for category in resource_categories:
                navigate()
                CommonOperationScopes.select_scope(scope.name)
                CommonOperationScopes.click_resource_link(get_category.get(category))

                for n, resource in enumerate(scope.resources):
                    if category == resource.category:
                        categories.get(category)(resource.name, 20)

    return True
コード例 #3
0
def create_scope(*scopes_obj):
    """ Create Scope
        Example:
        | `Create Scope`      | ${myScopeList}    |
    """

    logger.info("Create Scope")
    navigate()
    if isinstance(scopes_obj, test_data.DataObj):
        scopes_obj = [scopes_obj]
    elif isinstance(scopes_obj, tuple):
        scopes_obj = list(scopes_obj[0])

    fail_if_exist = 0

    for scope in scopes_obj:
        if VerifyScopes.verify_scope_existed(scope.name, 5, False):
            fail_if_exist += 1
            logger.warn("scope %s already exists" % scope.name)
            continue
        have_resource = False
        CreateScopes.click_create_scope_button()
        logger.info("Creating scope %s" % scope.name)
        CreateScopes.wait_create_scope_dialog_open()
        CreateScopes.input_name(scope.name)
        if hasattr(scope, 'description'):
            CreateScopes.input_description(scope.description)
        if hasattr(scope, 'resources'):
            for n, resource in enumerate(scope.resources):
                have_resource = True
                _Add_Resource_To_Scope_Add(resource)
        CreateScopes.click_create_plus_button()
        VerifyScopes.verify_create_plus_complete()
        CreateScopes.click_cancel_button()
        CreateScopes.wait_create_scope_dialog_close()

        FusionUIBase.show_activity_sidebar()
        FusionUIBase.wait_activity_action_ok(scope.name, 'Create', timeout=60, fail_if_false=True)
        if have_resource:
            FusionUIBase.wait_activity_action_ok(scope.name, 'Update Resource Assignments', timeout=60, fail_if_false=True)
        FusionUIBase.show_activity_sidebar()

        CommonOperationScopes.select_scope(scope.name)
        VerifyScopes.verify_scope_created(scope.name)

    if fail_if_exist > 0:
        return False
    return True
コード例 #4
0
def assign_scope_bulk_networks(*scope_obj):
    """ Edit Scope    """
    logger.info("Edit Scope")
    navigate()
    if isinstance(scope_obj, test_data.DataObj):
        scope_obj = [scope_obj]
    elif isinstance(scope_obj, tuple):
        scope_obj = list(scope_obj[0])
    fail_if_exist = 0
    #    Looping to edit all the resources present in the resources.txt file
    for scope in scope_obj:
        logger.info("Editing scope %s" % scope.name)
        if scope.has_property("new_name"):
            if scope.new_name != scope.name and VerifyScopes.verify_scope_existed(scope.new_name, 5, False):
                fail_if_exist += 1
                logger.warn("scope %s already exists, can't edit scope" % scope.new_name)
                continue

        #    Selecting the given scope
        if CommonOperationScopes.select_scope(scope.name):
            #    Clicking on edit button and verifying the edit options page
            CommonOperationScopes.wait_for_scopes_load()
            EditScopes.click_edit_scope_button()
            EditScopes.wait_edit_scope_dialog_open()
            EditScopes.click_add_resources_button()
            EditScopes.wait_add_resources_dialog_open()
            EditScopes.input_and_select_resource_category(scope.category)
            CommonOperationScopes.load_bulk_enets()
            EditScopes.click_add_button()
            EditScopes.wait_add_resources_dialog_close()
            EditScopes.click_ok_button()
            EditScopes.wait_edit_scope_dialog_close()
    if fail_if_exist > 0:
        return FusionUIBase.fail_test_or_return_false("Failed to assign bulk resource")
    return True
コード例 #5
0
def validate_resource_can_be_added_to_scope(*scope_obj):
    """ Validate Resource Can Be Added To Scope    """
    logger.info("Validate Resource Can Be Added To Scope")
    navigate()
    if isinstance(scope_obj, test_data.DataObj):
        scope_obj = [scope_obj]
    elif isinstance(scope_obj, tuple):
        scope_obj = list(scope_obj[0])
    fail_if_exist = 0
    #    Looping to edit all the resourcs present in the resources.txt file
    for scope in scope_obj:
        logger.info("Editing scope %s" % scope.name)
        #    Selecting the given scope
        if CommonOperationScopes.select_scope(scope.name):
            #    Clicking on edit button and verifying the edit options page
            EditScopes.click_edit_scope_button()
            EditScopes.wait_edit_scope_dialog_open()
            #    Verify resources
            if scope.has_property("resources"):
                _Add_Resource_To_Scope(scope.resources)
            EditScopes.click_cancel_button()
            EditScopes.wait_edit_scope_dialog_close()
    if fail_if_exist > 0:
        return False
    return True
コード例 #6
0
def edit_scope(*scope_obj):
    """ Edit Scope    """
    logger.info("Edit Scope")
    navigate()
    if isinstance(scope_obj, test_data.DataObj):
        scope_obj = [scope_obj]
    elif isinstance(scope_obj, tuple):
        scope_obj = list(scope_obj[0])
    fail_if_exist = 0
    #    Looping to edit all the resources present in the resources.txt file
    for scope in scope_obj:
        logger.info("Editing scope %s" % scope.name)
        if scope.has_property("new_name"):
            if scope.new_name != scope.name and VerifyScopes.verify_scope_existed(scope.new_name, 5, False):
                fail_if_exist += 1
                logger.warn("scope %s already exists, can't edit scope" % scope.new_name)
                continue

        have_resource = False
        #    Selecting the given scope
        if CommonOperationScopes.select_scope(scope.name):
            #    Clicking on edit button and verifying the edit options page
            CommonOperationScopes.wait_for_scopes_load()
            EditScopes.click_edit_scope_button()
            EditScopes.wait_edit_scope_dialog_open()
            if scope.has_property("new_name"):
                data = _Verify_Parameter(scope.new_name, "Scope Name")
                if not (data == "none" or data == ""):
                    EditScopes.input_name(data)
            #    deleting resources
            if hasattr(scope, 'remove_resources'):
                for n, resource in enumerate(scope.remove_resources):
                    have_resource = True
                    logger.info("Deleting resource %s from scope" % resource.name)
                    #   EditScopes.remove_resources_by_name(resource.name)
                    EditScopes.click_remove_resources_button()
                    EditScopes.input_and_select_remove_resource_category(resource.category)
                    EditScopes.click_remove_resources_button_from_scope()
                    #   EditScopes.click_ok_button()
                    #   VerifyScopes.verify_resource_deleted(resource.name)
            #    add resources
            if hasattr(scope, 'add_resources'):
                for n, resource in enumerate(scope.add_resources):
                    have_resource = _Add_Resource_To_Scope(resource) or have_resource
            EditScopes.click_ok_button()
            EditScopes.wait_edit_scope_dialog_close()

        if have_resource:
            FusionUIBase.show_activity_sidebar()
            FusionUIBase.wait_activity_action_ok(scope.name, 'Update', timeout=120, fail_if_false=True)
            FusionUIBase.show_activity_sidebar()

    if fail_if_exist > 0:
        return False
    return True
コード例 #7
0
def edit_verify_scope(*scope_obj):
    """ Edit Scope    """
    logger.info("Edit and Verify Scope")
    navigate()
    if isinstance(scope_obj, test_data.DataObj):
        scope_obj = [scope_obj]
    elif isinstance(scope_obj, tuple):
        scope_obj = list(scope_obj[0])
    fail_if_exist = 0
    #    Looping to edit all the resources present in the resources.txt file
    for scope in scope_obj:
        logger.info("Editing scope %s" % scope.name)
        if scope.has_property("new_name"):
            if scope.new_name != scope.name and VerifyScopes.verify_scope_existed(scope.new_name, 5, False):
                fail_if_exist += 1
                logger.warn("scope %s already exists, can't edit scope" % scope.new_name)
                continue
        #    Selecting the given scope
        if CommonOperationScopes.select_scope(scope.name):
            #    Clicking on edit button and verifying the edit options page
            CommonOperationScopes.wait_for_scopes_load()
            EditScopes.click_edit_scope_button()
            EditScopes.wait_edit_scope_dialog_open()
            if scope.has_property("new_name"):
                data = _Verify_Parameter(scope.new_name, "Scope Name")
                if not (data == "none" or data == ""):
                    EditScopes.input_name(data)
    EditScopes.click_ok_button()

    validate_msg = CommonOperationScopes.get_scopename_validate_message()
    EditScopes.click_cancel_button()
    EditScopes.wait_edit_scope_dialog_close()
    if validate_msg is None and fail_if_exist == 0:
        FusionUIBase.fail_test_or_return_false("Failed to find the required element")
    else:
        return validate_msg