class StarosGet_2
Attributes
staros_login[RW]
staros_parser[RW]
staros_password[RW]
Public Class Methods
new(staros_login, staros_password)
click to toggle source
# File lib/imperituroard/platforms/staros/get_data_ssh.rb, line 9 def initialize(staros_login, staros_password) @staros_parser = StarosParser_2.new @staros_login = staros_login @staros_password = staros_password end
Public Instance Methods
get_all_active_charging(host_ip)
click to toggle source
get all active-charging data host - staros device IP address return parsed ECS configuration in JSON
# File lib/imperituroard/platforms/staros/get_data_ssh.rb, line 19 def get_all_active_charging(host_ip) input_data = {:host_ip => host_ip} out_data = {} config_all = [] begin Net::SSH.start(host_ip, staros_login, :password => staros_password) do |ssh| staros_answer = ssh.exec!("show configuration active-charging service all") staros_answer = staros_answer.gsub("#exit", "exit") #staros_answer = staros_answer.gsub("\n", " ") #p staros_answer #host_pool_regexp = /(host-pool.+\s+exit)/ #fff = staros_answer.scan(host_pool_regexp) #p fff staros_answer = staros_answer.split("\n") for ttt in staros_answer regexp_full_command = /\s+(.+)/ group_ruled_ukaz60_9 = ttt.match(regexp_full_command) if group_ruled_ukaz60_9 != nil config_all.push(group_ruled_ukaz60_9[1]) else config_all.push(ttt) end end end staros_json = staros_parser.ecs_config_parser(config_all) out_data = {:code => 200, :result => "Successfully completed", :parsed_data => staros_json} rescue out_data = {:code => 507, :result => "get_all_active_charging: Unknown SDK error"} end out_data end