network-utility 1.1.4

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 (179) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +2 -0
  3. data/document/acl-M6000-16E.md +27 -0
  4. data/document/acl-M6000-18S.md +27 -0
  5. data/document/acl-M6000-8.md +27 -0
  6. data/document/acl-M6000-8E.md +27 -0
  7. data/document/acl-MA5200G-8.md +204 -0
  8. data/document/acl-ME60-16.md +177 -0
  9. data/document/acl-ME60-X16.md +177 -0
  10. data/document/acl-NE40E-X16.md +204 -0
  11. data/document/acl-NE40E-X16A.md +204 -0
  12. data/document/acl-NE40E-X8.md +204 -0
  13. data/document/acl-NE40E.md +204 -0
  14. data/document/acl-NE5000E-20.md +25 -0
  15. data/document/acl-NE5000E-X16.md +25 -0
  16. data/document/acl-NE5000E-X16A.md +25 -0
  17. data/document/acl-NE80E.md +204 -0
  18. data/document/bgp-CR16010H-F.md +25 -0
  19. data/document/bgp-CR16018-F.md +25 -0
  20. data/document/bgp-CR19000-20.md +25 -0
  21. data/document/bgp-M6000-16E.md +25 -0
  22. data/document/bgp-M6000-18S.md +25 -0
  23. data/document/bgp-M6000-8.md +25 -0
  24. data/document/bgp-M6000-8E.md +25 -0
  25. data/document/bgp-MA5200G-8.md +25 -0
  26. data/document/bgp-ME60-16.md +25 -0
  27. data/document/bgp-ME60-X16.md +25 -0
  28. data/document/bgp-NE40E-X16.md +25 -0
  29. data/document/bgp-NE40E-X16A.md +25 -0
  30. data/document/bgp-NE40E-X8.md +25 -0
  31. data/document/bgp-NE40E.md +25 -0
  32. data/document/bgp-NE5000E-20.md +25 -0
  33. data/document/bgp-NE5000E-X16.md +25 -0
  34. data/document/bgp-NE5000E-X16A.md +25 -0
  35. data/document/bgp-NE80E.md +25 -0
  36. data/document/config.md +1153 -0
  37. data/document/document.rb +27 -0
  38. data/document/if-ALCATEL7750.md +48 -0
  39. data/document/if-C7609.md +47 -0
  40. data/document/if-CR16010H-F.md +300 -0
  41. data/document/if-CR16018-F.md +300 -0
  42. data/document/if-CR19000-20.md +300 -0
  43. data/document/if-CRS-16.md +47 -0
  44. data/document/if-CX600-X16A.md +349 -0
  45. data/document/if-CX600-X8A.md +349 -0
  46. data/document/if-M6000-16E.md +652 -0
  47. data/document/if-M6000-18S.md +846 -0
  48. data/document/if-M6000-8.md +653 -0
  49. data/document/if-M6000-8E.md +653 -0
  50. data/document/if-MA5200G-8.md +357 -0
  51. data/document/if-ME60-16.md +357 -0
  52. data/document/if-ME60-X16.md +357 -0
  53. data/document/if-NE40E-X16.md +357 -0
  54. data/document/if-NE40E-X16A.md +357 -0
  55. data/document/if-NE40E-X8.md +357 -0
  56. data/document/if-NE40E.md +357 -0
  57. data/document/if-NE5000E-20.md +357 -0
  58. data/document/if-NE5000E-X16.md +357 -0
  59. data/document/if-NE5000E-X16A.md +357 -0
  60. data/document/if-NE8000E-X8.md +357 -0
  61. data/document/if-NE80E.md +357 -0
  62. data/document/if-NE8100-X8.md +357 -0
  63. data/document/if-Nokia7750.md +48 -0
  64. data/document/if-T8000-18.md +653 -0
  65. data/document/if-V6000.md +663 -0
  66. data/document/if-VNE9000.md +357 -0
  67. data/document/if-ZXCTN9000-18EA.md +762 -0
  68. data/document/if-ZXCTN9000-8EA.md +762 -0
  69. data/document/lic-M6000-16E.md +28 -0
  70. data/document/lic-M6000-18S.md +28 -0
  71. data/document/lic-M6000-8.md +28 -0
  72. data/document/lic-M6000-8E.md +28 -0
  73. data/document/lic-MA5200G-8.md +27 -0
  74. data/document/lic-ME60-16.md +27 -0
  75. data/document/lic-ME60-X16.md +27 -0
  76. data/document/lic-NE40E-X16.md +27 -0
  77. data/document/lic-NE40E-X16A.md +27 -0
  78. data/document/lic-NE40E-X8.md +27 -0
  79. data/document/log-M6000-16E.md +36 -0
  80. data/document/log-M6000-18S.md +36 -0
  81. data/document/log-M6000-8.md +36 -0
  82. data/document/log-M6000-8E.md +36 -0
  83. data/document/log-MA5200G-8.md +61 -0
  84. data/document/log-ME60-16.md +61 -0
  85. data/document/log-ME60-X16.md +61 -0
  86. data/document/log-NE40E-X16.md +61 -0
  87. data/document/log-NE40E-X16A.md +61 -0
  88. data/document/log-NE40E-X8.md +61 -0
  89. data/document/log-NE40E.md +61 -0
  90. data/document/log-NE5000E-20.md +61 -0
  91. data/document/log-NE5000E-X16.md +61 -0
  92. data/document/log-NE5000E-X16A.md +61 -0
  93. data/document/log-NE80E.md +61 -0
  94. data/document/nat-CR16010H-F.md +27 -0
  95. data/document/nat-CR16018-F.md +27 -0
  96. data/document/nat-M6000-16E.md +27 -0
  97. data/document/nat-M6000-18S.md +27 -0
  98. data/document/nat-M6000-8.md +27 -0
  99. data/document/nat-M6000-8E.md +27 -0
  100. data/document/nat-ME60-16.md +44 -0
  101. data/document/nat-ME60-X16.md +44 -0
  102. data/document/nat-NE40E-X16.md +44 -0
  103. data/document/nat-NE40E-X16A.md +44 -0
  104. data/document/policy-M6000-16E.md +13 -0
  105. data/document/policy-M6000-18S.md +13 -0
  106. data/document/policy-M6000-8.md +13 -0
  107. data/document/policy-M6000-8E.md +13 -0
  108. data/document/policy-MA5200G-8.md +87 -0
  109. data/document/policy-ME60-16.md +87 -0
  110. data/document/policy-ME60-X16.md +87 -0
  111. data/document/policy-NE40E-X16.md +87 -0
  112. data/document/policy-NE40E-X16A.md +87 -0
  113. data/document/policy-NE40E-X8.md +87 -0
  114. data/document/policy-NE40E.md +87 -0
  115. data/document/policy-NE5000E-20.md +87 -0
  116. data/document/policy-NE5000E-X16.md +87 -0
  117. data/document/policy-NE5000E-X16A.md +87 -0
  118. data/document/policy-NE80E.md +87 -0
  119. data/document/pool-M6000-16E.md +126 -0
  120. data/document/pool-M6000-18S.md +126 -0
  121. data/document/pool-M6000-8.md +126 -0
  122. data/document/pool-M6000-8E.md +126 -0
  123. data/document/pool-MA5200G-8.md +138 -0
  124. data/document/pool-ME60-16.md +138 -0
  125. data/document/pool-ME60-X16.md +138 -0
  126. data/document/pool-NE40E-X16.md +138 -0
  127. data/document/pool-NE40E-X16A.md +138 -0
  128. data/document/pool-NE40E-X8.md +138 -0
  129. data/document/pool-NE40E.md +138 -0
  130. data/document/pool-NE80E.md +138 -0
  131. data/document/static-CR16010H-F.md +60 -0
  132. data/document/static-CR16018-F.md +60 -0
  133. data/document/static-CR19000-20.md +60 -0
  134. data/document/static-CX600-X16A.md +26 -0
  135. data/document/static-CX600-X8A.md +26 -0
  136. data/document/static-M6000-16E.md +104 -0
  137. data/document/static-M6000-18S.md +104 -0
  138. data/document/static-M6000-8.md +104 -0
  139. data/document/static-M6000-8E.md +104 -0
  140. data/document/static-MA5200G-8.md +82 -0
  141. data/document/static-ME60-16.md +82 -0
  142. data/document/static-ME60-X16.md +82 -0
  143. data/document/static-NE40E-X16.md +82 -0
  144. data/document/static-NE40E-X16A.md +81 -0
  145. data/document/static-NE40E-X8.md +82 -0
  146. data/document/static-NE40E.md +67 -0
  147. data/document/static-NE5000E-20.md +67 -0
  148. data/document/static-NE5000E-X16.md +67 -0
  149. data/document/static-NE5000E-X16A.md +67 -0
  150. data/document/static-NE8000E-X8.md +26 -0
  151. data/document/static-NE80E.md +67 -0
  152. data/document/static-NE8100-X8.md +26 -0
  153. data/document/static-T8000-18.md +34 -0
  154. data/document/static-ZXCTN9000-18EA.md +34 -0
  155. data/document/static-ZXCTN9000-8EA.md +34 -0
  156. data/document/system-M6000-16E.md +75 -0
  157. data/document/system-M6000-18S.md +76 -0
  158. data/document/system-M6000-8.md +75 -0
  159. data/document/system-M6000-8E.md +75 -0
  160. data/document/system-MA5200G-8.md +51 -0
  161. data/document/system-ME60-16.md +51 -0
  162. data/document/system-ME60-X16.md +51 -0
  163. data/document/system-NE40E-X16.md +51 -0
  164. data/document/system-NE40E-X16A.md +51 -0
  165. data/document/system-NE40E-X8.md +51 -0
  166. data/document/system-NE40E.md +51 -0
  167. data/document/system-NE5000E-20.md +51 -0
  168. data/document/system-NE5000E-X16.md +51 -0
  169. data/document/system-NE5000E-X16A.md +51 -0
  170. data/document/system-NE80E.md +51 -0
  171. data/document/telnet.md +332 -0
  172. data/network.rb +24 -0
  173. data/utility/ipv4_address.rb +266 -0
  174. data/utility/ipv6_address.rb +201 -0
  175. data/utility/mac_address.rb +77 -0
  176. data/utility/netmerge.rb +46 -0
  177. data/utility/route.rb +79 -0
  178. data/utility/whitelist.rb +21 -0
  179. metadata +258 -0
@@ -0,0 +1,28 @@
1
+
2
+ # M6000-16E License
3
+
4
+ ```ruby
5
+ @sign << ['M6000-16E', 'license']
6
+
7
+ module M6000_16E
8
+ module_function
9
+
10
+ def license 报文
11
+ license = {}
12
+ functions = 报文.split("----------------------------------------\n")[1].split("\n\n")[0].split("\n").map{|line|line.split(" ")}
13
+ license['function'] = {}
14
+ functions.each do|func| license['function'][func[0]] = func[1] end
15
+
16
+ performance = 报文.split("-----------------------------------------------------------------------\n")[1].split("\n\n")[0].split("\n").select{|l|!l.include?('#')}.map{|line|line.split(" ")}
17
+ license['performance'] = {}
18
+ performance.each do|perf|
19
+ name, author, current, max = perf
20
+ author = author.to_i if author !='N/A'
21
+ current = current.to_i if current!='N/A'
22
+ max = max.to_i if max !='N/A'
23
+ license['performance'][name] = [current, author, max]
24
+ end
25
+ return license
26
+ end
27
+ end
28
+ ```
@@ -0,0 +1,28 @@
1
+
2
+ # M6000-18S License
3
+
4
+ ```ruby
5
+ @sign << ['M6000-18S', 'license']
6
+
7
+ module M6000_18S
8
+ module_function
9
+
10
+ def license 报文
11
+ license = {}
12
+ functions = 报文.split("----------------------------------------\n")[1].split("\n\n")[0].split("\n").map{|line|line.split(" ")}
13
+ license['function'] = {}
14
+ functions.each do|func| license['function'][func[0]] = func[1] end
15
+
16
+ performance = 报文.split("-----------------------------------------------------------------------\n")[1].split("\n\n")[0].split("\n").select{|l|!l.include?('#')}.map{|line|line.split(" ")}
17
+ license['performance'] = {}
18
+ performance.each do|perf|
19
+ name, author, current, max = perf
20
+ author = author.to_i if author !='N/A'
21
+ current = current.to_i if current!='N/A'
22
+ max = max.to_i if max !='N/A'
23
+ license['performance'][name] = [current, author, max]
24
+ end
25
+ return license
26
+ end
27
+ end
28
+ ```
@@ -0,0 +1,28 @@
1
+
2
+ # M6000-8 License
3
+
4
+ ```ruby
5
+ @sign << ['M6000-8', 'license']
6
+
7
+ module M6000_8
8
+ module_function
9
+
10
+ def license 报文
11
+ license = {}
12
+ functions = 报文.split("----------------------------------------\n")[1].split("\n\n")[0].split("\n").map{|line|line.split(" ")}
13
+ license['function'] = {}
14
+ functions.each do|func| license['function'][func[0]] = func[1] end
15
+
16
+ performance = 报文.split("-----------------------------------------------------------------------\n")[1].split("\n\n")[0].split("\n").select{|l|!l.include?('#')}.map{|line|line.split(" ")}
17
+ license['performance'] = {}
18
+ performance.each do|perf|
19
+ name, author, current, max = perf
20
+ author = author.to_i if author !='N/A'
21
+ current = current.to_i if current!='N/A'
22
+ max = max.to_i if max !='N/A'
23
+ license['performance'][name] = [current, author, max]
24
+ end
25
+ return license
26
+ end
27
+ end
28
+ ```
@@ -0,0 +1,28 @@
1
+
2
+ # M6000-8E License
3
+
4
+ ```ruby
5
+ @sign << ['M6000-8E', 'license']
6
+
7
+ module M6000_8E
8
+ module_function
9
+
10
+ def license 报文
11
+ license = {}
12
+ functions = 报文.split("----------------------------------------\n")[1].split("\n\n")[0].split("\n").map{|line|line.split(" ")}
13
+ license['function'] = {}
14
+ functions.each do|func| license['function'][func[0]] = func[1] end
15
+
16
+ performance = 报文.split("-----------------------------------------------------------------------\n")[1].split("\n\n")[0].split("\n").select{|l|!l.include?('#')}.map{|line|line.split(" ")}
17
+ license['performance'] = {}
18
+ performance.each do|perf|
19
+ name, author, current, max = perf
20
+ author = author.to_i if author !='N/A'
21
+ current = current.to_i if current!='N/A'
22
+ max = max.to_i if max !='N/A'
23
+ license['performance'][name] = [current, author, max]
24
+ end
25
+ return license
26
+ end
27
+ end
28
+ ```
@@ -0,0 +1,27 @@
1
+
2
+ # MA5200G-8 License
3
+
4
+ ```ruby
5
+ @sign << ['MA5200G-8', 'license']
6
+
7
+ module MA5200G_8
8
+ module_function
9
+
10
+ def license 报文
11
+ license = {}
12
+ if 报文.include?('----') # 0: pre 1: head 2: body
13
+ list = 报文.split('--------------------------------------------------------------------------------')[2].split("\n").select{|s|!s.empty?}.map{|line|line.split(" ")}
14
+ elsif 报文.include?('FeatureName')
15
+ list = 报文.split(" FeatureName | ConfigureItemName | ResourceUsage\n")[1].split("\n<")[0].split("\n").select{|s|!s.empty?}.map{|line|line.split(" ")}
16
+ else
17
+ list = [] # collect error!
18
+ end
19
+ list.each do|item|
20
+ feature, conf_item, res_usage = item
21
+ license[feature] ||= {}
22
+ license[feature][conf_item] = res_usage.split('/').map{|c|c.to_i}
23
+ end
24
+ return license
25
+ end
26
+ end
27
+ ```
@@ -0,0 +1,27 @@
1
+
2
+ # ME60-16 License
3
+
4
+ ```ruby
5
+ @sign << ['ME60-16', 'license']
6
+
7
+ module ME60_16
8
+ module_function
9
+
10
+ def license 报文
11
+ license = {}
12
+ if 报文.include?('----') # 0: pre 1: head 2: body
13
+ list = 报文.split('--------------------------------------------------------------------------------')[2].split("\n").map{|line|line.split(" ")}.select{|s|!s.empty?}
14
+ elsif 报文.include?('FeatureName')
15
+ list = 报文.split(" FeatureName | ConfigureItemName | ResourceUsage\n")[1].split("\n<")[0].split("\n").select{|s|!s.empty?}.map{|line|line.split(" ")}
16
+ else
17
+ list = [] # collect error!
18
+ end
19
+ list.each do|item|
20
+ feature, conf_item, res_usage = item
21
+ license[feature] ||= {}
22
+ license[feature][conf_item] = res_usage.split('/').map{|c|c.to_i}
23
+ end
24
+ return license
25
+ end
26
+ end
27
+ ```
@@ -0,0 +1,27 @@
1
+
2
+ # ME60-X16 License
3
+
4
+ ```ruby
5
+ @sign << ['ME60-X16', 'license']
6
+
7
+ module ME60_X16
8
+ module_function
9
+
10
+ def license 报文
11
+ license = {}
12
+ if 报文.include?('----') # 0: pre 1: head 2: body
13
+ list = 报文.split('--------------------------------------------------------------------------------')[2].split("\n").map{|line|line.split(" ")}.select{|s|!s.empty?}
14
+ elsif 报文.include?('FeatureName')
15
+ list = 报文.split(" FeatureName | ConfigureItemName | ResourceUsage\n")[1].split("\n<")[0].split("\n").select{|s|!s.empty?}.map{|line|line.split(" ")}
16
+ else
17
+ list = [] # collect error!
18
+ end
19
+ list.each do|item|
20
+ feature, conf_item, res_usage = item
21
+ license[feature] ||= {}
22
+ license[feature][conf_item] = res_usage.split('/').map{|c|c.to_i}
23
+ end
24
+ return license
25
+ end
26
+ end
27
+ ```
@@ -0,0 +1,27 @@
1
+
2
+ # NE40E-X16 License
3
+
4
+ ```ruby
5
+ @sign << ['NE40E-X16', 'license']
6
+
7
+ module NE40E_X16
8
+ module_function
9
+
10
+ def license 报文
11
+ license = {}
12
+ if 报文.include?('----') # 0: pre 1: head 2: body
13
+ list = 报文.split('--------------------------------------------------------------------------------')[2].split("\n").select{|s|!s.empty?}.map{|line|line.split(" ")}
14
+ elsif 报文.include?('FeatureName')
15
+ list = 报文.split(" FeatureName | ConfigureItemName | ResourceUsage\n")[1].split("\n<")[0].split("\n").select{|s|!s.empty?}.map{|line|line.split(" ")}
16
+ else
17
+ list = [] # collect error!
18
+ end
19
+ list.each do|item|
20
+ feature, conf_item, res_usage = item
21
+ license[feature] ||= {}
22
+ license[feature][conf_item] = res_usage.split('/').map{|c|c.to_i}
23
+ end
24
+ return license
25
+ end
26
+ end
27
+ ```
@@ -0,0 +1,27 @@
1
+
2
+ # NE40E-X16A License
3
+
4
+ ```ruby
5
+ @sign << ['NE40E-X16A', 'license']
6
+
7
+ module NE40E_X16A
8
+ module_function
9
+
10
+ def license 报文
11
+ license = {}
12
+ if 报文.include?('----') # 0: pre 1: head 2: body
13
+ list = 报文.split('--------------------------------------------------------------------------------')[2].split("\n").select{|s|!s.empty?}.map{|line|line.split(" ")}
14
+ elsif 报文.include?('FeatureName')
15
+ list = 报文.split(" FeatureName | ConfigureItemName | ResourceUsage\n")[1].split("\n<")[0].split("\n").select{|s|!s.empty?}.map{|line|line.split(" ")}
16
+ else
17
+ list = [] # collect error!
18
+ end
19
+ list.each do|item|
20
+ feature, conf_item, res_usage = item
21
+ license[feature] ||= {}
22
+ license[feature][conf_item] = res_usage.split('/').map{|c|c.to_i}
23
+ end
24
+ return license
25
+ end
26
+ end
27
+ ```
@@ -0,0 +1,27 @@
1
+
2
+ # NE40E-X8 License
3
+
4
+ ```ruby
5
+ @sign << ['NE40E-X8', 'license']
6
+
7
+ module NE40E_X8
8
+ module_function
9
+
10
+ def license 报文
11
+ license = {}
12
+ if 报文.include?('----') # 0: pre 1: head 2: body
13
+ list = 报文.split('--------------------------------------------------------------------------------')[2].split("\n").select{|s|!s.empty?}.map{|line|line.split(" ")}
14
+ elsif 报文.include?('FeatureName')
15
+ list = 报文.split(" FeatureName | ConfigureItemName | ResourceUsage\n")[1].split("\n<")[0].split("\n").select{|s|!s.empty?}.map{|line|line.split(" ")}
16
+ else
17
+ list = [] # collect error!
18
+ end
19
+ list.each do|item|
20
+ feature, conf_item, res_usage = item
21
+ license[feature] ||= {}
22
+ license[feature][conf_item] = res_usage.split('/').map{|c|c.to_i}
23
+ end
24
+ return license
25
+ end
26
+ end
27
+ ```
@@ -0,0 +1,36 @@
1
+
2
+ # M6000-16E 日志
3
+
4
+ ```ruby
5
+ @sign << ['M6000-16E', '日志']
6
+ # require 'time'
7
+
8
+ module M6000_16E
9
+ module_function
10
+
11
+ def 日志 logs
12
+ tab = [['time', 'alarm_type', 'alarm', 'alarm_id', 'alarm_lv', 'node_ip', 'node', 'board', 'type', 'alarm_action', 'message']]
13
+ logs.each do|log|
14
+ texts = log.split(":[")
15
+ header,content = texts[0],texts[1].split(']')[0]
16
+ headers = header.strip.split(" ")
17
+ timetag, node_ip, alarm_type = headers[0..-3].join(" "), headers[-2], headers[-1]
18
+
19
+ spin = content.split(" ")
20
+ alarm = [spin[spin.index("ID")-2],spin[spin.index("ID")-1]].join(' ')
21
+ alarm_id = spin[spin.index("ID")+1]
22
+ alarm_lv = spin[spin.index("level")+1]
23
+ alarm_action = spin[spin.index("level")+2]
24
+
25
+ time = Time.parse(timetag).strftime("%Y-%m-%d %H:%M:%S")
26
+ nodes = content.split(" sent by ")[1].split("% ")[0]
27
+ node, board, rtype = nodes.split(" ")
28
+ type = rtype.gsub("%","")
29
+ message = content.split("% ")[1]
30
+
31
+ tab << [time, alarm_type, alarm, alarm_id, alarm_lv, node_ip, node, board, type, alarm_action, message]
32
+ end
33
+ return tab
34
+ end
35
+ end
36
+ ```
@@ -0,0 +1,36 @@
1
+
2
+ # M6000-18S 日志
3
+
4
+ ```ruby
5
+ @sign << ['M6000-18S', '日志']
6
+ # require 'time'
7
+
8
+ module M6000_18S
9
+ module_function
10
+
11
+ def 日志 logs
12
+ tab = [['time', 'alarm_type', 'alarm', 'alarm_id', 'alarm_lv', 'node_ip', 'node', 'board', 'type', 'alarm_action', 'message']]
13
+ logs.each do|log|
14
+ texts = log.split(":[")
15
+ header,content = texts[0],texts[1].split(']')[0]
16
+ headers = header.strip.split(" ")
17
+ timetag, node_ip, alarm_type = headers[0..-3].join(" "), headers[-2], headers[-1]
18
+
19
+ spin = content.split(" ")
20
+ alarm = [spin[spin.index("ID")-2],spin[spin.index("ID")-1]].join(' ')
21
+ alarm_id = spin[spin.index("ID")+1]
22
+ alarm_lv = spin[spin.index("level")+1]
23
+ alarm_action = spin[spin.index("level")+2]
24
+
25
+ time = Time.parse(timetag).strftime("%Y-%m-%d %H:%M:%S")
26
+ nodes = content.split(" sent by ")[1].split("% ")[0]
27
+ node, board, rtype = nodes.split(" ")
28
+ type = rtype.gsub("%","")
29
+ message = content.split("% ")[1]
30
+
31
+ tab << [time, alarm_type, alarm, alarm_id, alarm_lv, node_ip, node, board, type, alarm_action, message]
32
+ end
33
+ return tab
34
+ end
35
+ end
36
+ ```
@@ -0,0 +1,36 @@
1
+
2
+ # M6000-8 日志
3
+
4
+ ```ruby
5
+ @sign << ['M6000-8', '日志']
6
+ # require 'time'
7
+
8
+ module M6000_8
9
+ module_function
10
+
11
+ def 日志 logs
12
+ tab = [['time', 'alarm_type', 'alarm', 'alarm_id', 'alarm_lv', 'node_ip', 'node', 'board', 'type', 'alarm_action', 'message']]
13
+ logs.each do|log|
14
+ texts = log.split(":[")
15
+ header,content = texts[0],texts[1].split(']')[0]
16
+ headers = header.strip.split(" ")
17
+ timetag, node_ip, alarm_type = headers[0..-3].join(" "), headers[-2], headers[-1]
18
+
19
+ spin = content.split(" ")
20
+ alarm = [spin[spin.index("ID")-2],spin[spin.index("ID")-1]].join(' ')
21
+ alarm_id = spin[spin.index("ID")+1]
22
+ alarm_lv = spin[spin.index("level")+1]
23
+ alarm_action = spin[spin.index("level")+2]
24
+
25
+ time = Time.parse(timetag).strftime("%Y-%m-%d %H:%M:%S")
26
+ nodes = content.split(" sent by ")[1].split("% ")[0]
27
+ node, board, rtype = nodes.split(" ")
28
+ type = rtype.gsub("%","")
29
+ message = content.split("% ")[1]
30
+
31
+ tab << [time, alarm_type, alarm, alarm_id, alarm_lv, node_ip, node, board, type, alarm_action, message]
32
+ end
33
+ return tab
34
+ end
35
+ end
36
+ ```
@@ -0,0 +1,36 @@
1
+
2
+ # M6000-8E 日志
3
+
4
+ ```ruby
5
+ @sign << ['M6000-8E', '日志']
6
+ # require 'time'
7
+
8
+ module M6000_8E
9
+ module_function
10
+
11
+ def 日志 logs
12
+ tab = [['time', 'alarm_type', 'alarm', 'alarm_id', 'alarm_lv', 'node_ip', 'node', 'board', 'type', 'alarm_action', 'message']]
13
+ logs.each do|log|
14
+ texts = log.split(":[")
15
+ header,content = texts[0],texts[1].split(']')[0]
16
+ headers = header.strip.split(" ")
17
+ timetag, node_ip, alarm_type = headers[0..-3].join(" "), headers[-2], headers[-1]
18
+
19
+ spin = content.split(" ")
20
+ alarm = [spin[spin.index("ID")-2],spin[spin.index("ID")-1]].join(' ')
21
+ alarm_id = spin[spin.index("ID")+1]
22
+ alarm_lv = spin[spin.index("level")+1]
23
+ alarm_action = spin[spin.index("level")+2]
24
+
25
+ time = Time.parse(timetag).strftime("%Y-%m-%d %H:%M:%S")
26
+ nodes = content.split(" sent by ")[1].split("% ")[0]
27
+ node, board, rtype = nodes.split(" ")
28
+ type = rtype.gsub("%","")
29
+ message = content.split("% ")[1]
30
+
31
+ tab << [time, alarm_type, alarm, alarm_id, alarm_lv, node_ip, node, board, type, alarm_action, message]
32
+ end
33
+ return tab
34
+ end
35
+ end
36
+ ```
@@ -0,0 +1,61 @@
1
+
2
+ # MA5200G-8 日志
3
+
4
+ ```ruby
5
+ @sign << ['MA5200G-8', '日志']
6
+ @sign << ['MA5200G-8', 'aaa下线日志']
7
+ # require 'time'
8
+
9
+ module MA5200G_8
10
+ module_function
11
+
12
+ def 日志 logs # logs => line-texts
13
+ tab = [['time', 'alarm_type', 'alarm_id', 'alarm_lv', 'node', 'module', 'message', 'list']]
14
+ logs.each do|log|
15
+ texts = log.split(": ")
16
+ header,content = texts[0],texts[1..-1].join(': ')
17
+ headers = header.split(' ')
18
+ timetag, node, source = headers[0..-3].join(' '),headers[-2], headers[-1]
19
+
20
+ time, src = Time.parse(timetag).strftime("%Y-%m-%d %H:%M:%S"),source.strip
21
+ mod, alarm_lv, mtype = src.split("/")
22
+ alarm_type = mtype.split("[")[0]
23
+ alarm_id = mtype.split("[")[1].to_s.split("]")[0].to_s
24
+
25
+ if content.include?("(")
26
+ message = content.split("(")[0]
27
+ list = content.split("(")[1].split(")")[0]
28
+ else
29
+ message = content
30
+ list = ""
31
+ end
32
+
33
+ tab << [time, alarm_type, alarm_id, alarm_lv, node, mod, message, list]
34
+ end
35
+ return tab
36
+ end
37
+
38
+ def aaa下线日志 rawlog
39
+ records = [['username','ipaddr','mac','interface','pvlan','cvlan','login-time','offline-time','reason']]
40
+ log = rawlog.split("--------------------------------------------------------------------------------\n")[1..-2]
41
+ log.each do|part|
42
+ next if part==''
43
+ begin
44
+ username = part.split("Username:")[1].split(" ")[0].strip
45
+ mac = part.split("MAC:")[1].split("\n")[0].strip
46
+ interface = part.split("Interface:")[1].split(" ")[0].strip
47
+ vlanid = part.split(" VlanID:")[1].split(" ")[0].strip
48
+ svlanid = part.split("SecondVlanID:")[1].split("\n")[0].strip
49
+ ipaddress = part.split("IpAddress:")[1].split("\n")[0].strip
50
+ logintime = part.split("LoginTime:")[1].split("\n")[0].strip
51
+ offlinetime = part.split("OfflineTime:")[1].split("\n")[0].strip
52
+ reason = part.split("OfflineReason:")[1].split("\n")[0].strip
53
+ records << [username, ipaddress, mac, interface, vlanid, svlanid, logintime, offlinetime, reason]
54
+ rescue
55
+ p part
56
+ end
57
+ end
58
+ return records
59
+ end
60
+ end
61
+ ```
@@ -0,0 +1,61 @@
1
+
2
+ # ME60-16 日志
3
+
4
+ ```ruby
5
+ @sign << ['ME60-16', '日志']
6
+ @sign << ['ME60-16', 'aaa下线日志']
7
+ # require 'time'
8
+
9
+ module ME60_16
10
+ module_function
11
+
12
+ def 日志 logs # logs => line-texts
13
+ tab = [['time', 'alarm_type', 'alarm_id', 'alarm_lv', 'node', 'module', 'message', 'list']]
14
+ logs.each do|log|
15
+ texts = log.split(": ")
16
+ header,content = texts[0],texts[1..-1].join(': ')
17
+ headers = header.split(' ')
18
+ timetag, node, source = headers[0..-3].join(' '),headers[-2], headers[-1]
19
+
20
+ time, src = Time.parse(timetag).strftime("%Y-%m-%d %H:%M:%S"),source.strip
21
+ mod, alarm_lv, mtype = src.split("/")
22
+ alarm_type = mtype.split("[")[0]
23
+ alarm_id = mtype.split("[")[1].to_s.split("]")[0].to_s
24
+
25
+ if content.include?("(")
26
+ message = content.split("(")[0]
27
+ list = content.split("(")[1].split(")")[0]
28
+ else
29
+ message = content
30
+ list = ""
31
+ end
32
+
33
+ tab << [time, alarm_type, alarm_id, alarm_lv, node, mod, message, list]
34
+ end
35
+ return tab
36
+ end
37
+
38
+ def aaa下线日志 rawlog
39
+ records = [['username','ipaddr','mac','interface','pvlan','cvlan','login-time','offline-time','reason']]
40
+ log = rawlog.split("--------------------------------------------------------------------------------\n")[1..-2]
41
+ log.each do|part|
42
+ next if part==''
43
+ begin
44
+ username = part.split("Username:")[1].split(" ")[0].strip
45
+ mac = part.split("MAC:")[1].split("\n")[0].strip
46
+ interface = part.split("Interface:")[1].split(" ")[0].strip
47
+ vlanid = part.split(" VlanID:")[1].split(" ")[0].strip
48
+ svlanid = part.split("SecondVlanID:")[1].split("\n")[0].strip
49
+ ipaddress = part.split("IpAddress:")[1].split("\n")[0].strip
50
+ logintime = part.split("LoginTime:")[1].split("\n")[0].strip
51
+ offlinetime = part.split("OfflineTime:")[1].split("\n")[0].strip
52
+ reason = part.split("OfflineReason:")[1].split("\n")[0].strip
53
+ records << [username, ipaddress, mac, interface, vlanid, svlanid, logintime, offlinetime, reason]
54
+ rescue
55
+ p part
56
+ end
57
+ end
58
+ return records
59
+ end
60
+ end
61
+ ```
@@ -0,0 +1,61 @@
1
+
2
+ # ME60-X16 日志
3
+
4
+ ```ruby
5
+ @sign << ['ME60-X16', '日志']
6
+ @sign << ['ME60-X16', 'aaa下线日志']
7
+ # require 'time'
8
+
9
+ module ME60_X16
10
+ module_function
11
+
12
+ def 日志 logs # logs => line-texts
13
+ tab = [['time', 'alarm_type', 'alarm_id', 'alarm_lv', 'node', 'module', 'message', 'list']]
14
+ logs.each do|log|
15
+ texts = log.split(": ")
16
+ header,content = texts[0],texts[1..-1].join(': ')
17
+ headers = header.split(' ')
18
+ timetag, node, source = headers[0..-3].join(' '),headers[-2], headers[-1]
19
+
20
+ time, src = Time.parse(timetag).strftime("%Y-%m-%d %H:%M:%S"),source.strip
21
+ mod, alarm_lv, mtype = src.split("/")
22
+ alarm_type = mtype.split("[")[0]
23
+ alarm_id = mtype.split("[")[1].to_s.split("]")[0].to_s
24
+
25
+ if content.include?("(")
26
+ message = content.split("(")[0]
27
+ list = content.split("(")[1].split(")")[0]
28
+ else
29
+ message = content
30
+ list = ""
31
+ end
32
+
33
+ tab << [time, alarm_type, alarm_id, alarm_lv, node, mod, message, list]
34
+ end
35
+ return tab
36
+ end
37
+
38
+ def aaa下线日志 rawlog
39
+ records = [['username','ipaddr','mac','interface','pvlan','cvlan','login-time','offline-time','reason']]
40
+ log = rawlog.split("--------------------------------------------------------------------------------\n")[1..-2]
41
+ log.each do|part|
42
+ next if part==''
43
+ begin
44
+ username = part.split("Username:")[1].split(" ")[0].strip
45
+ mac = part.split("MAC:")[1].split("\n")[0].strip
46
+ interface = part.split("Interface:")[1].split(" ")[0].strip
47
+ vlanid = part.split(" VlanID:")[1].split(" ")[0].strip
48
+ svlanid = part.split("SecondVlanID:")[1].split("\n")[0].strip
49
+ ipaddress = part.split("IpAddress:")[1].split("\n")[0].strip
50
+ logintime = part.split("LoginTime:")[1].split("\n")[0].strip
51
+ offlinetime = part.split("OfflineTime:")[1].split("\n")[0].strip
52
+ reason = part.split("OfflineReason:")[1].split("\n")[0].strip
53
+ records << [username, ipaddress, mac, interface, vlanid, svlanid, logintime, offlinetime, reason]
54
+ rescue
55
+ p part
56
+ end
57
+ end
58
+ return records
59
+ end
60
+ end
61
+ ```