def _combine_hosts(self): ct = ConfiguredTest() ct.resources = Resources.resources.resources() ct.hosts = {} ct.end_policy = Schedule.get_schedule().test_end_policy() ct.setup_phase_delay = Schedule.get_schedule().setup_phase_delay() ct.triggers = Schedule.get_schedule().triggers() for h in Model.get_model().hosts(): host = ConfiguredHost() host.model = h host.device = h.bound() host.schedule = Schedule.get_schedule().host_schedule(h['name']) resources = set(h.needed_resources()) for event in host.schedule: resources.update(event.command().needed_resources()) def resolve_resource(r): if isinstance(r, str): return Utils.resolve_resource_name(r) return r host.resources = set(map(resolve_resource, resources)) ct.hosts[h['name']] = host ct.sanity_check() ct.model = Model.get_model() ct.laboratory = Laboratory.get_laboratory() ct.schedule = Schedule.get_schedule() ct.mapping = Mapping.get_mapping() self._configured_test = ct
def _sanity_check(self): if not Model.get_model(): raise Exceptions.SanityError("No model defined. You need to create a model. Did you forget to use 'create_model(name)' in your configuration?") if not Laboratory.get_laboratory(): raise Exceptions.SanityError("No laboratory defined. You need to create a laboratory. Did you forget to use 'create_laboratory(name)' in your configuration?") if not Mapping.get_mapping(): raise Exceptions.SanityError("No mapping defined. You need to create a mapping. Did you forget to use 'create_mapping(name)' in your configuration?") if not Schedule.get_schedule(): raise Exceptions.SanityError("No schedule defined. You need to create a schedule. Did you forget to use 'create_schedule(name)' in your configuration?")