aio_elin 1.1.0 → 1.1.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 153a62d90356983e4babc17121ab7e1546ff505da2ae18ea27dac27510eb64b8
4
- data.tar.gz: 70a011bb5dae6389641e425f575993b6f55e0acff205cf62cbc6c191a0e12a4f
3
+ metadata.gz: 5add890da1f929e9fdf9b6975d2361ee53e19323b09e329e7ffda3875f0ba5c3
4
+ data.tar.gz: e8bbaa676e2ff53db21f720f43f4a05d43329ea758c3d9b2a4b1db296ffb5f36
5
5
  SHA512:
6
- metadata.gz: c3c9e469e112858e8f2839fb5ce6a27b53ff298dc47d8f459f4e0108f4980e5b463af780a877c65247280baf3e716347a1b5205039850abb1082618ffab971fe
7
- data.tar.gz: 5e687824d92a5b54d5c7f4925a6b846d232b3ed47c108e7bb7ebbf427c018c58da26afe9144c7d7cc5b70ed9095efc79eefd2d18a1fc69f3f0a13fafadcbf17d
6
+ metadata.gz: 323842c51f98dbeb9819828e102f614bb38f8722d92a8a1b9f87d9a1846fdd9733b13c470b8485c57fc79802e7fbafd920ffb1d82b4deceac094c43fbe460a36
7
+ data.tar.gz: ff67ddef33a8641c8b2c716f9c5550f5eee64d45372a018ab874eec9c8748e479254b3382d006a4213141e213176aa37cec952cf23c08abecbb94507dd593ad0
@@ -165,6 +165,8 @@ module Aio::Device
165
165
  rescue Aio::Text::Context::OutLineError
166
166
  rescue NoMethodError
167
167
  print_error "未找到方法,请检查模块的方法名拼写"
168
+ rescue NameError
169
+ print_error "#{module_klass.class} 未检测到对应版本"
168
170
  rescue Exception => e
169
171
  print_error "#{e.class} : #{module_klass.class}"
170
172
  print_error e.message
@@ -3,69 +3,85 @@
3
3
  require "aio/core"
4
4
 
5
5
  class Aio::Module::Cmd::Cisco::ShowEnv < Aio::Module::Cmd::Cisco
6
- include Aio::Module
6
+ include Aio::Module
7
7
 
8
- def initialize
9
- super({
10
- :cmd_full => "show environment",
11
- :cmd_short => "sh env",
12
- :author => "Elin",
13
- :description => "This is Cisco Command# show environment",
14
- :ranking => Ranking_1,
15
- :platform => "all",
16
- :benchmark => {
17
- :power_status => ["==", "Normal"],
18
- :fan_status => ["==", "OK"],
19
- :cpu_status => ["==", "Normal"],
20
- }
21
- })
22
- end
8
+ def initialize
9
+ super({
10
+ :cmd_full => "show environment",
11
+ :cmd_short => "sh env",
12
+ :author => "Elin",
13
+ :description => "This is Cisco Command# show environment",
14
+ :ranking => Ranking_1,
15
+ :platform => "all",
16
+ :benchmark => {
17
+ :power_status => ["==", "Normal"],
18
+ :fan_status => ["==", "OK"],
19
+ :cpu_status => ["==", "Normal"],
20
+ }
21
+ })
22
+ end
23
23
 
24
- def parse
25
- cont = self.context.dup
24
+ def parse
25
+ cont = self.context.dup
26
+ debugger
26
27
 
27
- # 是有版本区别的,要分开对待
28
- case device_template
29
- when Template_1, Template_2
30
- parse_tmp_1(cont)
31
- end
32
- end
28
+ # 是有版本区别的,要分开对待
29
+ case device_template
30
+ when Template_1, Template_2
31
+ parse_tmp_1(cont)
32
+ when Template_4
33
+ parse_tmp_2(cont)
34
+ end
35
+ end
33
36
 
34
- def parse_tmp_1(cont)
35
- useful[:power] = {}
36
- cont.readline_match_block(/SYSTEM POWER SUPPLY STATUS/)
37
- cont.readline_match_block(/==========================/)
38
- cont.readline_range_loop(/Internal Power/, reg_blank) do |cont_layer|
39
- power = {}
40
- cont_layer.readline_match_block(/Internal Power Supply (?<power_id>\d+) Type: (?<type>.*)/) do |block|
41
- power_id = block[:power_id]
42
- useful[:power]["slot_#{power_id}"] = power
43
- block.update(power, :power_id)
44
- block.update(power, :type)
45
- end
46
- cont_layer.readline_match_block(/Output Status: (?<power_status>.*)/) do |block|
47
- block.warning_serious(power, :power_status, self)
48
- end
49
- end
37
+ def parse_tmp_1(cont)
38
+ useful[:power] = {}
39
+ cont.readline_match_block(/SYSTEM POWER SUPPLY STATUS/) {|b|b}
40
+ cont.readline_match_block(/==========================/) {|b|b}
41
+ cont.readline_range_loop(/Internal Power/, reg_blank) do |cont_layer|
42
+ power = {}
43
+ cont_layer.readline_match_block(/Internal Power Supply (?<power_id>\d+) Type: (?<type>.*)/) do |block|
44
+ power_id = block[:power_id]
45
+ useful[:power]["slot_#{power_id}"] = power
46
+ block.update(power, :power_id)
47
+ block.update(power, :type)
48
+ end
49
+ cont_layer.readline_match_block(/Output Status: (?<power_status>.*)/) do |block|
50
+ block.warning_serious(power, :power_status, self)
51
+ end
52
+ end
50
53
 
51
- useful[:fan] = {}
52
- cont.readline_match_block(/SYSTEM FAN STATUS/)
53
- cont.readline_match_block(/=================/)
54
- cont.readline_match_block_loop(/Fan (?<fan_id>\d+) (?<fan_status>.*),/, reg_blank) do |block|
55
- fan = {}
56
- fan_id = block[:fan_id]
57
- useful[:fan]["slot_#{fan_id}"] = fan
58
- block.update(fan, :fan_id)
59
- block.warning_serious(fan, :fan_status, self)
60
- end
54
+ useful[:fan] = {}
55
+ cont.readline_match_block(/SYSTEM FAN STATUS/) {|b|b}
56
+ cont.readline_match_block(/=================/) {|b|b}
57
+ cont.readline_match_block_loop(/Fan (?<fan_id>\d+) (?<fan_status>.*)/, reg_blank) do |block|
58
+ fan = {}
59
+ fan_id = block[:fan_id]
60
+ useful[:fan]["slot_#{fan_id}"] = fan
61
+ block.update(fan, :fan_id)
62
+ block.warning_serious(fan, :fan_status, self)
63
+ end
61
64
 
62
- cont.readline_match_block(/SYSTEM TEMPERATURE STATUS/)
63
- cont.readline_match_block(/=========================/)
64
- cont.readline_match_block(/CPU temperature: (?<cpu_temperature>\d+) Celsius, (?<cpu_status>.*)/) do |block|
65
- useful[:temperature] = {}
66
- block.update(useful[:temperature], :cpu_temperature)
67
- block.warning_serious(useful[:temperature], :cpu_status, self)
68
- end
65
+ cont.readline_match_block(/SYSTEM TEMPERATURE STATUS/) {|b|b}
66
+ cont.readline_match_block(/=========================/) {|b|b}
67
+ cont.readline_match_block(/CPU temperature: (?<cpu_temperature>\d+) Celsius, (?<cpu_status>.*)/) do |block|
68
+ useful[:temperature] = {}
69
+ block.update(useful[:temperature], :cpu_temperature)
70
+ block.warning_serious(useful[:temperature], :cpu_status, self)
71
+ end
72
+ end
69
73
 
70
- end
74
+ def parse_tmp_2(cont)
75
+ debugger
76
+ useful[:fan] = {}
77
+ cont.readline_match_block(/Main Power Supply is AC/) {|b|b}
78
+ cont.readline_match_block(reg_blank) {|b|b}
79
+ cont.readline_match_block_loop(/Fan (?<fan_id>\d+) (?<fan_status>.*)/, reg_blank) do |block|
80
+ fan = {}
81
+ fan_id = block[:fan_id]
82
+ useful[:fan]["slot_#{fan_id}"] = fan
83
+ block.update(fan, :fan_id)
84
+ block.warning_serious(fan, :fan_status, self)
85
+ end
86
+ end
71
87
  end
@@ -80,6 +80,8 @@ class Aio::Module::Cmd::Cisco::ShowVersion < Aio::Module::Cmd::Cisco
80
80
  case block[:device_model]
81
81
  when /76|65/ # 当是7600的时候,使用模板2
82
82
  key_stand_template Template_2
83
+ when /28/ # 当是2800的时候,使用模板4
84
+ key_stand_template Template_4
83
85
  else
84
86
  key_stand_template Template_1
85
87
  end
@@ -18,6 +18,7 @@ class Aio::Module::Cmd::H3C::DisplayMemory < Aio::Module::Cmd::H3C
18
18
  end
19
19
 
20
20
  def parse
21
+ debugger
21
22
  cont = self.context.dup
22
23
  #memory = {}
23
24
  #useful[:memory] = memory
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aio_elin
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-31 00:00:00.000000000 Z
11
+ date: 2019-02-19 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: 网络设备巡检工具
14
14
  email: 365433079@qq.com