Commit a3354fc8 authored by Björn Richerzhagen's avatar Björn Richerzhagen
Browse files

5G-Topo: Set the Max-BW reported by the MAC layer for application use

parent 66612d42
......@@ -35,6 +35,7 @@ import de.tud.kom.p2psim.api.topology.waypoints.WaypointModel;
import de.tud.kom.p2psim.impl.topology.PositionVector;
import de.tud.kom.p2psim.impl.topology.views.FiveGTopologyView.CellLink;
import de.tud.kom.p2psim.impl.topology.views.fiveg.FiveGTopologyDatabase;
import de.tud.kom.p2psim.impl.topology.views.fiveg.FiveGTopologyDatabase.Entry;
import de.tudarmstadt.maki.simonstrator.api.Event;
import de.tudarmstadt.maki.simonstrator.api.EventHandler;
import de.tudarmstadt.maki.simonstrator.api.Host;
......@@ -230,6 +231,40 @@ public class FiveGTopologyView extends AbstractTopologyView<CellLink> {
databaseAccessPoints.getEntryFor(segId, false) != null);
}
}
/*
* FIXME the not-so-elegant approach of updating all max-BWs
*/
for (MacAddress mobileClient : mobileClientsList) {
updateMaxMacBandwidth(mobileClient);
}
}
/**
* FIXME this is currently needed to keep the max upload bandwidth reported
* by MOBILE-mac (UMTS) consistent with the bandwidth of the given cell. It
* always reports the BW that can be achieved when sending via MOBILE to the
* cloud (NOT to cloudlets).
*
* @param macAddr
*/
private void updateMaxMacBandwidth(MacAddress macAddr) {
// FIXME workaround for MAC bandwidth updates.
// Sets the initial max upload BW to the cloud (not to cloudlets!)
MacLayer mac = getMac(macAddr);
PositionVector pos = mac.getHost().getTopologyComponent()
.getRealPosition();
int segId = database.getSegmentID(pos.getX(), pos.getY());
Entry usedEntry = database.getEntryFor(segId, false);
if (mobileClientsUsingAccessPoints.contains(macAddr)) {
int apSegId = databaseAccessPoints.getSegmentID(pos.getX(),
pos.getY());
Entry apEntry = databaseAccessPoints.getEntryFor(apSegId, false);
usedEntry = (apEntry != null ? apEntry : usedEntry);
}
mac.getMaxBandwidth().setUpBW(usedEntry.getBandwidth(true));
mac.getMaxBandwidth().setDownBW(usedEntry.getBandwidth(false));
}
@Override
......@@ -410,6 +445,10 @@ public class FiveGTopologyView extends AbstractTopologyView<CellLink> {
return isCloudlet;
}
public boolean isUpload() {
return isUpload;
}
@Override
public long getBandwidth(boolean isBroadcast) {
assert (apLinkData != null && supportsAccessPoints)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment