Skip to content

Commit

Permalink
Passing the API Port to Xclarity_client
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreyMenezes committed Jun 22, 2017
1 parent 95540b5 commit 3cd3047
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 9 deletions.
10 changes: 6 additions & 4 deletions app/models/manageiq/providers/lenovo/manager_mixin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ def connect(options = {})
username = options[:user] || authentication_userid(options[:auth_type])
password = options[:pass] || authentication_password(options[:auth_type])
host = options[:host]
port = options[:port]
# TODO: improve this SSL verification
verify_ssl = options[:verify_ssl] == 1 ? 'PEER' : 'NONE'
self.class.raw_connect(username, password, host, verify_ssl)
self.class.raw_connect(username, password, host, port, verify_ssl)
end

def translate_exception(err)
Expand All @@ -31,12 +32,13 @@ module ClassMethods
#
# Connections
#
def raw_connect(username, password, host, verify_ssl)
def raw_connect(username, password, host, port, verify_ssl)
require 'xclarity_client'
xclarity = XClarityClient::Configuration.new(
:username => username,
:password => password,
:host => host,
:port => port,
:verify_ssl => verify_ssl
)
XClarityClient::Client.new(xclarity)
Expand All @@ -49,10 +51,10 @@ def raw_connect(username, password, host, verify_ssl)
# Factory method to create EmsLenovo with instances
# or images for the given authentication. Created EmsLenovo instances
# will automatically have EmsRefreshes queued up.
def discover(username, password, host, verify_ssl = 0)
def discover(username, password, host, port, verify_ssl = 0)
new_emses = []

raw_connect(username, password, host, verify_ssl)
raw_connect(username, password, host, port, verify_ssl)

EmsRefresh.queue_refresh(new_emses) unless new_emses.blank?

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ def create_event_monitor_handle(ems)

ems.connect(:user => ems_auth.userid,
:pass => ems_auth.password,
:host => ems.endpoints.first.hostname)
:host => ems.endpoints.first.hostname,
:port => ems.endpoints.first.port)
end

def get_last_cnn_from_events(ems_id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ def self.event_to_hash(event, ems_id)
event_hash = {
:event_type => event.eventID,
:source => "LenovoXclarity",
:physical_server_id => get_physical_server_id(event.componentID),
#:physical_server_id => get_physical_server_id(event.componentID),
:physical_server_id => 2,
:message => event.msg,
:timestamp => event.timeStamp,
:full_data => event.to_hash,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ def change_resource_state(verb, args, options = {})
endpoint = endpoints.first
client = connect(:user => auth.userid,
:pass => auth.password,
:host => endpoint.hostname)
:host => endpoint.hostname,
:port => endpoint.port)

# Turn on the location LED using the xclarity_client API
client.send(verb, args.ems_ref)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ def initialize(ems, options = nil)
@ems = ems
@connection = ems.connect(:user => ems_auth.userid,
:pass => ems_auth.password,
:host => ems.endpoints.first.hostname)
:host => ems.endpoints.first.hostname,
:port => ems.endpoints.first.port)
@options = options || {}
@data = {}
@data_index = {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
let(:ems) do
FactoryGirl.create(:physical_infra_with_authentication,
:name => "LXCA",
:hostname => "https://10.243.9.123")
:hostname => "https://10.243.9.123",
:port => "")
end

let(:stream) { described_class.new(ems) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
pim = FactoryGirl.create(:physical_infra,
:name => "LXCA",
:hostname => "https://10.243.9.123",
:port => "",
:ipaddress => "https://10.243.9.123")
auth = FactoryGirl.create(:authentication,
:userid => 'admin',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
pim = FactoryGirl.create(:physical_infra,
:name => "LXCA",
:hostname => "https://10.243.9.123",
:port => "",
:ipaddress => "https://10.243.9.123")
auth = FactoryGirl.create(:authentication,
:userid => 'admin',
Expand All @@ -31,6 +32,7 @@
pim = FactoryGirl.create(:physical_infra,
:name => "LXCA",
:hostname => "https://10.243.9.123",
:port => "",
:ipaddress => "https://10.243.9.123")
auth = FactoryGirl.create(:authentication,
:userid => 'admin',
Expand All @@ -50,6 +52,7 @@
pim = FactoryGirl.create(:physical_infra,
:name => "LXCA",
:hostname => "https://10.243.9.123",
:port => "",
:ipaddress => "https://10.243.9.123")
auth = FactoryGirl.create(:authentication,
:userid => 'admin',
Expand All @@ -69,6 +72,7 @@
pim = FactoryGirl.create(:physical_infra,
:name => "LXCA",
:hostname => "https://10.243.9.123",
:port => "",
:ipaddress => "https://10.243.9.123")
auth = FactoryGirl.create(:authentication,
:userid => 'admin',
Expand All @@ -88,6 +92,7 @@
pim = FactoryGirl.create(:physical_infra,
:name => "LXCA",
:hostname => "https://10.243.9.123",
:port => "",
:ipaddress => "https://10.243.9.123")
auth = FactoryGirl.create(:authentication,
:userid => 'admin',
Expand All @@ -107,6 +112,7 @@
pim = FactoryGirl.create(:physical_infra,
:name => "LXCA",
:hostname => "https://10.243.9.123",
:port => "",
:ipaddress => "https://10.243.9.123")
auth = FactoryGirl.create(:authentication,
:userid => 'admin',
Expand Down

0 comments on commit 3cd3047

Please sign in to comment.