- XBT_VERB("cluster getLocalRoute from '%s'[%u] to '%s'[%u]", src->cname(), src->id(), dst->cname(), dst->id());
- xbt_assert(not privateLinks_.empty(),
- "Cluster routing: no links attached to the source node - did you use host_link tag?");
-
- if ((src->id() == dst->id()) && hasLoopback_) {
- xbt_assert(not src->isRouter(), "Routing from a cluster private router to itself is meaningless");
-
- std::pair<surf::LinkImpl*, surf::LinkImpl*> info = privateLinks_.at(src->id() * linkCountPerNode_);
- route->link_list->push_back(info.first);
- if (lat)
- *lat += info.first->latency();
- return;
- }
-
- if (not src->isRouter()) { // No private link for the private router
- if (hasLimiter_) { // limiter for sender
- std::pair<surf::LinkImpl*, surf::LinkImpl*> info =
- privateLinks_.at(src->id() * linkCountPerNode_ + (hasLoopback_ ? 1 : 0));
- route->link_list->push_back(info.first);
- }
-
- std::pair<surf::LinkImpl*, surf::LinkImpl*> info =
- privateLinks_.at(src->id() * linkCountPerNode_ + (hasLoopback_ ? 1 : 0) + (hasLimiter_ ? 1 : 0));
- if (info.first) { // link up
- route->link_list->push_back(info.first);
- if (lat)
- *lat += info.first->latency();
- }
- }
-
- if (backbone_) {
- route->link_list->push_back(backbone_);
- if (lat)
- *lat += backbone_->latency();
- }
-
- if (not dst->isRouter()) { // No specific link for router
-
- std::pair<surf::LinkImpl*, surf::LinkImpl*> info =
- privateLinks_.at(dst->id() * linkCountPerNode_ + hasLoopback_ + hasLimiter_);
- if (info.second) { // link down
- route->link_list->push_back(info.second);
- if (lat)
- *lat += info.second->latency();
- }
- if (hasLimiter_) { // limiter for receiver
- info = privateLinks_.at(dst->id() * linkCountPerNode_ + hasLoopback_);
- route->link_list->push_back(info.first);
- }