コード例 #1
0
ファイル: steps.py プロジェクト: wsw2008new/fiware-paas
def i_request_the_update_of_a_tier_of_a_environment_with_data(
        step, tier_name, env_name):
    #data = dataset_utils.prepare_data(step.hashes[0])
    data = dataset_utils.generate_fixed_length_params(step.hashes[0])
    data = dataset_utils.remove_missing_params(data)
    tier = Tier(data.get(NAME))

    if TIER_REQUEST_IMAGE in data:
        tier.tier_image = data.get(TIER_REQUEST_IMAGE)

    if TIER_REQUEST_REGION in data:
        tier.region = data.get(TIER_REQUEST_REGION)

    if TIER_REQUEST_NUM_MIN in data:
        tier.tier_num_min = data.get(TIER_REQUEST_NUM_MIN)

    if TIER_REQUEST_NUM_MAX in data:
        tier.tier_num_max = data.get(TIER_REQUEST_NUM_MAX)

    if TIER_REQUEST_NUM_INITIAL in data:
        tier.tier_num_initial = data.get(TIER_REQUEST_NUM_INITIAL)

    if TIER_REQUEST_FLAVOUR in data:
        tier.tier_flavour = data.get(TIER_REQUEST_FLAVOUR)

    if TIER_REQUEST_KEYPAIR in data:
        tier.tier_keypair = data.get(TIER_REQUEST_KEYPAIR)

    if TIER_REQUEST_FLOATINGIP in data:
        tier.tier_floatingip = data.get(TIER_REQUEST_FLOATINGIP)

    tier.parse_and_add_products(data.get(PRODUCTS))
    tier.parse_and_add_networks(data.get(NETWORKS))
    world.env_requests.update_tier_environment(env_name, tier_name, tier)
コード例 #2
0
def process_the_list_of_tiers(step):
    """
    Lettuce step. This function parses dataset to prepare each tier data.
     Tiers list will be returned with the tiers parsed from dataset
    :param step: Lettuce step with all data about tiers
    :return: List of processed tiers from step data
    """
    tier_list = list()
    for row in step.hashes:
        data = dataset_utils.prepare_data(row)
        tier = Tier(data.get(NAME), world.config[PAAS][TIER_IMAGE])
        tier.parse_and_add_products(data.get(PRODUCTS))

        if TIER_REQUEST_IMAGE in data:
            tier.tier_image = data.get(TIER_REQUEST_IMAGE)

        if TIER_REQUEST_REGION in data:
            tier.region = data.get(TIER_REQUEST_REGION)

        # For each product, check if there are defined attributes
        for paas_product_with_attributes in world.paas_product_list_with_attributes:
            for attribute in paas_product_with_attributes['attributes']:
                attribute_type = attribute['type'] if 'type' in attribute else None
                tier.add_attribute_to_product(paas_product_with_attributes['name'], attribute['key'],
                                              attribute['value'], attribute_type)

        tier.parse_and_add_networks(data.get(NETWORKS))
        tier_list.append(tier)

    return tier_list
コード例 #3
0
ファイル: steps.py プロジェクト: Fiware/cloud.PaaS
def a_list_of_tiers_has_been_defined_with_data(step):
    world.tiers = []
    for row in step.hashes:
        data = dataset_utils.prepare_data(row)
        tier = Tier(data.get(NAME), world.config[PAAS][TIER_IMAGE])
        tier.parse_and_add_products(data.get(PRODUCTS))
        tier.parse_and_add_networks(data.get(NETWORKS))
        world.tiers.append(tier)
コード例 #4
0
ファイル: steps.py プロジェクト: Fiware/cloud.PaaS
def i_request_the_update_of_a_tier_of_a_environment_with_data(step, tier_name, env_name):
    # data = dataset_utils.prepare_data(step.hashes[0])
    data = dataset_utils.generate_fixed_length_params(step.hashes[0])
    data = dataset_utils.remove_missing_params(data)
    tier = Tier(data.get(NAME))

    if TIER_REQUEST_IMAGE in data:
        tier.tier_image = data.get(TIER_REQUEST_IMAGE)

    if TIER_REQUEST_REGION in data:
        tier.region = data.get(TIER_REQUEST_REGION)

    if TIER_REQUEST_NUM_MIN in data:
        tier.tier_num_min = data.get(TIER_REQUEST_NUM_MIN)

    if TIER_REQUEST_NUM_MAX in data:
        tier.tier_num_max = data.get(TIER_REQUEST_NUM_MAX)

    if TIER_REQUEST_NUM_INITIAL in data:
        tier.tier_num_initial = data.get(TIER_REQUEST_NUM_INITIAL)

    if TIER_REQUEST_FLAVOUR in data:
        tier.tier_flavour = data.get(TIER_REQUEST_FLAVOUR)

    if TIER_REQUEST_KEYPAIR in data:
        tier.tier_keypair = data.get(TIER_REQUEST_KEYPAIR)

    if TIER_REQUEST_FLOATINGIP in data:
        tier.tier_floatingip = data.get(TIER_REQUEST_FLOATINGIP)

    tier.parse_and_add_products(data.get(PRODUCTS))
    tier.parse_and_add_networks(data.get(NETWORKS))
    world.env_requests.update_tier_environment(env_name, tier_name, tier)
コード例 #5
0
def a_tier_has_already_been_added_to_abstract_environment_with_data(
        step, env_name):
    data = dataset_utils.prepare_data(step.hashes[0])
    tier = Tier(data.get(NAME), world.config[PAAS][TIER_IMAGE])
    tier.parse_and_add_products(data.get(PRODUCTS))
    tier.parse_and_add_networks(data.get(NETWORKS))
    world.env_requests.add_tier_abstract_environment(env_name, tier)
コード例 #6
0
def i_request_the_update_of_a_tier_of_a_environment_with_data(
        step, tier_name, env_name):
    data = dataset_utils.prepare_data(step.hashes[0])
    tier = Tier(data.get(NAME), world.config[PAAS][TIER_IMAGE])
    tier.parse_and_add_products(data.get(PRODUCTS))
    tier.parse_and_add_networks(data.get(NETWORKS))
    world.env_requests.update_tier_environment(env_name, tier_name, tier)
コード例 #7
0
ファイル: steps.py プロジェクト: wsw2008new/fiware-paas
def a_list_of_tiers_has_been_defined_with_data(step):
    """ Create and add tiers to the environment """
    world.tiers = []
    for row in step.hashes:
        data = dataset_utils.prepare_data(row)

        tier = Tier(data.get(NAME),
                    world.image_sdc_aware_id,
                    tier_flavour=world.flavor_id,
                    tier_region=world.region_name)

        tier.parse_and_add_products(data.get(PRODUCTS))

        if NETWORKS in data:
            # Is Neutron available?
            i_retrieve_the_service_catalog(step)
            body_response = raw_httplib_request_to_python_dic(world.response)
            nova_public_url = get_public_endpoint_url_by_type(
                body_response, 'network', world.region_name)
            if nova_public_url is None:
                raise Exception(
                    "Networks are not available. Region: {}".format(
                        world.region_name))

            tier.parse_and_add_networks(data.get(NETWORKS))

        world.env_requests.add_tier_environment(world.environment_name, tier)
コード例 #8
0
ファイル: steps.py プロジェクト: Fiware/cloud.PaaS
def a_list_of_tiers_has_been_defined_with_data(step):
    """ Create and add tiers to the environment """
    world.tiers = []
    for row in step.hashes:
        data = dataset_utils.prepare_data(row)

        tier = Tier(data.get(NAME), world.image_sdc_aware_id, tier_flavour=world.flavor_id,
                    tier_region=world.region_name)

        tier.parse_and_add_products(data.get(PRODUCTS))

        if NETWORKS in data:
            # Is Neutron available?
            i_retrieve_the_service_catalog(step)
            body_response = raw_httplib_request_to_python_dic(world.response)
            nova_public_url = get_public_endpoint_url_by_type(body_response, 'network', world.region_name)
            if nova_public_url is None:
                raise Exception("Networks are not available. Region: {}".format(world.region_name))

            tier.parse_and_add_networks(data.get(NETWORKS))

        world.env_requests.add_tier_environment(world.environment_name, tier)
コード例 #9
0
ファイル: steps.py プロジェクト: pratid/fiware-paas
def a_list_of_tiers_has_been_defined_with_data(step):
    world.tiers = []
    for row in step.hashes:
        data = dataset_utils.prepare_data(row)
        tier = Tier(data.get(NAME), world.config[PAAS][TIER_IMAGE])
        tier.parse_and_add_products(data.get(PRODUCTS))
        tier.parse_and_add_networks(data.get(NETWORKS))
        world.tiers.append(tier)