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