net.clackrouter.component.base
Class Interface

java.lang.Object
  extended by net.clackrouter.component.base.ClackComponent
      extended by net.clackrouter.component.base.Interface
All Implemented Interfaces:
Alarm
Direct Known Subclasses:
InterfaceIn, InterfaceOut

public abstract class Interface
extends ClackComponent

Abstract parent class of both InterfaceIn and InterfaceOut, which provides the basic functionality of a Clack Interface component. Interfaces are unique in that they cannot be created or destroyed, but rather they are defined by the topology, as are their attributes like hardware address, IP address and netmask.


Nested Class Summary
 
Nested classes/interfaces inherited from class net.clackrouter.component.base.ClackComponent
ClackComponent.Waiter
 
Field Summary
protected  java.lang.String device_name
           
 EthernetAddress ETH_BCAST_ADDR
           
static java.lang.String IP_ADDRESS
           
static java.lang.String IP_NETMASK
           
protected  EthernetAddress m_eth_addr
           
protected  java.net.InetAddress m_ip_addr
           
protected  java.net.InetAddress m_ip_subnet
           
 
Fields inherited from class net.clackrouter.component.base.ClackComponent
componentCell, m_has_error, m_log, m_name, m_num_ports, m_packetcount_in, m_packetcount_out, m_ports, mListeners, mRouter, pendingError, SIGNAL_ERROR_LEN_MSEC, UNIQUE_COUNT, view
 
Constructor Summary
Interface(java.lang.String name, Router router, TopologyModel.Interface entry)
           
Interface(java.lang.String name, Router router, VNSHWInfo.InterfaceEntry entry)
          Creates a new interface component
 
Method Summary
 java.awt.Color getColor()
          The color this component should be rendered in, assuming a standard component rendering by the ComponentView.ComponentRenderer class.
 java.lang.String getDeviceName()
          Gets simple device name of the component (e.g.
 java.net.InetAddress getIPAddress()
          Get IP address associated with this interface
 java.net.InetAddress getIPSubnet()
          Get subnet mask for this interface
 EthernetAddress getMACAddress()
          Get hardware address associated with this interface
 java.lang.String getMACAddressString()
          Get hardware MAC address as a string
 java.util.Properties getSerializableProperties(boolean isTransient)
          Used to get all values the component would like to serialize to file.
 java.lang.String getTypeName()
          For an interface, the type name to be displayed is the actual name of the component (e.g.
 void initializeProperties(java.util.Properties props)
          Method used to initialize a component based on serialized properties values saved to a file.
 void setIPAddress(java.net.InetAddress a)
           
 void setIPSubnet(java.net.InetAddress s)
           
 
Methods inherited from class net.clackrouter.component.base.ClackComponent
acceptPacket, createCopy, createInputPullPort, createInputPushPort, createOutputPullPort, createOutputPushPort, error, fireListeners, getComponentCell, getHierarchicalView, getLog, getName, getNumPorts, getPacketCountIn, getPacketCountOut, getPendingError, getPort, getPropertiesView, getRouter, getTime, getUniqueCount, getView, handlePullRequest, hasError, isHierarchical, isModifying, log, notifyAlarm, poll, registerListener, sendOutPort, setAlarm, setComponentCell, setName, setPendingError, setupPorts, setView, showErrorDialog, signalError, try_repaint, unregisterListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_eth_addr

protected EthernetAddress m_eth_addr

m_ip_addr

protected java.net.InetAddress m_ip_addr

m_ip_subnet

protected java.net.InetAddress m_ip_subnet

ETH_BCAST_ADDR

public EthernetAddress ETH_BCAST_ADDR

device_name

protected java.lang.String device_name

IP_ADDRESS

public static java.lang.String IP_ADDRESS

IP_NETMASK

public static java.lang.String IP_NETMASK
Constructor Detail

Interface

public Interface(java.lang.String name,
                 Router router,
                 VNSHWInfo.InterfaceEntry entry)
Creates a new interface component

Parameters:
name - unique name for this component in the router
router - parent router for this component
entry - Clack specific data-structure specifying Interface attributes

Interface

public Interface(java.lang.String name,
                 Router router,
                 TopologyModel.Interface entry)
Method Detail

getMACAddress

public EthernetAddress getMACAddress()
Get hardware address associated with this interface


getIPAddress

public java.net.InetAddress getIPAddress()
Get IP address associated with this interface


setIPAddress

public void setIPAddress(java.net.InetAddress a)

getIPSubnet

public java.net.InetAddress getIPSubnet()
Get subnet mask for this interface


setIPSubnet

public void setIPSubnet(java.net.InetAddress s)

getDeviceName

public java.lang.String getDeviceName()
Gets simple device name of the component (e.g. "eth0")


getMACAddressString

public java.lang.String getMACAddressString()
Get hardware MAC address as a string


getSerializableProperties

public java.util.Properties getSerializableProperties(boolean isTransient)
Description copied from class: ClackComponent

Used to get all values the component would like to serialize to file.

These values are stored as String -> String pairs in a Properties object. These properties will be passed to ClackComponent.initializeProperties(Properties) when the Component is recreated.

Serialization can be transient or not, which determines whether all or just some of the internal component state is saved. Transient serialization means that some properties will be saved which may make this serialized file invalid for use on different network or router set-ups. For example, saving info specific to the IP addresses of a certain topology would only happen if transient serialization was used. However, it can be desireable to save these properties when setting up exact demonstrations.

By default we have no properties to serialize, so we return an empty object

Overrides:
getSerializableProperties in class ClackComponent
Parameters:
isTransient - flag indicating if serialization is transient
Returns:
all property key-value pairs to serialize

initializeProperties

public void initializeProperties(java.util.Properties props)
Description copied from class: ClackComponent

Method used to initialize a component based on serialized properties values saved to a file.

By default, no action is performed

Overrides:
initializeProperties in class ClackComponent
Parameters:
props - all property values serialized for this component

getTypeName

public java.lang.String getTypeName()
For an interface, the type name to be displayed is the actual name of the component (e.g. FromDevice(eth0))

Overrides:
getTypeName in class ClackComponent
Returns:
the component's type name

getColor

public java.awt.Color getColor()
Description copied from class: ClackComponent

The color this component should be rendered in, assuming a standard component rendering by the ComponentView.ComponentRenderer class.

Other renderers may ignore this value.

Overrides:
getColor in class ClackComponent
Returns:
the rendering color