Class: UCS

Inherits:
Object
  • Object
show all
Includes:
Destroy, Inventory, Manage, Parser, Provision, Session, Stats, Update
Defined in:
lib/ucslib/service/ucs/ucs.rb

Constant Summary

Constants included from Stats

Stats::STATNAMES

Instance Method Summary collapse

Methods included from Destroy

#delete_org, #delete_vlan

Methods included from Inventory

#discover, #list_blades, #list_cpus, #list_memory, #list_running_firmware, #list_service_profiles, #list_vlans, #list_vsans

Methods included from Manage

#associate_service_profile_template_to_server_pool, #discover_state

Methods included from Provision

#set_chassis_discovery_policy, #set_fc_uplink_port, #set_host_firmware_package, #set_local_boot_policy, #set_local_disk_policy, #set_mac_pool, #set_management_ip_pool, #set_mgmt_firmware_package, #set_network_uplink_port, #set_ntp_server, #set_org, #set_port_channel, #set_power_policy, #set_pxe_boot_policy, #set_san_boot_policy, #set_server_pool, #set_server_port, #set_service_profile_template, #set_service_profiles, #set_service_profiles_from_template, #set_syslog_server, #set_time_zone, #set_uuid_pool, #set_vhba_template, #set_vlan, #set_vnic_template, #set_vsan, #set_wwnn_pool, #set_wwpn_pool

Methods included from Stats

#fetch, #get_hash, #show_all, #show_sample

Methods included from Update

#update_boot_policy_on_service_profile_template, #update_host_firmware_package

Methods included from Session

#logout, #refresh_token

Constructor Details

#initialize(authjson) ⇒ UCS

Returns a new instance of UCS.



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/ucslib/service/ucs/ucs.rb', line 38

def initialize (authjson)

  username = "#{JSON.parse(authjson)['username']}"
  password = "#{JSON.parse(authjson)['password']}"
  ip       = "#{JSON.parse(authjson)['ip']}"
  @url      = "https://#{ip}/nuova"

  xml_builder = Nokogiri::XML::Builder.new do |xml|
      xml.aaaLogin('inName' => username, 'inPassword' => password)
  end

   = xml_builder.to_xml.to_s
  ucs_response = RestClient.post(@url, , :content_type => 'text/xml').body
   = Nokogiri::XML(ucs_response)
   = .root
  @cookie = .attributes['outCookie']


  # Archive code to be removed later. #TODO
  # begin
  #   return session = { :cookie   => "#{cookie}",
  #                      :username => "#{username}",
  #                      :password => "#{password}",
  #                      :ip       => "#{ip}"  }.to_json
  # rescue Exception => e
  #   'An Error Occured. Please check authentication credentials'
  # else
  #   Process.exit
  # end

end