Changes between Version 41 and Version 42 of Internal/NewNodeAgent


Ignore:
Timestamp:
May 18, 2015, 7:03:53 PM (10 years ago)
Author:
ssugrim
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Internal/NewNodeAgent

    v41 v42  
    3939''' Design Notes: '''
    4040
    41 ''' File:kmodule.rb ''' [[BR]]
    42 ''' Class:kmodule ''' [[BR]]
     41''' File: kmodule.rb ''' [[BR]]
     42''' Class: kmodule ''' [[BR]]
    4343''' Interface: '''
    4444 * ''' public methods: '''
     
    5555Moving all the functionality of module handling into a separate class. There may be a need to have drivers load multiple modules. Additionally the module class needs to keep track of how many devices are using one module (as there may be many to one). The unload method should only unload if the last reference asks it to (all other references have de-registered).
    5656
    57 ''' File:nodeagent.rb '''[[BR]]
    58 ''' Class:nodeagent '''[[BR]]
     57''' File: nodeagent.rb '''[[BR]]
     58''' Class: nodeagent '''[[BR]]
    5959''' Interface: '''[[BR]]
    6060 * ''' public methods: '''
     
    6666
    6767
    68 ''' File:agentCommands.rb '''[[BR]]
    69 ''' Module:agentCommands '''[[BR]]
     68''' File: agentCommands.rb '''[[BR]]
     69''' Module: agentCommands '''[[BR]]
    7070''' Interface: '''[[BR]]
    7171 * ''' public methods: '''
     
    7575The BRINGUP command is called after all the initial configs are sent, but before the experiment is started. This instructs the agent to attempt to apply all the configs and bring up / connect interfaces as necissary.
    7676
    77 ''' device.rb '''[[BR]]
    78 ''' Interface '''[[BR]]
    79  * ''' public methods: '''
     77''' File: device.rb '''[[BR]]
     78''' Class: Device '''[[BR]]
     79''' Interface: '''[[BR]]
     80 * ''' public methods: '''
     81  * initialize(logName = nil) - can be used to set logicalName
    8082  * activate - load all modules (via the kmodule.load) and other basic setup to make a device ready to be configure
    8183  * deactivate - deconfigure device and remove module
    8284  * configure - Nothing to configure at this context, raise exception
    83   * hasMod? 
     85  * hasMod?
    8486  * add_kmodName - adds a kernel module name to list of modules for this device
    8587  * start - Nothing to start at this context, raise exception
    8688  * stop - Nothing to stop at this context, raise exception
     89  * apply_conf(prop, value) - No config to apply at this context, raise exception
    8790 * '''readable instance vars: '''
    88   * isActive
    89   * isStarted
     91  * isActive - Desired state Var
     92  * isStarted - Desired state Var
     93  * kmodNames
     94  * media
    9095 * '''accesible instance vars: '''
    91   * logicalName
     96  * logicalName <- can be set via constructor or by direct assignment
    9297  * deviceName <- Maybe this should be just readable
    9398  * configHash <- Maybe this should be just readable
     
    95100The device class is the prototype for all devices. It should not be instantiated, instead it should be extended to child classes which will have proper context to actually start the device and apply configs.
    96101
    97 ''' ethernet.rb < device.rb'''[[BR]]
     102''' File: ethernet.rb'''[[BR]]
     103''' Class: !EthernetDevice < Device '''[[BR]]
    98104''' Interface: '''
    99105 * ''' public methods: '''
    100106  * initialize()
    101107  * claim_ctrl(call_ref)
    102   * self.set_control_if(iface="eth1")
    103   * self.get_control_if()
    104   * control_if?
     108  * set_altKmodName(kmodName) - used to map devname to module/logical name if "driver=" string in lshw does not match original in @kmodNames
     109  * self.set_control_if(iface="eth1") - Set global variable @@controlif which holds the device name of the control if
     110  * self.get_control_if() - read @@controlif
     111  * control_if? - is this device object the control if?
     112  * activate(logicalNumber=nil) - logical number is the numeric part of the logical name, if possible we bind to the deivce name with the same logical number
     113  * deactivate()
     114  * deviceName=(d) - Some additional steps/checks may be required to set device name
     115  * start() - Override the parent start method to establish what start means in the Ethernet context.
     116  * stop()
     117  * up(devName=@deviceName) - optional devicename argument is for the case when multiple logical interfaces are handled by a single driver (e.g. wifi monitor interfaces).
     118  * down(devName=@deviceName)
    105119  * set_ip(ip)
    106   * get_ip()
    107   * up()
    108   * down()
    109120  * set_netmask(netmask)
    110121  * set_mtu(mtu)
    111122  * set_mac(mac)
    112   * get_mac()
    113123  * set_arp(arp)
    114124  * set_forwarding(forwarding)
    115125  * set_gateway(gateway)
    116   * drop_config()
    117   * restart_dhcp()
    118   * execConfigCmd(prop, value=nil)
    119   * getCmdForRoute(value)
    120   * getCmdForFilter(value)
     126  * drop_config() - not used, can be used to recover interface (will reestablish address via dhcp)
     127  * restart_dhcp() - not used, part of drop_config
     128  * apply_conf(prop, value) - checks if prop is from this context. If it is, calls appropriate method, otherwise, calls parent's apply_conf with same args
     129  * configure(prop, value) - check current state (@isActive, @isUP, @isStarted) and apply config. Live if the device was started (may require starting interface).
     130  * get_eth_status(devName) - live check of the Ethernet state of devName, this is independent of @configHash which stores the "desired" state.
     131  * get_gateway
     132  * get_hw_mac(devName) - retrieve the original hardware mac (read from ethtool -p)
     133  * get_up?(devName) - Live check if devName is up (independent of @isUP the desired state)
     134 * '''readable instance vars: '''
     135  * isUp - Desired state Var
     136
     137This class is responsible for all of the ifconfig/route handling code (all things ethernet). The same cocaine lib will handle shell commands with similar exception handeling. The interface has been extended to implement setters for all the requisite interface state (ip, netmask, etc...). The usage scenario is expected to flow as follows:
     138 1. include file and instantiate ''object'' (will probably instantiate one of the hardware specific children instead of !EthernetDevice class proper).
     139 2. Set Logical Name (via constructor or assignment)
     140 3. Activate via ''object''.activate
     141 4. configure requisite parameters via multiple calls to ''object''.configure("prop","value"), this will store them
     142 5. apply configs and bring up interfaces via ''object''.start
     143 6. device should now be ready to used for traffic experiments
     144
     145''' File: wifi.rb '''[[BR]]
     146''' Class: !WifiDevice < !EthernetDevice '''[[BR]]
     147''' Interface: '''
     148 * ''' public methods: '''
     149  * initialize(logName = nil)
     150  * activate(logicalNumber = nil)
     151  * get_ranges() - determine what the allowable ranges are for a given card. (collected but not used)
     152  * get_current_mode(devName) - live mode check, independent of @configHahs["mode"] (e.g. managed, ibss).
     153  * get_wifi_status(devName, att = @stat_retry) - live status check.
     154  * get_connected?(att = 1, refresh = 5) - live connection check.
     155  * connect_adhoc(ssid, freq) - attempt to connect in ibss mode - will raise exceptions if connection fails
     156  * disconnect_adhoc() - attempt ibss leave
     157  * connect_simple(ssid, freq=nil) - attempt to connect to an open managed AP (no WEP/WPA)
     158  * disconnect_simple() - disconnect form managed AP
     159  * start()
     160  * stop()
     161  * build_monitor() - create a monitor interface for the given device
     162  * del_monitor() - take down monitor interface
     163  * set_freq(freq = @configHash["freq"])
     164  * scan() - scan channel sets to learn hearable AP's / adhoc clients
     165  * set_mode(mode) - switch between IBSS (adhoc) and managed mode
     166  * set_essid(essid)
     167  * set_channel(chan) - logical mapping between channel numbers and frequency (really just a wrapper around setting a specific frequency)
     168  * set_rate(rateStr) - takes a string argument of allowable rates (can't be a single item list)
     169  * set_type(type) - Wrapper around rate str that translates a/b/g to rate strings
     170  * apply_conf(prop, value) - same concept as the Ethernet. If prop is in the wifi context set it, otherwise pass it down
     171  * configure(prop, value) - Similar to the Ethernet case. Some settings (e.g. frequency) can be set live. If the can just apply them immediately. Others require a reconnect (e.g. mode) if the interface is already started, this method handles that problem.
    121172  * deactivate()
     173 * '''accesible instance vars: '''
     174  * action_interval
     175  * stat_retry
     176  * connSleep
    122177 * '''readable instance vars: '''
    123  * '''accesible instance vars: '''
    124 
    125 This class is responsible for all of the ifconfig/route handling code (all things ethernet). The same cocaine lib will handle shell commands with similar exception handeling. The interface has been extended to implement getters and setters for all the requisite interface state (ip, netmask, etc...). We've left the original get config command structure alone, but now also have implemented an execConfigCmd which will actually implement these config commands.
    126 
    127 ''' wifi.rb < ethernet.rb '''[[BR]]
    128 ''' Interface: '''
    129  * initialize()
    130  * check_time
    131  * connected?()
    132  * connect_simple(ssid)
    133  * connect_adhoc
    134  * disconnect_simple
    135  * disconnect_adhoc
    136  * disconnect()
    137  * checkStatus(retries = true)
    138  * scan()
    139 
    140 
    141 ''' rcDrv_e1000e.rb < ethernet.rb'''[[BR]]
    142 ''' Interface '''
    143  * new
    144 
    145 e1000e kernel module specif driver. A child of ethernet. Overides any thing that is specific to e1000e, but mostly leaves the parent class in tact. Also sets the value of @kmodName
    146 
    147 
    148 ''' rcdrv_r8169.rb < ethernet.rb'''[[BR]]
    149 ''' Interface '''
    150  * new
    151 
    152 ''' rcdrv_skge.rb < ethernet.rb'''[[BR]]
    153 ''' Interface '''
    154  * new
    155 
    156 ''' rcdrv_ath5k.rb < wifi.rb'''[[BR]]
    157 ''' Interface '''
    158  * new
    159 
    160 ''' rcdrv_ath9k.rb < wifi.rb'''[[BR]]
    161 ''' Interface '''
    162  * new
    163 
    164 ''' rcdrv_ipw2200.rb < wifi.rb'''[[BR]]
    165 ''' Interface '''
    166  * new
     178  * media
     179  * freq_range
     180  * bitrate_range
     181  * monIf
     182  * isConnected - Desired state Var
     183
     184''' File: wimax.rb '''[[BR]]
     185''' Class: !WimaxDevice < !EthernetDevice '''[[BR]]
     186''' Interface: '''
     187 * ''' public methods: '''
     188  * initialize(logName = nil)
     189  * activate(logicalNumber = nil) - in addition to loading the module this checks to make sure wimaxd was started.
     190  * start()
     191  * stop()
     192  * connect()
     193  * disconnect()
     194  * scan() - "wimaxcu scan"
     195  * get_connected?() - uses "wimaxcu info stats" as a check of connectivity. If the interface is connected the stats call will return some values, if it is disconnected it will terminate in error (which will raise a handled exception). 
     196  * info() - returns a string that is the result of "wimaxcu info"
     197  * configure(prop, value) - same function wifi
     198  * get_mac() - uses the get_eth_status method to get the current mac
     199  * current_ip() - uses the get_eth_status method to get the ip for the current device
     200 * '''readable instance vars: '''
     201  * media
     202  * isConnected - Desired state Var
     203
     204
     205''' File: rcDrv_e1000e.rb '''[[BR]]
     206''' Class: RcDrv_e1000e < !EthernetDevice '''[[BR]]
     207''' Interface: '''
     208 * ''' public methods: '''
     209  * initialize(logName = nil) - sets kmod name(s)
     210
     211e1000e kernel module specifc driver. A child of ethernet. Overides any thing that is specific to e1000e, but mostly leaves the parent class in tact. Also sets the value of @kmodName
     212
     213''' File: rcDrv_e1000e.rb '''[[BR]]
     214''' Class: RcDrv_e1000e < !EthernetDevice '''[[BR]]
     215''' Interface: '''
     216 * ''' public methods: '''
     217  * initialize(logName = nil) - sets kmod name(s)
     218
     219''' File: rcdrv_r8169.rb '''[[BR]]
     220''' Class: Rcdrv_r8169.rb < !EthernetDevice '''[[BR]]
     221''' Interface: '''
     222 * ''' public methods: '''
     223  * initialize(logName = nil) - sets kmod name(s)
     224
     225''' File: rcdrv_skge.rb '''[[BR]]
     226''' Class: Rcdrv_skge.rb < !EthernetDevice '''[[BR]]
     227''' Interface: '''
     228 * ''' public methods: '''
     229  * initialize(logName = nil) - sets kmod name(s)
     230
     231''' File: rcdrv_ath5k.rb '''[[BR]]
     232''' Class: Rcdrv_ath5k.rb < !WifiDevice '''[[BR]]
     233''' Interface: '''
     234 * ''' public methods: '''
     235  * initialize(logName = nil) - sets kmod name(s)
     236
     237''' File: rcdrv_ath9k.rb '''[[BR]]
     238''' Class: Rcdrv_ath9k.rb < !WifiDevice '''[[BR]]
     239''' Interface: '''
     240 * ''' public methods: '''
     241  * initialize(logName = nil) - sets kmod name(s)
     242
     243''' File: rcdrv_ipw2200.rb '''[[BR]]
     244''' Class: Rcdrv_ipw2200.rb < !WifiDevice '''[[BR]]
     245''' Interface: '''
     246 * ''' public methods: '''
     247  * initialize(logName = nil) - sets kmod name(s)
     248
     249''' File: rcdrv_wl.rb '''[[BR]]
     250''' Class: Rcdrv_wl.rb < !WifiDevice '''[[BR]]
     251''' Interface: '''
     252 * ''' public methods: '''
     253  * initialize(logName = nil) - sets kmod name(s)
     254
     255
    167256
    168257''' rcdrv_iwlwifi.rb < wifi.rb'''[[BR]]
     
    173262''' Interface '''
    174263 * new
     264
     265
    175266
    176267''' Driver Inheretance Chain '''
     
    454545  * Wifi or Wimax Context
    455546  * Depends on: isUp
     547
     548Also note that these are "desired" states not the actual state. Ideally they properly model the actual state.
    456549----
    4575505/7/2015