Changes between Version 40 and Version 41 of Internal/NewNodeAgent


Ignore:
Timestamp:
May 18, 2015, 3:58:48 PM (10 years ago)
Author:
ssugrim
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Internal/NewNodeAgent

    v40 v41  
    55
    66''' gems: '''
    7  * cocaine refrence [https://github.com/thoughtbot/cocaine here]
     7 * cocaine - refrence [https://github.com/thoughtbot/cocaine here]
    88 * yaml?
    99 * timeout
     
    1313 * lshw
    1414
     15
     16'''Current Images'''
     17
     18 * '''Stable:'''
     19   {{{
     20baseline-ubuntu-12-04-32bit-newResCtl-5-13-2015.ndz
     21   }}}
     22 * '''Testing (wimax featurs):'''
     23   {{{
     24ssugrim-node-node1-1.sb4.orbit-lab.org-2015-05-16-23-05-33.ndz
     25   }}}
    1526
    1627----
     
    2031 * In the Ethernet context, it will return a string that says "Why are you trying to scan with ethernet?"
    2132 * What other configure directives should wimiax/LTE repspond to beside network name.
     33 * Test Wimax features
     34 * Test other tutorials against the base function
     35 * Return IP address in the result hash of start. For devices that autodhcp when started (e.g. wimax)
     36 * LTE support - requires pushing commands into serial to start a connection.
    2237
    2338----
    2439''' Design Notes: '''
    2540
    26 ''' Lib:kmodule.rb ''' [[BR]]
     41''' File:kmodule.rb ''' [[BR]]
    2742''' Class:kmodule ''' [[BR]]
    2843''' Interface: '''
    29  * new (private)
    30  * instance - give you and instance of the object with checks to make sure the module name is unique
    31  * mload(private) - loads the module if needed and registers a reference to the class that requested the load
    32  * munload - unloads module is conditions are met, and de-registers the unload requester
    33  * loaded? - preforms an actual check to see if module is loaded
     44 * ''' public methods: '''
     45  * new (private)
     46  * self.lsmod - output of lsmod
     47  * self.instance - give you and instance of the object with checks to make sure the module name is unique
     48  * self.set_interval - sleep interval between modprobe commands
     49  * mload(private) - loads the module if needed and registers a reference to the class that requested the load
     50  * munload - unloads module is conditions are met, and de-registers the unload requester
     51  * loaded? - preforms an actual check to see if module is loaded
     52 * '''readable instance vars: '''
     53  * kmodName
    3454
    3555Moving 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).
    3656
    37 ''' Lib:nodeagent.rb: '''[[BR]]
    38 ''' Class:nodeagent.rb: '''[[BR]]
    39 ''' Interface '''
    40  * hwDiscover -
    41  * instance
    42  * run
     57''' File:nodeagent.rb '''[[BR]]
     58''' Class:nodeagent '''[[BR]]
     59''' Interface: '''[[BR]]
     60 * ''' public methods: '''
     61  * hwDiscover - uses lspci,lsusb, and lshw to discover what hardware is installed. It also checks what modules are preloaded and creates objects to manage them.
     62  * instance
     63  * run
    4364
    4465The hwdiscovery mode of the nodeagent code is being re-done. Instead of the original grep lspci lines, we now have has of dev_id's. Each dev_id in the hash maps to a node agent device driver that will be loaded to handle that specific device. This device will load the module for it's respective device type.
    4566
    4667
    47 ''' agentCommands.rb: '''[[BR]]
    48 ''' Interface '''
    49  * configure
     68''' File:agentCommands.rb '''[[BR]]
     69''' Module:agentCommands '''[[BR]]
     70''' Interface: '''[[BR]]
     71 * ''' public methods: '''
     72  * CONFIGURE
     73  * BRINGUP
     74
     75The 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.
    5076
    5177''' device.rb '''[[BR]]
    52 ''' Interface '''
    53  * activate
    54  * deactivate
    55  * active?
    56  * getconfigCMD
    57  * configure
    58  * hasMod?
    59  *add_kmodName
    60 
    61 We're implementing all the module handeling code here. It uses the cocaine command line library as a wrapper. The cocaine lib kicks out an exception if the command fails. Exception handling will mitigate failed commands.
     78''' Interface '''[[BR]]
     79 * ''' public methods: '''
     80  * activate - load all modules (via the kmodule.load) and other basic setup to make a device ready to be configure
     81  * deactivate - deconfigure device and remove module
     82  * configure - Nothing to configure at this context, raise exception
     83  * hasMod?
     84  * add_kmodName - adds a kernel module name to list of modules for this device
     85  * start - Nothing to start at this context, raise exception
     86  * stop - Nothing to stop at this context, raise exception
     87 * '''readable instance vars: '''
     88  * isActive
     89  * isStarted
     90 * '''accesible instance vars: '''
     91  * logicalName
     92  * deviceName <- Maybe this should be just readable
     93  * configHash <- Maybe this should be just readable
     94
     95The 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.
    6296
    6397''' ethernet.rb < device.rb'''[[BR]]
    64 ''' Interface '''
    65  * initialize()
    66  * claim_ctrl(call_ref)
    67  * self.set_control_if(iface="eth1")
    68  * self.get_control_if()
    69  * control_if?
    70  * set_ip(ip)
    71  * get_ip()
    72  * up()
    73  * down()
    74  * set_netmask(netmask)
    75  * set_mtu(mtu)
    76  * set_mac(mac)
    77  * get_mac()
    78  * set_arp(arp)
    79  * set_forwarding(forwarding)
    80  * set_gateway(gateway)
    81  * drop_config()
    82  * restart_dhcp()
    83  * execConfigCmd(prop, value=nil)
    84  * getCmdForRoute(value)
    85  * getCmdForFilter(value)
    86  * deactivate()
    87 
    88  
     98''' Interface: '''
     99 * ''' public methods: '''
     100  * initialize()
     101  * claim_ctrl(call_ref)
     102  * self.set_control_if(iface="eth1")
     103  * self.get_control_if()
     104  * control_if?
     105  * set_ip(ip)
     106  * get_ip()
     107  * up()
     108  * down()
     109  * set_netmask(netmask)
     110  * set_mtu(mtu)
     111  * set_mac(mac)
     112  * get_mac()
     113  * set_arp(arp)
     114  * set_forwarding(forwarding)
     115  * set_gateway(gateway)
     116  * drop_config()
     117  * restart_dhcp()
     118  * execConfigCmd(prop, value=nil)
     119  * getCmdForRoute(value)
     120  * getCmdForFilter(value)
     121  * deactivate()
     122 * '''readable instance vars: '''
     123 * '''accesible instance vars: '''
    89124
    90125This 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.
    91126
    92127''' wifi.rb < ethernet.rb '''[[BR]]
    93 ''' Interface '''
     128''' Interface: '''
    94129 * initialize()
    95130 * check_time