- xbt_assert(current_routing->p_modelDesc == &routing_models[SURF_MODEL_CLUSTER],
- "You have to be in model Cluster to use tag backbone!");
- xbt_assert(!static_cast<simgrid::surf::AsCluster*>(current_routing)->p_backbone, "The backbone link is already defined!");
- static_cast<simgrid::surf::AsCluster*>(current_routing)->p_backbone =
- static_cast<simgrid::surf::Link*>(bb);
+ simgrid::surf::AsCluster *cluster = dynamic_cast<simgrid::surf::AsCluster*>(current_routing);
+
+ xbt_assert(cluster, "Only hosts from Cluster can get a backbone.");
+ xbt_assert(nullptr == cluster->p_backbone, "Cluster %s already has a backbone link!", cluster->p_name);
+
+ cluster->p_backbone = static_cast<simgrid::surf::Link*>(bb);