+ XBT_DEBUG("host model: %s", host_model_name.c_str());
+ if (host_model_name == "compound") {
+ xbt_assert(not cpu_model_name.empty(), "Set a cpu model to use with the 'compound' host model");
+ xbt_assert(not network_model_name.empty(), "Set a network model to use with the 'compound' host model");
+
+ const auto* cpu_model = find_model_description(surf_cpu_model_description, cpu_model_name);
+ cpu_model->model_init_preparse();
+
+ const auto* network_model = find_model_description(surf_network_model_description, network_model_name);
+ network_model->model_init_preparse();
+ }
+
+ XBT_DEBUG("Call host_model_init");
+ const auto* host_model = find_model_description(surf_host_model_description, host_model_name);
+ host_model->model_init_preparse();
+
+ XBT_DEBUG("Call vm_model_init");
+ /* ideally we should get back the pointer to CpuModel from model_init_preparse(), but this
+ * requires changing the declaration of surf_cpu_model_description.
+ * To be reviewed in the future */
+ surf_vm_model_init_HL13(
+ simgrid::s4u::Engine::get_instance()->get_netzone_root()->get_impl()->get_cpu_pm_model().get());
+
+ XBT_DEBUG("Call disk_model_init");
+ const auto* disk_model = find_model_description(surf_disk_model_description, disk_model_name);
+ disk_model->model_init_preparse();
+}
+
+xbt::signal<void(bool symmetrical, kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst,
+ kernel::routing::NetPoint* gw_src, kernel::routing::NetPoint* gw_dst,
+ std::vector<kernel::resource::StandardLinkImpl*> const& link_list)>
+ NetZoneImpl::on_route_creation;
+
+NetZoneImpl::NetZoneImpl(const std::string& name) : piface_(this), name_(name)
+{
+ auto* engine = s4u::Engine::get_instance();
+ /* workaroud: first netzoneImpl will be the root netzone.
+ * Without globals and with current surf_*_model_description init functions, we need
+ * the root netzone to exist when creating the models.
+ * This was usually done at sg_platf.cpp, during XML parsing */
+ if (not engine->get_netzone_root()) {
+ engine->set_netzone_root(&piface_);
+ /* root netzone set, initialize models */
+ simgrid::s4u::Engine::on_platform_creation();
+
+ /* Initialize the surf models. That must be done after we got all config, and before we need the models.
+ * That is, after the last <config> tag, if any, and before the first of cluster|peer|zone|trace|trace_cb
+ *
+ * I'm not sure for <trace> and <trace_cb>, there may be a bug here
+ * (FIXME: check it out by creating a file beginning with one of these tags)
+ * but cluster and peer come down to zone creations, so putting this verification here is correct.
+ */
+ surf_config_models_setup();
+ }
+
+ xbt_assert(nullptr == engine->netpoint_by_name_or_null(get_name()),
+ "Refusing to create a second NetZone called '%s'.", get_cname());
+ netpoint_ = new NetPoint(name_, NetPoint::Type::NetZone);
+ XBT_DEBUG("NetZone '%s' created with the id '%lu'", get_cname(), netpoint_->id());
+ _sg_cfg_init_status = 2; /* HACK: direct access to the global controlling the level of configuration to prevent
+ * any further config now that we created some real content */
+ simgrid::s4u::NetZone::on_creation(piface_); // notify the signal