Lines Matching refs:self

22     def __init__(self, iface, fst_group, fst_pri, fst_llt=None):  argument
23 self.iface = iface
24 self.fst_group = fst_group
25 self.fst_pri = fst_pri
26 self.fst_llt = fst_llt # None llt means no llt parameter will be set
28 def ifname(self): argument
29 return self.iface
31 def is_ap(self): argument
35 def to_file(self, pathname): argument
43 def __init__(self, iface, ssid, mode, chan, fst_group, fst_pri, argument
45 self.ssid = ssid
46 self.mode = mode
47 self.chan = chan
48 FstLauncherConfig.__init__(self, iface, fst_group, fst_pri, fst_llt)
50 def is_ap(self): argument
53 def get_channel(self): argument
54 return self.chan
56 def to_file(self, pathname): argument
66 "ieee80211n=1\n" % (self.iface, self.ssid, self.chan,
67 self.mode))
68 if len(self.fst_group) != 0:
70 "fst_priority=%s\n" % (self.fst_group, self.fst_pri))
71 if self.fst_llt is not None:
72 f.write("fst_llt=%s\n" % self.fst_llt)
80 def __init__(self, iface, fst_group, fst_pri, fst_llt=None): argument
81 FstLauncherConfig.__init__(self, iface, fst_group, fst_pri, fst_llt)
83 def is_ap(self): argument
86 def to_file(self, pathname): argument
92 if len(self.fst_group) != 0:
94 "fst_priority=%s\n" % (self.fst_group, self.fst_pri))
95 if self.fst_llt is not None:
96 f.write("fst_llt=%s\n" % self.fst_llt)
103 def __init__(self, logpath): argument
104 self.logger = logging.getLogger()
105 self.fst_logpath = logpath
106 self.cfgs_to_run = []
107 self.hapd_fst_global = '/var/run/hostapd-fst-global'
108 self.wsup_fst_global = '/tmp/fststa'
109 self.nof_aps = 0
110 self.nof_stas = 0
111 self.reg_ctrl = fst_test_common.HapdRegCtrl()
112 self.test_is_supported()
114 def __enter__(self): argument
115 return self
117 def __exit__(self, type, value, traceback): argument
118 self.cleanup()
131 def get_cfg_pathname(self, cfg): argument
133 return self.fst_logpath +'/'+ cfg.ifname() + '.conf'
135 def add_cfg(self, cfg): argument
138 if cfg not in self.cfgs_to_run:
139 self.cfgs_to_run.append(cfg)
141 self.nof_aps += 1
143 self.nof_stas += 1
145 def remove_cfg(self, cfg): argument
147 if cfg in self.cfgs_to_run:
148 self.cfgs_to_run.remove(cfg)
150 self.nof_aps -= 1
152 self.nof_stas -= 1
153 config_file = self.get_cfg_pathname(cfg)
157 def run_hostapd(self): argument
160 if self.nof_aps == 0:
162 pidfile = self.fst_logpath + '/' + 'myhostapd.pid'
163 mylogfile = self.fst_logpath + '/' + 'fst-hostapd'
164 prg = os.path.join(self.fst_logpath,
169 '-P', pidfile, '-f', mylogfile, '-g', self.hapd_fst_global]
170 for i in range(0, len(self.cfgs_to_run)):
171 cfg = self.cfgs_to_run[i]
173 cfgfile = self.get_cfg_pathname(cfg)
176 self.reg_ctrl.add_ap(cfg.ifname(), cfg.get_channel())
177 self.logger.debug("Starting fst hostapd: " + ' '.join(cmd))
179 self.logger.debug("fst hostapd start result: %d" % res)
181 self.reg_ctrl.start()
184 def run_wpa_supplicant(self): argument
187 if self.nof_stas == 0:
189 pidfile = self.fst_logpath + '/' + 'mywpa_supplicant.pid'
190 mylogfile = self.fst_logpath + '/' + 'fst-wpa_supplicant'
191 prg = os.path.join(self.fst_logpath,
196 '-P' + pidfile, '-f', mylogfile, '-g', self.wsup_fst_global]
198 for i in range(0, len(self.cfgs_to_run)):
199 cfg = self.cfgs_to_run[i]
201 cfgfile = self.get_cfg_pathname(cfg)
206 if sta_no != self.nof_stas -1:
209 self.logger.debug("Starting fst supplicant: " + ' '.join(cmd))
211 self.logger.debug("fst supplicant start result: %d" % res)
214 def cleanup(self): argument
217 pidfile = self.fst_logpath + '/' + 'myhostapd.pid'
218 self.kill_pid(pidfile, self.nof_aps > 0)
219 pidfile = self.fst_logpath + '/' + 'mywpa_supplicant.pid'
220 self.kill_pid(pidfile, self.nof_stas > 0)
221 self.reg_ctrl.stop()
222 while len(self.cfgs_to_run) != 0:
223 cfg = self.cfgs_to_run[0]
224 self.remove_cfg(cfg)
227 def kill_pid(self, pidfile, try_again=False): argument
234self.logger.info("kill_pid: pidfile %s does not exist - try again after a second" % pidfile)
237self.logger.info("kill_pid: pidfile %s does not exist - could not kill the process" % pidfile)
244 self.logger.debug("kill_pid: %s: '%s'" % (pidfile, pidtxt))
250 self.logger.debug("kill_pid: No valid PID found: %s" % str(e))
252 self.logger.debug("kill_pid %s --> pid %d" % (pidfile, pid))
264self.logger.debug("Didn't stop the pid=%d. Was it stopped already? (%s)" % (pid, str(e)))