Changes between Version 40 and Version 41 of Internal/NewNodeAgent
- Timestamp:
- May 18, 2015, 3:58:48 PM (10 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Internal/NewNodeAgent
v40 v41 5 5 6 6 ''' gems: ''' 7 * cocaine refrence [https://github.com/thoughtbot/cocaine here]7 * cocaine - refrence [https://github.com/thoughtbot/cocaine here] 8 8 * yaml? 9 9 * timeout … … 13 13 * lshw 14 14 15 16 '''Current Images''' 17 18 * '''Stable:''' 19 {{{ 20 baseline-ubuntu-12-04-32bit-newResCtl-5-13-2015.ndz 21 }}} 22 * '''Testing (wimax featurs):''' 23 {{{ 24 ssugrim-node-node1-1.sb4.orbit-lab.org-2015-05-16-23-05-33.ndz 25 }}} 15 26 16 27 ---- … … 20 31 * In the Ethernet context, it will return a string that says "Why are you trying to scan with ethernet?" 21 32 * 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. 22 37 23 38 ---- 24 39 ''' Design Notes: ''' 25 40 26 ''' Lib:kmodule.rb ''' [[BR]]41 ''' File:kmodule.rb ''' [[BR]] 27 42 ''' Class:kmodule ''' [[BR]] 28 43 ''' 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 34 54 35 55 Moving 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). 36 56 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 43 64 44 65 The 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. 45 66 46 67 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 75 The 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. 50 76 51 77 ''' 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 95 The 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. 62 96 63 97 ''' 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: ''' 89 124 90 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. 91 126 92 127 ''' wifi.rb < ethernet.rb '''[[BR]] 93 ''' Interface '''128 ''' Interface: ''' 94 129 * initialize() 95 130 * check_time