ucslib 0.1.2 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -48,6 +48,7 @@ class UCSInventory
48
48
  xml.classId("value" => "orgOrg")
49
49
  xml.classId("value" => "fabricVlan")
50
50
  xml.classId("value" => "vnicEther")
51
+ xml.classId("value" => "vnicFc")
51
52
  xml.classId("value" => "fabricVsan")
52
53
  xml.classId("value" => "vmAdaptor")
53
54
  xml.classId("value" => "vmCont")
@@ -514,8 +514,8 @@ class UCSProvision
514
514
  xml.configConfMos('cookie' => "#{@cookie}", 'inHierarchical' => 'true'){
515
515
  xml.inConfigs{
516
516
  xml.pair('key' => "org-root/org-#{org}/fw-host-pack-#{host_firmware_pkg_name}"){
517
- xml.firmwareComputeHostPack('descr' => "#{host_firmware_pkg_description}", 'dn' => "org-root/org-#{org}/fw-host-pack-#{host_firmware_pkg_name}",
518
- 'ignoreCompCheck' => 'yes', 'mode' => 'staged', 'name' => "#{host_firmware_pkg_name}", 'stageSize' => '0',
517
+ xml.firmwareComputeHostPack('bladeBundleVersion' => "", 'descr' => "#{host_firmware_pkg_description}", 'dn' => "org-root/org-#{org}/fw-host-pack-#{host_firmware_pkg_name}",
518
+ 'ignoreCompCheck' => 'yes', 'mode' => 'staged', 'policyOwner' =>"local", 'rackBundleVersion' => "",'name' => "#{host_firmware_pkg_name}", 'stageSize' => '0',
519
519
  'status' => 'created', 'updateTrigger' => 'immediate'){
520
520
  xml.firmwarePackItem('hwModel' => "#{hardware_model}", 'hwVendor' => "#{hardware_vendor}",
521
521
  'rn' => "pack-image-#{hardware_vendor}|#{hardware_model}|#{hardware_type}",
@@ -532,8 +532,8 @@ class UCSProvision
532
532
  xml.configConfMos('cookie' => "#{@cookie}", 'inHierarchical' => 'false'){
533
533
  xml.inConfigs{
534
534
  xml.pair('key' => "org-root/org-#{org}/fw-host-pack-#{host_firmware_pkg_name}"){
535
- xml.firmwareComputeHostPack('descr' => "#{host_firmware_pkg_description}", 'dn' => "org-root/org-#{org}/fw-host-pack-#{host_firmware_pkg_name}",
536
- 'ignoreCompCheck' => 'yes', 'mode' => 'staged', 'stageSize' => '0', 'updateTrigger' => 'immediate'){
535
+ xml.firmwareComputeHostPack('bladeBundleVersion' => "", 'descr' => "#{host_firmware_pkg_description}", 'dn' => "org-root/org-#{org}/fw-host-pack-#{host_firmware_pkg_name}",
536
+ 'ignoreCompCheck' => 'yes', 'mode' => 'staged', 'policyOwner' =>"local", 'rackBundleVersion' => "",'stageSize' => '0', 'updateTrigger' => 'immediate'){
537
537
  xml.firmwarePackItem('hwModel' => "#{hardware_model}", 'hwVendor' => "#{hardware_vendor}",
538
538
  'rn' => "pack-image-#{hardware_vendor}|#{hardware_model}|#{hardware_type}",
539
539
  'type' => "#{hardware_type}", 'version' => "#{firmware_version}")
data/lib/ucslib/stats.rb CHANGED
@@ -1,4 +1,6 @@
1
1
  class UCSStats
2
+ STATNAMES = %w(adaptorEthPortStats adaptorEthPortErrStats adaptorEthPortMcastStats adaptorVnicStats computeMbPowerStats computeMbTempStats computePCIeFatalStats computePCIeFatalCompletionStats computePCIeFatalProtocolStats computePCIeFatalReceiveStats equipmentChassisStats equipmentFanStats equipmentFanModuleStats equipmentIOCardStats equipmentNetworkElementFanStats equipmentPsuStats equipmentPsuInputStats etherErrStats etherLossStats etherPauseStats etherRxStats etherTxStats fcStats fcErrStats memoryArrayEnvStats memoryErrorStats memoryUnitEnvStats processorEnvStats processorErrorStats swEnvStats swSystemStats)
3
+
2
4
  def fetch(tokenjson)
3
5
  cookie = "#{JSON.parse(tokenjson)['cookie']}"
4
6
  ip = "#{JSON.parse(tokenjson)['ip']}"
@@ -60,6 +62,29 @@ class UCSStats
60
62
  return Nokogiri::XML(ucs_response_multi_class)
61
63
  end
62
64
 
65
+ # Translate stats XML into a hash.
66
+ #
67
+ # If statname is supplied, only include that stat. Otherwise, include
68
+ # all stats.
69
+ #
70
+ # Hash looks like hash[statname][dn][attribute] = value
71
+ def get_hash(xml,statname=:all)
72
+ statnames = STATNAMES if statname == :all
73
+
74
+ h = Hash.new{|k,v| k[v] = Hash.new}
75
+ statnames.each do |statname|
76
+ xml.xpath("configResolveClasses/outConfigs/#{statname}").each do |stat|
77
+ dn = stat.attributes['dn'].value
78
+ h[statname][dn] = Hash.new
79
+ stat.attributes.each do |attr,value|
80
+ next if attr == 'dn'
81
+ h[statname][dn][attr] = value.value
82
+ end
83
+ end
84
+ end
85
+ return h
86
+ end
87
+
63
88
  def show_sample(xml,statname,all=false)
64
89
  list = xml.xpath("configResolveClasses/outConfigs/#{statname}")
65
90
  list = [list.first] unless all
@@ -16,5 +16,5 @@
16
16
  #
17
17
 
18
18
  module Ucslib
19
- VERSION = "0.1.2"
19
+ VERSION = "0.1.4"
20
20
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ucslib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-28 00:00:00.000000000 Z
12
+ date: 2012-12-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri