net.clackrouter.topology.core
Class TopologyModel

java.lang.Object
  extended by net.clackrouter.topology.core.TopologyModel

public class TopologyModel
extends java.lang.Object

Represents the data of a single topology, combining information from a VNS topology file, and information provided by saved config files.

We get connectivity information from the VNS topology file, as well as host names. We get the graphical position of the components in the graph from the saved XML files.

A topology model can create a TopoGraph to represent this topo.

The topology model also implements the "VSwitch" functionality, that checks to see if a packet being transmitted by a host on a Clack network can be handed directly to another clack host running locally, or whether it must be sent back all the way to the VNS server. This improves speed for larger clack topologies, as we cut out the round-trip to VNS infrastructure (i.e., stanford) for communication between two virtual hosts.


Nested Class Summary
static class TopologyModel.Host
          Represents a single host within a topology.
static class TopologyModel.Interface
          Represents an interface on a host within a topology.
static class TopologyModel.Link
          Represents an link between two hosts inside a topology.
 
Field Summary
static int ALERTER_LENGTH_MSEC
           
 
Constructor Summary
TopologyModel(int topology, java.util.ArrayList hosts, java.util.ArrayList links, boolean isLocal, org.w3c.dom.Element topo_element)
           
 
Method Summary
 boolean attemptLocalTransmit(java.lang.String routerName, TopologyModel.Link activeLink, VNSPacket packet)
           
 TopoGraph createTopoGraph(TopologyView view, ClackDocument doc)
           
 Alerter getAlerter()
           
 EthernetAddress getFirewallHWAddr()
           
 TopologyModel.Host getHost(java.lang.String name)
           
 java.util.ArrayList getHosts()
           
 TopologyModel.Link getLink(java.lang.String router1, java.lang.String router2)
           
 java.util.ArrayList getLinks()
           
 java.util.Hashtable getLinksForHost(java.lang.String hostname)
           
 int getTopology()
           
 org.w3c.dom.Element getTopologyElement()
           
 boolean isLocalTopology()
           
 void setHostBoundsRects(java.util.Hashtable rects)
           
 void setLinkStatus(ClackDocument doc, java.lang.String router_name1, java.lang.String router_name2, boolean is_enabled)
          Used to enable or disable a link.
 void setLinkStatus(ClackDocument doc, TopologyModel.Link link, boolean is_enabled)
          Enable or disable the specified link, updating the GUI
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ALERTER_LENGTH_MSEC

public static final int ALERTER_LENGTH_MSEC
See Also:
Constant Field Values
Constructor Detail

TopologyModel

public TopologyModel(int topology,
                     java.util.ArrayList hosts,
                     java.util.ArrayList links,
                     boolean isLocal,
                     org.w3c.dom.Element topo_element)
Method Detail

isLocalTopology

public boolean isLocalTopology()

getTopologyElement

public org.w3c.dom.Element getTopologyElement()

getLinks

public java.util.ArrayList getLinks()

getHosts

public java.util.ArrayList getHosts()

getAlerter

public Alerter getAlerter()

setHostBoundsRects

public void setHostBoundsRects(java.util.Hashtable rects)

createTopoGraph

public TopoGraph createTopoGraph(TopologyView view,
                                 ClackDocument doc)

getLinksForHost

public java.util.Hashtable getLinksForHost(java.lang.String hostname)

attemptLocalTransmit

public boolean attemptLocalTransmit(java.lang.String routerName,
                                    TopologyModel.Link activeLink,
                                    VNSPacket packet)

getTopology

public int getTopology()

getHost

public TopologyModel.Host getHost(java.lang.String name)

getFirewallHWAddr

public EthernetAddress getFirewallHWAddr()

getLink

public TopologyModel.Link getLink(java.lang.String router1,
                                  java.lang.String router2)

setLinkStatus

public void setLinkStatus(ClackDocument doc,
                          java.lang.String router_name1,
                          java.lang.String router_name2,
                          boolean is_enabled)
Used to enable or disable a link. Just a wrapper around the main setLinkStatus function.

Parameters:
doc -
router_name1 -
router_name2 -
is_enabled -

setLinkStatus

public void setLinkStatus(ClackDocument doc,
                          TopologyModel.Link link,
                          boolean is_enabled)
Enable or disable the specified link, updating the GUI

Parameters:
doc -
link -
is_enabled -