$LOAD_PATH.unshift File.expand_path("../cisco/iwag", __dir__) $LOAD_PATH.unshift File.expand_path("../mikrotik", __dir__) $LOAD_PATH.unshift File.expand_path("../huawei", __dir__) require 'freewifi/cisco/iwag/iwag_telnet_connector' require 'freewifi/mikrotik/newhub_mtik_api' require 'freewifi/huawei/hua_controller_class' require 'freewifi/cisco/iwag/get_iwag_data' require 'rubygems' require 'savon' class WiFiPortal_1 attr_accessor :iwag_telnet_connector, :ard_api_gw_connector_wifi, :iwag1_host, :iwag_username, :iwag_password, :mtik_control_ips_get, :mtik_user, :mtik_password, :mtik_api_connector, :hua_controller_connector, :iwag_connector1, :iwag_connector2 def initialize(apigw_wsdl, apigw_endpoint, apigw_namespace, apigw_wsse_aut_log, apigw_wsse_aut_pass, iwag1_host, iwag1_username, iwag1_password, iwag1_port, mtik_control_ips_get, mtik_user, mtik_password, hua_wlc_1_ip, hua_wlc_2_ip, hua_wlc_login, hua_wlc_password, iwag2_host, iwag2_username, iwag2_password, iwag2_port ) @iwag_telnet_connector = CSRtelnet_1.new(iwag1_host, iwag1_username, iwag1_password) @ard_api_gw_connector_wifi = Savon.client do #ssl_verify_mode :none wsdl apigw_wsdl endpoint apigw_endpoint namespace apigw_namespace wsse_auth(apigw_wsse_aut_log, apigw_wsse_aut_pass, :digest) encoding 'UTF-8' headers = {"Accept-Encoding" => "gzip, deflate", "Connection" => "Keep-Alive"} end @iwag1_host = iwag1_host @iwag_username = iwag1_username @iwag_password = iwag1_password @mtik_api_connector = NEWhubWifiApi_1.new(mtik_control_ips_get, mtik_user, mtik_password) @hua_controller_connector = HuaWifi_1.new(hua_wlc_1_ip, hua_wlc_2_ip, hua_wlc_login, hua_wlc_password) @iwag_connector1 = IwagRequester.new(iwag1_host, iwag1_username, iwag1_password, iwag1_port) @iwag_connector2 = IwagRequester.new(iwag2_host, iwag2_username, iwag2_password, iwag2_port) end def python_mac_iwag1_1(ipaddress) begin response = ard_api_gw_connector_wifi.call(:mts_python_mac_iwag1) do message({:ipaddress => ipaddress}) end answer = response.to_hash return answer[:mts_python_mac_iwag1_response][:data].gsub("\n", "") rescue return "Unknown Unknown Unknown Unknown" end end def ssh_mac_iwag1_1(ipaddress) begin data_iw1 = iwag_connector1.iwag_get_dhcp_binding_ssh(ipaddress) "#{data_iw1[:mac]} #{data_iw1[:iwaginterface]} #{data_iw1[:aphostname]} #{data_iw1[:SSID]}" rescue return "Unknown Unknown Unknown Unknown" end end def python_mac_iwag2_1(ipaddress) begin response = ard_api_gw_connector_wifi.call(:mts_python_mac_iwag2) do message({:ipaddress => ipaddress}) end answer = response.to_hash return answer[:mts_python_mac_iwag2_response][:data].gsub("\n", "") rescue return "Unknown Unknown Unknown Unknown" end end def ssh_mac_iwag2_1(ipaddress) begin data_iw1 = iwag_connector2.iwag_get_dhcp_binding_ssh(ipaddress) "#{data_iw1[:mac]} #{data_iw1[:iwaginterface]} #{data_iw1[:aphostname]} #{data_iw1[:SSID]}" rescue return "Unknown Unknown Unknown Unknown" end end def get_subs_add_info3_1(ipaddress, access_interface) answer = "" #region get additional information if access_interface != "false" subscribers_mac = "" begin dump ="" connection = Net::Telnet.new("Host" => "172.24.247.183", "Timeout" => false, "Prompt" => /.*\#/) {|str|} connection.login({"Name" => iwag_username, "Password" => iwag_password, "LoginPrompt" => /Username:/}) {|str|} connection.cmd("show ip dhcp binding #{ipaddress}") { |c| dump << c } connection.close as = dump.split("\n") reer = as[4].split(" ") ma = reer[1].to_s.upcase pos = ma[0]+ma[1] if pos=="01" 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] else 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] end rescue subscribers_mac = "unknown" end begin thr0 = Thread.new do begin p mikr_info5 = mtik_api_connector.get_info_subs_from_mik_1(subscribers_mac, "172.24.247.15") splitting5 = mikr_info5.split("---") if splitting5[1] != "not on mikrotik controller" && splitting5[1]!="unknown" && splitting5[1]!=nil answer = mikr_info5 end rescue p "thr1 wrong" end end rescue p "thread 0 failed" end begin thr1 = Thread.new do begin p mikr_info7 = mtik_api_connector.get_info_subs_from_mik_1(subscribers_mac, "172.24.214.155") splitting7 = mikr_info7.split("---") if splitting7[1] != "not on mikrotik controller" && splitting7[1]!="unknown" && splitting7[1]!=nil answer = mikr_info7 end rescue p "thr1 wrong" end end rescue p "thread 1 failed" end begin thr2 = Thread.new do begin p mikr_info9 = mtik_api_connector.get_info_subs_from_mik_1(subscribers_mac, "172.24.214.140") splitting9 = mikr_info9.split("---") if splitting9[1] != "not on mikrotik controller" && splitting9[1]!="unknown" && splitting9[1]!=nil answer = mikr_info9 end rescue p "thr2 wrong" end end rescue p "thread 2 failed" end begin thr3 = Thread.new do begin p mikr_info9 = mtik_api_connector.get_info_subs_from_mik_1(subscribers_mac, "172.24.214.105") splitting9 = mikr_info9.split("---") if splitting9[1] != "not on mikrotik controller" && splitting9[1]!="unknown" && splitting9[1]!=nil answer = mikr_info9 end rescue p "thr3 wrong" end end rescue p "thread 3 failed" end begin thr4 = Thread.new do begin p mikr_info9 = mtik_api_connector.get_info_subs_from_mik_1(subscribers_mac, "172.24.223.105") splitting9 = mikr_info9.split("---") if splitting9[1] != "not on mikrotik controller" && splitting9[1]!="unknown" && splitting9[1]!=nil answer = mikr_info9 end rescue p "thr4 wrong" end end rescue p "thread 4 failed" end thr0.join thr1.join thr2.join thr3.join thr4.join if answer=="" answer = subscribers_mac + "---" + "not on mikrotik controller" + "---" + "unknown" + "---" + "unknown" + "---"+ "unknown" + "---"+ "unknown" + "---"+ "unknown" + "---"+ "unknown" + "---"+ "unknown" + "---"+ "unknown" end end return answer end def get_subs_add_info4new_1(access_interface, subscribers_mac) capsman_list = [ "172.24.247.15", "172.24.214.155", "172.24.214.140", "172.24.214.105", "172.24.223.105" ] answer = "" #region get additional information if access_interface != "false" p subscribers_mac threads_mikro_wlc = [] capsman_list.each do |capsman| threads_mikro_wlc << Thread.new do begin p mikr_info5 = mtik_api_connector.get_info_subs_from_mik_1(subscribers_mac, capsman) splitting5 = mikr_info5.split("---") if splitting5[1] != "not on mikrotik controller" && splitting5[1]!="unknown" && splitting5[1]!=nil answer = mikr_info5 p answer end rescue p "thr0 wrong" end end end threads_mikro_wlc.each(&:join) if answer=="" answer = subscribers_mac + "---" + "not on mikrotik controller" + "---" + "unknown" + "---" + "unknown" + "---"+ "unknown" + "---"+ "unknown" + "---"+ "unknown" + "---"+ "unknown" + "---"+ "unknown" + "---"+ "unknown" end end answer end def proc_100_71_0_0(ip_address) begin p access_int = iwag_telnet_connector.return_iwag_access_interface_1(ip_address) ip_a = ip_address access_poi = "unknown" ssid_a = "unknown" tx_rate_se = "unknown" tx_rat = "unknown" rx_rat = "unknown" rx_signa = "unknown" uptim = "unknown" packet = "unknown" byt = "unknown" if access_int == "Tunnel5" mikr_info2 = self.get_subs_add_info3_1(ip_address, access_int) splitting2 = mikr_info2.split("---") subs_mac = splitting2[0] access_poi = "belrw_3_Cisco_ap1-1" ssid_a = "BelRW_WiFi" tx_rate_se = "unknown" tx_rat = "unknown" rx_rat = "unknown" rx_signa = "unknown" uptim = "unknown" packet = "unknown" byt = "unknown" elsif access_int == "GigabitEthernet2.4008" mikr_info3 = self.get_subs_add_info3_1(ip_address, access_int) splitting3 = mikr_info3.split("---") subs_mac = splitting3[0] access_poi = "belrw_4_HP_ap1-1" ssid_a = "BelRW_WiFi" tx_rate_se = "unknown" tx_rat = "unknown" rx_rat = "unknown" rx_signa = "unknown" uptim = "unknown" packet = "unknown" byt = "unknown" elsif access_int == "Tunnel9" subs_mac = iwag_telnet_connector.get_subs_mac2_1(ip_address) p resp1 = hua_controller_connector.get_sub_info_1(subs_mac) p resp=resp1.split(",,,") p access_poi = resp[1] p ssid_a = resp[2] p tx_rate_se = resp[3] p tx_rat = resp[4] p rx_rat = resp[5] p rx_signa = resp[6] p uptim = resp[7] p packet = resp[8] p byt = resp[9] elsif access_int == "Tunnel16" subs_mac = iwag_telnet_connector.get_subs_mac2_1(ip_address) p resp1 = hua_controller_connector.get_sub_info2_1(subs_mac) p resp=resp1.split(",,,") p access_poi = resp[1] p ssid_a = resp[2] p tx_rate_se = resp[3] p tx_rat = resp[4] p rx_rat = resp[5] p rx_signa = resp[6] p uptim = resp[7] p packet = resp[8] p byt = resp[9] else p "before get info" p mikr_info5 = self.get_subs_add_info3_1(ip_address, access_int) p "after get info" splitting5 = mikr_info5.split("---") p subs_mac = splitting5[0] p access_poi = splitting5[1] p ssid_a = splitting5[2] p tx_rate_se = splitting5[3] p tx_rat = splitting5[4] p rx_rat = splitting5[5] p rx_signa = splitting5[6] p uptim = splitting5[7] p packet = splitting5[8] p byt = splitting5[9] if access_poi==nil || access_poi=="" || access_poi=="unknown" access_poi = "not on mikrotik controller" end if ssid_a==nil || ssid_a=="" || ssid_a=="unknown" ssid_a = "unknown" tx_rate_se = "unknown" tx_rat = "unknown" rx_rat = "unknown" rx_signa = "unknown" uptim = "unknown" packet = "unknown" byt = "unknown" end end if subs_mac=="unknown" output_params = {:code => 505, :result => "ERROR. Something wrong."} end if subs_mac=="" subs_mac="unknown" end mess = {:iwag_access_interface => access_int, :subscribers_mac => subs_mac, :access_point => access_poi, :ssid_ap => ssid_a, :apid => "unknown", :statistics => {:tx_rate_set => tx_rate_se, :tx_rate => tx_rat, :rx_rate => rx_rat, :rx_signal => rx_signa, :uptime => uptim, :packets => packet, :bytes => byt} } # 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}" output_params = {:code => 200, :result => "Request completed", :body => {:message => mess}} rescue puts 'SOAP mts_wifi_get_subs_info_return errorMethod' output_params = {:code => 505, :result => "ERROR. Something wrong."} end output_params end def proc_100_75_0_0(ip_address) begin result_iwag = self.python_mac_iwag2_1(ip_address) if result_iwag.split(" ")[0]!="Unknown" ppp = result_iwag.split(" ") subs_mac = ppp[0] access_int = ppp[1] access_poi = ppp[2] ssid_a = ppp[3] tx_rate_se = "unknown" tx_rat = "unknown" rx_rat = "unknown" rx_signa = "unknown" uptim = "unknown" packet = "unknown" byt = "unknown" if access_int=='GigabitEthernet4.3002' access_poi = "belrw_4_HP_ap1-1" ssid_a = "BelRW_WiFi" elsif access_int=='GigabitEthernet4.3005' access_poi = "belbiz-AP1-1" ssid_a = "IMAGURU_GUEST" end if access_poi == "Unknown" && ssid_a == "Unknown" && subs_mac != "Unknown" frommikrotik = self.get_subs_add_info4new_1(access_int, subs_mac) splitting5 = frommikrotik.split("---") p access_poi = splitting5[1] p ssid_a = splitting5[2] p tx_rate_se = splitting5[3] p tx_rat = splitting5[4] p rx_rat = splitting5[5] p rx_signa = splitting5[6] p uptim = splitting5[7] p packet = splitting5[8] p byt = splitting5[9] end if subs_mac=="unknown" output_params = {:code => 505, :result => "ERROR. Something wrong."} end if subs_mac=="" subs_mac="unknown" end mess = {:iwag_access_interface => access_int, :subscribers_mac => subs_mac, :access_point => access_poi, :ssid_ap => ssid_a, :apid => "unknown", :statistics => {:tx_rate_set => tx_rate_se, :tx_rate => tx_rat, :rx_rate => rx_rat, :rx_signal => rx_signa, :uptime => uptim, :packets => packet, :bytes => byt} } # 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}" output_params = {:code => 200, :result => "Request completed", :body => {:message => mess}} p output_params else mess = {:iwag_access_interface => "unknown", :subscribers_mac => "unknown", :access_point => "unknown", :ssid_ap => "unknown", :apid => "unknown", :statistics => {:tx_rate_set => "unknown", :tx_rate => "unknown", :rx_rate => "unknown", :rx_signal => "unknown", :uptime => "unknown", :packets => "unknown", :bytes => "unknown"} } # 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}" output_params = {:code => 202, :result => "Request completed", :body => {:message => mess}} p output_params end rescue puts 'SOAP mts_wifi_get_subs_info_return errorMethod' output_params = {:code => 505, :result => "ERROR. Something wrong."} end output_params #### end def proc_100_70_0_0(ip_address) p "min11iwag1" begin result_iwag = self.python_mac_iwag1_1(ip_address) p result_iwag if result_iwag.split(" ")[0]!="Unknown" ppp = result_iwag.split(" ") subs_mac = ppp[0] access_int = ppp[1] access_poi = ppp[2] ssid_a = ppp[3] if access_int=='GigabitEthernet4.3002' access_poi = "belrw_4_HP_ap1-1" ssid_a = "BelRW_WiFi" elsif access_int=='GigabitEthernet4.3005' access_poi = "belbiz-AP1-1" ssid_a = "IMAGURU_GUEST" end if access_poi == "Unknown" && ssid_a == "Unknown" && subs_mac != "Unknown" frommikrotik = self.get_subs_add_info4new_1(access_int, subs_mac) splitting5 = frommikrotik.split("---") p access_poi = splitting5[1] p ssid_a = splitting5[2] p tx_rate_se = splitting5[3] p tx_rat = splitting5[4] p rx_rat = splitting5[5] p rx_signa = splitting5[6] p uptim = splitting5[7] p packet = splitting5[8] p byt = splitting5[9] end tx_rate_se = "unknown" tx_rat = "unknown" rx_rat = "unknown" rx_signa = "unknown" uptim = "unknown" packet = "unknown" byt = "unknown" if subs_mac=="unknown" output_params = {:code => 505, :result => "ERROR. Something wrong."} end if subs_mac=="" output_params = {:code => 505, :result => "ERROR. Something wrong."} end mess = {:iwag_access_interface => access_int, :subscribers_mac => subs_mac, :access_point => access_poi, :ssid_ap => ssid_a, :apid => "unknown", :statistics => {:tx_rate_set => tx_rate_se, :tx_rate => tx_rat, :rx_rate => rx_rat, :rx_signal => rx_signa, :uptime => uptim, :packets => packet, :bytes => byt} } # 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}" output_params = {:code => 200, :result => "Request completed", :body => {:message => mess}} p output_params else mess = {:iwag_access_interface => "unknown", :subscribers_mac => "unknown", :access_point => "unknown", :ssid_ap => "unknown", :apid => "unknown", :statistics => {:tx_rate_set => "unknown", :tx_rate => "unknown", :rx_rate => "unknown", :rx_signal => "unknown", :uptime => "unknown", :packets => "unknown", :bytes => "unknown"} } # 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}" output_params = {:code => 405, :result => "ERROR. MAC address not found on IWAG."} #render :soap => mess end rescue puts 'SOAP mts_wifi_get_subs_info_return errorMethod' output_params = {:code => 505, :result => "ERROR. Something wrong."} end output_params #### end def get_subs_info_return_1(ip_address) input_params = {:ip_address => ip_address} output_params = {} begin ipaddr_transformed = IPAddr.new ip_address ipaddr_network = ipaddr_transformed.mask(17).to_s if ipaddr_network == "100.71.0.0" #iwag old output_params = self.proc_100_71_0_0(ip_address) elsif ipaddr_network == "100.75.0.0" #min11iwag2 output_params = self.proc_100_75_0_0(ip_address) elsif ipaddr_network == "100.70.0.0" #min11iwag1 output_params = self.proc_100_70_0_0(ip_address) else output_params = {:code => 404, :result => "ERROR. Unknown IP Pool."} end rescue output_params = {:code => 500, :result => "ERROR. Something wrong.", :body => "SOAP mts_wifi_get_subs_info_return errorMethod unknown error"} end output_params end def get_subs_info_ret_ssh_1(ip_address) input_params = {:ip_address => ip_address} output_params = {} begin ipaddr_transformed = IPAddr.new ip_address ipaddr_network = ipaddr_transformed.mask(17).to_s if ipaddr_network == "100.71.0.0" #iwag old output_params = self.proc_100_71_0_0_ssh(ip_address) elsif ipaddr_network == "100.75.0.0" #min11iwag2 output_params = self.proc_100_75_0_0_ssh(ip_address) elsif ipaddr_network == "100.70.0.0" #min11iwag1 output_params = self.proc_100_70_0_0_ssh(ip_address) else output_params = {:code => 404, :result => "ERROR. Unknown IP Pool."} end rescue output_params = {:code => 500, :result => "ERROR. Something wrong.", :body => "SOAP mts_wifi_get_subs_info_return errorMethod unknown error"} end output_params end def proc_100_71_0_0_ssh(ip_address) begin p access_int = iwag_telnet_connector.return_iwag_access_interface_1(ip_address) ip_a = ip_address access_poi = "unknown" ssid_a = "unknown" tx_rate_se = "unknown" tx_rat = "unknown" rx_rat = "unknown" rx_signa = "unknown" uptim = "unknown" packet = "unknown" byt = "unknown" if access_int == "Tunnel5" mikr_info2 = self.get_subs_add_info3_1(ip_address, access_int) splitting2 = mikr_info2.split("---") subs_mac = splitting2[0] access_poi = "belrw_3_Cisco_ap1-1" ssid_a = "BelRW_WiFi" tx_rate_se = "unknown" tx_rat = "unknown" rx_rat = "unknown" rx_signa = "unknown" uptim = "unknown" packet = "unknown" byt = "unknown" elsif access_int == "GigabitEthernet2.4008" mikr_info3 = self.get_subs_add_info3_1(ip_address, access_int) splitting3 = mikr_info3.split("---") subs_mac = splitting3[0] access_poi = "belrw_4_HP_ap1-1" ssid_a = "BelRW_WiFi" tx_rate_se = "unknown" tx_rat = "unknown" rx_rat = "unknown" rx_signa = "unknown" uptim = "unknown" packet = "unknown" byt = "unknown" elsif access_int == "Tunnel9" subs_mac = iwag_telnet_connector.get_subs_mac2_1(ip_address) p resp1 = hua_controller_connector.get_sub_info_1(subs_mac) p resp=resp1.split(",,,") p access_poi = resp[1] p ssid_a = resp[2] p tx_rate_se = resp[3] p tx_rat = resp[4] p rx_rat = resp[5] p rx_signa = resp[6] p uptim = resp[7] p packet = resp[8] p byt = resp[9] elsif access_int == "Tunnel16" subs_mac = iwag_telnet_connector.get_subs_mac2_1(ip_address) p resp1 = hua_controller_connector.get_sub_info2_1(subs_mac) p resp=resp1.split(",,,") p access_poi = resp[1] p ssid_a = resp[2] p tx_rate_se = resp[3] p tx_rat = resp[4] p rx_rat = resp[5] p rx_signa = resp[6] p uptim = resp[7] p packet = resp[8] p byt = resp[9] else p "before get info" p mikr_info5 = self.get_subs_add_info3_1(ip_address, access_int) p "after get info" splitting5 = mikr_info5.split("---") p subs_mac = splitting5[0] p access_poi = splitting5[1] p ssid_a = splitting5[2] p tx_rate_se = splitting5[3] p tx_rat = splitting5[4] p rx_rat = splitting5[5] p rx_signa = splitting5[6] p uptim = splitting5[7] p packet = splitting5[8] p byt = splitting5[9] if access_poi==nil || access_poi=="" || access_poi=="unknown" access_poi = "not on mikrotik controller" end if ssid_a==nil || ssid_a=="" || ssid_a=="unknown" ssid_a = "unknown" tx_rate_se = "unknown" tx_rat = "unknown" rx_rat = "unknown" rx_signa = "unknown" uptim = "unknown" packet = "unknown" byt = "unknown" end end if subs_mac=="unknown" output_params = {:code => 505, :result => "ERROR. Something wrong."} end if subs_mac=="" subs_mac="unknown" end mess = {:iwag_access_interface => access_int, :subscribers_mac => subs_mac, :access_point => access_poi, :ssid_ap => ssid_a, :apid => "unknown", :statistics => {:tx_rate_set => tx_rate_se, :tx_rate => tx_rat, :rx_rate => rx_rat, :rx_signal => rx_signa, :uptime => uptim, :packets => packet, :bytes => byt} } # 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}" output_params = {:code => 200, :result => "Request completed", :body => {:message => mess}} rescue puts 'SOAP mts_wifi_get_subs_info_return errorMethod' output_params = {:code => 505, :result => "ERROR. Something wrong."} end output_params end def proc_100_75_0_0_ssh(ip_address) begin result_iwag = self.ssh_mac_iwag2_1(ip_address) if result_iwag.split(" ")[0]!="Unknown" ppp = result_iwag.split(" ") subs_mac = ppp[0] access_int = ppp[1] access_poi = ppp[2] ssid_a = ppp[3] tx_rate_se = "unknown" tx_rat = "unknown" rx_rat = "unknown" rx_signa = "unknown" uptim = "unknown" packet = "unknown" byt = "unknown" if access_int=='GigabitEthernet4.3002' access_poi = "belrw_4_HP_ap1-1" ssid_a = "BelRW_WiFi" elsif access_int=='GigabitEthernet4.3005' access_poi = "belbiz-AP1-1" ssid_a = "IMAGURU_GUEST" end if access_poi == "Unknown" && ssid_a == "Unknown" && subs_mac != "Unknown" frommikrotik = self.get_subs_add_info4new_1(access_int, subs_mac) splitting5 = frommikrotik.split("---") p access_poi = splitting5[1] p ssid_a = splitting5[2] p tx_rate_se = splitting5[3] p tx_rat = splitting5[4] p rx_rat = splitting5[5] p rx_signa = splitting5[6] p uptim = splitting5[7] p packet = splitting5[8] p byt = splitting5[9] end if subs_mac=="unknown" output_params = {:code => 505, :result => "ERROR. Something wrong."} end if subs_mac=="" subs_mac="unknown" end mess = {:iwag_access_interface => access_int, :subscribers_mac => subs_mac, :access_point => access_poi, :ssid_ap => ssid_a, :apid => "unknown", :statistics => {:tx_rate_set => tx_rate_se, :tx_rate => tx_rat, :rx_rate => rx_rat, :rx_signal => rx_signa, :uptime => uptim, :packets => packet, :bytes => byt} } # 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}" output_params = {:code => 200, :result => "Request completed", :body => {:message => mess}} p output_params else mess = {:iwag_access_interface => "unknown", :subscribers_mac => "unknown", :access_point => "unknown", :ssid_ap => "unknown", :apid => "unknown", :statistics => {:tx_rate_set => "unknown", :tx_rate => "unknown", :rx_rate => "unknown", :rx_signal => "unknown", :uptime => "unknown", :packets => "unknown", :bytes => "unknown"} } # 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}" output_params = {:code => 202, :result => "Request completed", :body => {:message => mess}} p output_params end rescue puts 'SOAP mts_wifi_get_subs_info_return errorMethod' output_params = {:code => 505, :result => "ERROR. Something wrong."} end output_params #### end def proc_100_70_0_0_ssh(ip_address) p "min11iwag1" begin result_iwag = self.ssh_mac_iwag1_1(ip_address) p result_iwag if result_iwag.split(" ")[0]!="Unknown" ppp = result_iwag.split(" ") subs_mac = ppp[0] access_int = ppp[1] access_poi = ppp[2] ssid_a = ppp[3] if access_int=='GigabitEthernet4.3002' access_poi = "belrw_4_HP_ap1-1" ssid_a = "BelRW_WiFi" elsif access_int=='GigabitEthernet4.3005' access_poi = "belbiz-AP1-1" ssid_a = "IMAGURU_GUEST" end if access_poi == "Unknown" && ssid_a == "Unknown" && subs_mac != "Unknown" frommikrotik = self.get_subs_add_info4new_1(access_int, subs_mac) splitting5 = frommikrotik.split("---") p access_poi = splitting5[1] p ssid_a = splitting5[2] p tx_rate_se = splitting5[3] p tx_rat = splitting5[4] p rx_rat = splitting5[5] p rx_signa = splitting5[6] p uptim = splitting5[7] p packet = splitting5[8] p byt = splitting5[9] end tx_rate_se = "unknown" tx_rat = "unknown" rx_rat = "unknown" rx_signa = "unknown" uptim = "unknown" packet = "unknown" byt = "unknown" if subs_mac=="unknown" output_params = {:code => 505, :result => "ERROR. Something wrong."} end if subs_mac=="" output_params = {:code => 505, :result => "ERROR. Something wrong."} end mess = {:iwag_access_interface => access_int, :subscribers_mac => subs_mac, :access_point => access_poi, :ssid_ap => ssid_a, :apid => "unknown", :statistics => {:tx_rate_set => tx_rate_se, :tx_rate => tx_rat, :rx_rate => rx_rat, :rx_signal => rx_signa, :uptime => uptim, :packets => packet, :bytes => byt} } # 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}" output_params = {:code => 200, :result => "Request completed", :body => {:message => mess}} p output_params else mess = {:iwag_access_interface => "unknown", :subscribers_mac => "unknown", :access_point => "unknown", :ssid_ap => "unknown", :apid => "unknown", :statistics => {:tx_rate_set => "unknown", :tx_rate => "unknown", :rx_rate => "unknown", :rx_signal => "unknown", :uptime => "unknown", :packets => "unknown", :bytes => "unknown"} } # 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}" output_params = {:code => 405, :result => "ERROR. MAC address not found on IWAG."} #render :soap => mess end rescue puts 'SOAP mts_wifi_get_subs_info_return errorMethod' output_params = {:code => 505, :result => "ERROR. Something wrong."} end output_params #### end end