def initialize(host=ENV['MU_IP'], username=ENV['MU_ADMIN_USER'], password=ENV['MU_ADMIN_PASS'])
@host = host
@username = username
@password = password
@docroot = "/api/v5/scale/"
@uuid = nil
@http = HttpHelper.new(@host, @username, @password, @docroot)
@config_file = (ENV['SCALE_CONFIG_FILE'].nil?) ? "scale.json" : ENV['SCALE_CONFIG_FILE']
if File.readable? @config_file
msg "reading config file: #{@config_file}", Logger::DEBUG
@configuration = JSON.parse File.read(@config_file)
else
@configuration = {
"hosts"=> {
"host_0"=> "a1/*",
"host_1"=> "a2/*"
},
"timeout"=> 5000,
"delay"=> 0,
"volume"=> 1,
"holdConcurrency"=> true,
"limitConcurrency"=> false,
"vectorAddressPairing"=> false,
"musl" => "",
"csv" => "",
"pattern" => {}
}
end
@uuid = session
msg "Created Scale Api session [#{@uuid}] on :#{@host}", Logger::DEBUG
end