public class GlobalController extends java.lang.Object implements ComponentController
Constructor and Description |
---|
GlobalController()
Construct a GlobalController -- this constructor contains things
which apply whether we are simulation or emulation
|
Modifier and Type | Method and Description |
---|---|
void |
aliveMessage(LocalHostInfo lh)
An alive message has been received from the host specified
in LocalHostInfo.
|
void |
APControllerUpdate(long time) |
int |
appStart(int routerID,
java.lang.String className,
java.lang.String[] args)
Run an application on a Router.
|
int |
appStop(int routerID,
int appID)
Stop an application on a Router.
|
void |
apSet(int gid,
int AP)
Set the agg point for router gid to router AP
|
void |
checkIsolated(long time)
Check network for isolated nodes and connect them if possible
|
void |
checkIsolated(long time,
int gid)
Check if given node is isolated and connect it if possible
|
void |
checkTrafficOutputRequests(long time,
OutputType o)
When output for traffic is requested then queue requests for traffic from
routers
|
java.util.List<java.lang.String> |
compileRouterStats()
Get the router stats -- method is blocking
|
void |
connectNetwork(long time)
Make sure network is connected
|
void |
connectNetwork(long time,
int r1,
int r2)
Make sure network is connected from r1 to r2
|
java.lang.String |
elapsedToString(long elapsedTime)
Convert an elasped time, in milliseconds, into a string.
|
int |
endLink(long time,
int router1Id,
int router2Id)
Event to unlink two routers
|
int |
endRouter(long time,
int routerId)
Event to end a router
|
BasicRouterInfo |
findAppInfo(int appId)
Find some app info
|
us.monoid.json.JSONObject |
findAppInfoAsJSON(int appID)
Find some app info, given an app ID
and returns a JSONObject.
|
eu.reservoir.monitoring.core.Reporter |
findByInterface(java.lang.Class inter)
Find reporter by Interface Class
|
eu.reservoir.monitoring.core.Reporter |
findByLabel(java.lang.String label)
Find reporter by label
|
LinkInfo |
findLinkInfo(int linkID)
Find link info
|
us.monoid.json.JSONObject |
findLinkInfoAsJSON(int linkID)
Find link info
and return a JSONObject
|
java.util.Collection<LinkInfo> |
findLinkInfoByRouter(int routerID)
Find links for Router.
|
BasicRouterInfo |
findRouterInfo(int rId)
Find some router info
|
BasicRouterInfo |
findRouterInfo(java.lang.String value)
Find some router info, given a router address or a router name
|
us.monoid.json.JSONObject |
findRouterInfoAsJSON(int routerID)
Find some router info, given a router address or a router name
and return a JSONObject
|
void |
followEvent(SimEvent e,
EventScheduler s,
GlobalController g,
java.lang.Object o)
Add or remove events following a simulation event -- object allows
global controller to pass extra parameters related to event if necessary
|
void |
gcFollowEvent(SimEvent e,
java.lang.Object o)
Follow an event not generated by engine
|
void |
gcPreceedEvent(SimEvent e)
Preceed an event not generated by engine
|
java.util.Collection<LinkInfo> |
getAllLinkInfo()
List all LinkInfo
|
us.monoid.json.JSONObject |
getAllLinkInfoAsJSON(java.lang.String detail)
List all LinkInfo as a JSONObject
|
java.util.Collection<BasicRouterInfo> |
getAllRouterInfo()
List all RouterInfo.
|
us.monoid.json.JSONObject |
getAllRouterInfoAsJSON(java.lang.String detail)
List all RouterInfo as a JSON object
|
int |
getAP(int gid)
Get the nominated AP for a router
|
APController |
getAPController()
Get the APController
|
java.util.ArrayList<java.lang.Integer> |
getAPs()
List all APs
|
long |
getEventTime()
Get the time of the current event
|
int[] |
getLinkCosts(int routerId) |
int |
getLinkCount()
Get the number of links
|
int |
getLinkWeight(int l1,
int l2) |
LocalHostInfo |
getLocalHostInfo()
Get the host info for this GlobalController.
|
cc.clayman.console.ManagementConsole |
getManagementConsole()
Get the ManagementConsole this ComponentController interacts with.
|
int |
getMaxRouterId()
Accessor function for maxRouterId_
|
java.lang.String |
getName()
Get the name of this GlobalController.
|
int |
getNoRouters()
Number of routers in simulation
|
ControlOptions |
getOptions()
Accessor function for ControlOptions structure options_
|
int[] |
getOutLinks(int routerId) |
int |
getPort()
Get the port for this GlobalController
|
java.util.List<eu.reservoir.monitoring.core.Reporter> |
getReporterList()
Get the Reporter list of the monitoring data
|
int |
getRouterCount()
Get the number of routers
|
int |
getRouterId(int i)
Return id of ith router
|
us.monoid.json.JSONObject |
getRouterLinkStatsAsJSON(int routerID)
Get router stats info, given a router address
and return a JSONObject
|
us.monoid.json.JSONObject |
getRouterLinkStatsAsJSON(int routerID,
int dstID)
Get router stats info, given a router address and a destination router
and return a JSONObject
|
java.util.ArrayList<java.lang.Integer> |
getRouterList()
Accessor function for routerList
|
java.lang.String |
getRouterStats()
Accessor function for routerStats_
|
java.util.ArrayList<BasicRouterInfo> |
getShutdownRouters()
List all shutdown routers
|
long |
getSimulationCurrentTime()
Get the simulation current time.
|
long |
getSimulationElapsedTime()
Get the simulation elapsed time.
|
long |
getSimulationStartTime()
Get the simulation start time.
|
long |
getStartTime()
Get the simulation start time.
|
java.util.HashMap<java.lang.String,int[]> |
getTrafficLinkCounts() |
protected void |
informAllLinks()
Called to give a snapshot of all the links
|
protected void |
informAllRouters()
Called to give a snapshot of all the routers
|
protected void |
informRouterEnded(us.monoid.json.JSONObject routerAttrs)
Called after a router is ended.
|
protected void |
informRouterStarted(us.monoid.json.JSONObject routerAttrs)
Called after a router is started.
|
protected boolean |
init()
Basic intialisation for the global controller
|
boolean |
isConnected(int routerId,
int other)
Is a router directly connected to another one
|
boolean |
isLatticeMonitoring() |
boolean |
isValidAppID(int appId)
Is the app ID valid.
|
boolean |
isValidLinkID(int lId)
Is the link ID valid.
|
boolean |
isValidRouterID(int rId)
Is the router ID valid.
|
us.monoid.json.JSONObject |
listShutdownRoutersAsJSON()
List all shutdown routers
|
static void |
main(java.lang.String[] args)
Main entry point.
|
int |
onRouter(int routerID,
java.lang.String className,
java.lang.String[] args)
Run an application on a Router.
|
void |
preceedEvent(SimEvent e,
EventScheduler s,
GlobalController g)
Add or remove events following a simulation event
|
void |
receiveRouterStats(java.lang.String stats)
Receiver router traffic -- if it completes a set then output it
|
boolean |
reportAP(int gid,
int AP)
Router GID reports a connection to access point AP
|
void |
requestRouterStats()
Request router stats
|
void |
setAP(int gid,
int AP)
Set the agg point for router gid to router AP
|
void |
setLinkCosts(int routerId,
int[] costs) |
int |
setLinkWeight(long time,
int router1Id,
int router2Id,
int weight)
Update the link weight between two routers.
|
void |
setListenPort()
Set the port of the GlobalController
|
void |
setOutLinks(int routerId,
int[] out) |
void |
setStartupFile(java.lang.String file)
Set the startup file
|
protected int |
setupListenPort()
Setup the port for this GlobalController
|
protected void |
shutDown() |
void |
shutDownCommand()
Shutdown called from console -- add shut down command to list to
happen now
|
void |
start() |
protected void |
startConsole()
Start the console.
|
int |
startLink(long time,
int router1Id,
int router2Id,
int weight,
java.lang.String name)
Create a link between two routers.
|
void |
startMonitoringConsumer(java.net.InetSocketAddress addr)
Start listening for router stats using monitoring framework.
|
void |
startMonitoringProducer(java.net.InetSocketAddress addr)
Start producing router stats using monitoring framework.
|
int |
startRouter(long time,
java.lang.String address,
java.lang.String name)
Event to start a router
|
protected void |
stopConsole()
Stop the console.
|
void |
stopMonitoringConsumer()
Stop monitoring.
|
void |
stopMonitoringProducer()
Stop monitoring Producer.
|
void |
waitUntil(long time)
Wait until a specified absolute time is milliseconds.
|
void |
wakeWait()
Interrupt above wait
|
public GlobalController()
public static void main(java.lang.String[] args)
protected boolean init()
public void start()
protected void startConsole()
protected void stopConsole()
public int startRouter(long time, java.lang.String address, java.lang.String name)
public int endRouter(long time, int routerId)
protected void informRouterStarted(us.monoid.json.JSONObject routerAttrs) throws us.monoid.json.JSONException
us.monoid.json.JSONException
protected void informRouterEnded(us.monoid.json.JSONObject routerAttrs) throws us.monoid.json.JSONException
us.monoid.json.JSONException
protected void informAllRouters()
protected void informAllLinks()
public BasicRouterInfo findRouterInfo(int rId)
public BasicRouterInfo findRouterInfo(java.lang.String value)
public us.monoid.json.JSONObject findRouterInfoAsJSON(int routerID) throws us.monoid.json.JSONException
us.monoid.json.JSONException
public java.util.Collection<BasicRouterInfo> getAllRouterInfo()
public us.monoid.json.JSONObject getAllRouterInfoAsJSON(java.lang.String detail) throws us.monoid.json.JSONException
us.monoid.json.JSONException
public int getRouterCount()
public boolean isValidRouterID(int rId)
public java.util.ArrayList<BasicRouterInfo> getShutdownRouters()
public us.monoid.json.JSONObject listShutdownRoutersAsJSON() throws us.monoid.json.JSONException
us.monoid.json.JSONException
public LinkInfo findLinkInfo(int linkID)
public us.monoid.json.JSONObject findLinkInfoAsJSON(int linkID) throws us.monoid.json.JSONException
us.monoid.json.JSONException
public java.util.Collection<LinkInfo> getAllLinkInfo()
public us.monoid.json.JSONObject getAllLinkInfoAsJSON(java.lang.String detail) throws us.monoid.json.JSONException
us.monoid.json.JSONException
public boolean isValidLinkID(int lId)
public java.util.Collection<LinkInfo> findLinkInfoByRouter(int routerID)
public us.monoid.json.JSONObject getRouterLinkStatsAsJSON(int routerID) throws us.monoid.json.JSONException
us.monoid.json.JSONException
public us.monoid.json.JSONObject getRouterLinkStatsAsJSON(int routerID, int dstID) throws us.monoid.json.JSONException
us.monoid.json.JSONException
public int startLink(long time, int router1Id, int router2Id, int weight, java.lang.String name)
public int[] getOutLinks(int routerId)
public void setOutLinks(int routerId, int[] out)
public int getLinkCount()
public boolean isConnected(int routerId, int other)
public int[] getLinkCosts(int routerId)
public void setLinkCosts(int routerId, int[] costs)
public int endLink(long time, int router1Id, int router2Id)
public int setLinkWeight(long time, int router1Id, int router2Id, int weight)
public BasicRouterInfo findAppInfo(int appId)
public us.monoid.json.JSONObject findAppInfoAsJSON(int appID) throws us.monoid.json.JSONException
us.monoid.json.JSONException
public boolean isValidAppID(int appId)
public int onRouter(int routerID, java.lang.String className, java.lang.String[] args)
public int appStart(int routerID, java.lang.String className, java.lang.String[] args)
public int appStop(int routerID, int appID)
public void requestRouterStats()
public java.util.List<java.lang.String> compileRouterStats()
public void shutDownCommand()
protected void shutDown()
public void APControllerUpdate(long time)
public java.util.HashMap<java.lang.String,int[]> getTrafficLinkCounts()
public void checkTrafficOutputRequests(long time, OutputType o)
public void receiveRouterStats(java.lang.String stats)
public java.lang.String getRouterStats()
public void startMonitoringConsumer(java.net.InetSocketAddress addr)
public void stopMonitoringConsumer()
public void startMonitoringProducer(java.net.InetSocketAddress addr)
public void stopMonitoringProducer()
public java.util.List<eu.reservoir.monitoring.core.Reporter> getReporterList()
public eu.reservoir.monitoring.core.Reporter findByLabel(java.lang.String label)
public eu.reservoir.monitoring.core.Reporter findByInterface(java.lang.Class inter)
public void aliveMessage(LocalHostInfo lh)
public void waitUntil(long time)
public void wakeWait()
public long getSimulationStartTime()
public long getStartTime()
public long getSimulationCurrentTime()
public long getSimulationElapsedTime()
public long getEventTime()
public java.lang.String elapsedToString(long elapsedTime)
public cc.clayman.console.ManagementConsole getManagementConsole()
getManagementConsole
in interface ComponentController
public int getMaxRouterId()
public APController getAPController()
public int getLinkWeight(int l1, int l2)
public java.util.ArrayList<java.lang.Integer> getAPs()
public int getAP(int gid)
public void setAP(int gid, int AP)
public void apSet(int gid, int AP)
public boolean reportAP(int gid, int AP)
public void checkIsolated(long time)
public void checkIsolated(long time, int gid)
public void connectNetwork(long time)
public void preceedEvent(SimEvent e, EventScheduler s, GlobalController g)
public void followEvent(SimEvent e, EventScheduler s, GlobalController g, java.lang.Object o)
public void gcFollowEvent(SimEvent e, java.lang.Object o)
public void gcPreceedEvent(SimEvent e)
public void connectNetwork(long time, int r1, int r2)
public boolean isLatticeMonitoring()
public ControlOptions getOptions()
public java.util.ArrayList<java.lang.Integer> getRouterList()
public int getRouterId(int i)
public int getNoRouters()
public LocalHostInfo getLocalHostInfo()
public void setListenPort()
protected int setupListenPort()
public int getPort()
public java.lang.String getName()
getName
in interface ComponentController
public void setStartupFile(java.lang.String file)
User Space Routing 0.10.3