forked from lalithsuresh/odin-master
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merging branches: HandoverMultichannel and Statistics
- Loading branch information
1 parent
9e0357a
commit 8a52ff5
Showing
7 changed files
with
212 additions
and
2 deletions.
There are no files selected for viewing
106 changes: 106 additions & 0 deletions
106
src/main/java/net/floodlightcontroller/odin/applications/ShowStatistics.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
package net.floodlightcontroller.odin.applications; | ||
|
||
import java.net.InetAddress; | ||
import java.util.HashMap; | ||
import java.util.HashSet; | ||
import java.util.Map; | ||
import java.util.Map.Entry; | ||
import java.util.Set; | ||
|
||
import net.floodlightcontroller.odin.master.OdinApplication; | ||
import net.floodlightcontroller.odin.master.OdinClient; | ||
import net.floodlightcontroller.util.MACAddress; | ||
|
||
public class ShowStatistics extends OdinApplication { | ||
|
||
// IMPORTANT: this application only works if all the agents in the | ||
//poolfile are activated before the end of the INITIAL_INTERVAL. | ||
// Otherwise, the application looks for an object that does not exist | ||
//and gets stopped | ||
|
||
// this interval is for allowing the agents to connect to the controller | ||
private final int INITIAL_INTERVAL = 30000; // in ms | ||
|
||
// this interval this interval is the period for showing the statistics | ||
private final int REPORTING_PERIOD = 15000; // in ms | ||
|
||
HashSet<OdinClient> clients; | ||
|
||
@Override | ||
public void run() { | ||
try { | ||
Thread.sleep(INITIAL_INTERVAL); | ||
} catch (InterruptedException e) { | ||
e.printStackTrace(); | ||
} | ||
|
||
while (true) { | ||
try { | ||
Thread.sleep(REPORTING_PERIOD); | ||
clients = new HashSet<OdinClient>(getClients()); | ||
/* | ||
* If a handoff has happened during the statistic gathering period, | ||
* it may happen that a client appears in the statistics of two agents | ||
* because it has been handed off from one agent to another | ||
*/ | ||
|
||
System.out.println("[ShowStatistics] List of Agents:"); //JOSE | ||
|
||
// for each Agent | ||
for (InetAddress agentAddr: getAgents()) { | ||
|
||
System.out.println("[ShowStatistics] Agent: " + agentAddr); | ||
|
||
// Transmission statistics | ||
System.out.println("[ShowStatistics] Last ping heard from agent " + agentAddr + " " + getLastHeardFromAgent(agentAddr)); | ||
|
||
Map<MACAddress, Map<String, String>> vals_tx = getTxStatsFromAgent(agentAddr); // all the clients who have statistics | ||
|
||
// Reception statistics | ||
Map<MACAddress, Map<String, String>> vals_rx = getRxStatsFromAgent(agentAddr); | ||
|
||
for (OdinClient oc: clients) { // all the clients currently associated | ||
// NOTE: the clients currently associated MAY NOT be the same as the clients who have statistics | ||
|
||
System.out.println("\n[ShowStatistics] 1" + agentAddr); | ||
|
||
// for each STA associated to the Agent | ||
for (Entry<MACAddress, Map<String, String>> vals_entry_rx: vals_rx.entrySet()) { | ||
|
||
MACAddress staHwAddr = vals_entry_rx.getKey(); | ||
if (oc.getMacAddress().equals(staHwAddr) && oc.getIpAddress() != null && !oc.getIpAddress().getHostAddress().equals("0.0.0.0")) { | ||
System.out.println("\tUplink station MAC: " + staHwAddr + " IP: " + oc.getIpAddress().getHostAddress()); | ||
System.out.println("\t\tnum packets: " + vals_entry_rx.getValue().get("packets")); | ||
System.out.println("\t\tavg rate: " + vals_entry_rx.getValue().get("avg_rate") + " kbps"); | ||
System.out.println("\t\tavg signal: " + vals_entry_rx.getValue().get("avg_signal") + " dBm"); | ||
System.out.println("\t\tavg length: " + vals_entry_rx.getValue().get("avg_len_pkt") + " bytes"); | ||
System.out.println("\t\tair time: " + vals_entry_rx.getValue().get("air_time") + " ms"); | ||
System.out.println("\t\tinit time: " + vals_entry_rx.getValue().get("first_received") + " sec"); | ||
System.out.println("\t\tend time: " + vals_entry_rx.getValue().get("last_received") + " sec"); | ||
System.out.println(""); | ||
} | ||
} | ||
// for each STA associated to the Agent | ||
for (Entry<MACAddress, Map<String, String>> vals_entry_tx: vals_tx.entrySet()) { | ||
MACAddress staHwAddr = vals_entry_tx.getKey(); | ||
if (oc.getMacAddress().equals(staHwAddr) && oc.getIpAddress() != null && !oc.getIpAddress().getHostAddress().equals("0.0.0.0")) { | ||
System.out.println("\tDownlink station MAC: " + staHwAddr + " IP: " + oc.getIpAddress().getHostAddress()); | ||
System.out.println("\t\tnum packets: " + vals_entry_tx.getValue().get("packets")); | ||
System.out.println("\t\tavg rate: " + vals_entry_tx.getValue().get("avg_rate") + " kbps"); | ||
System.out.println("\t\tavg signal: " + vals_entry_tx.getValue().get("avg_signal") + " dBm"); | ||
System.out.println("\t\tavg length: " + vals_entry_tx.getValue().get("avg_len_pkt") + " bytes"); | ||
System.out.println("\t\tair time: " + vals_entry_tx.getValue().get("air_time") + " ms"); | ||
System.out.println("\t\tinit time: " + vals_entry_tx.getValue().get("first_received") + " sec"); | ||
System.out.println("\t\tend time: " + vals_entry_tx.getValue().get("last_received") + " sec"); | ||
System.out.println(""); | ||
} | ||
|
||
} | ||
} | ||
} | ||
} catch (InterruptedException e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ | |
* channel to map the physical Wi-Fi channel used by the access point. | ||
* | ||
* @author Lalith Suresh <[email protected]> | ||
* | ||
*/ | ||
class StubOdinAgent implements IOdinAgent { | ||
|
||
|
@@ -37,7 +38,12 @@ public void addClientLvap(OdinClient oc) { | |
public InetAddress getIpAddress() { | ||
return ipAddr; | ||
} | ||
|
||
|
||
@Override | ||
public Map<MACAddress, Map<String, String>> getTxStats() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public Map<MACAddress, Map<String, String>> getRxStats() { | ||
return null; | ||
|