Module: OmfRc::ResourceProxy::Wlan

Extended by:
OmfRc::ResourceProxyDSL::ClassMethods
Includes:
OmfRc::ResourceProxyDSL, Util::Iw, Util::Mod, Util::Sysfs
Defined in:
omf_rc/lib/omf_rc/resource_proxy/wlan.rb

Overview

Proxy module for managing wifi devices

Wlan resources can be created as children of Node.

It is important to set if_name (interface_name) and phy (physical device name) as they are used as identifier for executing iw and ip commands.

Examples:

Set up a wifi interface wlan0 as managed mode

wlan0 = node.create(:wlan, if_name: 'wlan0', phy: 'phy0')
wlan0.configure_mode(mode: :master, hw_mode: 'g', channel: 1, essid: 'bob')

Configure IP address of interface wlan0

wlan0.conifgure_ip_addr("192.168.1.100/24")

See Also:

Constant Summary

Constant Summary

Constants included from OmfRc::ResourceProxyDSL

OmfRc::ResourceProxyDSL::DEFAULT_PROP_ACCESS, OmfRc::ResourceProxyDSL::PROXY_DIR, OmfRc::ResourceProxyDSL::UTIL_DIR

FRCP RC Properties (collapse)

OMF RC Hooks (collapse)

Methods included from OmfRc::ResourceProxyDSL::ClassMethods

call_hook, configure, configure_all, extend_configure, extend_hook, extend_request, extend_work, hook, namespace, property, register_proxy, request, utility, work

Methods included from Util::Sysfs

#request_devices, #request_wlan_devices

Methods included from OmfRc::ResourceProxyDSL

#call_hook, #hook_defined?, included

Methods included from Util::Mod

#configure_load_module, #request_modules

Methods included from Util::Iw

#add_interface, #configure_mode, #delete_interface, #join_ibss, #request_info, #request_link, #validate_iw_properties

Methods included from Util::Hostapd

#hostapd, #init_ap_conf_pid, #stop_hostapd

Methods included from Util::Wpa

#init_wpa_conf_pid, #stop_wpa, #wpasup

Methods included from Util::Ip

#configure_ip_addr, #flush_ip_addrs, #interface_up, #request_ip_addr, #request_mac_addr

Instance Attribute Details

- (Object) if_name

Note:

DSL method 'property' will generate configure_x, request_x, or initialise_x methods according to property's access mode (:configure, :read_only or :init_only)

Interface name, default is 'wlan0'



38
# File 'omf_rc/lib/omf_rc/resource_proxy/wlan.rb', line 38

property :if_name, :default => "wlan0"

- (Object) phy

Note:

DSL method 'property' will generate configure_x, request_x, or initialise_x methods according to property's access mode (:configure, :read_only or :init_only)

Device's physical name



42
# File 'omf_rc/lib/omf_rc/resource_proxy/wlan.rb', line 42

property :phy

Instance Method Details

- (Object) before_release

Stop hostapd or wpa instances before releasing wifi device



62
63
64
65
66
67
68
69
70
71
72
# File 'omf_rc/lib/omf_rc/resource_proxy/wlan.rb', line 62

hook :before_release do |device|
  device.property.timer.cancel

  case device.property.mode.to_sym
  when :master
    device.stop_hostapd
  when :managed
    device.stop_wpa
  end
  device.interface_down
end