def test001():
    class Infra(InfraModel):
        fip_pool = "external"
        #add the standard secgroup and connectivity components
        gateway = external_connection
        slave_secgroup = make_std_secgroup
        
        #HADOOP slaves
        slaves = MultiResourceGroup("slaves",
                                     slave=Server("slave", ubuntu_img,
                                                  "m1.small",
                                                  nics=[ctxt.model.gateway.net],
                                                  security_groups=[ctxt.model.slave_secgroup.group],
                                                  **common_kwargs),
                                     slave_fip=FloatingIP("sn_fip",
                                                          ctxt.comp.container.slave,
                                                          ctxt.comp.container.slave.iface0.addr0,
                                                          pool=fip_pool))
    infra = Infra("infra")
    
    class Namespace(NamespaceModel):
        with_variables(Var("SLAVE_IPS", host_list(ctxt.model.slaves)))
        
        slaves = MultiRole(Role("slave",
                                host_ref=ctxt.model.infra.slaves[ctxt.name].slave_fip,
                                variables=[Var("COMP_NAME", "slave_!{COMP_KEY}"),
                                           Var("COMP_KEY", ctxt.name)]))
    ns = Namespace()
        
    class InnerConfig(ConfigModel):
        task = NullTask("inner_task", "summat")
    
    class Config(ConfigModel):
        do_it = MultiTask("multi", ConfigClassTask("suite", InnerConfig),
                          Namespace.q.slaves.all())
    cfg = Config()
    
    uid = "it"
    pwd = "doesn't"
    url = "matter"
    
    os_prov = OpenstackProvisioner(uid, pwd, uid, url, num_threads=1)
    for i in range(5):
        _ = ns.slaves[i]
    ns.compute_provisioning_for_environ(infra)
    _ = infra.refs_for_components()
    import traceback
    try:
        os_prov.provision_infra_model(infra)
    except Exception, e:
        print "Provision failed with %s; details below" % e.message
        for t, et, ev, tb in os_prov.agent.get_aborted_tasks():
            print "prov task %s failed with:" % t.name
            traceback.print_exception(et, ev, tb)
            print
        assert False, "can't proceed due to provisioning errors"
        
    ea = AnsibleExecutionAgent(config_model_instance=cfg,
                               namespace_model_instance=ns,
                               num_threads = 1,
                               no_delay=True, log_level=LOG_DEBUG)
    try:
        ea.perform_config()
    except Exception, e:
        print "Config failed with %s; details below" % e.message
        for t, et, ev, tb in ea.get_aborted_tasks():
            print "task %s failed with:" % t.name
            traceback.print_exception(et, ev, tb)
            print
        assert False, "The config had errors; see output"
        
    assert (cfg.do_it.value().instances[0].instance.task.get_task_role().host_ref is not None and
            cfg.do_it.value().instances[0].instance.task.get_task_host() is not None and
            isinstance(cfg.do_it.value().instances[0].instance.task.get_task_host(),
                           basestring))
dataset/ETHPy150Open haxsaw/actuator/src/tests/config2_tests.py/test001/original