imperituroard 1.1.7 → 1.1.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.idea/runConfigurations/autovpn.xml +21 -0
- data/.idea/runConfigurations/dabrab_proced.xml +21 -0
- data/.idea/runConfigurations/test9_dab.xml +21 -0
- data/imperituroard.gemspec +1 -1
- data/lib/.DS_Store +0 -0
- data/lib/imperituroard.rb +57 -5
- data/lib/imperituroard/.DS_Store +0 -0
- data/lib/imperituroard/add_functions/logger/any_functions.rb +4 -2
- data/lib/imperituroard/platforms/iwag/get_iwag_data.rb +90 -0
- data/lib/imperituroard/platforms/iwag/iwag_database_worker.rb +24 -0
- data/lib/imperituroard/platforms/iwag/iwag_telnet_connector.rb +112 -0
- data/lib/imperituroard/platforms/staros/staros_automation.rb +1 -1
- data/lib/imperituroard/projects/autovpn.rb +27 -0
- data/lib/imperituroard/projects/{vpn/ezuev_fun → autovpn}/functions_ezuev.rb +0 -0
- data/lib/imperituroard/projects/autovpn/mongo_vpn.rb +56 -0
- data/lib/imperituroard/projects/iot.rb +1 -1
- data/lib/imperituroard/projects/iot/hua_oceanconnect_adapter.rb +25 -21
- data/lib/imperituroard/projects/iot/internal_functions.rb +5 -4
- data/lib/imperituroard/projects/mhub.rb +68 -14
- data/lib/imperituroard/projects/mhub/gms.rb +96 -0
- data/lib/imperituroard/projects/mhub/sk.rb +26 -18
- data/lib/imperituroard/projects/mhub/subs/dabrab/dabrab_platform.rb +5 -4
- data/lib/imperituroard/projects/mhub/subs/dabrab/dabrab_proced.rb +162 -100
- data/lib/imperituroard/projects/mhub/subs/evrotorg/gms_connector.rb +69 -0
- data/lib/imperituroard/projects/ukaz60.rb +4 -2
- data/lib/imperituroard/projects/ukaz60/belgim.rb +1 -1
- data/lib/imperituroard/projects/ukaz60/fortigate.rb +1 -1
- data/lib/imperituroard/projects/ukaz60/staros.rb +5 -5
- data/lib/imperituroard/projects/ukaz60/ukaz60_add_func.rb +50 -4
- data/lib/imperituroard/projects/wttx/updatepostcps.rb +7 -7
- data/lib/imperituroard/version.rb +1 -1
- metadata +17 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5198d998fbd582bceeb23ed0aae23336538cd3ae
|
4
|
+
data.tar.gz: acfe02d6260bc7898565496fddaa3cb5759b78b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 141216aa7ce9480c4dbbbe7b3d6749e58a80e812389485ee78bf6536e0b296052f2a9456fff879c2bed0194c02868952c143f6cd09ba51d16bf32ff046c07bce
|
7
|
+
data.tar.gz: 80e2937875b1f9e28b52297d1544f0c2e05a815fbe17dc4d785860c9fc59d80fb3f98c23cd56e81034569747021186ab6707dc7007cfcecf7151beab2d81c3fe
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<component name="ProjectRunConfigurationManager">
|
2
|
+
<configuration default="false" name="autovpn" type="RubyRunConfigurationType" factoryName="Ruby">
|
3
|
+
<module name="imperituroard" />
|
4
|
+
<RUBY_RUN_CONFIG NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
|
5
|
+
<RUBY_RUN_CONFIG NAME="WORK DIR" VALUE="$MODULE_DIR$/lib/imperituroard/projects" />
|
6
|
+
<RUBY_RUN_CONFIG NAME="SHOULD_USE_SDK" VALUE="false" />
|
7
|
+
<RUBY_RUN_CONFIG NAME="ALTERN_SDK_NAME" VALUE="" />
|
8
|
+
<RUBY_RUN_CONFIG NAME="myPassParentEnvs" VALUE="true" />
|
9
|
+
<envs />
|
10
|
+
<EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="true" />
|
11
|
+
<EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
|
12
|
+
<EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
|
13
|
+
<COVERAGE_PATTERN ENABLED="true">
|
14
|
+
<PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
|
15
|
+
</COVERAGE_PATTERN>
|
16
|
+
</EXTENSION>
|
17
|
+
<RUBY_RUN_CONFIG NAME="SCRIPT_PATH" VALUE="$MODULE_DIR$/lib/imperituroard/projects/autovpn.rb" />
|
18
|
+
<RUBY_RUN_CONFIG NAME="SCRIPT_ARGS" VALUE="" />
|
19
|
+
<method />
|
20
|
+
</configuration>
|
21
|
+
</component>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<component name="ProjectRunConfigurationManager">
|
2
|
+
<configuration default="false" name="dabrab_proced" type="RubyRunConfigurationType" factoryName="Ruby">
|
3
|
+
<module name="imperituroard" />
|
4
|
+
<RUBY_RUN_CONFIG NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
|
5
|
+
<RUBY_RUN_CONFIG NAME="WORK DIR" VALUE="$MODULE_DIR$/lib/imperituroard/projects/mhub/subs/dabrab" />
|
6
|
+
<RUBY_RUN_CONFIG NAME="SHOULD_USE_SDK" VALUE="false" />
|
7
|
+
<RUBY_RUN_CONFIG NAME="ALTERN_SDK_NAME" VALUE="" />
|
8
|
+
<RUBY_RUN_CONFIG NAME="myPassParentEnvs" VALUE="true" />
|
9
|
+
<envs />
|
10
|
+
<EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="true" />
|
11
|
+
<EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
|
12
|
+
<EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
|
13
|
+
<COVERAGE_PATTERN ENABLED="true">
|
14
|
+
<PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
|
15
|
+
</COVERAGE_PATTERN>
|
16
|
+
</EXTENSION>
|
17
|
+
<RUBY_RUN_CONFIG NAME="SCRIPT_PATH" VALUE="$MODULE_DIR$/lib/imperituroard/projects/mhub/subs/dabrab/dabrab_proced.rb" />
|
18
|
+
<RUBY_RUN_CONFIG NAME="SCRIPT_ARGS" VALUE="" />
|
19
|
+
<method />
|
20
|
+
</configuration>
|
21
|
+
</component>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<component name="ProjectRunConfigurationManager">
|
2
|
+
<configuration default="false" name="test9_dab" type="RubyRunConfigurationType" factoryName="Ruby">
|
3
|
+
<module name="imperituroard" />
|
4
|
+
<RUBY_RUN_CONFIG NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
|
5
|
+
<RUBY_RUN_CONFIG NAME="WORK DIR" VALUE="$MODULE_DIR$/test" />
|
6
|
+
<RUBY_RUN_CONFIG NAME="SHOULD_USE_SDK" VALUE="false" />
|
7
|
+
<RUBY_RUN_CONFIG NAME="ALTERN_SDK_NAME" VALUE="" />
|
8
|
+
<RUBY_RUN_CONFIG NAME="myPassParentEnvs" VALUE="true" />
|
9
|
+
<envs />
|
10
|
+
<EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="true" />
|
11
|
+
<EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
|
12
|
+
<EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
|
13
|
+
<COVERAGE_PATTERN ENABLED="true">
|
14
|
+
<PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
|
15
|
+
</COVERAGE_PATTERN>
|
16
|
+
</EXTENSION>
|
17
|
+
<RUBY_RUN_CONFIG NAME="SCRIPT_PATH" VALUE="$MODULE_DIR$/test/test9_dab.rb" />
|
18
|
+
<RUBY_RUN_CONFIG NAME="SCRIPT_ARGS" VALUE="" />
|
19
|
+
<method />
|
20
|
+
</configuration>
|
21
|
+
</component>
|
data/imperituroard.gemspec
CHANGED
data/lib/.DS_Store
CHANGED
Binary file
|
data/lib/imperituroard.rb
CHANGED
@@ -25,6 +25,7 @@ require 'imperituroard/projects/dns'
|
|
25
25
|
require 'imperituroard/platforms/cps/qps_connector'
|
26
26
|
require 'imperituroard/platforms/public/telegram'
|
27
27
|
require 'imperituroard/projects/ukaz60'
|
28
|
+
require 'imperituroard/projects/mhub/gms'
|
28
29
|
|
29
30
|
require 'json'
|
30
31
|
require 'ipaddr'
|
@@ -269,6 +270,17 @@ class Iot
|
|
269
270
|
iot_connector.set_data_replace_2(soapgw_params, real_ip, remote_ip)
|
270
271
|
end
|
271
272
|
|
273
|
+
#14 integration with SPA
|
274
|
+
# add imei to correct profile
|
275
|
+
def spa_service_set(soapgw_params, real_ip, remote_ip)
|
276
|
+
#imei
|
277
|
+
#imsi
|
278
|
+
#msisdn
|
279
|
+
#unp
|
280
|
+
#note
|
281
|
+
#descriptiot
|
282
|
+
end
|
283
|
+
|
272
284
|
|
273
285
|
def logger_to_audit_database(proc_name, src_ip, input_json, output_json, real_ip)
|
274
286
|
mongo_client.audit_logger(proc_name, src_ip, input_json, output_json, real_ip)
|
@@ -299,19 +311,21 @@ class Mhub_2
|
|
299
311
|
:internal_func,
|
300
312
|
:dabrab_connecter,
|
301
313
|
:static_callback,
|
302
|
-
:crm_connector
|
314
|
+
:crm_connector,
|
315
|
+
:log_level
|
303
316
|
|
304
|
-
def initialize(sk_url_simple, sk_login, sk_password, telegram_api_url, telegram_chat_id, sk_url_broadcast, static_callback, crm_callback_url, crm_login, crm_password, sms_alphaname)
|
317
|
+
def initialize(sk_url_simple, sk_login, sk_password, telegram_api_url, telegram_chat_id, sk_url_broadcast, static_callback, crm_callback_url, crm_login, crm_password, sms_alphaname, log_level="error")
|
305
318
|
@sk_url = sk_url_simple
|
306
319
|
@sk_login = sk_login
|
307
320
|
@sk_password = sk_password
|
321
|
+
@log_level = log_level
|
308
322
|
@internal_func = InternalFunc.new
|
309
|
-
@mhub_connector = Sksk_2.new(sk_url_simple, sk_login, sk_password, sk_url_broadcast, telegram_api_url, telegram_chat_id)
|
323
|
+
@mhub_connector = Sksk_2.new(sk_url_simple, sk_login, sk_password, sk_url_broadcast, telegram_api_url, telegram_chat_id, log_level)
|
310
324
|
@internal_func = InternalFunc.new
|
311
325
|
@dabrab_connecter = Dabrab.new
|
312
326
|
@static_callback = static_callback
|
313
|
-
@crm_connector = Crm_2.new(crm_callback_url, crm_login, crm_password, telegram_api_url, telegram_chat_id)
|
314
|
-
@mhub_connector = MhubFunctions_2.new(sk_url_simple, sk_login, sk_password, telegram_api_url, telegram_chat_id, sk_url_broadcast, static_callback, crm_callback_url, crm_login, crm_password, sms_alphaname)
|
327
|
+
@crm_connector = Crm_2.new(crm_callback_url, crm_login, crm_password, telegram_api_url, telegram_chat_id, log_level)
|
328
|
+
@mhub_connector = MhubFunctions_2.new(sk_url_simple, sk_login, sk_password, telegram_api_url, telegram_chat_id, sk_url_broadcast, static_callback, crm_callback_url, crm_login, crm_password, sms_alphaname, log_level)
|
315
329
|
end
|
316
330
|
|
317
331
|
#{"destinations"=>[{"to"=>{"phoneNumber"=>"375297116638", "emailAddress"=>nil}}],
|
@@ -327,6 +341,10 @@ class Mhub_2
|
|
327
341
|
mhub_connector.get_send_message_2(params, ip_src, ip_real, ip_vip)
|
328
342
|
end
|
329
343
|
|
344
|
+
def get_send_message_mass(params, ip_src, ip_real, ip_vip, slice_number=100, time_pause_minutes=5)
|
345
|
+
mhub_connector.get_send_message_mass_2(params, ip_src, ip_real, ip_vip, slice_number, time_pause_minutes)
|
346
|
+
end
|
347
|
+
|
330
348
|
def recieve_delivery_report(params, ip_src, ip_real, ip_vip)
|
331
349
|
mhub_connector.rec_deliv_report_2(params, ip_src, ip_real, ip_vip)
|
332
350
|
end
|
@@ -334,6 +352,26 @@ class Mhub_2
|
|
334
352
|
end
|
335
353
|
|
336
354
|
|
355
|
+
#2020.09.02 function for some procedure for get message status
|
356
|
+
class GmsFunctions_2
|
357
|
+
|
358
|
+
attr_accessor :gms_func
|
359
|
+
|
360
|
+
def initialize(gms_t_login, gms_t_password, gms_r_login, gms_r_password, telegram_api_url, telegram_chat_id)
|
361
|
+
@gms_func = Gmsgms_2.new(gms_t_login, gms_t_password, gms_r_login, gms_r_password, telegram_api_url, telegram_chat_id)
|
362
|
+
end
|
363
|
+
|
364
|
+
def get_t_status_external(external_id)
|
365
|
+
gms_func.get_t_status_external_2(external_id)
|
366
|
+
end
|
367
|
+
|
368
|
+
def get_r_status_external(external_id)
|
369
|
+
gms_func.get_r_status_external_2(external_id)
|
370
|
+
end
|
371
|
+
|
372
|
+
end
|
373
|
+
|
374
|
+
|
337
375
|
class CpsFunctions_2
|
338
376
|
|
339
377
|
attr_accessor :qps_connector
|
@@ -431,3 +469,17 @@ class Ukaz60Automation_2
|
|
431
469
|
end
|
432
470
|
|
433
471
|
end
|
472
|
+
|
473
|
+
|
474
|
+
class Autovpn
|
475
|
+
attr_accessor :vpn_connector
|
476
|
+
|
477
|
+
def initialize (mongo_vpn_ip, mongo_vpn_port, mongo_vpn_database)
|
478
|
+
@vpn_connector = Autovpn.new(mongo_vpn_ip, mongo_vpn_port, mongo_vpn_database)
|
479
|
+
end
|
480
|
+
|
481
|
+
def vpn_add_msisdn_by_example(new_msisdn, example_msisdn)
|
482
|
+
vpn_connector.vpn_add_msisdn_by_example_2(new_msisdn, example_msisdn)
|
483
|
+
end
|
484
|
+
|
485
|
+
end
|
data/lib/imperituroard/.DS_Store
CHANGED
Binary file
|
@@ -14,8 +14,10 @@ class LogAddFunctions_2
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def printer_texter(text, log_level)
|
17
|
-
|
18
|
-
|
17
|
+
if log_level == debug
|
18
|
+
mess = {:datetime => datetimenow, :sdk => "imperituroard", :sdk_version => Imperituroard::VERSION, :message => text}
|
19
|
+
p mess
|
20
|
+
end
|
19
21
|
end
|
20
22
|
|
21
23
|
|
@@ -0,0 +1,90 @@
|
|
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
|
@@ -0,0 +1,24 @@
|
|
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
|
+
def insert_new_cache()
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
|
23
|
+
end
|
24
|
+
|
@@ -0,0 +1,112 @@
|
|
1
|
+
require 'net-telnet'
|
2
|
+
require 'net/ssh'
|
3
|
+
require 'date'
|
4
|
+
|
5
|
+
class CSRtelnet_1
|
6
|
+
|
7
|
+
attr_accessor :iwag1_host, :iwag_username, :iwag_password
|
8
|
+
|
9
|
+
def initialize(iwag1_host, iwag_username, iwag_password)
|
10
|
+
@iwag1_host = iwag1_host
|
11
|
+
@iwag_username = iwag_username
|
12
|
+
@iwag_password = iwag_password
|
13
|
+
end
|
14
|
+
|
15
|
+
def get_subs_mac2_1(ipaddress)
|
16
|
+
|
17
|
+
subscribers_mac = ""
|
18
|
+
|
19
|
+
#begin
|
20
|
+
|
21
|
+
dump =""
|
22
|
+
connection = Net::Telnet.new( "Host" => iwag1_host, "Timeout" => false, "Prompt" => /.*\#/ ) { |str| }
|
23
|
+
connection.login({ "Name" => iwag_username, "Password" => iwag_password, "LoginPrompt" => /Username:/ }) { |str| }
|
24
|
+
connection.cmd("show ip dhcp binding #{ipaddress}") {
|
25
|
+
|c|
|
26
|
+
p c
|
27
|
+
dump << c
|
28
|
+
}
|
29
|
+
connection.close
|
30
|
+
as = dump.split("\n")
|
31
|
+
p as
|
32
|
+
reer = as[4].split(" ")
|
33
|
+
|
34
|
+
ma = reer[1].to_s.upcase
|
35
|
+
pos = ma[0]+ma[1]
|
36
|
+
if pos=="01"
|
37
|
+
subscribers_mac = ma[2]+ma[3]+":"+ma[5]+ma[6]+":"+ma[7]+ma[8]+":"+ma[10]+ma[11]+":"+ma[12]+ma[13]+":"+ma[15]+ma[16]
|
38
|
+
else
|
39
|
+
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]
|
40
|
+
end
|
41
|
+
|
42
|
+
|
43
|
+
#rescue
|
44
|
+
# subscribers_mac = "unknown"
|
45
|
+
#end
|
46
|
+
|
47
|
+
return subscribers_mac
|
48
|
+
|
49
|
+
end
|
50
|
+
|
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
|
+
|
63
|
+
|
64
|
+
def return_iwag_access_interface_1(ipaddress)
|
65
|
+
host_iwag = iwag1_host
|
66
|
+
username_iwag = iwag_username
|
67
|
+
password_iwag = iwag_password
|
68
|
+
answer =""
|
69
|
+
|
70
|
+
dump =""
|
71
|
+
begin
|
72
|
+
connection = Net::Telnet.new("Host" => host_iwag, "Timeout" => false, "Prompt" => /.*\#/) {|str| print str}
|
73
|
+
connection.login({"Name" => username_iwag, "Password" => password_iwag, "LoginPrompt" => /Username:/}) {|str| print str}
|
74
|
+
connection.cmd("show ip dhcp binding #{ipaddress}") {
|
75
|
+
|c|
|
76
|
+
dump << c
|
77
|
+
}
|
78
|
+
connection.close
|
79
|
+
as = dump.split("\n")
|
80
|
+
|
81
|
+
if as[4] != nil && as[3] != ""
|
82
|
+
access_interface = as[4].gsub!(" ", "").split(" ").last
|
83
|
+
return access_interface
|
84
|
+
else
|
85
|
+
answer ="false"
|
86
|
+
return answer
|
87
|
+
end
|
88
|
+
rescue
|
89
|
+
begin
|
90
|
+
connection = Net::Telnet.new("Host" => host_iwag, "Timeout" => false, "Prompt" => /.*\#/) {|str| print str}
|
91
|
+
connection.login({"Name" => username_iwag, "Password" => password_iwag, "LoginPrompt" => /Username:/}) {|str| print str}
|
92
|
+
connection.cmd("show ip dhcp binding #{ipaddress}") {
|
93
|
+
|c|
|
94
|
+
dump << c
|
95
|
+
}
|
96
|
+
connection.close
|
97
|
+
as = dump.split("\n")
|
98
|
+
if as[4] != nil && as[3] != ""
|
99
|
+
access_interface = as[4].gsub!(" ", "").split(" ").last
|
100
|
+
return access_interface
|
101
|
+
else
|
102
|
+
answer ="false"
|
103
|
+
return answer
|
104
|
+
end
|
105
|
+
rescue
|
106
|
+
return "unknown"
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
|
112
|
+
end
|