freewifi 0.1.9 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.idea/freewifi.iml +39 -1
- data/.idea/runConfigurations/get_iwag_data.xml +21 -0
- data/.idea/workspace.xml +239 -185
- data/Gemfile +1 -1
- data/freewifi.gemspec +23 -23
- data/lib/freewifi.rb +67 -34
- data/lib/freewifi/additional/additional_functions.rb +1 -1
- data/lib/freewifi/cisco/any/cisco_schemes_conf_gen.rb +2 -1
- data/lib/freewifi/cisco/iwag/get_iwag_data.rb +91 -0
- data/lib/freewifi/cisco/iwag/iwag_database_worker.rb +24 -0
- data/lib/freewifi/cisco/iwag/iwag_telnet_connector.rb +21 -7
- data/lib/freewifi/config.rb +2 -1
- data/lib/freewifi/general/wifi_portal_procedures.rb +774 -388
- data/lib/freewifi/mikrotik/automation/get_data_ssh_fun.rb +2 -0
- data/lib/freewifi/mikrotik/newhub_mtik_api.rb +4 -4
- data/lib/freewifi/mikrotik/newhub_mtik_ssh.rb +12 -12
- data/lib/freewifi/mikrotik/schemes_conf_gen.rb +2 -2
- data/lib/freewifi/version.rb +1 -1
- metadata +10 -6
data/lib/freewifi/config.rb
CHANGED
@@ -5,6 +5,7 @@ $LOAD_PATH.unshift File.expand_path("../huawei", __dir__)
|
|
5
5
|
require 'freewifi/cisco/iwag/iwag_telnet_connector'
|
6
6
|
require 'freewifi/mikrotik/newhub_mtik_api'
|
7
7
|
require 'freewifi/huawei/hua_controller_class'
|
8
|
+
require 'freewifi/cisco/iwag/get_iwag_data'
|
8
9
|
require 'rubygems'
|
9
10
|
require 'savon'
|
10
11
|
|
@@ -18,29 +19,54 @@ class WiFiPortal_1
|
|
18
19
|
:mtik_user,
|
19
20
|
:mtik_password,
|
20
21
|
:mtik_api_connector,
|
21
|
-
:hua_controller_connector
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
22
|
+
:hua_controller_connector,
|
23
|
+
:iwag_connector1,
|
24
|
+
:iwag_connector2
|
25
|
+
|
26
|
+
def initialize(apigw_wsdl,
|
27
|
+
apigw_endpoint,
|
28
|
+
apigw_namespace,
|
29
|
+
apigw_wsse_aut_log,
|
30
|
+
apigw_wsse_aut_pass,
|
31
|
+
iwag1_host,
|
32
|
+
iwag1_username,
|
33
|
+
iwag1_password,
|
34
|
+
iwag1_port,
|
35
|
+
mtik_control_ips_get,
|
36
|
+
mtik_user,
|
37
|
+
mtik_password,
|
38
|
+
hua_wlc_1_ip,
|
39
|
+
hua_wlc_2_ip,
|
40
|
+
hua_wlc_login,
|
41
|
+
hua_wlc_password,
|
42
|
+
iwag2_host,
|
43
|
+
iwag2_username,
|
44
|
+
iwag2_password,
|
45
|
+
iwag2_port
|
46
|
+
)
|
47
|
+
@iwag_telnet_connector = CSRtelnet_1.new(iwag1_host, iwag1_username, iwag1_password)
|
48
|
+
@ard_api_gw_connector_wifi = Savon.client do
|
49
|
+
#ssl_verify_mode :none
|
50
|
+
wsdl apigw_wsdl
|
51
|
+
endpoint apigw_endpoint
|
52
|
+
namespace apigw_namespace
|
53
|
+
wsse_auth(apigw_wsse_aut_log, apigw_wsse_aut_pass, :digest)
|
54
|
+
encoding 'UTF-8'
|
55
|
+
headers = {"Accept-Encoding" => "gzip, deflate", "Connection" => "Keep-Alive"}
|
56
|
+
end
|
34
57
|
|
35
|
-
|
36
|
-
|
37
|
-
|
58
|
+
@iwag1_host = iwag1_host
|
59
|
+
@iwag_username = iwag1_username
|
60
|
+
@iwag_password = iwag1_password
|
38
61
|
|
39
|
-
|
62
|
+
@mtik_api_connector = NEWhubWifiApi_1.new(mtik_control_ips_get, mtik_user, mtik_password)
|
40
63
|
|
41
|
-
|
64
|
+
@hua_controller_connector = HuaWifi_1.new(hua_wlc_1_ip, hua_wlc_2_ip, hua_wlc_login, hua_wlc_password)
|
42
65
|
|
43
|
-
|
66
|
+
@iwag_connector1 = IwagRequester.new(iwag1_host, iwag1_username, iwag1_password, iwag1_port)
|
67
|
+
@iwag_connector2 = IwagRequester.new(iwag2_host, iwag2_username, iwag2_password, iwag2_port)
|
68
|
+
|
69
|
+
end
|
44
70
|
|
45
71
|
|
46
72
|
def python_mac_iwag1_1(ipaddress)
|
@@ -55,6 +81,16 @@ class WiFiPortal_1
|
|
55
81
|
end
|
56
82
|
end
|
57
83
|
|
84
|
+
|
85
|
+
def ssh_mac_iwag1_1(ipaddress)
|
86
|
+
begin
|
87
|
+
data_iw1 = iwag_connector1.iwag_get_dhcp_binding_ssh(ipaddress)
|
88
|
+
"#{data_iw1[:mac]} #{data_iw1[:iwaginterface]} #{data_iw1[:aphostname]} #{data_iw1[:SSID]}"
|
89
|
+
rescue
|
90
|
+
return "Unknown Unknown Unknown Unknown"
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
58
94
|
def python_mac_iwag2_1(ipaddress)
|
59
95
|
begin
|
60
96
|
response = ard_api_gw_connector_wifi.call(:mts_python_mac_iwag2) do
|
@@ -67,8 +103,18 @@ class WiFiPortal_1
|
|
67
103
|
end
|
68
104
|
end
|
69
105
|
|
106
|
+
def ssh_mac_iwag2_1(ipaddress)
|
107
|
+
begin
|
108
|
+
data_iw1 = iwag_connector2.iwag_get_dhcp_binding_ssh(ipaddress)
|
109
|
+
"#{data_iw1[:mac]} #{data_iw1[:iwaginterface]} #{data_iw1[:aphostname]} #{data_iw1[:SSID]}"
|
110
|
+
rescue
|
111
|
+
return "Unknown Unknown Unknown Unknown"
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
70
115
|
def get_subs_add_info3_1(ipaddress, access_interface)
|
71
116
|
|
117
|
+
|
72
118
|
answer = ""
|
73
119
|
|
74
120
|
#region get additional information
|
@@ -79,8 +125,8 @@ class WiFiPortal_1
|
|
79
125
|
begin
|
80
126
|
|
81
127
|
dump =""
|
82
|
-
connection = Net::Telnet.new(
|
83
|
-
connection.login({
|
128
|
+
connection = Net::Telnet.new("Host" => "172.24.247.183", "Timeout" => false, "Prompt" => /.*#/) {|str|}
|
129
|
+
connection.login({"Name" => iwag_username, "Password" => iwag_password, "LoginPrompt" => /Username:/}) {|str|}
|
84
130
|
connection.cmd("show ip dhcp binding #{ipaddress}") {
|
85
131
|
|c|
|
86
132
|
dump << c
|
@@ -97,11 +143,11 @@ class WiFiPortal_1
|
|
97
143
|
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
144
|
end
|
99
145
|
|
100
|
-
|
101
146
|
rescue
|
102
147
|
subscribers_mac = "unknown"
|
103
148
|
end
|
104
149
|
|
150
|
+
|
105
151
|
begin
|
106
152
|
thr0 = Thread.new do
|
107
153
|
begin
|
@@ -193,7 +239,7 @@ class WiFiPortal_1
|
|
193
239
|
thr4.join
|
194
240
|
|
195
241
|
if answer==""
|
196
|
-
answer = subscribers_mac + "---" + "not on mikrotik controller" + "---" + "unknown" + "---" + "unknown" + "---"+ "unknown"
|
242
|
+
answer = subscribers_mac + "---" + "not on mikrotik controller" + "---" + "unknown" + "---" + "unknown" + "---"+ "unknown" + "---"+ "unknown" + "---"+ "unknown" + "---"+ "unknown" + "---"+ "unknown" + "---"+ "unknown"
|
197
243
|
end
|
198
244
|
|
199
245
|
end
|
@@ -204,8 +250,15 @@ class WiFiPortal_1
|
|
204
250
|
end
|
205
251
|
|
206
252
|
|
253
|
+
def get_subs_add_info4new_1(access_interface, subscribers_mac)
|
207
254
|
|
208
|
-
|
255
|
+
capsman_list = [
|
256
|
+
"172.24.247.15",
|
257
|
+
"172.24.214.155",
|
258
|
+
"172.24.214.140",
|
259
|
+
"172.24.214.105",
|
260
|
+
"172.24.223.105"
|
261
|
+
]
|
209
262
|
|
210
263
|
answer = ""
|
211
264
|
|
@@ -214,115 +267,537 @@ class WiFiPortal_1
|
|
214
267
|
|
215
268
|
p subscribers_mac
|
216
269
|
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
270
|
+
threads_mikro_wlc = []
|
271
|
+
capsman_list.each do |capsman|
|
272
|
+
threads_mikro_wlc << Thread.new do
|
273
|
+
begin
|
274
|
+
p mikr_info5 = mtik_api_connector.get_info_subs_from_mik_1(subscribers_mac, capsman)
|
275
|
+
splitting5 = mikr_info5.split("---")
|
276
|
+
if splitting5[1] != "not on mikrotik controller" && splitting5[1]!="unknown" && splitting5[1]!=nil
|
277
|
+
answer = mikr_info5
|
278
|
+
p answer
|
279
|
+
end
|
280
|
+
rescue
|
281
|
+
p "thr0 wrong"
|
223
282
|
end
|
224
|
-
rescue
|
225
|
-
p "thr0 wrong"
|
226
283
|
end
|
227
284
|
end
|
285
|
+
threads_mikro_wlc.each(&:join)
|
228
286
|
|
229
|
-
|
230
|
-
|
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
|
287
|
+
if answer==""
|
288
|
+
answer = subscribers_mac + "---" + "not on mikrotik controller" + "---" + "unknown" + "---" + "unknown" + "---"+ "unknown" + "---"+ "unknown" + "---"+ "unknown" + "---"+ "unknown" + "---"+ "unknown" + "---"+ "unknown"
|
239
289
|
end
|
290
|
+
end
|
291
|
+
answer
|
292
|
+
end
|
240
293
|
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
294
|
+
def proc_100_71_0_0(ip_address)
|
295
|
+
begin
|
296
|
+
p access_int = iwag_telnet_connector.return_iwag_access_interface_1(ip_address)
|
297
|
+
|
298
|
+
ip_a = ip_address
|
299
|
+
|
300
|
+
access_poi = "unknown"
|
301
|
+
ssid_a = "unknown"
|
302
|
+
tx_rate_se = "unknown"
|
303
|
+
tx_rat = "unknown"
|
304
|
+
rx_rat = "unknown"
|
305
|
+
rx_signa = "unknown"
|
306
|
+
uptim = "unknown"
|
307
|
+
packet = "unknown"
|
308
|
+
byt = "unknown"
|
309
|
+
|
310
|
+
if access_int == "Tunnel5"
|
311
|
+
mikr_info2 = self.get_subs_add_info3_1(ip_address, access_int)
|
312
|
+
splitting2 = mikr_info2.split("---")
|
313
|
+
subs_mac = splitting2[0]
|
314
|
+
access_poi = "belrw_3_Cisco_ap1-1"
|
315
|
+
ssid_a = "BelRW_WiFi"
|
316
|
+
tx_rate_se = "unknown"
|
317
|
+
tx_rat = "unknown"
|
318
|
+
rx_rat = "unknown"
|
319
|
+
rx_signa = "unknown"
|
320
|
+
uptim = "unknown"
|
321
|
+
packet = "unknown"
|
322
|
+
byt = "unknown"
|
323
|
+
elsif access_int == "GigabitEthernet2.4008"
|
324
|
+
mikr_info3 = self.get_subs_add_info3_1(ip_address, access_int)
|
325
|
+
splitting3 = mikr_info3.split("---")
|
326
|
+
subs_mac = splitting3[0]
|
327
|
+
access_poi = "belrw_4_HP_ap1-1"
|
328
|
+
ssid_a = "BelRW_WiFi"
|
329
|
+
tx_rate_se = "unknown"
|
330
|
+
tx_rat = "unknown"
|
331
|
+
rx_rat = "unknown"
|
332
|
+
rx_signa = "unknown"
|
333
|
+
uptim = "unknown"
|
334
|
+
packet = "unknown"
|
335
|
+
byt = "unknown"
|
336
|
+
elsif access_int == "Tunnel9"
|
337
|
+
subs_mac = iwag_telnet_connector.get_subs_mac2_1(ip_address)
|
338
|
+
p resp1 = hua_controller_connector.get_sub_info_1(subs_mac)
|
339
|
+
p resp=resp1.split(",,,")
|
340
|
+
|
341
|
+
p access_poi = resp[1]
|
342
|
+
p ssid_a = resp[2]
|
343
|
+
p tx_rate_se = resp[3]
|
344
|
+
p tx_rat = resp[4]
|
345
|
+
p rx_rat = resp[5]
|
346
|
+
p rx_signa = resp[6]
|
347
|
+
p uptim = resp[7]
|
348
|
+
p packet = resp[8]
|
349
|
+
p byt = resp[9]
|
350
|
+
elsif access_int == "Tunnel16"
|
351
|
+
subs_mac = iwag_telnet_connector.get_subs_mac2_1(ip_address)
|
352
|
+
p resp1 = hua_controller_connector.get_sub_info2_1(subs_mac)
|
353
|
+
p resp=resp1.split(",,,")
|
354
|
+
|
355
|
+
p access_poi = resp[1]
|
356
|
+
p ssid_a = resp[2]
|
357
|
+
p tx_rate_se = resp[3]
|
358
|
+
p tx_rat = resp[4]
|
359
|
+
p rx_rat = resp[5]
|
360
|
+
p rx_signa = resp[6]
|
361
|
+
p uptim = resp[7]
|
362
|
+
p packet = resp[8]
|
363
|
+
p byt = resp[9]
|
364
|
+
else
|
365
|
+
p "before get info"
|
366
|
+
p mikr_info5 = self.get_subs_add_info3_1(ip_address, access_int)
|
367
|
+
p "after get info"
|
368
|
+
splitting5 = mikr_info5.split("---")
|
369
|
+
p subs_mac = splitting5[0]
|
370
|
+
|
371
|
+
p access_poi = splitting5[1]
|
372
|
+
p ssid_a = splitting5[2]
|
373
|
+
p tx_rate_se = splitting5[3]
|
374
|
+
p tx_rat = splitting5[4]
|
375
|
+
p rx_rat = splitting5[5]
|
376
|
+
p rx_signa = splitting5[6]
|
377
|
+
p uptim = splitting5[7]
|
378
|
+
p packet = splitting5[8]
|
379
|
+
p byt = splitting5[9]
|
380
|
+
|
381
|
+
|
382
|
+
if access_poi==nil || access_poi=="" || access_poi=="unknown"
|
383
|
+
access_poi = "not on mikrotik controller"
|
384
|
+
end
|
385
|
+
|
386
|
+
if ssid_a==nil || ssid_a=="" || ssid_a=="unknown"
|
387
|
+
ssid_a = "unknown"
|
388
|
+
tx_rate_se = "unknown"
|
389
|
+
tx_rat = "unknown"
|
390
|
+
rx_rat = "unknown"
|
391
|
+
rx_signa = "unknown"
|
392
|
+
uptim = "unknown"
|
393
|
+
packet = "unknown"
|
394
|
+
byt = "unknown"
|
250
395
|
end
|
396
|
+
|
251
397
|
end
|
252
398
|
|
399
|
+
if subs_mac=="unknown"
|
400
|
+
output_params = {:code => 505, :result => "ERROR. Something wrong."}
|
401
|
+
end
|
253
402
|
|
254
|
-
|
255
|
-
|
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"
|
403
|
+
if subs_mac==""
|
404
|
+
subs_mac="unknown"
|
268
405
|
end
|
269
406
|
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
407
|
+
|
408
|
+
mess = {:iwag_access_interface => access_int,
|
409
|
+
:subscribers_mac => subs_mac,
|
410
|
+
:access_point => access_poi,
|
411
|
+
:ssid_ap => ssid_a,
|
412
|
+
:apid => "unknown",
|
413
|
+
:statistics =>
|
414
|
+
{:tx_rate_set => tx_rate_se,
|
415
|
+
:tx_rate => tx_rat,
|
416
|
+
:rx_rate => rx_rat,
|
417
|
+
:rx_signal => rx_signa,
|
418
|
+
:uptime => uptim,
|
419
|
+
:packets => packet,
|
420
|
+
:bytes => byt}
|
421
|
+
}
|
422
|
+
# 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}"
|
423
|
+
output_params = {:code => 200, :result => "Request completed", :body => {:message => mess}}
|
424
|
+
rescue
|
425
|
+
|
426
|
+
puts 'SOAP mts_wifi_get_subs_info_return errorMethod'
|
427
|
+
output_params = {:code => 505, :result => "ERROR. Something wrong."}
|
428
|
+
end
|
429
|
+
output_params
|
430
|
+
end
|
431
|
+
|
432
|
+
def proc_100_75_0_0(ip_address)
|
433
|
+
|
434
|
+
begin
|
435
|
+
result_iwag = self.python_mac_iwag2_1(ip_address)
|
436
|
+
if result_iwag.split(" ")[0]!="Unknown"
|
437
|
+
ppp = result_iwag.split(" ")
|
438
|
+
|
439
|
+
subs_mac = ppp[0]
|
440
|
+
access_int = ppp[1]
|
441
|
+
access_poi = ppp[2]
|
442
|
+
ssid_a = ppp[3]
|
443
|
+
|
444
|
+
tx_rate_se = "unknown"
|
445
|
+
tx_rat = "unknown"
|
446
|
+
rx_rat = "unknown"
|
447
|
+
rx_signa = "unknown"
|
448
|
+
uptim = "unknown"
|
449
|
+
packet = "unknown"
|
450
|
+
byt = "unknown"
|
451
|
+
|
452
|
+
if access_int=='GigabitEthernet4.3002'
|
453
|
+
access_poi = "belrw_4_HP_ap1-1"
|
454
|
+
ssid_a = "BelRW_WiFi"
|
455
|
+
elsif access_int=='GigabitEthernet4.3005'
|
456
|
+
access_poi = "belbiz-AP1-1"
|
457
|
+
ssid_a = "IMAGURU_GUEST"
|
281
458
|
end
|
282
|
-
rescue
|
283
|
-
p "thread 4 failed"
|
284
|
-
end
|
285
459
|
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
460
|
+
if access_poi == "Unknown" && ssid_a == "Unknown" && subs_mac != "Unknown"
|
461
|
+
frommikrotik = self.get_subs_add_info4new_1(access_int, subs_mac)
|
462
|
+
splitting5 = frommikrotik.split("---")
|
463
|
+
p access_poi = splitting5[1]
|
464
|
+
p ssid_a = splitting5[2]
|
465
|
+
p tx_rate_se = splitting5[3]
|
466
|
+
p tx_rat = splitting5[4]
|
467
|
+
p rx_rat = splitting5[5]
|
468
|
+
p rx_signa = splitting5[6]
|
469
|
+
p uptim = splitting5[7]
|
470
|
+
p packet = splitting5[8]
|
471
|
+
p byt = splitting5[9]
|
472
|
+
end
|
473
|
+
|
474
|
+
if subs_mac=="unknown"
|
475
|
+
output_params = {:code => 505, :result => "ERROR. Something wrong."}
|
476
|
+
end
|
477
|
+
|
478
|
+
if subs_mac==""
|
479
|
+
subs_mac="unknown"
|
480
|
+
end
|
481
|
+
|
482
|
+
|
483
|
+
mess = {:iwag_access_interface => access_int,
|
484
|
+
:subscribers_mac => subs_mac,
|
485
|
+
:access_point => access_poi,
|
486
|
+
:ssid_ap => ssid_a,
|
487
|
+
:apid => "unknown",
|
488
|
+
:statistics =>
|
489
|
+
{:tx_rate_set => tx_rate_se,
|
490
|
+
:tx_rate => tx_rat,
|
491
|
+
:rx_rate => rx_rat,
|
492
|
+
:rx_signal => rx_signa,
|
493
|
+
:uptime => uptim,
|
494
|
+
:packets => packet,
|
495
|
+
:bytes => byt}
|
496
|
+
}
|
497
|
+
# 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}"
|
498
|
+
output_params = {:code => 200, :result => "Request completed", :body => {:message => mess}}
|
499
|
+
p output_params
|
500
|
+
|
501
|
+
else
|
502
|
+
|
503
|
+
mess = {:iwag_access_interface => "unknown",
|
504
|
+
:subscribers_mac => "unknown",
|
505
|
+
:access_point => "unknown",
|
506
|
+
:ssid_ap => "unknown",
|
507
|
+
:apid => "unknown",
|
508
|
+
:statistics =>
|
509
|
+
{:tx_rate_set => "unknown",
|
510
|
+
:tx_rate => "unknown",
|
511
|
+
:rx_rate => "unknown",
|
512
|
+
:rx_signal => "unknown",
|
513
|
+
:uptime => "unknown",
|
514
|
+
:packets => "unknown",
|
515
|
+
:bytes => "unknown"}
|
516
|
+
}
|
517
|
+
# 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}"
|
518
|
+
output_params = {:code => 202, :result => "Request completed", :body => {:message => mess}}
|
519
|
+
p output_params
|
291
520
|
|
292
|
-
if answer==""
|
293
|
-
answer = subscribers_mac + "---" + "not on mikrotik controller" + "---" + "unknown" + "---" + "unknown" + "---"+ "unknown" + "---"+ "unknown" + "---"+ "unknown" + "---"+ "unknown" + "---"+ "unknown" + "---"+ "unknown"
|
294
521
|
end
|
522
|
+
rescue
|
523
|
+
puts 'SOAP mts_wifi_get_subs_info_return errorMethod'
|
524
|
+
output_params = {:code => 505, :result => "ERROR. Something wrong."}
|
525
|
+
end
|
526
|
+
|
527
|
+
output_params
|
528
|
+
|
529
|
+
####
|
530
|
+
end
|
531
|
+
|
532
|
+
|
533
|
+
def proc_100_70_0_0(ip_address)
|
534
|
+
p "min11iwag1"
|
535
|
+
|
536
|
+
begin
|
537
|
+
result_iwag = self.python_mac_iwag1_1(ip_address)
|
538
|
+
p result_iwag
|
539
|
+
if result_iwag.split(" ")[0]!="Unknown"
|
540
|
+
ppp = result_iwag.split(" ")
|
541
|
+
|
542
|
+
subs_mac = ppp[0]
|
543
|
+
access_int = ppp[1]
|
544
|
+
access_poi = ppp[2]
|
545
|
+
ssid_a = ppp[3]
|
546
|
+
|
547
|
+
|
548
|
+
if access_int=='GigabitEthernet4.3002'
|
549
|
+
access_poi = "belrw_4_HP_ap1-1"
|
550
|
+
ssid_a = "BelRW_WiFi"
|
551
|
+
elsif access_int=='GigabitEthernet4.3005'
|
552
|
+
access_poi = "belbiz-AP1-1"
|
553
|
+
ssid_a = "IMAGURU_GUEST"
|
554
|
+
end
|
555
|
+
|
556
|
+
if access_poi == "Unknown" && ssid_a == "Unknown" && subs_mac != "Unknown"
|
557
|
+
frommikrotik = self.get_subs_add_info4new_1(access_int, subs_mac)
|
558
|
+
splitting5 = frommikrotik.split("---")
|
559
|
+
p access_poi = splitting5[1]
|
560
|
+
p ssid_a = splitting5[2]
|
561
|
+
p tx_rate_se = splitting5[3]
|
562
|
+
p tx_rat = splitting5[4]
|
563
|
+
p rx_rat = splitting5[5]
|
564
|
+
p rx_signa = splitting5[6]
|
565
|
+
p uptim = splitting5[7]
|
566
|
+
p packet = splitting5[8]
|
567
|
+
p byt = splitting5[9]
|
568
|
+
end
|
569
|
+
|
570
|
+
tx_rate_se = "unknown"
|
571
|
+
tx_rat = "unknown"
|
572
|
+
rx_rat = "unknown"
|
573
|
+
rx_signa = "unknown"
|
574
|
+
uptim = "unknown"
|
575
|
+
packet = "unknown"
|
576
|
+
byt = "unknown"
|
295
577
|
|
578
|
+
if subs_mac=="unknown"
|
579
|
+
output_params = {:code => 505, :result => "ERROR. Something wrong."}
|
580
|
+
end
|
581
|
+
|
582
|
+
if subs_mac==""
|
583
|
+
output_params = {:code => 505, :result => "ERROR. Something wrong."}
|
584
|
+
end
|
585
|
+
|
586
|
+
mess = {:iwag_access_interface => access_int,
|
587
|
+
:subscribers_mac => subs_mac,
|
588
|
+
:access_point => access_poi,
|
589
|
+
:ssid_ap => ssid_a,
|
590
|
+
:apid => "unknown",
|
591
|
+
:statistics =>
|
592
|
+
{:tx_rate_set => tx_rate_se,
|
593
|
+
:tx_rate => tx_rat,
|
594
|
+
:rx_rate => rx_rat,
|
595
|
+
:rx_signal => rx_signa,
|
596
|
+
:uptime => uptim,
|
597
|
+
:packets => packet,
|
598
|
+
:bytes => byt}
|
599
|
+
}
|
600
|
+
# 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}"
|
601
|
+
output_params = {:code => 200, :result => "Request completed", :body => {:message => mess}}
|
602
|
+
p output_params
|
603
|
+
|
604
|
+
else
|
605
|
+
|
606
|
+
mess = {:iwag_access_interface => "unknown",
|
607
|
+
:subscribers_mac => "unknown",
|
608
|
+
:access_point => "unknown",
|
609
|
+
:ssid_ap => "unknown",
|
610
|
+
:apid => "unknown",
|
611
|
+
:statistics =>
|
612
|
+
{:tx_rate_set => "unknown",
|
613
|
+
:tx_rate => "unknown",
|
614
|
+
:rx_rate => "unknown",
|
615
|
+
:rx_signal => "unknown",
|
616
|
+
:uptime => "unknown",
|
617
|
+
:packets => "unknown",
|
618
|
+
:bytes => "unknown"}
|
619
|
+
}
|
620
|
+
|
621
|
+
# 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}"
|
622
|
+
|
623
|
+
output_params = {:code => 405, :result => "ERROR. MAC address not found on IWAG."}
|
624
|
+
|
625
|
+
#render :soap => mess
|
626
|
+
|
627
|
+
end
|
628
|
+
rescue
|
629
|
+
puts 'SOAP mts_wifi_get_subs_info_return errorMethod'
|
630
|
+
output_params = {:code => 505, :result => "ERROR. Something wrong."}
|
296
631
|
end
|
297
632
|
|
633
|
+
output_params
|
298
634
|
|
299
|
-
|
635
|
+
####
|
300
636
|
|
301
637
|
end
|
302
638
|
|
303
639
|
|
640
|
+
def get_subs_info_return_1(ip_address)
|
304
641
|
|
642
|
+
input_params = {:ip_address => ip_address}
|
643
|
+
output_params = {}
|
305
644
|
|
645
|
+
begin
|
646
|
+
ipaddr_transformed = IPAddr.new ip_address
|
647
|
+
ipaddr_network = ipaddr_transformed.mask(17).to_s
|
306
648
|
|
307
|
-
|
649
|
+
if ipaddr_network == "100.71.0.0" #iwag old
|
650
|
+
|
651
|
+
output_params = self.proc_100_71_0_0(ip_address)
|
652
|
+
|
653
|
+
elsif ipaddr_network == "100.75.0.0" #min11iwag2
|
654
|
+
|
655
|
+
output_params = self.proc_100_75_0_0(ip_address)
|
656
|
+
|
657
|
+
elsif ipaddr_network == "100.70.0.0" #min11iwag1
|
658
|
+
|
659
|
+
output_params = self.proc_100_70_0_0(ip_address)
|
660
|
+
|
661
|
+
else
|
662
|
+
output_params = {:code => 404, :result => "ERROR. Unknown IP Pool."}
|
663
|
+
end
|
664
|
+
|
665
|
+
rescue
|
666
|
+
output_params = {:code => 500, :result => "ERROR. Something wrong.", :body => "SOAP mts_wifi_get_subs_info_return errorMethod unknown error"}
|
667
|
+
end
|
668
|
+
|
669
|
+
output_params
|
670
|
+
|
671
|
+
end
|
672
|
+
|
673
|
+
|
674
|
+
def get_subs_info_ret_ssh_1(ip_address)
|
308
675
|
|
309
676
|
input_params = {:ip_address => ip_address}
|
310
677
|
output_params = {}
|
311
678
|
|
312
679
|
begin
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
680
|
+
ipaddr_transformed = IPAddr.new ip_address
|
681
|
+
ipaddr_network = ipaddr_transformed.mask(17).to_s
|
682
|
+
|
683
|
+
if ipaddr_network == "100.71.0.0" #iwag old
|
684
|
+
|
685
|
+
output_params = self.proc_100_71_0_0_ssh(ip_address)
|
686
|
+
|
687
|
+
elsif ipaddr_network == "100.75.0.0" #min11iwag2
|
317
688
|
|
318
|
-
|
689
|
+
output_params = self.proc_100_75_0_0_ssh(ip_address)
|
319
690
|
|
320
|
-
|
321
|
-
p access_int = iwag_telnet_connector.return_iwag_access_interface_1(ip_address)
|
691
|
+
elsif ipaddr_network == "100.70.0.0" #min11iwag1
|
322
692
|
|
323
|
-
|
693
|
+
output_params = self.proc_100_70_0_0_ssh(ip_address)
|
694
|
+
|
695
|
+
else
|
696
|
+
output_params = {:code => 404, :result => "ERROR. Unknown IP Pool."}
|
697
|
+
end
|
698
|
+
|
699
|
+
rescue
|
700
|
+
output_params = {:code => 500, :result => "ERROR. Something wrong.", :body => "SOAP mts_wifi_get_subs_info_return errorMethod unknown error"}
|
701
|
+
end
|
702
|
+
|
703
|
+
output_params
|
704
|
+
|
705
|
+
end
|
706
|
+
|
707
|
+
|
708
|
+
def proc_100_71_0_0_ssh(ip_address)
|
709
|
+
begin
|
710
|
+
p access_int = iwag_telnet_connector.return_iwag_access_interface_1(ip_address)
|
711
|
+
|
712
|
+
ip_a = ip_address
|
713
|
+
|
714
|
+
access_poi = "unknown"
|
715
|
+
ssid_a = "unknown"
|
716
|
+
tx_rate_se = "unknown"
|
717
|
+
tx_rat = "unknown"
|
718
|
+
rx_rat = "unknown"
|
719
|
+
rx_signa = "unknown"
|
720
|
+
uptim = "unknown"
|
721
|
+
packet = "unknown"
|
722
|
+
byt = "unknown"
|
723
|
+
|
724
|
+
if access_int == "Tunnel5"
|
725
|
+
mikr_info2 = self.get_subs_add_info3_1(ip_address, access_int)
|
726
|
+
splitting2 = mikr_info2.split("---")
|
727
|
+
subs_mac = splitting2[0]
|
728
|
+
access_poi = "belrw_3_Cisco_ap1-1"
|
729
|
+
ssid_a = "BelRW_WiFi"
|
730
|
+
tx_rate_se = "unknown"
|
731
|
+
tx_rat = "unknown"
|
732
|
+
rx_rat = "unknown"
|
733
|
+
rx_signa = "unknown"
|
734
|
+
uptim = "unknown"
|
735
|
+
packet = "unknown"
|
736
|
+
byt = "unknown"
|
737
|
+
elsif access_int == "GigabitEthernet2.4008"
|
738
|
+
mikr_info3 = self.get_subs_add_info3_1(ip_address, access_int)
|
739
|
+
splitting3 = mikr_info3.split("---")
|
740
|
+
subs_mac = splitting3[0]
|
741
|
+
access_poi = "belrw_4_HP_ap1-1"
|
742
|
+
ssid_a = "BelRW_WiFi"
|
743
|
+
tx_rate_se = "unknown"
|
744
|
+
tx_rat = "unknown"
|
745
|
+
rx_rat = "unknown"
|
746
|
+
rx_signa = "unknown"
|
747
|
+
uptim = "unknown"
|
748
|
+
packet = "unknown"
|
749
|
+
byt = "unknown"
|
750
|
+
elsif access_int == "Tunnel9"
|
751
|
+
subs_mac = iwag_telnet_connector.get_subs_mac2_1(ip_address)
|
752
|
+
p resp1 = hua_controller_connector.get_sub_info_1(subs_mac)
|
753
|
+
p resp=resp1.split(",,,")
|
754
|
+
|
755
|
+
p access_poi = resp[1]
|
756
|
+
p ssid_a = resp[2]
|
757
|
+
p tx_rate_se = resp[3]
|
758
|
+
p tx_rat = resp[4]
|
759
|
+
p rx_rat = resp[5]
|
760
|
+
p rx_signa = resp[6]
|
761
|
+
p uptim = resp[7]
|
762
|
+
p packet = resp[8]
|
763
|
+
p byt = resp[9]
|
764
|
+
elsif access_int == "Tunnel16"
|
765
|
+
subs_mac = iwag_telnet_connector.get_subs_mac2_1(ip_address)
|
766
|
+
p resp1 = hua_controller_connector.get_sub_info2_1(subs_mac)
|
767
|
+
p resp=resp1.split(",,,")
|
768
|
+
|
769
|
+
p access_poi = resp[1]
|
770
|
+
p ssid_a = resp[2]
|
771
|
+
p tx_rate_se = resp[3]
|
772
|
+
p tx_rat = resp[4]
|
773
|
+
p rx_rat = resp[5]
|
774
|
+
p rx_signa = resp[6]
|
775
|
+
p uptim = resp[7]
|
776
|
+
p packet = resp[8]
|
777
|
+
p byt = resp[9]
|
778
|
+
else
|
779
|
+
p "before get info"
|
780
|
+
p mikr_info5 = self.get_subs_add_info3_1(ip_address, access_int)
|
781
|
+
p "after get info"
|
782
|
+
splitting5 = mikr_info5.split("---")
|
783
|
+
p subs_mac = splitting5[0]
|
784
|
+
|
785
|
+
p access_poi = splitting5[1]
|
786
|
+
p ssid_a = splitting5[2]
|
787
|
+
p tx_rate_se = splitting5[3]
|
788
|
+
p tx_rat = splitting5[4]
|
789
|
+
p rx_rat = splitting5[5]
|
790
|
+
p rx_signa = splitting5[6]
|
791
|
+
p uptim = splitting5[7]
|
792
|
+
p packet = splitting5[8]
|
793
|
+
p byt = splitting5[9]
|
794
|
+
|
795
|
+
|
796
|
+
if access_poi==nil || access_poi=="" || access_poi=="unknown"
|
797
|
+
access_poi = "not on mikrotik controller"
|
798
|
+
end
|
324
799
|
|
325
|
-
|
800
|
+
if ssid_a==nil || ssid_a=="" || ssid_a=="unknown"
|
326
801
|
ssid_a = "unknown"
|
327
802
|
tx_rate_se = "unknown"
|
328
803
|
tx_rat = "unknown"
|
@@ -331,337 +806,248 @@ class WiFiPortal_1
|
|
331
806
|
uptim = "unknown"
|
332
807
|
packet = "unknown"
|
333
808
|
byt = "unknown"
|
809
|
+
end
|
334
810
|
|
335
|
-
|
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]
|
811
|
+
end
|
395
812
|
|
396
|
-
|
397
|
-
|
398
|
-
|
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]
|
813
|
+
if subs_mac=="unknown"
|
814
|
+
output_params = {:code => 505, :result => "ERROR. Something wrong."}
|
815
|
+
end
|
405
816
|
|
817
|
+
if subs_mac==""
|
818
|
+
subs_mac="unknown"
|
819
|
+
end
|
406
820
|
|
407
|
-
if access_poi==nil || access_poi=="" || access_poi=="unknown"
|
408
|
-
access_poi = "not on mikrotik controller"
|
409
|
-
end
|
410
821
|
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
822
|
+
mess = {:iwag_access_interface => access_int,
|
823
|
+
:subscribers_mac => subs_mac,
|
824
|
+
:access_point => access_poi,
|
825
|
+
:ssid_ap => ssid_a,
|
826
|
+
:apid => "unknown",
|
827
|
+
:statistics =>
|
828
|
+
{:tx_rate_set => tx_rate_se,
|
829
|
+
:tx_rate => tx_rat,
|
830
|
+
:rx_rate => rx_rat,
|
831
|
+
:rx_signal => rx_signa,
|
832
|
+
:uptime => uptim,
|
833
|
+
:packets => packet,
|
834
|
+
:bytes => byt}
|
835
|
+
}
|
836
|
+
# 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}"
|
837
|
+
output_params = {:code => 200, :result => "Request completed", :body => {:message => mess}}
|
838
|
+
rescue
|
421
839
|
|
422
|
-
|
840
|
+
puts 'SOAP mts_wifi_get_subs_info_return errorMethod'
|
841
|
+
output_params = {:code => 505, :result => "ERROR. Something wrong."}
|
842
|
+
end
|
843
|
+
output_params
|
844
|
+
end
|
423
845
|
|
424
|
-
|
425
|
-
output_params = {:code => 505, :result => "ERROR. Something wrong."}
|
426
|
-
end
|
846
|
+
def proc_100_75_0_0_ssh(ip_address)
|
427
847
|
|
428
|
-
|
429
|
-
|
430
|
-
|
848
|
+
begin
|
849
|
+
result_iwag = self.ssh_mac_iwag2_1(ip_address)
|
850
|
+
if result_iwag.split(" ")[0]!="Unknown"
|
851
|
+
ppp = result_iwag.split(" ")
|
852
|
+
|
853
|
+
subs_mac = ppp[0]
|
854
|
+
access_int = ppp[1]
|
855
|
+
access_poi = ppp[2]
|
856
|
+
ssid_a = ppp[3]
|
857
|
+
|
858
|
+
tx_rate_se = "unknown"
|
859
|
+
tx_rat = "unknown"
|
860
|
+
rx_rat = "unknown"
|
861
|
+
rx_signa = "unknown"
|
862
|
+
uptim = "unknown"
|
863
|
+
packet = "unknown"
|
864
|
+
byt = "unknown"
|
865
|
+
|
866
|
+
if access_int=='GigabitEthernet4.3002'
|
867
|
+
access_poi = "belrw_4_HP_ap1-1"
|
868
|
+
ssid_a = "BelRW_WiFi"
|
869
|
+
elsif access_int=='GigabitEthernet4.3005'
|
870
|
+
access_poi = "belbiz-AP1-1"
|
871
|
+
ssid_a = "IMAGURU_GUEST"
|
872
|
+
end
|
431
873
|
|
874
|
+
if access_poi == "Unknown" && ssid_a == "Unknown" && subs_mac != "Unknown"
|
875
|
+
frommikrotik = self.get_subs_add_info4new_1(access_int, subs_mac)
|
876
|
+
splitting5 = frommikrotik.split("---")
|
877
|
+
p access_poi = splitting5[1]
|
878
|
+
p ssid_a = splitting5[2]
|
879
|
+
p tx_rate_se = splitting5[3]
|
880
|
+
p tx_rat = splitting5[4]
|
881
|
+
p rx_rat = splitting5[5]
|
882
|
+
p rx_signa = splitting5[6]
|
883
|
+
p uptim = splitting5[7]
|
884
|
+
p packet = splitting5[8]
|
885
|
+
p byt = splitting5[9]
|
886
|
+
end
|
432
887
|
|
433
|
-
|
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'
|
888
|
+
if subs_mac=="unknown"
|
452
889
|
output_params = {:code => 505, :result => "ERROR. Something wrong."}
|
453
890
|
end
|
454
891
|
|
455
|
-
|
456
|
-
|
457
|
-
|
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
|
892
|
+
if subs_mac==""
|
893
|
+
subs_mac="unknown"
|
894
|
+
end
|
504
895
|
|
505
896
|
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
897
|
+
mess = {:iwag_access_interface => access_int,
|
898
|
+
:subscribers_mac => subs_mac,
|
899
|
+
:access_point => access_poi,
|
900
|
+
:ssid_ap => ssid_a,
|
901
|
+
:apid => "unknown",
|
902
|
+
:statistics =>
|
903
|
+
{:tx_rate_set => tx_rate_se,
|
904
|
+
:tx_rate => tx_rat,
|
905
|
+
:rx_rate => rx_rat,
|
906
|
+
:rx_signal => rx_signa,
|
907
|
+
:uptime => uptim,
|
908
|
+
:packets => packet,
|
909
|
+
:bytes => byt}
|
910
|
+
}
|
520
911
|
# 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
|
-
|
522
|
-
|
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
|
912
|
+
output_params = {:code => 200, :result => "Request completed", :body => {:message => mess}}
|
913
|
+
p output_params
|
543
914
|
|
544
|
-
|
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
|
915
|
+
else
|
552
916
|
|
553
|
-
|
917
|
+
mess = {:iwag_access_interface => "unknown",
|
918
|
+
:subscribers_mac => "unknown",
|
919
|
+
:access_point => "unknown",
|
920
|
+
:ssid_ap => "unknown",
|
921
|
+
:apid => "unknown",
|
922
|
+
:statistics =>
|
923
|
+
{:tx_rate_set => "unknown",
|
924
|
+
:tx_rate => "unknown",
|
925
|
+
:rx_rate => "unknown",
|
926
|
+
:rx_signal => "unknown",
|
927
|
+
:uptime => "unknown",
|
928
|
+
:packets => "unknown",
|
929
|
+
:bytes => "unknown"}
|
930
|
+
}
|
931
|
+
# 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}"
|
932
|
+
output_params = {:code => 202, :result => "Request completed", :body => {:message => mess}}
|
933
|
+
p output_params
|
554
934
|
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
935
|
+
end
|
936
|
+
rescue
|
937
|
+
puts 'SOAP mts_wifi_get_subs_info_return errorMethod'
|
938
|
+
output_params = {:code => 505, :result => "ERROR. Something wrong."}
|
939
|
+
end
|
560
940
|
|
561
|
-
|
562
|
-
access_int = ppp[1]
|
563
|
-
access_poi = ppp[2]
|
564
|
-
ssid_a = ppp[3]
|
941
|
+
output_params
|
565
942
|
|
943
|
+
####
|
944
|
+
end
|
566
945
|
|
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
946
|
|
575
|
-
|
576
|
-
|
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
|
947
|
+
def proc_100_70_0_0_ssh(ip_address)
|
948
|
+
p "min11iwag1"
|
588
949
|
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
950
|
+
begin
|
951
|
+
result_iwag = self.ssh_mac_iwag1_1(ip_address)
|
952
|
+
p result_iwag
|
953
|
+
if result_iwag.split(" ")[0]!="Unknown"
|
954
|
+
ppp = result_iwag.split(" ")
|
955
|
+
|
956
|
+
subs_mac = ppp[0]
|
957
|
+
access_int = ppp[1]
|
958
|
+
access_poi = ppp[2]
|
959
|
+
ssid_a = ppp[3]
|
960
|
+
|
961
|
+
|
962
|
+
if access_int=='GigabitEthernet4.3002'
|
963
|
+
access_poi = "belrw_4_HP_ap1-1"
|
964
|
+
ssid_a = "BelRW_WiFi"
|
965
|
+
elsif access_int=='GigabitEthernet4.3005'
|
966
|
+
access_poi = "belbiz-AP1-1"
|
967
|
+
ssid_a = "IMAGURU_GUEST"
|
968
|
+
end
|
596
969
|
|
597
|
-
|
598
|
-
|
599
|
-
|
970
|
+
if access_poi == "Unknown" && ssid_a == "Unknown" && subs_mac != "Unknown"
|
971
|
+
frommikrotik = self.get_subs_add_info4new_1(access_int, subs_mac)
|
972
|
+
splitting5 = frommikrotik.split("---")
|
973
|
+
p access_poi = splitting5[1]
|
974
|
+
p ssid_a = splitting5[2]
|
975
|
+
p tx_rate_se = splitting5[3]
|
976
|
+
p tx_rat = splitting5[4]
|
977
|
+
p rx_rat = splitting5[5]
|
978
|
+
p rx_signa = splitting5[6]
|
979
|
+
p uptim = splitting5[7]
|
980
|
+
p packet = splitting5[8]
|
981
|
+
p byt = splitting5[9]
|
982
|
+
end
|
600
983
|
|
601
|
-
|
602
|
-
|
603
|
-
|
984
|
+
tx_rate_se = "unknown"
|
985
|
+
tx_rat = "unknown"
|
986
|
+
rx_rat = "unknown"
|
987
|
+
rx_signa = "unknown"
|
988
|
+
uptim = "unknown"
|
989
|
+
packet = "unknown"
|
990
|
+
byt = "unknown"
|
604
991
|
|
605
|
-
|
606
|
-
|
607
|
-
|
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
|
992
|
+
if subs_mac=="unknown"
|
993
|
+
output_params = {:code => 505, :result => "ERROR. Something wrong."}
|
994
|
+
end
|
645
995
|
|
646
|
-
|
647
|
-
rescue
|
648
|
-
puts 'SOAP mts_wifi_get_subs_info_return errorMethod'
|
996
|
+
if subs_mac==""
|
649
997
|
output_params = {:code => 505, :result => "ERROR. Something wrong."}
|
650
998
|
end
|
651
999
|
|
652
|
-
|
1000
|
+
mess = {:iwag_access_interface => access_int,
|
1001
|
+
:subscribers_mac => subs_mac,
|
1002
|
+
:access_point => access_poi,
|
1003
|
+
:ssid_ap => ssid_a,
|
1004
|
+
:apid => "unknown",
|
1005
|
+
:statistics =>
|
1006
|
+
{:tx_rate_set => tx_rate_se,
|
1007
|
+
:tx_rate => tx_rat,
|
1008
|
+
:rx_rate => rx_rat,
|
1009
|
+
:rx_signal => rx_signa,
|
1010
|
+
:uptime => uptim,
|
1011
|
+
:packets => packet,
|
1012
|
+
:bytes => byt}
|
1013
|
+
}
|
1014
|
+
# 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}"
|
1015
|
+
output_params = {:code => 200, :result => "Request completed", :body => {:message => mess}}
|
1016
|
+
p output_params
|
653
1017
|
|
654
1018
|
else
|
655
|
-
|
1019
|
+
|
1020
|
+
mess = {:iwag_access_interface => "unknown",
|
1021
|
+
:subscribers_mac => "unknown",
|
1022
|
+
:access_point => "unknown",
|
1023
|
+
:ssid_ap => "unknown",
|
1024
|
+
:apid => "unknown",
|
1025
|
+
:statistics =>
|
1026
|
+
{:tx_rate_set => "unknown",
|
1027
|
+
:tx_rate => "unknown",
|
1028
|
+
:rx_rate => "unknown",
|
1029
|
+
:rx_signal => "unknown",
|
1030
|
+
:uptime => "unknown",
|
1031
|
+
:packets => "unknown",
|
1032
|
+
:bytes => "unknown"}
|
1033
|
+
}
|
1034
|
+
|
1035
|
+
# 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}"
|
1036
|
+
|
1037
|
+
output_params = {:code => 405, :result => "ERROR. MAC address not found on IWAG."}
|
1038
|
+
|
1039
|
+
#render :soap => mess
|
656
1040
|
|
657
1041
|
end
|
658
1042
|
rescue
|
659
|
-
puts 'SOAP mts_wifi_get_subs_info_return errorMethod
|
660
|
-
output_params = {:code =>
|
1043
|
+
puts 'SOAP mts_wifi_get_subs_info_return errorMethod'
|
1044
|
+
output_params = {:code => 505, :result => "ERROR. Something wrong."}
|
661
1045
|
end
|
662
1046
|
|
663
1047
|
output_params
|
664
1048
|
|
1049
|
+
####
|
1050
|
+
|
665
1051
|
end
|
666
1052
|
|
667
1053
|
|