Esempio n. 1
0
def process_instance(instance):
    """
    Process the instance provided as a dictionary.
    :param instance: instance to be processed.
    :return: a EnvironmentInstance object.
    """
    processed_instance = EnvironmentInstance(instance['blueprintName'],
                                             instance['description'],
                                             status=instance['status'])
    try:
        tiers = tier.process_tiers(instance['tierDto'])
        processed_instance.add_tiers(tiers)
    except:
        pass
    return processed_instance
def process_instance(instance):
    """
    Process the instance provided as a dictionary.
    :param instance: instance to be processed.
    :return: a EnvironmentInstance object.
    """
    processed_instance = EnvironmentInstance(instance['blueprintName'],
        instance['description'],
        status=instance['status'])
    try:
        tiers = tier.process_tiers(instance['tierDto'])
        processed_instance.add_tiers(tiers)
    except:
        pass
    return processed_instance
Esempio n. 3
0
def i_request_the_creation_of_an_instance_of_an_environment_using_data(step, env_name):
    # First, send the request to get the environment on which the instance will be based
    env_name = dataset_utils.generate_fixed_length_param(env_name)
    world.env_requests.get_environment(env_name)
    assert world.response.status == 200,\
    "Wrong status code received getting environment: %d. Expected: %d. Body content: %s"\
    % (world.response.status, 200, world.response.read())
    environment = environment_request.process_environment(json.loads(world.response.read()))
    # Then, create the instance
    data = dataset_utils.prepare_data(step.hashes[0])
    instance = EnvironmentInstance(data.get(NAME), data.get(DESCRIPTION), environment)
    world.inst_requests.add_instance(instance)
Esempio n. 4
0
def an_instance_of_the_environment_has_already_been_created_using_data(step, env_name):
    # First, send the request to get the environment on which the instance will be based
    env_name = dataset_utils.generate_fixed_length_param(env_name)
    world.env_requests.get_environment(env_name)
    assert world.response.status == 200,\
    "Wrong status code received getting environment: %d. Expected: %d. Body content: %s"\
    % (world.response.status, 200, world.response.read())

    parsed_body = json.loads(world.response.read())
    environment = environment_request.process_environment(parsed_body)

    # Then, create the instance
    data = dataset_utils.prepare_data(step.hashes[0])
    instance = EnvironmentInstance(data.get(NAME), data.get(DESCRIPTION), environment)
    world.inst_requests.add_instance(instance)
    i_receive_a_response_of_type(step, 'OK')
    the_task_ends_with_status(step, 'SUCCESS')
    print environment_name
    blueprint_name = cmd_args[2]
    tier_name = cmd_args[3]
    product_name = cmd_args[4]

    print('Create a blueprint Template : ' + environment_name)
    env_request.add_environment(environment_name, 'description')
    print("  OK")

    print('Create tier: ' + tier_name + " with products " + product_name)
    env_request.add_tier_environment(environment_name, tier_name, product_name)
    print("  OK")

    print('Get Information about the template: ' + environment_name)
    env = env_request.get_environment(environment_name)
    env.to_string()
    print("  OK")

    print('Deploy an environment Instance: ' + blueprint_name)
    blueprint_instance = EnvironmentInstance(blueprint_name, 'description',
                                             env, 'INIT')
    instance_request.add_blueprint_instance(blueprint_instance)
    print('OK')

    print('Delete an environment Instance: ' + blueprint_name)
    instance_request.delete_blueprint_instance(blueprint_name)

    print('borrado del blueprint Template: ' + environment_name)
    env_request.delete_environment(environment_name)
    print("  OK")
blueprintname = 'dddsdd'

print('Create a blueprint Template No tiers for nodemysql: ')
g.add_environment(environment_name, 'description')
print("  OK")

print('Create createTierNoProduct: node')
tier_name = 'nodejsjust66'
g.add_tier_environment(environment_name, tier_name, "tomcat=6")
print("  OK")

print('Get Information about the Blueprint: ' + environment_name)
env = g.get_environment(environment_name)
env.to_xml()
print("  OK")

print('Deploy an environment Instance' + blueprintname)
blueprint_instance = EnvironmentInstance(blueprintname, 'description', env,
                                         'INIT')
print tostring(blueprint_instance.to_xml())
instance_request.add_blueprint_instance(blueprint_instance)
print('OK')

print('Delete an environment Instance' + blueprintname)
#instance_request.delete_blueprint_instance(blueprintname)

print('borrado del blueprint Template No tiers for contextbroker: ')
#g.delete_environment(environment_name)

print("  OK")
Esempio n. 7
0
print('Create a blueprint Template No tiers for nodemysql: ')
g.add_environment(environment_name, 'description')
print("  OK")

print('Create createTierNoProduct: node')
tier_name = 'nodejsjust66'
g.add_tier_environment(environment_name, tier_name, "tomcat=6")
print("  OK")

print('Get Information about the Blueprint: ' + environment_name )
env = g.get_environment(environment_name)
env.to_xml()
print("  OK")

print('Deploy an environment Instance' + blueprintname )
blueprint_instance = EnvironmentInstance(blueprintname, 'description', env, 'INIT')
print tostring(blueprint_instance.to_xml())
instance_request.add_blueprint_instance(blueprint_instance)
print ('OK')

print('Delete an environment Instance' + blueprintname )
#instance_request.delete_blueprint_instance(blueprintname)

print('borrado del blueprint Template No tiers for contextbroker: ')
#g.delete_environment(environment_name)

print("  OK")


Esempio n. 8
0
 def __process_env_inst(self, data):
     envIns = EnvironmentInstance(data['blueprintName'],
                                  data['description'], None, data['status'])
     return envIns