- XBT_VERB("cluster getLocalRoute from '%s'[%u] to '%s'[%u]", src->get_cname(), src->id(), dst->get_cname(), dst->id());
- xbt_assert(not private_links_.empty(),
- "Cluster routing: no links attached to the source node - did you use host_link tag?");
-
- if ((src->id() == dst->id()) && has_loopback_) {
- if (src->is_router()) {
- XBT_WARN("Routing from a cluster private router to itself is meaningless");
- } else {
- std::pair<resource::LinkImpl*, resource::LinkImpl*> info = private_links_.at(node_pos(src->id()));
- route->link_list.push_back(info.first);
- if (lat)
- *lat += info.first->get_latency();
- }
- return;
- }
-
- if (not src->is_router()) { // No private link for the private router
- if (has_limiter_) { // limiter for sender
- std::pair<resource::LinkImpl*, resource::LinkImpl*> info = private_links_.at(node_pos_with_loopback(src->id()));
- route->link_list.push_back(info.first);
- }
-
- std::pair<resource::LinkImpl*, resource::LinkImpl*> info =
- private_links_.at(node_pos_with_loopback_limiter(src->id()));
- if (info.first) { // link up
- route->link_list.push_back(info.first);
- if (lat)
- *lat += info.first->get_latency();
- }
- }
-
- if (backbone_) {
- route->link_list.push_back(backbone_);
- if (lat)
- *lat += backbone_->get_latency();
- }
-
- if (not dst->is_router()) { // No specific link for router
- std::pair<resource::LinkImpl*, resource::LinkImpl*> info =
- private_links_.at(node_pos_with_loopback_limiter(dst->id()));
-
- if (info.second) { // link down
- route->link_list.push_back(info.second);
- if (lat)
- *lat += info.second->get_latency();
- }
- if (has_limiter_) { // limiter for receiver
- info = private_links_.at(node_pos_with_loopback(dst->id()));
- route->link_list.push_back(info.first);
- }
- }