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
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)
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)
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)