rubyipmi 0.10.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. checksums.yaml +5 -5
  2. data/.document +5 -0
  3. data/.gitignore +50 -0
  4. data/.rspec +1 -0
  5. data/.rubocop.yml +66 -0
  6. data/.travis.yml +13 -0
  7. data/Gemfile +3 -3
  8. data/README.md +9 -3
  9. data/RELEASE_NOTES.md +33 -0
  10. data/Rakefile +15 -42
  11. data/lib/rubyipmi/commands/basecommand.rb +17 -23
  12. data/lib/rubyipmi/commands/mixins/power_mixin.rb +50 -0
  13. data/lib/rubyipmi/commands/mixins/sensors_mixin.rb +54 -0
  14. data/lib/rubyipmi/freeipmi/commands/basecommand.rb +26 -35
  15. data/lib/rubyipmi/freeipmi/commands/bmc.rb +4 -7
  16. data/lib/rubyipmi/freeipmi/commands/bmcconfig.rb +7 -17
  17. data/lib/rubyipmi/freeipmi/commands/bmcdevice.rb +2 -9
  18. data/lib/rubyipmi/freeipmi/commands/bmcinfo.rb +4 -10
  19. data/lib/rubyipmi/freeipmi/commands/chassis.rb +27 -45
  20. data/lib/rubyipmi/freeipmi/commands/chassisconfig.rb +23 -38
  21. data/lib/rubyipmi/freeipmi/commands/fru.rb +23 -42
  22. data/lib/rubyipmi/freeipmi/commands/lan.rb +4 -6
  23. data/lib/rubyipmi/freeipmi/commands/power.rb +8 -51
  24. data/lib/rubyipmi/freeipmi/commands/sensors.rb +10 -67
  25. data/lib/rubyipmi/freeipmi/connection.rb +14 -17
  26. data/lib/rubyipmi/freeipmi/errorcodes.rb +11 -17
  27. data/lib/rubyipmi/ipmitool/commands/basecommand.rb +12 -16
  28. data/lib/rubyipmi/ipmitool/commands/bmc.rb +13 -22
  29. data/lib/rubyipmi/ipmitool/commands/chassis.rb +26 -44
  30. data/lib/rubyipmi/ipmitool/commands/chassisconfig.rb +11 -21
  31. data/lib/rubyipmi/ipmitool/commands/fru.rb +35 -48
  32. data/lib/rubyipmi/ipmitool/commands/lan.rb +25 -28
  33. data/lib/rubyipmi/ipmitool/commands/power.rb +7 -58
  34. data/lib/rubyipmi/ipmitool/commands/sensors.rb +10 -68
  35. data/lib/rubyipmi/ipmitool/connection.rb +10 -19
  36. data/lib/rubyipmi/ipmitool/errorcodes.rb +11 -45
  37. data/lib/rubyipmi/observablehash.rb +1 -2
  38. data/lib/rubyipmi/version.rb +5 -0
  39. data/lib/rubyipmi.rb +23 -28
  40. data/rubyipmi.gemspec +17 -128
  41. metadata +18 -101
  42. data/spec/Vagrantfile +0 -45
  43. data/spec/fixtures/freeipmi/bmc_config.txt +0 -317
  44. data/spec/fixtures/freeipmi/bmc_config_lan_conf.txt +0 -19
  45. data/spec/fixtures/freeipmi/bmc_info.txt +0 -32
  46. data/spec/fixtures/freeipmi/errors.txt +0 -3
  47. data/spec/fixtures/freeipmi/fru.txt +0 -13
  48. data/spec/fixtures/freeipmi/sensors.txt +0 -29
  49. data/spec/fixtures/ipmitool/bmc_info.txt +0 -20
  50. data/spec/fixtures/ipmitool/errors.txt +0 -10
  51. data/spec/fixtures/ipmitool/fru.txt +0 -96
  52. data/spec/fixtures/ipmitool/lan.txt +0 -17
  53. data/spec/fixtures/ipmitool/sensors.txt +0 -105
  54. data/spec/integration/bmc_spec.rb +0 -48
  55. data/spec/integration/chassis_config_spec.rb +0 -38
  56. data/spec/integration/chassis_spec.rb +0 -26
  57. data/spec/integration/connection_spec.rb +0 -45
  58. data/spec/integration/fru_spec.rb +0 -38
  59. data/spec/integration/lan_spec.rb +0 -50
  60. data/spec/integration/power_spec.rb +0 -40
  61. data/spec/integration/rubyipmi_spec.rb +0 -114
  62. data/spec/integration/sensor_spec.rb +0 -43
  63. data/spec/manifests/default.pp +0 -50
  64. data/spec/puppetmodules/archive/LICENSE-2.0.txt +0 -202
  65. data/spec/puppetmodules/archive/Modulefile +0 -8
  66. data/spec/puppetmodules/archive/README.md +0 -40
  67. data/spec/puppetmodules/archive/manifests/download.pp +0 -157
  68. data/spec/puppetmodules/archive/manifests/extract.pp +0 -81
  69. data/spec/puppetmodules/archive/manifests/init.pp +0 -70
  70. data/spec/puppetmodules/archive/manifests/tar-gz.pp +0 -7
  71. data/spec/puppetmodules/archive/manifests/zip.pp +0 -7
  72. data/spec/puppetmodules/archive/metadata.json +0 -26
  73. data/spec/spec_helper.rb +0 -47
  74. data/spec/unit/freeipmi/bmc-info_spec.rb +0 -38
  75. data/spec/unit/freeipmi/bmc_spec.rb +0 -43
  76. data/spec/unit/freeipmi/connection_spec.rb +0 -121
  77. data/spec/unit/freeipmi/errorcodes_spec.rb +0 -28
  78. data/spec/unit/freeipmi/fru_spec.rb +0 -76
  79. data/spec/unit/freeipmi/lan_spec.rb +0 -0
  80. data/spec/unit/freeipmi/sensors_spec.rb +0 -85
  81. data/spec/unit/ipmitool/bmc_spec.rb +0 -77
  82. data/spec/unit/ipmitool/connection_spec.rb +0 -122
  83. data/spec/unit/ipmitool/errorcodes_spec.rb +0 -35
  84. data/spec/unit/ipmitool/fru_spec.rb +0 -77
  85. data/spec/unit/ipmitool/lan_spec.rb +0 -94
  86. data/spec/unit/ipmitool/sensors_spec.rb +0 -96
  87. data/spec/unit/rubyipmi_spec.rb +0 -50
  88. data/spec/vagrant +0 -27
  89. data/spec/vagrant.pub +0 -1
@@ -1,105 +0,0 @@
1
- FCB FAN1 | 5600.000 | RPM | ok | na | 1500.000 | na | 25500.000 | 25500.000 | 25500.000
2
- FCB FAN2 | 5600.000 | RPM | ok | na | 1500.000 | na | 25500.000 | 25500.000 | 25500.000
3
- FCB FAN3 | 5600.000 | RPM | ok | na | 1500.000 | na | 25500.000 | 25500.000 | 25500.000
4
- FCB FAN4 | 5600.000 | RPM | ok | na | 1500.000 | na | 25500.000 | 25500.000 | 25500.000
5
- PEF Action | 0x0 | discrete | 0x1080| na | na | na | na | na | na
6
- WatchDog2 | 0x0 | discrete | 0x0080| na | na | na | na | na | na
7
- AC Pwr On | 0x0 | discrete | 0x0080| na | na | na | na | na | na
8
- ACPI Pwr State | 0x0 | discrete | 0x0088| na | na | na | na | na | na
9
- FCB Ambient1 | 21.000 | degrees C | ok | na | na | na | na | 50.000 | 255.000
10
- FCB Ambient2 | 0.000 | degrees C | ok | na | na | na | na | 50.000 | 255.000
11
- CPU1Status | 0x0 | discrete | 0x0080| na | na | na | na | na | na
12
- CPU2Status | 0x0 | discrete | 0x0080| na | na | na | na | na | na
13
- PS 12V | 12.152 | Volts | ok | 10.602 | 10.850 | 11.160 | 12.834 | 13.144 | 13.392
14
- PS 5V | 5.018 | Volts | ok | 4.394 | 4.524 | 4.654 | 5.330 | 5.486 | 5.590
15
- MLB TEMP 2 | 47.000 | degrees C | ok | na | na | na | 85.000 | 87.000 | 90.000
16
- MLB TEMP 3 | 43.000 | degrees C | ok | na | na | na | 85.000 | 87.000 | 90.000
17
- Processor 1 Temp | 23.000 | degrees C | ok | na | na | na | 81.000 | 85.000 | 90.000
18
- MLB TEMP 1 | 45.000 | degrees C | ok | na | na | na | 85.000 | 87.000 | 90.000
19
- Processor 2 Temp | 24.000 | degrees C | ok | na | na | na | 81.000 | 85.000 | 90.000
20
- STBY 3.3V | 3.354 | Volts | ok | 2.907 | 2.976 | 3.079 | 3.526 | 3.629 | 3.681
21
- PS Current | 14.000 | Amps | ok | na | na | na | 255.000 | 255.000 | 255.000
22
- SEL Fullness | 0x0 | discrete | 0x0080| na | na | na | na | na | na
23
- PCI BUS | 0x0 | discrete | 0x0080| na | na | na | na | na | na
24
- Memory | 0x0 | discrete | 0x0080| na | na | na | na | na | na
25
- VCORE 1 | 1.029 | Volts | ok | na | na | na | 2.117 | 2.117 | 2.117
26
- VCORE 2 | 0.893 | Volts | ok | na | na | na | 2.958 | 2.958 | 2.958
27
- NM Capability | na | discrete | na | na | na | na | na | na | na
28
- Security | 0x0 | discrete | 0x0080| na | na | na | na | na | na
29
- PSU 1 AC Status | 0x0 | discrete | 0x0080| na | na | na | na | na | na
30
- PSU 2 AC Status | 0x0 | discrete | 0x0080| na | na | na | na | na | na
31
- PSU 1 Present | 0x0 | discrete | 0x0180| na | na | na | na | na | na
32
- PSU 2 Present | 0x0 | discrete | 0x0180| na | na | na | na | na | na
33
- PSU 2 POUT | 21.000 | Amps | ok | na | na | na | na | na | na
34
- PSU 1 POUT | 22.000 | Amps | ok | na | na | na | na | na | na
35
- UID Light | 0x0 | discrete | 0x0080| na | na | na | na | na | na
36
- Int. Health LED | 0x0 | discrete | 0x0080| na | na | na | na | na | na
37
- Ext. Health LED | 0x0 | discrete | 0x0080| na | na | na | na | na | na
38
- Power Supply 1 | 0x0 | discrete | 0x0180| na | na | na | na | na | na
39
- Power Supply 2 | 0x0 | discrete | 0x0180| na | na | na | na | na | na
40
- Power Supplies | 0x0 | discrete | 0x0180| na | na | na | na | na | na
41
- VRM 1 | 0x0 | discrete | 0x0280| na | na | na | na | na | na
42
- VRM 2 | 0x0 | discrete | 0x0280| na | na | na | na | na | na
43
- Fan 1 | 45.080 | percent | ok | na | na | na | na | na | na
44
- Fan 2 | 45.080 | percent | ok | na | na | na | na | na | na
45
- Fan 3 | 45.080 | percent | ok | na | na | na | na | na | na
46
- Fan 4 | 45.080 | percent | ok | na | na | na | na | na | na
47
- Fan 5 | 41.944 | percent | ok | na | na | na | na | na | na
48
- Fan 6 | 41.944 | percent | ok | na | na | na | na | na | na
49
- Fan 7 | 36.064 | percent | ok | na | na | na | na | na | na
50
- Fan 8 | 36.064 | percent | ok | na | na | na | na | na | na
51
- Fan 9 | 36.064 | percent | ok | na | na | na | na | na | na
52
- Fan 10 | 36.064 | percent | ok | na | na | na | na | na | na
53
- Fan 11 | 36.064 | percent | ok | na | na | na | na | na | na
54
- Fan 12 | 36.064 | percent | ok | na | na | na | na | na | na
55
- Fans | 0x0 | discrete | 0x0180| na | na | na | na | na | na
56
- Temp 1 | 37.000 | degrees C | ok | 0.000 | 0.000 | 0.000 | 67.000 | 70.000 | 75.000
57
- Temp 2 | 20.000 | degrees C | ok | 0.000 | 0.000 | 0.000 | 37.000 | 39.000 | 44.000
58
- Temp 3 | 40.000 | degrees C | ok | 0.000 | 0.000 | 0.000 | 68.000 | 127.000 | 127.000
59
- Temp 4 | 40.000 | degrees C | ok | 0.000 | 0.000 | 0.000 | 68.000 | 127.000 | 127.000
60
- Temp 5 | 49.000 | degrees C | ok | 0.000 | 0.000 | 0.000 | 74.000 | 77.000 | 82.000
61
- Temp 6 | 40.000 | degrees C | ok | 0.000 | 0.000 | 0.000 | 68.000 | 127.000 | 127.000
62
- Temp 7 | 40.000 | degrees C | ok | 0.000 | 0.000 | 0.000 | 68.000 | 127.000 | 127.000
63
- Power Meter | 374 | Watts | ok | na | na | na | na | na | na
64
- UID Light | 0x0 | discrete | 0x0080| na | na | na | na | na | na
65
- Sys. Health LED | 0x0 | discrete | 0x0080| na | na | na | na | na | na
66
- Memory | 0x0 | discrete | 0x4080| na | na | na | na | na | na
67
- Power Supply 1 | 1200.000 | Watts | nc | na | na | na | na | na | na
68
- Power Supply 2 | 1200.000 | Watts | nc | na | na | na | na | na | na
69
- Power Supply 3 | 1200.000 | Watts | nc | na | na | na | na | na | na
70
- Power Supply 4 | 1200.000 | Watts | nc | na | na | na | na | na | na
71
- Fan 3 | 46.648 | unspecified | nc | na | na | na | na | na | na
72
- Fan 4 | 46.648 | unspecified | nc | na | na | na | na | na | na
73
- 01-Inlet Ambient | 19.000 | degrees C | ok | na | na | na | na | 42.000 | 46.000
74
- 02-CPU 1 | 40.000 | degrees C | ok | na | na | na | na | 70.000 | 0.000
75
- 03-CPU 2 | 40.000 | degrees C | ok | na | na | na | na | 70.000 | 0.000
76
- 04-P1 DIMM 1-4 | 27.000 | degrees C | ok | na | na | na | na | 87.000 | 0.000
77
- 05-P1 DIMM 5-8 | 25.000 | degrees C | ok | na | na | na | na | 87.000 | 0.000
78
- 06-P2 DIMM 1-4 | 26.000 | degrees C | ok | na | na | na | na | 87.000 | 0.000
79
- 07-P2 DIMM 5-8 | 27.000 | degrees C | ok | na | na | na | na | 87.000 | 0.000
80
- 08-HD Max | 35.000 | degrees C | ok | na | na | na | na | 60.000 | 0.000
81
- 09-Chipset | 44.000 | degrees C | ok | na | na | na | na | 105.000 | 0.000
82
- 10-VR P1 | 34.000 | degrees C | ok | na | na | na | na | 115.000 | 120.000
83
- 11-VR P2 | 35.000 | degrees C | ok | na | na | na | na | 115.000 | 120.000
84
- 12-VR P1 Zone | 27.000 | degrees C | ok | na | na | na | na | 90.000 | 95.000
85
- 13-VR P2 Zone | 27.000 | degrees C | ok | na | na | na | na | 90.000 | 95.000
86
- 14-VR P1 Mem | 31.000 | degrees C | ok | na | na | na | na | 115.000 | 120.000
87
- 15-VR P1 Mem | 29.000 | degrees C | ok | na | na | na | na | 115.000 | 120.000
88
- 16-VR P2 Mem | 32.000 | degrees C | ok | na | na | na | na | 115.000 | 120.000
89
- 17-VR P2 Mem | 29.000 | degrees C | ok | na | na | na | na | 115.000 | 120.000
90
- 18-VR P1Mem Zone | 30.000 | degrees C | ok | na | na | na | na | 90.000 | 95.000
91
- 19-VR P2Mem Zone | 31.000 | degrees C | ok | na | na | na | na | 90.000 | 95.000
92
- 20-SuperCap Max | 21.000 | degrees C | ok | na | na | na | na | 65.000 | 0.000
93
- 21-HD Controller | 40.000 | degrees C | ok | na | na | na | na | 100.000 | 0.000
94
- 22-LOM | na | degrees C | na | na | na | na | na | 100.000 | 0.000
95
- 23-LOM Card | na | degrees C | na | na | na | na | na | 100.000 | 0.000
96
- 24-PCI 1 | na | degrees C | na | na | na | na | na | 100.000 | 0.000
97
- 25-PCI 2 Zone | 25.000 | degrees C | ok | na | na | na | na | 65.000 | 70.000
98
- 26-PCI 2 | 50.000 | degrees C | ok | na | na | na | na | 100.000 | 0.000
99
- 42-P/S Board | 24.000 | degrees C | ok | na | na | na | na | 80.000 | 85.000
100
- 43-Sys Exhaust | 29.000 | degrees C | ok | na | na | na | na | 90.000 | 95.000
101
- 44-HD zone | 29.000 | degrees C | ok | na | na | na | na | 65.000 | 0.000
102
- C3 P2I Bay 1 | 0.000 | unspecified | nc | na | na | na | na | na | na
103
- C3 P2I Bay 2 | 0.000 | unspecified | nc | na | na | na | na | na | na
104
- C3 P2I Bay 3 | 0.000 | unspecified | nc | na | na | na | na | na | na
105
- C3 P2I Bay 4 | 0.000 | unspecified | nc | na | na | na | na | na | na
@@ -1,48 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe "Bmc" do
4
-
5
- before :each do
6
- user ||= ENV["ipmiuser"] || "admin"
7
- pass ||= ENV["ipmipass"] || "password"
8
- host ||= ENV["ipmihost"] || "10.0.1.16"
9
- provider ||= ENV["ipmiprovider"] || "ipmitool"
10
- @conn = Rubyipmi.connect(user, pass, host, provider)
11
-
12
- end
13
-
14
- it "creates a bmc object" do
15
- expect(@conn.bmc).not_to be_nil
16
- end
17
-
18
- it "options should change after calling info" do
19
- before = @conn.bmc.options.clone
20
- info = @conn.bmc.info
21
- after = @conn.bmc.options.clone
22
- expect(before.length).to be < after.length
23
- end
24
-
25
- it 'should retrun a max retry count' do
26
- expect(@conn.bmc.max_retry_count).to be > 0
27
- end
28
-
29
- it "should reset the bmc device" do
30
- expect(@conn.bmc.reset('cold')).not_to be_nil
31
- end
32
-
33
- it "should reset the bmc device warmly" do
34
- expect(@conn.bmc.reset('warm')).not_to be_nil
35
- end
36
-
37
- it "reset should fail when type is wrong" do
38
- expect{@conn.bmc.reset('freezing')}.to raise_exception
39
- end
40
-
41
- it "is able to retrieve the bmc info" do
42
- expect(@conn.bmc.info).not_to be_nil
43
- end
44
-
45
- it "is able to retrieve the guid" do
46
- expect(@conn.bmc.guid).not_to be_nil
47
- end
48
- end
@@ -1,38 +0,0 @@
1
- require 'spec_helper'
2
-
3
-
4
- describe "Chassis Config" do
5
-
6
- before :each do
7
- user ||= ENV["ipmiuser"] || "admin"
8
- pass ||= ENV["ipmipass"] || "password"
9
- host ||= ENV["ipmihost"] || "10.0.1.16"
10
- provider ||= ENV["ipmiprovider"] || "ipmitool"
11
- @conn = Rubyipmi.connect(user, pass, host, provider)
12
-
13
- end
14
-
15
- it "test to set booting from PXE" do
16
- expect(@conn.chassis.config.bootpxe).to eq(true)
17
- end
18
-
19
- it "test to set booting from Disk" do
20
- expect(@conn.chassis.config.bootdisk).to eq(true)
21
- end
22
-
23
- it "test to set booting from Cdrom" do
24
- expect(@conn.chassis.config.bootcdrom).to eq(true)
25
- end
26
-
27
- it "test to set booting from bios" do
28
- expect(@conn.chassis.config.bootbios).to eq(true)
29
- end
30
-
31
- it "test to set boot persistent value" do
32
-
33
- end
34
-
35
- it "test to checkout the entire chassis config" do
36
-
37
- end
38
- end
@@ -1,26 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe "Chassis" do
4
-
5
- before :each do
6
- user ||= ENV["ipmiuser"] || "admin"
7
- pass ||= ENV["ipmipass"] || "password"
8
- host ||= ENV["ipmihost"] || "10.0.1.16"
9
- provider ||= ENV["ipmiprovider"] || "ipmitool"
10
- @conn = Rubyipmi.connect(user, pass, host, provider)
11
-
12
- end
13
-
14
- it "test to turn uid light on for 5 seconds" do
15
- value = @conn.chassis.identify(true, 5)
16
- sleep(6)
17
- expect(value).to eq(true)
18
- end
19
-
20
- it "test to turn uid light on then off" do
21
- @conn.chassis.identify(true)
22
- sleep(2)
23
- expect(@conn.chassis.identify(false)).to eq(true)
24
- end
25
-
26
- end
@@ -1,45 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe "Connection" do
4
-
5
- before :each do
6
- user ||= ENV["ipmiuser"] || "admin"
7
- pass ||= ENV["ipmipass"] || "password"
8
- host ||= ENV["ipmihost"] || "192.168.1.16"
9
- provider ||= ENV["ipmiprovider"] || "ipmitool"
10
- @conn = Rubyipmi.connect(user, pass, host, provider)
11
- end
12
-
13
- it "creates a new object" do
14
- expect(@conn).to be_truthy
15
- end
16
-
17
- it 'creates a bmc object' do
18
- expect(@conn.bmc).to be_truthy
19
- end
20
-
21
- it 'creates a chassis object' do
22
- expect(@conn.chassis).to be_truthy
23
- end
24
-
25
- it 'can test the connection' do
26
- expect(@conn.connection_works?).to eq true
27
- end
28
-
29
- it 'can test the connection when credentials are wrong' do
30
- user ||= ENV["ipmiuser"] || "admin"
31
- pass = "wrong_password"
32
- host ||= ENV["ipmihost"] || "192.168.1.16"
33
- provider ||= ENV["ipmiprovider"] || "ipmitool"
34
- conn = Rubyipmi.connect(user, pass, host, provider)
35
- expect(conn.connection_works?).to eq false
36
- end
37
-
38
- it 'can get diag info' do
39
- expect(@conn.get_diag.keys).to eq([:provider, :frus, :sensors, :bmc_info, :version])
40
- end
41
-
42
- it 'can get version info' do
43
- expect(@conn.bmc.version).to match(/[\d\.]{3,4}/)
44
- end
45
- end
@@ -1,38 +0,0 @@
1
- require 'spec_helper'
2
- describe "Fru" do
3
-
4
- attr_accessor :provider
5
- before :each do
6
- user ||= ENV["ipmiuser"] || "admin"
7
- pass ||= ENV["ipmipass"] || "password"
8
- host ||= ENV["ipmihost"] || "10.0.1.16"
9
- provider ||= ENV["ipmiprovider"] || "ipmitool"
10
- @conn = Rubyipmi.connect(user, pass, host, provider)
11
-
12
- end
13
-
14
- it "test should return manufacturer" do
15
- expect(@conn.fru.manufacturer).not_to be nil
16
-
17
- end
18
-
19
- it "test should return serial" do
20
- expect(@conn.fru.board_serial).not_to be nil
21
- end
22
-
23
- it "test should return product name" do
24
- expect(@conn.fru.model).not_to be nil
25
- end
26
-
27
- it "test should return fru list" do
28
- expect(@conn.fru.list.length).to be >= 1
29
- end
30
-
31
- it "test missing method with known good method" do
32
- expect(@conn.fru.chassis_type).not_to be nil
33
- end
34
-
35
- it "test missing method with known bad method" do
36
- expect {@conn.fru.blah}.to raise_exception
37
- end
38
- end
@@ -1,50 +0,0 @@
1
- require 'spec_helper'
2
- describe "Lan" do
3
- before :all do
4
- @user ||= ENV["ipmiuser"] || "admin"
5
- @pass ||= ENV["ipmipass"] || "password"
6
- @host ||= ENV["ipmihost"] || "10.0.1.16"
7
- @provider ||= ENV["ipmiprovider"] || "ipmitool"
8
- end
9
- let(:conn) { Rubyipmi.connect(@user, @pass, @host, @provider) }
10
-
11
- it "get ip address" do
12
- expect(conn.bmc.lan.ip).to eq(@host)
13
- end
14
-
15
- it "get netmask" do
16
- expect(conn.bmc.lan.netmask).to be_truthy
17
- end
18
-
19
- it "get gateway address" do
20
- expect(conn.bmc.lan.gateway).to be_truthy
21
- end
22
-
23
- it "get mac address" do
24
- expect(conn.bmc.lan.mac).to be_truthy
25
- end
26
-
27
- it "get static or dhcp" do
28
- expect(conn.bmc.lan.dhcp?).to be_truthy
29
- end
30
-
31
- it "static should be opposite of dhcp" do
32
- expect(conn.bmc.lan.dhcp? ).to_not eq(conn.bmc.lan.static?)
33
- end
34
-
35
- it "should set gateway address" do
36
- gw = conn.bmc.lan.gateway
37
- conn.bmc.lan.gateway = gw
38
- expect(conn.bmc.lan.gateway = gw).to be_truthy
39
- end
40
-
41
- it "should set netmask" do
42
- netmask = conn.bmc.lan.netmask
43
- expect(conn.bmc.lan.netmask = netmask).to be_truthy
44
- end
45
-
46
- it "should set ip address" do
47
- ip = conn.bmc.lan.ip
48
- expect(conn.bmc.lan.ip = ip).to be_truthy
49
- end
50
- end
@@ -1,40 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe "Power" do
4
-
5
- before :each do
6
- user ||= ENV["ipmiuser"] || "admin"
7
- pass ||= ENV["ipmipass"] || "password"
8
- host ||= ENV["ipmihost"] || "10.0.1.16"
9
- provider ||= ENV["ipmiprovider"] || "ipmitool"
10
- @conn = Rubyipmi.connect(user, pass, host, provider)
11
- @conn.chassis.power.off
12
- sleep(1)
13
- end
14
-
15
- it "test to turn power on" do
16
- expect(@conn.chassis.power.on).to be_truthy
17
- sleep(2)
18
- expect(@conn.chassis.power.status).to eq('on')
19
- end
20
-
21
- it "test power status" do
22
- expect(@conn.chassis.power.status).to eq('off')
23
-
24
- end
25
-
26
- it "test to check if power status is off" do
27
- @conn.chassis.power.off
28
- max_count = 12
29
- while 0 < max_count
30
- if @conn.chassis.power.off?
31
- break
32
- else
33
- sleep(5)
34
- max_count = max_count - 1
35
- end
36
- end
37
- expect(@conn.chassis.power.off?).to be true
38
- end
39
-
40
- end
@@ -1,114 +0,0 @@
1
- require 'spec_helper'
2
- require 'fileutils'
3
- require 'logger'
4
-
5
- describe "rubyipmi" do
6
- before :each do
7
- @user ||= ENV["ipmiuser"] || "admin"
8
- @pass ||= ENV["ipmipass"] || "password"
9
- @host ||= ENV["ipmihost"] || "10.0.1.16"
10
- @provider ||= ENV["ipmiprovider"] || "ipmitool"
11
- @conn = Rubyipmi.connect(@user, @pass, @host, @provider)
12
-
13
- end
14
- it "creates a connection object" do
15
- conn = Rubyipmi.connect(@user, @pass, @host, @provider)
16
- expect(conn).to be_truthy
17
- end
18
-
19
- it "should test if a provider is present" do
20
- value = Rubyipmi.is_provider_installed?("ipmitool")
21
- value2 = Rubyipmi.is_provider_installed?("freeipmi")
22
- expect((value|value2)).to eq true
23
-
24
- end
25
-
26
- it "should create a connection object if freeipmi is present" do
27
- begin
28
- conn = Rubyipmi.connect(@user, @pass, @host, "freeipmi")
29
- expect(conn.kind_of?(Rubyipmi::Freeipmi::Connection)).to eq true
30
- rescue Exception => e
31
- expect(e.message.match(/freeipmi\ is\ not\ installed/)).to eq true
32
- puts "#{e.message}"
33
- end
34
- end
35
-
36
- it "should create a connection object if ipmitool is present" do
37
- begin
38
- conn = Rubyipmi.connect(@user, @pass, @host, "ipmitool")
39
- rescue Exception => e
40
- expect(e.message).to match(/ipmitool\ is\ not\ installed/)
41
- puts "#{e.message}"
42
- return true
43
- end
44
- expect(conn.kind_of?(Rubyipmi::Ipmitool::Connection)).to eq true
45
- end
46
-
47
- it "should not create a connection object if a provider is not present" do
48
- begin
49
- conn = Rubyipmi.connect(@user, @pass, @host, "bogus")
50
- rescue Exception => e
51
- expect(e.message).to match(/The IPMI provider: bogus is not installed/)
52
- end
53
- end
54
-
55
- it "check to find any available installed providers" do
56
- expect(Rubyipmi.providers_installed.length).to be > 0
57
- end
58
-
59
- it 'can get diag info' do
60
- # must have both freeipmi and ipmitool for this to pass
61
- Rubyipmi.get_diag(@user,@pass,@host)
62
- expect(File.exists?('/tmp/rubyipmi_diag_data.txt')).to be true
63
- FileUtils.rm('/tmp/rubyipmi_diag_data.txt')
64
- end
65
-
66
- describe :logger do
67
- before :each do
68
- FileUtils.rm_f('/tmp/rubyipmi.log')
69
- Rubyipmi.log_level = nil
70
- Rubyipmi.logger = nil
71
- end
72
-
73
- it 'should only create an info log level' do
74
- Rubyipmi.log_level = Logger::INFO
75
- Rubyipmi.get_diag(@user,@pass,@host)
76
- expect(File.exists?('/tmp/rubyipmi.log')).to be true
77
- size = File.open('/tmp/rubyipmi.log', 'r') {|f| f.read.length}
78
- expect(size).to be_within(60).of(100)
79
- end
80
-
81
- it 'should create a log with debug level' do
82
- Rubyipmi.log_level = Logger::DEBUG
83
- Rubyipmi.get_diag(@user,@pass,@host)
84
- expect(File.exists?('/tmp/rubyipmi.log')).to be true
85
- size = File.open('/tmp/rubyipmi.log', 'r') {|f| f.read.length}
86
- expect(size).to be > 100
87
- end
88
-
89
- it 'should use custom logger' do
90
- FileUtils.rm_f('/tmp/rubyipmi_custom.log')
91
- logger = Logger.new('/tmp/rubyipmi_custom.log')
92
- logger.level = Logger::DEBUG
93
- Rubyipmi.logger = logger
94
- Rubyipmi.get_diag(@user,@pass,@host)
95
- expect(File.exists?('/tmp/rubyipmi_custom.log')).to be true
96
- size = File.open('/tmp/rubyipmi_custom.log', 'r') {|f| f.read.length}
97
- expect(size).to be > 100
98
- FileUtils.rm_f('/tmp/rubyipmi_custom.log')
99
- end
100
-
101
- it 'should not create a log file when log level is nil' do
102
- Rubyipmi.get_diag(@user,@pass,@host)
103
- expect(Rubyipmi.logger.instance_of?(NullLogger)).to be true
104
- expect(File.exists?('/tmp/rubyipmi.log')).to be false
105
- end
106
-
107
- it 'should not create a log file when logger is set to nil and log_level is nil' do
108
- Rubyipmi.get_diag(@user,@pass,@host)
109
- expect(Rubyipmi.logger.instance_of?(NullLogger)).to be true
110
- expect(File.exists?('/tmp/rubyipmi.log')).to be false
111
- end
112
- end
113
- end
114
-
@@ -1,43 +0,0 @@
1
- require 'spec_helper'
2
- describe "Sensors" do
3
-
4
- attr_accessor :provider
5
- before :each do
6
- user = ENV["ipmiuser"] || 'admin'
7
- pass = ENV["ipmipass"] || 'password'
8
- host = ENV["ipmihost"] || "10.0.1.16"
9
- provider = ENV["ipmiprovider"] || 'ipmitool'
10
- @conn = Rubyipmi.connect(user, pass, host, provider)
11
-
12
- end
13
-
14
- it "test get all sensors" do
15
- expect(@conn.sensors.list.count).to be > 1
16
- end
17
-
18
- it "test should refresh data" do
19
- old = @conn.sensors.list
20
- @conn.sensors.refresh
21
- new = @conn.sensors.list
22
- expect(old).not_to equal(new)
23
- end
24
-
25
- it "test should return count greater than 1" do
26
- expect(@conn.sensors.count).to be > 1
27
- end
28
-
29
- it "test should return names" do
30
- expect(@conn.sensors.names.count).to be > 1
31
- end
32
-
33
- it "test should return list of fans" do
34
- expect(@conn.sensors.fanlist.count).to be > 1
35
- end
36
-
37
- it "test should return list of temps" do
38
- expect(@conn.sensors.templist.count).to be > 1
39
- end
40
-
41
-
42
-
43
- end
@@ -1,50 +0,0 @@
1
- $packages_installed = ['libgcrypt-devel', 'ipmitool', 'gcc', 'make', 'ruby-devel']
2
- $freeipmi_version = '1.3.2'
3
- $freeipmi_name = "freeipmi-${freeipmi_version}"
4
- $freeipmi_dir = "/opt/${freeipmi_name}"
5
- $directories_created = ['/opt']
6
- $gems_installed = ['bundler']
7
- $rubyipmi_dir = '/rubyipmi'
8
- archive { "freeipmi-${freeipmi_version}":
9
- ensure => present,
10
- url => "http://ftp.gnu.org/gnu/freeipmi/freeipmi-${freeipmi_version}.tar.gz",
11
- target => '/opt',
12
- checksum => false,
13
- before => Exec["configure_freeipmi"],
14
- require => File['/opt'],
15
- src_target => '/opt'
16
- }
17
- Exec{
18
- path => ['/usr/bin/', '/sbin', '/bin', '/usr/local/bin', '/usr/local/sbin', '/usr/sbin']
19
- }
20
- package{$gems_installed:
21
- ensure => present,
22
- provider => 'gem',
23
- before => Exec["configure_freeipmi"]
24
- }
25
- package{$packages_installed:
26
- ensure => present,
27
- before => Exec["configure_freeipmi"]
28
- }
29
- file{$directories_created:
30
- ensure => directory,
31
- before => Exec['configure_freeipmi']
32
- }
33
- exec{"configure_freeipmi":
34
- cwd => $freeipmi_dir,
35
- command => "bash ${freeipmi_dir}/configure",
36
- creates => "${freeipmi_dir}/ipmipower/ipmipower",
37
- before => Exec["install_freeipmi"]
38
- }
39
- exec{"install_freeipmi":
40
- cwd => $freeipmi_dir,
41
- command => "make install",
42
- creates => "/usr/local/sbin/ipmipower"
43
- }
44
-
45
- exec{"bundle install":
46
- cwd => $rubyipmi_dir,
47
- creates => "${rubyipmi_dir}/Gem.lock"
48
-
49
-
50
- }