freewifi 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,669 @@
1
+ $LOAD_PATH.unshift File.expand_path("../cisco/iwag", __dir__)
2
+ $LOAD_PATH.unshift File.expand_path("../mikrotik", __dir__)
3
+ $LOAD_PATH.unshift File.expand_path("../huawei", __dir__)
4
+
5
+ require 'freewifi/cisco/iwag/iwag_telnet_connector'
6
+ require 'freewifi/mikrotik/newhub_mtik_api'
7
+ require 'freewifi/huawei/hua_controller_class'
8
+ require 'rubygems'
9
+ require 'savon'
10
+
11
+ class WiFiPortal_1
12
+ attr_accessor :iwag_telnet_connector,
13
+ :ard_api_gw_connector_wifi,
14
+ :iwag1_host,
15
+ :iwag_username,
16
+ :iwag_password,
17
+ :mtik_control_ips_get,
18
+ :mtik_user,
19
+ :mtik_password,
20
+ :mtik_api_connector,
21
+ :hua_controller_connector
22
+
23
+ def initialize(apigw_wsdl, apigw_endpoint, apigw_namespace, apigw_wsse_aut_log, apigw_wsse_aut_pass, iwag1_host, iwag_username, iwag_password, mtik_control_ips_get, mtik_user, mtik_password, hua_wlc_1_ip, hua_wlc_2_ip, hua_wlc_login, hua_wlc_password)
24
+ @iwag_telnet_connector = CSRtelnet_1.new(iwag1_host, iwag_username, iwag_password)
25
+ @ard_api_gw_connector_wifi = Savon.client do
26
+ #ssl_verify_mode :none
27
+ wsdl apigw_wsdl
28
+ endpoint apigw_endpoint
29
+ namespace apigw_namespace
30
+ wsse_auth(apigw_wsse_aut_log, apigw_wsse_aut_pass, :digest)
31
+ encoding 'UTF-8'
32
+ headers = {"Accept-Encoding" => "gzip, deflate", "Connection" => "Keep-Alive"}
33
+ end
34
+
35
+ @iwag1_host = iwag1_host
36
+ @iwag_username = iwag_username
37
+ @iwag_password = iwag_password
38
+
39
+ @mtik_api_connector = NEWhubWifiApi_1.new(mtik_control_ips_get, mtik_user, mtik_password)
40
+
41
+ @hua_controller_connector = HuaWifi_1.new(hua_wlc_1_ip, hua_wlc_2_ip, hua_wlc_login, hua_wlc_password)
42
+
43
+ end
44
+
45
+
46
+ def python_mac_iwag1_1(ipaddress)
47
+ begin
48
+ response = ard_api_gw_connector_wifi.call(:mts_python_mac_iwag1) do
49
+ message({:ipaddress => ipaddress})
50
+ end
51
+ answer = response.to_hash
52
+ return answer[:mts_python_mac_iwag1_response][:data].gsub("\n", "")
53
+ rescue
54
+ return "Unknown Unknown Unknown Unknown"
55
+ end
56
+ end
57
+
58
+ def python_mac_iwag2_1(ipaddress)
59
+ begin
60
+ response = ard_api_gw_connector_wifi.call(:mts_python_mac_iwag2) do
61
+ message({:ipaddress => ipaddress})
62
+ end
63
+ answer = response.to_hash
64
+ return answer[:mts_python_mac_iwag2_response][:data].gsub("\n", "")
65
+ rescue
66
+ return "Unknown Unknown Unknown Unknown"
67
+ end
68
+ end
69
+
70
+ def get_subs_add_info3_1(ipaddress, access_interface)
71
+
72
+ answer = ""
73
+
74
+ #region get additional information
75
+ if access_interface != "false"
76
+
77
+ subscribers_mac = ""
78
+
79
+ begin
80
+
81
+ dump =""
82
+ connection = Net::Telnet.new( "Host" => "172.24.247.183", "Timeout" => false, "Prompt" => /.*\#/ ) { |str| }
83
+ connection.login({ "Name" => iwag_username, "Password" => iwag_password, "LoginPrompt" => /Username:/ }) { |str| }
84
+ connection.cmd("show ip dhcp binding #{ipaddress}") {
85
+ |c|
86
+ dump << c
87
+ }
88
+ connection.close
89
+ as = dump.split("\n")
90
+ reer = as[4].split(" ")
91
+
92
+ ma = reer[1].to_s.upcase
93
+ pos = ma[0]+ma[1]
94
+ if pos=="01"
95
+ subscribers_mac = ma[2]+ma[3]+":"+ma[5]+ma[6]+":"+ma[7]+ma[8]+":"+ma[10]+ma[11]+":"+ma[12]+ma[13]+":"+ma[15]+ma[16]
96
+ else
97
+ subscribers_mac = ma[0]+ma[1]+":"+ma[2]+ma[3]+":"+ma[5]+ma[6]+":"+ma[7]+ma[8]+":"+ma[10]+ma[11]+":"+ma[12]+ma[13]
98
+ end
99
+
100
+
101
+ rescue
102
+ subscribers_mac = "unknown"
103
+ end
104
+
105
+ begin
106
+ thr0 = Thread.new do
107
+ begin
108
+ p mikr_info5 = mtik_api_connector.get_info_subs_from_mik_1(subscribers_mac, "172.24.247.15")
109
+ splitting5 = mikr_info5.split("---")
110
+ if splitting5[1] != "not on mikrotik controller" && splitting5[1]!="unknown" && splitting5[1]!=nil
111
+ answer = mikr_info5
112
+ end
113
+ rescue
114
+ p "thr1 wrong"
115
+ end
116
+ end
117
+ rescue
118
+ p "thread 0 failed"
119
+ end
120
+
121
+
122
+ begin
123
+ thr1 = Thread.new do
124
+ begin
125
+ p mikr_info7 = mtik_api_connector.get_info_subs_from_mik_1(subscribers_mac, "172.24.214.155")
126
+ splitting7 = mikr_info7.split("---")
127
+ if splitting7[1] != "not on mikrotik controller" && splitting7[1]!="unknown" && splitting7[1]!=nil
128
+ answer = mikr_info7
129
+ end
130
+ rescue
131
+ p "thr1 wrong"
132
+ end
133
+ end
134
+ rescue
135
+ p "thread 1 failed"
136
+ end
137
+
138
+
139
+ begin
140
+ thr2 = Thread.new do
141
+ begin
142
+ p mikr_info9 = mtik_api_connector.get_info_subs_from_mik_1(subscribers_mac, "172.24.214.140")
143
+ splitting9 = mikr_info9.split("---")
144
+ if splitting9[1] != "not on mikrotik controller" && splitting9[1]!="unknown" && splitting9[1]!=nil
145
+ answer = mikr_info9
146
+ end
147
+ rescue
148
+ p "thr2 wrong"
149
+ end
150
+ end
151
+ rescue
152
+ p "thread 2 failed"
153
+ end
154
+
155
+
156
+ begin
157
+ thr3 = Thread.new do
158
+ begin
159
+ p mikr_info9 = mtik_api_connector.get_info_subs_from_mik_1(subscribers_mac, "172.24.214.105")
160
+ splitting9 = mikr_info9.split("---")
161
+ if splitting9[1] != "not on mikrotik controller" && splitting9[1]!="unknown" && splitting9[1]!=nil
162
+ answer = mikr_info9
163
+ end
164
+ rescue
165
+ p "thr3 wrong"
166
+ end
167
+ end
168
+ rescue
169
+ p "thread 3 failed"
170
+ end
171
+
172
+ begin
173
+ thr4 = Thread.new do
174
+ begin
175
+ p mikr_info9 = mtik_api_connector.get_info_subs_from_mik_1(subscribers_mac, "172.24.223.105")
176
+ splitting9 = mikr_info9.split("---")
177
+ if splitting9[1] != "not on mikrotik controller" && splitting9[1]!="unknown" && splitting9[1]!=nil
178
+ answer = mikr_info9
179
+ end
180
+ rescue
181
+ p "thr4 wrong"
182
+ end
183
+ end
184
+ rescue
185
+ p "thread 4 failed"
186
+ end
187
+
188
+
189
+ thr0.join
190
+ thr1.join
191
+ thr2.join
192
+ thr3.join
193
+ thr4.join
194
+
195
+ if answer==""
196
+ answer = subscribers_mac + "---" + "not on mikrotik controller" + "---" + "unknown" + "---" + "unknown" + "---"+ "unknown" + "---"+ "unknown" + "---"+ "unknown" + "---"+ "unknown" + "---"+ "unknown" + "---"+ "unknown"
197
+ end
198
+
199
+ end
200
+
201
+
202
+ return answer
203
+
204
+ end
205
+
206
+
207
+
208
+ def get_subs_add_info4new_1(access_interface,subscribers_mac)
209
+
210
+ answer = ""
211
+
212
+ #region get additional information
213
+ if access_interface != "false"
214
+
215
+ p subscribers_mac
216
+
217
+ thr0 = Thread.new do
218
+ begin
219
+ p mikr_info5 = mtik_api_connector.get_info_subs_from_mik_1(subscribers_mac, "172.24.247.15")
220
+ splitting5 = mikr_info5.split("---")
221
+ if splitting5[1] != "not on mikrotik controller" && splitting5[1]!="unknown" && splitting5[1]!=nil
222
+ answer = mikr_info5
223
+ end
224
+ rescue
225
+ p "thr0 wrong"
226
+ end
227
+ end
228
+
229
+ thr1 = Thread.new do
230
+ begin
231
+ p mikr_info7 = mtik_api_connector.get_info_subs_from_mik_1(subscribers_mac, "172.24.214.155")
232
+ splitting7 = mikr_info7.split("---")
233
+ if splitting7[1] != "not on mikrotik controller" && splitting7[1]!="unknown" && splitting7[1]!=nil
234
+ answer = mikr_info7
235
+ end
236
+ rescue
237
+ p "thr1 wrong"
238
+ end
239
+ end
240
+
241
+ thr2 = Thread.new do
242
+ begin
243
+ p mikr_info9 = mtik_api_connector.get_info_subs_from_mik_1(subscribers_mac, "172.24.214.140")
244
+ splitting9 = mikr_info9.split("---")
245
+ if splitting9[1] != "not on mikrotik controller" && splitting9[1]!="unknown" && splitting9[1]!=nil
246
+ answer = mikr_info9
247
+ end
248
+ rescue
249
+ p "thr2 wrong"
250
+ end
251
+ end
252
+
253
+
254
+ begin
255
+ thr3 = Thread.new do
256
+ begin
257
+ p mikr_info9 = mtik_api_connector.get_info_subs_from_mik_1(subscribers_mac, "172.24.214.105")
258
+ splitting9 = mikr_info9.split("---")
259
+ if splitting9[1] != "not on mikrotik controller" && splitting9[1]!="unknown" && splitting9[1]!=nil
260
+ answer = mikr_info9
261
+ end
262
+ rescue
263
+ p "thr3 wrong"
264
+ end
265
+ end
266
+ rescue
267
+ p "thread 3 failed"
268
+ end
269
+
270
+ begin
271
+ thr4 = Thread.new do
272
+ begin
273
+ p mikr_info9 = mtik_api_connector.get_info_subs_from_mik_1(subscribers_mac, "172.24.223.105")
274
+ splitting9 = mikr_info9.split("---")
275
+ if splitting9[1] != "not on mikrotik controller" && splitting9[1]!="unknown" && splitting9[1]!=nil
276
+ answer = mikr_info9
277
+ end
278
+ rescue
279
+ p "thr4 wrong"
280
+ end
281
+ end
282
+ rescue
283
+ p "thread 4 failed"
284
+ end
285
+
286
+ thr0.join
287
+ thr1.join
288
+ thr2.join
289
+ thr3.join
290
+ thr4.join
291
+
292
+ if answer==""
293
+ answer = subscribers_mac + "---" + "not on mikrotik controller" + "---" + "unknown" + "---" + "unknown" + "---"+ "unknown" + "---"+ "unknown" + "---"+ "unknown" + "---"+ "unknown" + "---"+ "unknown" + "---"+ "unknown"
294
+ end
295
+
296
+ end
297
+
298
+
299
+ return answer
300
+
301
+ end
302
+
303
+
304
+
305
+
306
+
307
+ def get_subs_info_return_1(ip_address)
308
+
309
+ input_params = {:ip_address => ip_address}
310
+ output_params = {}
311
+
312
+ begin
313
+ ipaddr_full = ip_address
314
+ ipaddr1 = IPAddr.new ipaddr_full
315
+ p ipaddr2 = ipaddr1.mask(17).to_s
316
+ p ipaddr3 = ipaddr2.to_s
317
+
318
+ if ipaddr3=="100.71.0.0" #iwag old
319
+
320
+ begin
321
+ p access_int = iwag_telnet_connector.return_iwag_access_interface_1(ip_address)
322
+
323
+ ip_a = ip_address
324
+
325
+ access_poi = "unknown"
326
+ ssid_a = "unknown"
327
+ tx_rate_se = "unknown"
328
+ tx_rat = "unknown"
329
+ rx_rat = "unknown"
330
+ rx_signa = "unknown"
331
+ uptim = "unknown"
332
+ packet = "unknown"
333
+ byt = "unknown"
334
+
335
+ if access_int == "Tunnel5"
336
+ mikr_info2 = self.get_subs_add_info3_1(ip_address, access_int)
337
+ splitting2 = mikr_info2.split("---")
338
+ subs_mac = splitting2[0]
339
+ access_poi = "belrw_3_Cisco_ap1-1"
340
+ ssid_a = "BelRW_WiFi"
341
+ tx_rate_se = "unknown"
342
+ tx_rat = "unknown"
343
+ rx_rat = "unknown"
344
+ rx_signa = "unknown"
345
+ uptim = "unknown"
346
+ packet = "unknown"
347
+ byt = "unknown"
348
+ elsif access_int == "GigabitEthernet2.4008"
349
+ mikr_info3 = self.get_subs_add_info3_1(ip_address, access_int)
350
+ splitting3 = mikr_info3.split("---")
351
+ subs_mac = splitting3[0]
352
+ access_poi = "belrw_4_HP_ap1-1"
353
+ ssid_a = "BelRW_WiFi"
354
+ tx_rate_se = "unknown"
355
+ tx_rat = "unknown"
356
+ rx_rat = "unknown"
357
+ rx_signa = "unknown"
358
+ uptim = "unknown"
359
+ packet = "unknown"
360
+ byt = "unknown"
361
+ elsif access_int == "Tunnel9"
362
+ subs_mac = iwag_telnet_connector.get_subs_mac2_1(ip_address)
363
+ p resp1 = hua_controller_connector.get_sub_info_1(subs_mac)
364
+ p resp=resp1.split(",,,")
365
+
366
+ p access_poi = resp[1]
367
+ p ssid_a = resp[2]
368
+ p tx_rate_se = resp[3]
369
+ p tx_rat = resp[4]
370
+ p rx_rat = resp[5]
371
+ p rx_signa = resp[6]
372
+ p uptim = resp[7]
373
+ p packet = resp[8]
374
+ p byt = resp[9]
375
+ elsif access_int == "Tunnel16"
376
+ subs_mac = iwag_telnet_connector.get_subs_mac2_1(ip_address)
377
+ p resp1 = hua_controller_connector.get_sub_info2_1(subs_mac)
378
+ p resp=resp1.split(",,,")
379
+
380
+ p access_poi = resp[1]
381
+ p ssid_a = resp[2]
382
+ p tx_rate_se = resp[3]
383
+ p tx_rat = resp[4]
384
+ p rx_rat = resp[5]
385
+ p rx_signa = resp[6]
386
+ p uptim = resp[7]
387
+ p packet = resp[8]
388
+ p byt = resp[9]
389
+ else
390
+ p "before get info"
391
+ p mikr_info5 = self.get_subs_add_info3_1(ip_address, access_int)
392
+ p "after get info"
393
+ splitting5 = mikr_info5.split("---")
394
+ p subs_mac = splitting5[0]
395
+
396
+ p access_poi = splitting5[1]
397
+ p ssid_a = splitting5[2]
398
+ p tx_rate_se = splitting5[3]
399
+ p tx_rat = splitting5[4]
400
+ p rx_rat = splitting5[5]
401
+ p rx_signa = splitting5[6]
402
+ p uptim = splitting5[7]
403
+ p packet = splitting5[8]
404
+ p byt = splitting5[9]
405
+
406
+
407
+ if access_poi==nil || access_poi=="" || access_poi=="unknown"
408
+ access_poi = "not on mikrotik controller"
409
+ end
410
+
411
+ if ssid_a==nil || ssid_a=="" || ssid_a=="unknown"
412
+ ssid_a = "unknown"
413
+ tx_rate_se = "unknown"
414
+ tx_rat = "unknown"
415
+ rx_rat = "unknown"
416
+ rx_signa = "unknown"
417
+ uptim = "unknown"
418
+ packet = "unknown"
419
+ byt = "unknown"
420
+ end
421
+
422
+ end
423
+
424
+ if subs_mac=="unknown"
425
+ output_params = {:code => 505, :result => "ERROR. Something wrong."}
426
+ end
427
+
428
+ if subs_mac==""
429
+ subs_mac="unknown"
430
+ end
431
+
432
+
433
+ mess = {:iwag_access_interface => access_int,
434
+ :subscribers_mac => subs_mac,
435
+ :access_point => access_poi,
436
+ :ssid_ap => ssid_a,
437
+ :apid => "unknown",
438
+ :statistics =>
439
+ {:tx_rate_set => tx_rate_se,
440
+ :tx_rate => tx_rat,
441
+ :rx_rate => rx_rat,
442
+ :rx_signal => rx_signa,
443
+ :uptime => uptim,
444
+ :packets => packet,
445
+ :bytes => byt}
446
+ }
447
+ # logger.info "HAproxy #{request.remote_ip}, request device real ip: #{request.headers['X-Client']}, ipaddressinputparameter: #{ip_address} recieved from mts_wifi_get_subs_info_return procedure of wifi_portal_controller such information as: #{mess.to_xml}"
448
+ render :soap => mess
449
+ rescue
450
+
451
+ puts 'SOAP mts_wifi_get_subs_info_return errorMethod'
452
+ output_params = {:code => 505, :result => "ERROR. Something wrong."}
453
+ end
454
+
455
+ elsif ipaddr3=="100.75.0.0" #min11iwag2
456
+
457
+ begin
458
+ result_iwag = self.python_mac_iwag2_1(ip_address)
459
+ if result_iwag.split(" ")[0]!="Unknown"
460
+ ppp = result_iwag.split(" ")
461
+
462
+ subs_mac = ppp[0]
463
+ access_int = ppp[1]
464
+ access_poi = ppp[2]
465
+ ssid_a = ppp[3]
466
+
467
+ tx_rate_se = "unknown"
468
+ tx_rat = "unknown"
469
+ rx_rat = "unknown"
470
+ rx_signa = "unknown"
471
+ uptim = "unknown"
472
+ packet = "unknown"
473
+ byt = "unknown"
474
+
475
+ if access_int=='GigabitEthernet4.3002'
476
+ access_poi = "belrw_4_HP_ap1-1"
477
+ ssid_a = "BelRW_WiFi"
478
+ elsif access_int=='GigabitEthernet4.3005'
479
+ access_poi = "belbiz-AP1-1"
480
+ ssid_a = "IMAGURU_GUEST"
481
+ end
482
+
483
+ if access_poi == "Unknown" && ssid_a == "Unknown" && subs_mac != "Unknown"
484
+ frommikrotik = self.get_subs_add_info4new_1(access_int, subs_mac)
485
+ splitting5 = frommikrotik.split("---")
486
+ p access_poi = splitting5[1]
487
+ p ssid_a = splitting5[2]
488
+ p tx_rate_se = splitting5[3]
489
+ p tx_rat = splitting5[4]
490
+ p rx_rat = splitting5[5]
491
+ p rx_signa = splitting5[6]
492
+ p uptim = splitting5[7]
493
+ p packet = splitting5[8]
494
+ p byt = splitting5[9]
495
+ end
496
+
497
+ if subs_mac=="unknown"
498
+ output_params = {:code => 505, :result => "ERROR. Something wrong."}
499
+ end
500
+
501
+ if subs_mac==""
502
+ subs_mac="unknown"
503
+ end
504
+
505
+
506
+ mess = {:iwag_access_interface => access_int,
507
+ :subscribers_mac => subs_mac,
508
+ :access_point => access_poi,
509
+ :ssid_ap => ssid_a,
510
+ :apid => "unknown",
511
+ :statistics =>
512
+ {:tx_rate_set => tx_rate_se,
513
+ :tx_rate => tx_rat,
514
+ :rx_rate => rx_rat,
515
+ :rx_signal => rx_signa,
516
+ :uptime => uptim,
517
+ :packets => packet,
518
+ :bytes => byt}
519
+ }
520
+ # logger.info "HAproxy #{request.remote_ip}, request device real ip: #{request.headers['X-Client']}, ipaddressinputparameter: #{ip_address} recieved from mts_wifi_get_subs_info_return procedure of wifi_portal_controller such information as: #{mess.to_xml}"
521
+ output_params = {:code => 200, :result => "Request completed", :body => {:message => mess}}
522
+ p output_params
523
+
524
+ else
525
+
526
+ mess = {:iwag_access_interface => "unknown",
527
+ :subscribers_mac => "unknown",
528
+ :access_point => "unknown",
529
+ :ssid_ap => "unknown",
530
+ :apid => "unknown",
531
+ :statistics =>
532
+ {:tx_rate_set => "unknown",
533
+ :tx_rate => "unknown",
534
+ :rx_rate => "unknown",
535
+ :rx_signal => "unknown",
536
+ :uptime => "unknown",
537
+ :packets => "unknown",
538
+ :bytes => "unknown"}
539
+ }
540
+ # logger.info "HAproxy #{request.remote_ip}, request device real ip: #{request.headers['X-Client']}, ipaddressinputparameter: #{params[:ipaddress]} recieved from mts_wifi_get_subs_info_return procedure of wifi_portal_controller such information as: #{mess.to_xml}"
541
+ output_params = {:code => 202, :result => "Request completed", :body => {:message => mess}}
542
+ p output_params
543
+
544
+ end
545
+ rescue
546
+ puts 'SOAP mts_wifi_get_subs_info_return errorMethod'
547
+ output_params = {:code => 505, :result => "ERROR. Something wrong."}
548
+ end
549
+
550
+ ####
551
+ elsif ipaddr3=="100.70.0.0" #min11iwag1
552
+
553
+ p "min11iwag1"
554
+
555
+ begin
556
+ result_iwag = self.python_mac_iwag1_1(ip_address)
557
+ p result_iwag
558
+ if result_iwag.split(" ")[0]!="Unknown"
559
+ ppp = result_iwag.split(" ")
560
+
561
+ subs_mac = ppp[0]
562
+ access_int = ppp[1]
563
+ access_poi = ppp[2]
564
+ ssid_a = ppp[3]
565
+
566
+
567
+ if access_int=='GigabitEthernet4.3002'
568
+ access_poi = "belrw_4_HP_ap1-1"
569
+ ssid_a = "BelRW_WiFi"
570
+ elsif access_int=='GigabitEthernet4.3005'
571
+ access_poi = "belbiz-AP1-1"
572
+ ssid_a = "IMAGURU_GUEST"
573
+ end
574
+
575
+ if access_poi == "Unknown" && ssid_a == "Unknown" && subs_mac != "Unknown"
576
+ frommikrotik = self.get_subs_add_info4new_1(access_int, subs_mac)
577
+ splitting5 = frommikrotik.split("---")
578
+ p access_poi = splitting5[1]
579
+ p ssid_a = splitting5[2]
580
+ p tx_rate_se = splitting5[3]
581
+ p tx_rat = splitting5[4]
582
+ p rx_rat = splitting5[5]
583
+ p rx_signa = splitting5[6]
584
+ p uptim = splitting5[7]
585
+ p packet = splitting5[8]
586
+ p byt = splitting5[9]
587
+ end
588
+
589
+ tx_rate_se = "unknown"
590
+ tx_rat = "unknown"
591
+ rx_rat = "unknown"
592
+ rx_signa = "unknown"
593
+ uptim = "unknown"
594
+ packet = "unknown"
595
+ byt = "unknown"
596
+
597
+ if subs_mac=="unknown"
598
+ output_params = {:code => 505, :result => "ERROR. Something wrong."}
599
+ end
600
+
601
+ if subs_mac==""
602
+ output_params = {:code => 505, :result => "ERROR. Something wrong."}
603
+ end
604
+
605
+ mess = {:iwag_access_interface => access_int,
606
+ :subscribers_mac => subs_mac,
607
+ :access_point => access_poi,
608
+ :ssid_ap => ssid_a,
609
+ :apid => "unknown",
610
+ :statistics =>
611
+ {:tx_rate_set => tx_rate_se,
612
+ :tx_rate => tx_rat,
613
+ :rx_rate => rx_rat,
614
+ :rx_signal => rx_signa,
615
+ :uptime => uptim,
616
+ :packets => packet,
617
+ :bytes => byt}
618
+ }
619
+ # logger.info "HAproxy #{request.remote_ip}, request device real ip: #{request.headers['X-Client']}, ipaddressinputparameter: #{ip_address} recieved from mts_wifi_get_subs_info_return procedure of wifi_portal_controller such information as: #{mess.to_xml}"
620
+ output_params = {:code => 200, :result => "Request completed", :body => {:message => mess}}
621
+ p output_params
622
+
623
+ else
624
+
625
+ mess = {:iwag_access_interface => "unknown",
626
+ :subscribers_mac => "unknown",
627
+ :access_point => "unknown",
628
+ :ssid_ap => "unknown",
629
+ :apid => "unknown",
630
+ :statistics =>
631
+ {:tx_rate_set => "unknown",
632
+ :tx_rate => "unknown",
633
+ :rx_rate => "unknown",
634
+ :rx_signal => "unknown",
635
+ :uptime => "unknown",
636
+ :packets => "unknown",
637
+ :bytes => "unknown"}
638
+ }
639
+
640
+ # logger.info "HAproxy #{request.remote_ip}, request device real ip: #{request.headers['X-Client']}, ipaddressinputparameter: #{ip_address} recieved from mts_wifi_get_subs_info_return procedure of wifi_portal_controller such information as: #{mess.to_xml}"
641
+
642
+ output_params = {:code => 405, :result => "ERROR. MAC address not found on IWAG."}
643
+
644
+ #render :soap => mess
645
+
646
+ end
647
+ rescue
648
+ puts 'SOAP mts_wifi_get_subs_info_return errorMethod'
649
+ output_params = {:code => 505, :result => "ERROR. Something wrong."}
650
+ end
651
+
652
+ ####
653
+
654
+ else
655
+ output_params = {:code => 404, :result => "ERROR. Unknown IP Pool."}
656
+
657
+ end
658
+ rescue
659
+ puts 'SOAP mts_wifi_get_subs_info_return errorMethod invalid ip address'
660
+ output_params = {:code => 500, :result => "ERROR. Something wrong."}
661
+ end
662
+
663
+ output_params
664
+
665
+ end
666
+
667
+
668
+ end
669
+