lib/freewifi/mikrotik/newhub_mtik_ssh.rb in freewifi-0.2.3 vs lib/freewifi/mikrotik/newhub_mtik_ssh.rb in freewifi-0.2.4
- old
+ new
@@ -23,11 +23,11 @@
begin
Net::SSH.start(hub1, user_hub, :password => password_hub) do |ssh|
#result = ssh.exec!("/interface eoip print where tunnel-id=#{tunnel_id}")
#p result
result = ssh.exec!("/interface eoip print where tunnel-id=#{tunnel_id}")
- regimsi = /\s+name=\"(.+)\"\s+/
+ regimsi = /\s+name="(.+)"\s+/
m1 = regimsi.match(result)[1]
sleep 0.2
result2 = ssh.exec!("/interface bridge port remove [/interface bridge port find interface=#{m1}]")
sleep 0.2
result3 = ssh.exec!("/interface eoip remove [/interface eoip find where tunnel-id=#{tunnel_id}]")
@@ -40,11 +40,11 @@
end
begin
Net::SSH.start(hub2, user_hub, :password => password_hub) do |ssh|
result = ssh.exec!("/interface eoip print where tunnel-id=#{tunnel_id}")
- regimsi = /\s+name=\"(.+)\"\s+/
+ regimsi = /\s+name="(.+)"\s+/
m1 = regimsi.match(result)[1]
sleep 0.2
result2 = ssh.exec!("/interface bridge port remove [/interface bridge port find interface=#{m1}]")
sleep 0.2
result3 = ssh.exec!("/interface eoip remove [/interface eoip find where tunnel-id=#{tunnel_id}]")
@@ -220,16 +220,16 @@
if j == ip_addr_new
res = "exists"
end
end
end
- output_params = {:code => 200, :result => "check_pool_range_includes_1: Request processed", :body => {:result => res}}
+ output_params = {:code => 200, :result => 'check_pool_range_includes_1: Request processed', :body => {:result => res}}
rescue
- output_params = {:code => 507, :result => "check_pool_range_includes_1: Unknown SDK error"}
+ output_params = {:code => 507, :result => 'check_pool_range_includes_1: Unknown SDK error'}
end
- additional_func_wifi_1.printer_texter_wifi_1({:input_params => input_params, :output_params => output_params, :procedure => "check_pool_range_includes_1", :file => "freewifi/mikrotik/newhub_mtik_ssh.rb", :sdk => "freewifi"}, "debug")
+ additional_func_wifi_1.printer_texter_wifi_1({:input_params => input_params, :output_params => output_params, :procedure => 'check_pool_range_includes_1', :file => 'freewifi/mikrotik/newhub_mtik_ssh.rb', :sdk => 'freewifi'}, 'debug')
output_params
end
def capsman_set_ip_range_1(capsman1, capsman_user1, capsman_pass1, ap_ip)
@@ -243,11 +243,11 @@
conf_5ghz_name = "auto_cfg_5ghz_#{companyname}_#{wifissid}"
command_conf_5ghz = "/caps-man configuration add name=#{conf_5ghz_name} ssid=#{wifissid} country=belarus mode=ap hw-retries=15 channel=5_channel_5GHz_number1_power23 datapath=1_datapath_MTS_Local-forwarding security=security_without_passphrase_default_FREE-WiFi"
command_provisioning_24ghz = "/caps-man provisioning add hw-supported-modes=b,g,gn ip-address-ranges=#{ap_ip} action=create-dynamic-enabled place-before=30 master-configuration=#{conf_24ghz_name} name-format=identity"
- command_provisioning_5ghz = "/caps-man provisioning add hw-supported-modes=a,ac,an ip-address-ranges=#{ap_ip} action=create-dynamic-enabled place-before=30 master-configuration=#{conf_24ghz_name} name-format=identity"
+ command_provisioning_5ghz = "/caps-man provisioning add hw-supported-modes=a,ac,an ip-address-ranges=#{ap_ip} action=create-dynamic-enabled place-before=30 master-configuration=#{conf_5ghz_name} name-format=identity"
Net::SSH.start(capsman1, capsman_user1, :password => capsman_pass1) do |ssh|
result = ssh.exec!(command_conf_24ghz)
result1 = ssh.exec!(command_conf_5ghz)
result2 = ssh.exec!(command_provisioning_24ghz)
@@ -268,21 +268,21 @@
Net::SSH.start(capsman1, capsman_user1, :password => capsman_pass1) do |ssh|
result = ssh.exec!(command)
s1 = result.split("\r\n\r\n")
for a in s1
- a1 = a.gsub("\r\n", "")
- a2 = a1.gsub(", ", ",")
+ a1 = a.gsub("\r\n", '')
+ a2 = a1.gsub(', ', ',')
reg_addr_range = / (\d) .+ ip-address-ranges=(\d{1,3}.+\.\d{1,3}|\d{1,3}.+\.\d{1,3}\/\d{1,2})\s+/
m1 = a2.scan(reg_addr_range)
num = m1[0][0]
ip_ran = m1[0][1].gsub(" ", "")
triplet = [num, ip_ran]
final_provision_old << triplet
exists_check = self.check_pool_range_includes_1(triplet[1], ap_ip)
- if exists_check[:body][:result] != "exists"
+ if exists_check[:body][:result] != 'exists'
#self.capsman_set_ip_range_1(capsman1, capsman_user1, capsman_pass1, ap_ip)
#set data to capsman
rewrite_ip_command = "/caps-man provisioning set numbers=#{triplet[0]} ip-address-ranges=#{triplet[1]},#{ap_ip}"
p rewrite_ip_command
@@ -312,11 +312,11 @@
if result == "\r\n" || result == "" || result == nil
self.capsman_new_configuration_1(wifissid, capsman1, capsman_user1, capsman_pass1, ap_ip, companyname)
else
p result
conf_names = []
- reg_config_name = /name=\"(\S+)\"/
+ reg_config_name = /name="(\S+)"/
m1 = result.scan(reg_config_name)
for a1 in m1
if a1[0] != []
s1 = a1[0]
conf_names << s1
@@ -324,10 +324,10 @@
end
self.capsman_add_ip_to_existed_1(conf_names, capsman1, capsman_user1, capsman_pass1, ap_ip)
end
end
rescue
- output_params = {:code => 507, :result => "set_capsman_config_1: Unknown SDK error"}
+ output_params = {:code => 507, :result => 'set_capsman_config_1: Unknown SDK error'}
end
additional_func_wifi_1.printer_texter_wifi_1({:input_params => input_params, :output_params => output_params, :procedure => "set_capsman_config_1", :file => "freewifi/mikrotik/newhub_mtik_ssh.rb", :sdk => "freewifi"}, "debug")
output_params
\ No newline at end of file