network-utility 1.1.40 → 1.1.42
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 +4 -4
- data/document/acl-T8000-18.md +26 -0
- data/document/flexe-CX600-X16A.md +74 -0
- data/document/flexe-CX600-X8A.md +73 -0
- data/document/flexe-NE8000E-X8.md +73 -0
- data/document/flexe-NE8100-X8.md +74 -0
- data/document/isis-CX600-X16A.md +140 -0
- data/document/isis-CX600-X8A.md +141 -0
- data/document/isis-NE40E-X16A.md +141 -0
- data/document/isis-NE8000E-X8.md +140 -0
- data/document/isis-NE8100-X8.md +140 -0
- data/document/policy-CX600-X16A.md +87 -0
- data/document/policy-CX600-X8A.md +87 -0
- data/document/policy-NE8000E-X8.md +87 -0
- data/document/policy-NE8100-X8.md +87 -0
- data/document/policy-VNE9000.md +87 -0
- data/document/static-CR16010H-F.md +1 -0
- data/document/static-CR16018-F.md +1 -0
- data/document/static-CR19000-20.md +1 -0
- data/document/static-CX600-X16A.md +2 -1
- data/document/static-CX600-X8A.md +2 -1
- data/document/static-MA5200G-8.md +2 -1
- data/document/static-ME60-16.md +2 -1
- data/document/static-ME60-X16.md +2 -1
- data/document/static-NE40E-X16.md +1 -0
- data/document/static-NE40E-X16A.md +1 -0
- data/document/static-NE40E-X8.md +2 -1
- data/document/static-NE40E.md +1 -0
- data/document/static-NE5000E-20.md +1 -1
- data/document/static-NE5000E-X16.md +1 -1
- data/document/static-NE5000E-X16A.md +1 -1
- data/document/static-NE8000E-X8.md +1 -1
- data/document/static-NE80E.md +1 -0
- data/document/static-NE8100-X8.md +1 -1
- data/document/statistics-M6000-16E.md +56 -0
- data/document/statistics-M6000-18S.md +147 -0
- data/document/statistics-M6000-8.md +56 -0
- data/document/statistics-M6000-8E.md +56 -0
- data/document/vpn-CX600-X16A.md +78 -0
- data/document/vpn-CX600-X8A.md +79 -0
- data/document/vpn-ZXCTN9000-18EA.md +74 -0
- data/document/vpn-ZXCTN9000-8EA.md +74 -0
- data/network.rb +1 -1
- metadata +24 -1
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
|
|
2
|
+
# NE8000E-X8 流策略、路由策略
|
|
3
|
+
|
|
4
|
+
```ruby
|
|
5
|
+
@sign << ['NE8000E-X8', 'traffic']
|
|
6
|
+
@sign << ['NE8000E-X8', 'traffic_classifier']
|
|
7
|
+
@sign << ['NE8000E-X8', 'traffic_behavior']
|
|
8
|
+
@sign << ['NE8000E-X8', 'traffic_policy']
|
|
9
|
+
|
|
10
|
+
module NE8000E_X8
|
|
11
|
+
module_function
|
|
12
|
+
|
|
13
|
+
def traffic conflist
|
|
14
|
+
tc,tb,tp = ['traffic_classifier','traffic_behavior','traffic_policy'].map{|t|self.send(t,conflist)}
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# {name => {classifier => [matchers], operator => opt}, ...}
|
|
18
|
+
def traffic_classifier conflist
|
|
19
|
+
tc = {}
|
|
20
|
+
conflist['traffic'].each do|traffic|
|
|
21
|
+
next unless traffic.include?('classifier')
|
|
22
|
+
name,tab = nil,{'operator'=>''}
|
|
23
|
+
traffic.split("\n").each do|line|
|
|
24
|
+
if line.include?('traffic classifier ')
|
|
25
|
+
tc[name] = tab
|
|
26
|
+
name, opt, op = line.split(' ')[2..4]
|
|
27
|
+
tab = {'operator'=>op}
|
|
28
|
+
else
|
|
29
|
+
matcher = line.split(' ')
|
|
30
|
+
tab['classifier'] ||= []
|
|
31
|
+
tab['classifier'] << matcher # sequences
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
tc[name] = tab # last tc
|
|
35
|
+
tc.delete(nil)
|
|
36
|
+
end if conflist['traffic']
|
|
37
|
+
return tc
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# {name => [behaviors], ...}
|
|
41
|
+
def traffic_behavior conflist
|
|
42
|
+
tb = {}
|
|
43
|
+
conflist['traffic'].each do|traffic|
|
|
44
|
+
next unless traffic.include?('behavior')
|
|
45
|
+
name,tab = nil,{'behavior'=>[]}
|
|
46
|
+
traffic.split("\n").each do|line|
|
|
47
|
+
if line.include?('traffic behavior ')
|
|
48
|
+
tb[name] = tab
|
|
49
|
+
name,tab = line.split(' ')[2],{'behavior'=>[]}
|
|
50
|
+
else
|
|
51
|
+
behavior = line.split(' ')
|
|
52
|
+
tab['behavior'] << behavior # sequences
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
tb[name] = tab # last tb
|
|
56
|
+
tb.delete(nil)
|
|
57
|
+
end if conflist['traffic']
|
|
58
|
+
return tb
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# {name => {policy => {classifier => [behavior,precedence], ...}, mode => mode}, ...}
|
|
62
|
+
def traffic_policy conflist
|
|
63
|
+
tp = {}
|
|
64
|
+
conflist['traffic'].each do|traffic|
|
|
65
|
+
next unless traffic.include?('policy')
|
|
66
|
+
name,tab = nil,{'policy'=>{}}
|
|
67
|
+
traffic.split("\n").each do|line|
|
|
68
|
+
if line.include?('traffic policy ')
|
|
69
|
+
tp[name] = tab
|
|
70
|
+
name,tab = line.split(' ')[2],{'policy'=>{}}
|
|
71
|
+
elsif line.include?('-mode')
|
|
72
|
+
tab['mode'] = 'share-mode'
|
|
73
|
+
elsif line.include?('statistics ')
|
|
74
|
+
tab['statistics'] = line.split(' ')[1]
|
|
75
|
+
else
|
|
76
|
+
policy = line.split(' ')
|
|
77
|
+
classifier, behavior, precedence = policy[1],policy[3],policy[5]
|
|
78
|
+
tab['policy'].merge!({ classifier => (precedence ? [behavior,precedence] : [behavior]) }) # tree
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
tp[name] = tab # last tb
|
|
82
|
+
tp.delete(nil)
|
|
83
|
+
end if conflist['traffic']
|
|
84
|
+
return tp
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
```
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
|
|
2
|
+
# NE8100-X8 流策略、路由策略
|
|
3
|
+
|
|
4
|
+
```ruby
|
|
5
|
+
@sign << ['NE8100-X8', 'traffic']
|
|
6
|
+
@sign << ['NE8100-X8', 'traffic_classifier']
|
|
7
|
+
@sign << ['NE8100-X8', 'traffic_behavior']
|
|
8
|
+
@sign << ['NE8100-X8', 'traffic_policy']
|
|
9
|
+
|
|
10
|
+
module NE8100_X8
|
|
11
|
+
module_function
|
|
12
|
+
|
|
13
|
+
def traffic conflist
|
|
14
|
+
tc,tb,tp = ['traffic_classifier','traffic_behavior','traffic_policy'].map{|t|self.send(t,conflist)}
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# {name => {classifier => [matchers], operator => opt}, ...}
|
|
18
|
+
def traffic_classifier conflist
|
|
19
|
+
tc = {}
|
|
20
|
+
conflist['traffic'].each do|traffic|
|
|
21
|
+
next unless traffic.include?('classifier')
|
|
22
|
+
name,tab = nil,{'operator'=>''}
|
|
23
|
+
traffic.split("\n").each do|line|
|
|
24
|
+
if line.include?('traffic classifier ')
|
|
25
|
+
tc[name] = tab
|
|
26
|
+
name, opt, op = line.split(' ')[2..4]
|
|
27
|
+
tab = {'operator'=>op}
|
|
28
|
+
else
|
|
29
|
+
matcher = line.split(' ')
|
|
30
|
+
tab['classifier'] ||= []
|
|
31
|
+
tab['classifier'] << matcher # sequences
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
tc[name] = tab # last tc
|
|
35
|
+
tc.delete(nil)
|
|
36
|
+
end if conflist['traffic']
|
|
37
|
+
return tc
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# {name => [behaviors], ...}
|
|
41
|
+
def traffic_behavior conflist
|
|
42
|
+
tb = {}
|
|
43
|
+
conflist['traffic'].each do|traffic|
|
|
44
|
+
next unless traffic.include?('behavior')
|
|
45
|
+
name,tab = nil,{'behavior'=>[]}
|
|
46
|
+
traffic.split("\n").each do|line|
|
|
47
|
+
if line.include?('traffic behavior ')
|
|
48
|
+
tb[name] = tab
|
|
49
|
+
name,tab = line.split(' ')[2],{'behavior'=>[]}
|
|
50
|
+
else
|
|
51
|
+
behavior = line.split(' ')
|
|
52
|
+
tab['behavior'] << behavior # sequences
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
tb[name] = tab # last tb
|
|
56
|
+
tb.delete(nil)
|
|
57
|
+
end if conflist['traffic']
|
|
58
|
+
return tb
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# {name => {policy => {classifier => [behavior,precedence], ...}, mode => mode}, ...}
|
|
62
|
+
def traffic_policy conflist
|
|
63
|
+
tp = {}
|
|
64
|
+
conflist['traffic'].each do|traffic|
|
|
65
|
+
next unless traffic.include?('policy')
|
|
66
|
+
name,tab = nil,{'policy'=>{}}
|
|
67
|
+
traffic.split("\n").each do|line|
|
|
68
|
+
if line.include?('traffic policy ')
|
|
69
|
+
tp[name] = tab
|
|
70
|
+
name,tab = line.split(' ')[2],{'policy'=>{}}
|
|
71
|
+
elsif line.include?('-mode')
|
|
72
|
+
tab['mode'] = 'share-mode'
|
|
73
|
+
elsif line.include?('statistics ')
|
|
74
|
+
tab['statistics'] = line.split(' ')[1]
|
|
75
|
+
else
|
|
76
|
+
policy = line.split(' ')
|
|
77
|
+
classifier, behavior, precedence = policy[1],policy[3],policy[5]
|
|
78
|
+
tab['policy'].merge!({ classifier => (precedence ? [behavior,precedence] : [behavior]) }) # tree
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
tp[name] = tab # last tb
|
|
82
|
+
tp.delete(nil)
|
|
83
|
+
end if conflist['traffic']
|
|
84
|
+
return tp
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
```
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
|
|
2
|
+
# VNE9000 流策略、路由策略
|
|
3
|
+
|
|
4
|
+
```ruby
|
|
5
|
+
@sign << ['VNE9000', 'traffic']
|
|
6
|
+
@sign << ['VNE9000', 'traffic_classifier']
|
|
7
|
+
@sign << ['VNE9000', 'traffic_behavior']
|
|
8
|
+
@sign << ['VNE9000', 'traffic_policy']
|
|
9
|
+
|
|
10
|
+
module VNE9000
|
|
11
|
+
module_function
|
|
12
|
+
|
|
13
|
+
def traffic conflist
|
|
14
|
+
tc,tb,tp = ['traffic_classifier','traffic_behavior','traffic_policy'].map{|t|self.send(t,conflist)}
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# {name => {classifier => [matchers], operator => opt}, ...}
|
|
18
|
+
def traffic_classifier conflist
|
|
19
|
+
tc = {}
|
|
20
|
+
conflist['traffic'].each do|traffic|
|
|
21
|
+
next unless traffic.include?('classifier')
|
|
22
|
+
name,tab = nil,{'operator'=>''}
|
|
23
|
+
traffic.split("\n").each do|line|
|
|
24
|
+
if line.include?('traffic classifier ')
|
|
25
|
+
tc[name] = tab
|
|
26
|
+
name, opt, op = line.split(' ')[2..4]
|
|
27
|
+
tab = {'operator'=>op}
|
|
28
|
+
else
|
|
29
|
+
matcher = line.split(' ')
|
|
30
|
+
tab['classifier'] ||= []
|
|
31
|
+
tab['classifier'] << matcher # sequences
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
tc[name] = tab # last tc
|
|
35
|
+
tc.delete(nil)
|
|
36
|
+
end if conflist['traffic']
|
|
37
|
+
return tc
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# {name => [behaviors], ...}
|
|
41
|
+
def traffic_behavior conflist
|
|
42
|
+
tb = {}
|
|
43
|
+
conflist['traffic'].each do|traffic|
|
|
44
|
+
next unless traffic.include?('behavior')
|
|
45
|
+
name,tab = nil,{'behavior'=>[]}
|
|
46
|
+
traffic.split("\n").each do|line|
|
|
47
|
+
if line.include?('traffic behavior ')
|
|
48
|
+
tb[name] = tab
|
|
49
|
+
name,tab = line.split(' ')[2],{'behavior'=>[]}
|
|
50
|
+
else
|
|
51
|
+
behavior = line.split(' ')
|
|
52
|
+
tab['behavior'] << behavior # sequences
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
tb[name] = tab # last tb
|
|
56
|
+
tb.delete(nil)
|
|
57
|
+
end if conflist['traffic']
|
|
58
|
+
return tb
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# {name => {policy => {classifier => [behavior,precedence], ...}, mode => mode}, ...}
|
|
62
|
+
def traffic_policy conflist
|
|
63
|
+
tp = {}
|
|
64
|
+
conflist['traffic'].each do|traffic|
|
|
65
|
+
next unless traffic.include?('policy')
|
|
66
|
+
name,tab = nil,{'policy'=>{}}
|
|
67
|
+
traffic.split("\n").each do|line|
|
|
68
|
+
if line.include?('traffic policy ')
|
|
69
|
+
tp[name] = tab
|
|
70
|
+
name,tab = line.split(' ')[2],{'policy'=>{}}
|
|
71
|
+
elsif line.include?('-mode')
|
|
72
|
+
tab['mode'] = 'share-mode'
|
|
73
|
+
elsif line.include?('statistics ')
|
|
74
|
+
tab['statistics'] = line.split(' ')[1]
|
|
75
|
+
else
|
|
76
|
+
policy = line.split(' ')
|
|
77
|
+
classifier, behavior, precedence = policy[1],policy[3],policy[5]
|
|
78
|
+
tab['policy'].merge!({ classifier => (precedence ? [behavior,precedence] : [behavior]) }) # tree
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
tp[name] = tab # last tb
|
|
82
|
+
tp.delete(nil)
|
|
83
|
+
end if conflist['traffic']
|
|
84
|
+
return tp
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
```
|
|
@@ -13,6 +13,7 @@ module CR16010H_F
|
|
|
13
13
|
(配置散列[tag] || []).each do|part|
|
|
14
14
|
if part.include?('route-static ')
|
|
15
15
|
part.split("\n").each do|line|
|
|
16
|
+
next unless line.include?('route-static ')
|
|
16
17
|
items = line.split(" ")
|
|
17
18
|
record = items[2].include?('vpn-') ? ["static:#{items[3]}"]+items[4..-1].to_a : ["static"]+items[2..-1].to_a
|
|
18
19
|
static_routes << record
|
|
@@ -13,6 +13,7 @@ module CR16018_F
|
|
|
13
13
|
(配置散列[tag] || []).each do|part|
|
|
14
14
|
if part.include?('route-static ')
|
|
15
15
|
part.split("\n").each do|line|
|
|
16
|
+
next unless line.include?('route-static ')
|
|
16
17
|
items = line.split(" ")
|
|
17
18
|
record = items[2].include?('vpn-') ? ["static:#{items[3]}"]+items[4..-1].to_a : ["static"]+items[2..-1].to_a
|
|
18
19
|
static_routes << record
|
|
@@ -13,6 +13,7 @@ module CR19000_20
|
|
|
13
13
|
(配置散列[tag] || []).each do|part|
|
|
14
14
|
if part.include?('route-static ')
|
|
15
15
|
part.split("\n").each do|line|
|
|
16
|
+
next unless line.include?('route-static ')
|
|
16
17
|
items = line.split(" ")
|
|
17
18
|
record = items[2].include?('vpn-') ? ["static:#{items[3]}"]+items[4..-1].to_a : ["static"]+items[2..-1].to_a
|
|
18
19
|
static_routes << record
|
|
@@ -11,8 +11,9 @@ module CX600_X16A
|
|
|
11
11
|
static_routes = []
|
|
12
12
|
['ip','ipv6'].each do|tag|
|
|
13
13
|
(配置散列[tag] || []).each do|part|
|
|
14
|
-
if part.include?('route-static')
|
|
14
|
+
if part.include?('route-static ')
|
|
15
15
|
part.split("\n").each do|line|
|
|
16
|
+
next unless line.include?('route-static ')
|
|
16
17
|
items = line.split(" ")
|
|
17
18
|
record = items[2].include?('vpn-') ? ["static:#{items[3]}"]+items[4..-1].to_a : ["static"]+items[2..-1].to_a
|
|
18
19
|
static_routes << record
|
|
@@ -11,8 +11,9 @@ module CX600_X8A
|
|
|
11
11
|
static_routes = []
|
|
12
12
|
['ip','ipv6'].each do|tag|
|
|
13
13
|
(配置散列[tag] || []).each do|part|
|
|
14
|
-
if part.include?('route-static')
|
|
14
|
+
if part.include?('route-static ')
|
|
15
15
|
part.split("\n").each do|line|
|
|
16
|
+
next unless line.include?('route-static ')
|
|
16
17
|
items = line.split(" ")
|
|
17
18
|
record = items[2].include?('vpn-') ? ["static:#{items[3]}"]+items[4..-1].to_a : ["static"]+items[2..-1].to_a
|
|
18
19
|
static_routes << record
|
|
@@ -11,8 +11,9 @@ module MA5200G_8
|
|
|
11
11
|
static_routes = []
|
|
12
12
|
['ip','ipv6'].each do|tag|
|
|
13
13
|
(配置散列[tag] || []).map{|part|part.split("\n")}.flatten.each do|part|
|
|
14
|
-
if part.include?('route-static')
|
|
14
|
+
if part.include?('route-static ')
|
|
15
15
|
part.split("\n").each do|line|
|
|
16
|
+
next unless line.include?('route-static ')
|
|
16
17
|
items = line.split(" ")
|
|
17
18
|
record = items[2].include?('vpn-') ? ["static:#{items[3]}"]+items[4..-1].to_a : ["static"]+items[2..-1].to_a
|
|
18
19
|
static_routes << record
|
data/document/static-ME60-16.md
CHANGED
|
@@ -11,8 +11,9 @@ module ME60_16
|
|
|
11
11
|
static_routes = []
|
|
12
12
|
['ip','ipv6'].each do|tag|
|
|
13
13
|
(配置散列[tag] || []).each do|part|
|
|
14
|
-
if part.include?('route-static')
|
|
14
|
+
if part.include?('route-static ')
|
|
15
15
|
part.split("\n").each do|line|
|
|
16
|
+
next unless line.include?('route-static ')
|
|
16
17
|
items = line.split(" ")
|
|
17
18
|
record = items[2].include?('vpn-') ? ["static:#{items[3]}"]+items[4..-1].to_a : ["static"]+items[2..-1].to_a
|
|
18
19
|
static_routes << record
|
data/document/static-ME60-X16.md
CHANGED
|
@@ -11,8 +11,9 @@ module ME60_X16
|
|
|
11
11
|
static_routes = []
|
|
12
12
|
['ip','ipv6'].each do|tag|
|
|
13
13
|
(配置散列[tag] || []).each do|part|
|
|
14
|
-
if part.include?('route-static')
|
|
14
|
+
if part.include?('route-static ')
|
|
15
15
|
part.split("\n").each do|line|
|
|
16
|
+
next unless line.include?('route-static ')
|
|
16
17
|
items = line.split(" ")
|
|
17
18
|
record = items[2].include?('vpn-') ? ["static:#{items[3]}"]+items[4..-1].to_a : ["static"]+items[2..-1].to_a
|
|
18
19
|
static_routes << record
|
|
@@ -13,6 +13,7 @@ module NE40E_X16
|
|
|
13
13
|
(配置散列[tag] || []).each do|part|
|
|
14
14
|
if part.include?('route-static')
|
|
15
15
|
part.split("\n").each do|line|
|
|
16
|
+
next unless line.include?('route-static ')
|
|
16
17
|
items = line.split(" ")
|
|
17
18
|
record = items[2].include?('vpn-') ? ["static:#{items[3]}"]+items[4..-1].to_a : ["static"]+items[2..-1].to_a
|
|
18
19
|
static_routes << record
|
|
@@ -13,6 +13,7 @@ module NE40E_X16A
|
|
|
13
13
|
(配置散列[tag] || []).each do|part|
|
|
14
14
|
if part.include?('route-static')
|
|
15
15
|
part.split("\n").each do|line|
|
|
16
|
+
next unless line.include?('route-static ')
|
|
16
17
|
items = line.split(" ")
|
|
17
18
|
record = items[2].include?('vpn-') ? ["static:#{items[3]}"]+items[4..-1].to_a : ["static"]+items[2..-1].to_a
|
|
18
19
|
static_routes << record
|
data/document/static-NE40E-X8.md
CHANGED
|
@@ -11,8 +11,9 @@ module NE40E_X8
|
|
|
11
11
|
static_routes = []
|
|
12
12
|
['ip','ipv6'].each do|tag|
|
|
13
13
|
(配置散列[tag] || []).each do|part|
|
|
14
|
-
if part.include?('route-static')
|
|
14
|
+
if part.include?('route-static ')
|
|
15
15
|
part.split("\n").each do|line|
|
|
16
|
+
next unless line.include?('route-static ')
|
|
16
17
|
items = line.split(" ")
|
|
17
18
|
record = items[2].include?('vpn-') ? ["static:#{items[3]}"]+items[4..-1].to_a : ["static"]+items[2..-1].to_a
|
|
18
19
|
static_routes << record
|
data/document/static-NE40E.md
CHANGED
|
@@ -13,6 +13,7 @@ module NE40E
|
|
|
13
13
|
(配置散列[tag] || []).each do|part|
|
|
14
14
|
if part.include?('route-static')
|
|
15
15
|
part.split("\n").each do|line|
|
|
16
|
+
next unless line.include?('route-static ')
|
|
16
17
|
items = line.split(" ")
|
|
17
18
|
record = items[2].include?('vpn-') ? ["static:#{items[3]}"]+items[4..-1].to_a : ["static"]+items[2..-1].to_a
|
|
18
19
|
static_routes << record
|
|
@@ -13,7 +13,7 @@ module NE5000E_20
|
|
|
13
13
|
(配置散列[tag] || []).each do|part|
|
|
14
14
|
if part.include?('route-static')
|
|
15
15
|
part.split("\n").each do|line|
|
|
16
|
-
next unless line.include?('route-static')
|
|
16
|
+
next unless line.include?('route-static ')
|
|
17
17
|
items = line.split(" ")
|
|
18
18
|
record = items[2].include?('vpn-') ? ["static:#{items[3]}"]+items[4..-1].to_a : ["static"]+items[2..-1].to_a
|
|
19
19
|
static_routes << record
|
|
@@ -13,7 +13,7 @@ module NE5000E_X16
|
|
|
13
13
|
(配置散列[tag] || []).each do|part|
|
|
14
14
|
if part.include?('route-static')
|
|
15
15
|
part.split("\n").each do|line|
|
|
16
|
-
next unless line.include?('route-static')
|
|
16
|
+
next unless line.include?('route-static ')
|
|
17
17
|
items = line.split(" ")
|
|
18
18
|
record = items[2].include?('vpn-') ? ["static:#{items[3]}"]+items[4..-1].to_a : ["static"]+items[2..-1].to_a
|
|
19
19
|
static_routes << record
|
|
@@ -13,7 +13,7 @@ module NE5000E_X16A
|
|
|
13
13
|
(配置散列[tag] || []).each do|part|
|
|
14
14
|
if part.include?('route-static')
|
|
15
15
|
part.split("\n").each do|line|
|
|
16
|
-
next unless line.include?('route-static')
|
|
16
|
+
next unless line.include?('route-static ')
|
|
17
17
|
items = line.split(" ")
|
|
18
18
|
record = items[2].include?('vpn-') ? ["static:#{items[3]}"]+items[4..-1].to_a : ["static"]+items[2..-1].to_a
|
|
19
19
|
static_routes << record
|
|
@@ -13,7 +13,7 @@ module NE8000E_X8
|
|
|
13
13
|
(配置散列[tag] || []).each do|part|
|
|
14
14
|
if part.include?('route-static')
|
|
15
15
|
part.split("\n").each do|line|
|
|
16
|
-
next unless line.include?('route-static')
|
|
16
|
+
next unless line.include?('route-static ')
|
|
17
17
|
items = line.split(" ")
|
|
18
18
|
record = items[2].include?('vpn-') ? ["static:#{items[3]}"]+items[4..-1].to_a : ["static"]+items[2..-1].to_a
|
|
19
19
|
static_routes << record
|
data/document/static-NE80E.md
CHANGED
|
@@ -13,6 +13,7 @@ module NE80E
|
|
|
13
13
|
(配置散列[tag] || []).each do|part|
|
|
14
14
|
if part.include?('route-static')
|
|
15
15
|
part.split("\n").each do|line|
|
|
16
|
+
next unless line.include?('route-static ')
|
|
16
17
|
items = line.split(" ")
|
|
17
18
|
record = items[2].include?('vpn-') ? ["static:#{items[3]}"]+items[4..-1].to_a : ["static"]+items[2..-1].to_a
|
|
18
19
|
static_routes << record
|
|
@@ -13,7 +13,7 @@ module NE8100_X8
|
|
|
13
13
|
(配置散列[tag] || []).each do|part|
|
|
14
14
|
if part.include?('route-static')
|
|
15
15
|
part.split("\n").each do|line|
|
|
16
|
-
next unless line.include?('route-static')
|
|
16
|
+
next unless line.include?('route-static ')
|
|
17
17
|
items = line.split(" ")
|
|
18
18
|
record = items[2].include?('vpn-') ? ["static:#{items[3]}"]+items[4..-1].to_a : ["static"]+items[2..-1].to_a
|
|
19
19
|
static_routes << record
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
|
|
2
|
+
# M6000-16E 流量、光功率、用户数统计
|
|
3
|
+
|
|
4
|
+
```ruby
|
|
5
|
+
@sign << ['M6000-16E', 'flux_statistic']
|
|
6
|
+
@sign << ['M6000-16E', 'optical_statistic']
|
|
7
|
+
@sign << ['M6000-16E', 'subscriber_statistic']
|
|
8
|
+
|
|
9
|
+
module M6000_16E
|
|
10
|
+
module_function
|
|
11
|
+
|
|
12
|
+
def flux_statistic content
|
|
13
|
+
context,flag = [], false
|
|
14
|
+
head = ['interface', 'in_flux(bps)', # Bps => bps
|
|
15
|
+
'in_percent(bps)','out_flux', # Bps => bps
|
|
16
|
+
'out_percent','in_error','in_optical','out_optical']
|
|
17
|
+
content.split("\n").each do|line|
|
|
18
|
+
(flag = true;next) if line.include?('#### begin flux ####')
|
|
19
|
+
break if line.include?('#### end flux ####')
|
|
20
|
+
if flag
|
|
21
|
+
words = line.strip.split(' ')
|
|
22
|
+
next if words.size < 8
|
|
23
|
+
context << [words[0], words[1].to_i*8, words[2]+'%', words[3].to_i*8, words[4]+'%', words[5].to_i, words[6].to_f, words[7].to_f]
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
context.sort_by!{|c|c[0]}
|
|
27
|
+
context.unshift head
|
|
28
|
+
return context
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def optical_statistic content_or_table
|
|
32
|
+
content = content_or_table.is_a?(Array) ? content_or_table : (self.flux_statistic content_or_table)
|
|
33
|
+
# head: ['interface', 'in_optical', 'out_optical']
|
|
34
|
+
return content.map{|c|[c[0],c[-2],c[-1]]}
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def subscriber_statistic content
|
|
38
|
+
context,flag = [], false
|
|
39
|
+
head = ['domain','state','limit','num','num(v4)','num(v6)','num(dual)']
|
|
40
|
+
content.split("\n").each do|line|
|
|
41
|
+
(flag = true;next) if line.include?('#### begin subscriber ####')
|
|
42
|
+
break if line.include?('#### end subscriber ####')
|
|
43
|
+
if flag
|
|
44
|
+
words = line.strip.split(' ')
|
|
45
|
+
next if words.size != 4 || words.include?('subscriber')
|
|
46
|
+
num, sub = words[-1].split('(')
|
|
47
|
+
num4, num6, numd = sub.split(')').first.split('/')
|
|
48
|
+
context << words[0..1]+ [words[2].to_i, num.to_i, num4.to_i, num6.to_i, numd.to_i]
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
context.sort_by!{|c|c[0]}
|
|
52
|
+
context.unshift head
|
|
53
|
+
return context
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
```
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
|
|
2
|
+
# M6000-18S 流量、光功率、用户数统计
|
|
3
|
+
|
|
4
|
+
```ruby
|
|
5
|
+
@sign << ['M6000-18S', 'flux_statistic']
|
|
6
|
+
@sign << ['M6000-18S', 'optical_statistic']
|
|
7
|
+
@sign << ['M6000-18S', 'subscriber_statistic']
|
|
8
|
+
|
|
9
|
+
module M6000_18S
|
|
10
|
+
module_function
|
|
11
|
+
|
|
12
|
+
def flux_statistic content
|
|
13
|
+
context,flag,record = [], false, []
|
|
14
|
+
content.split("\n").each do|line|
|
|
15
|
+
(flag = true;next) if line.include?('#### begin flux ####')
|
|
16
|
+
next if line.include?('show intf-statistics utilization')
|
|
17
|
+
next if line.strip.empty?
|
|
18
|
+
break if line.include?('#### end flux ####')
|
|
19
|
+
if flag
|
|
20
|
+
words = line.strip.split(' ')
|
|
21
|
+
if words.size==4
|
|
22
|
+
if record.size==4 # no desc, add an new record
|
|
23
|
+
context << record+['']
|
|
24
|
+
record = [words[0], words[1]+"%", words[2]+"%", words[3].to_i]
|
|
25
|
+
else # normal
|
|
26
|
+
record += [words[0], words[1]+"%", words[2]+"%", words[3].to_i]
|
|
27
|
+
end
|
|
28
|
+
elsif words.size < 4 # desc, attach to current record
|
|
29
|
+
record += words if record.size==4
|
|
30
|
+
context << record
|
|
31
|
+
record = []
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
context = context[1..-1].select{|c|!c.empty?}
|
|
36
|
+
context.sort_by!{|c|c[0]}
|
|
37
|
+
context.unshift head=['interface','in_percent', 'out_percent', 'in_error', 'description']
|
|
38
|
+
return context
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def optical_statistic content
|
|
42
|
+
context,flag = [], false
|
|
43
|
+
if_name, mod_type, wav_len, in_dbm, in_range, out_dbm, out_range, state = '','','',[],[],[],[],[]
|
|
44
|
+
content.split("\n").each do|line|
|
|
45
|
+
(flag = true;next) if line.include?('#### begin optical ####')
|
|
46
|
+
next if line.include?('show opticalinfo brief')
|
|
47
|
+
next if line.strip.empty?
|
|
48
|
+
break if line.include?('#### end optical ####')
|
|
49
|
+
if flag
|
|
50
|
+
words = line.strip.split(' ')
|
|
51
|
+
next if words[0].include?('Interface') || words[0].include?('TxPower')
|
|
52
|
+
if words.size==4 # if_name, mod_type, wav_len, in_dbm
|
|
53
|
+
if_name, mod_type, wav_len = words[0..2]
|
|
54
|
+
in_optical,others = words[3].split('/[')
|
|
55
|
+
in_ranges = others.gsub(']','').split(',').map{|r|r.to_f} if others
|
|
56
|
+
in_dbm << (in_optical=='N/A' ? 'N/A' : in_optical.to_f)
|
|
57
|
+
in_range << in_ranges if others
|
|
58
|
+
elsif words.size==6 # if_name, mod_type, wav_len, in_dbm, out_dbm, state
|
|
59
|
+
if_name, mod_type, wav_len = words[0..2]
|
|
60
|
+
in_optical,others = words[3].split('/[')
|
|
61
|
+
in_ranges = others.gsub(']','').split(',').map{|r|r.to_f} if others
|
|
62
|
+
in_dbm << (in_optical=='N/A' ? 'N/A' : in_optical.to_f)
|
|
63
|
+
in_range << in_ranges if others
|
|
64
|
+
out_optical, others = words[4].split('/[')
|
|
65
|
+
out_ranges = others.gsub(']','').split(',').map{|r|r.to_f} if others
|
|
66
|
+
out_dbm << (out_optical=='N/A' ? 'N/A' : out_optical.to_f)
|
|
67
|
+
out_range << out_ranges if others
|
|
68
|
+
state << words[5]
|
|
69
|
+
elsif words.size==3 # in_dbm, out_dbm, state
|
|
70
|
+
in_optical,others = words[0].split('/[')
|
|
71
|
+
in_ranges = others.gsub(']','').split(',').map{|r|r.to_f} if others
|
|
72
|
+
in_dbm << (in_optical=='N/A' ? 'N/A' : in_optical.to_f)
|
|
73
|
+
in_range << in_ranges if others
|
|
74
|
+
out_optical, others = words[1].split('/[')
|
|
75
|
+
out_ranges = others.gsub(']','').split(',').map{|r|r.to_f} if others
|
|
76
|
+
out_dbm << (out_optical=='N/A' ? 'N/A' : out_optical.to_f)
|
|
77
|
+
out_range << out_ranges if others
|
|
78
|
+
state << words[2]
|
|
79
|
+
elsif words.size==2
|
|
80
|
+
if words.include?('offline') # if_name, mod_type='offline'
|
|
81
|
+
context << words+['',[],[],[],[],[]]
|
|
82
|
+
if_name, mod_type, wav_len, in_dbm, in_range, out_dbm, out_range, state = '','','',[],[],[],[],[]
|
|
83
|
+
next
|
|
84
|
+
end
|
|
85
|
+
if words[1].match(/(\d|\.)+/) # in_dbm, out_dbm
|
|
86
|
+
in_optical,others = words[0].split('/[')
|
|
87
|
+
in_ranges = others.gsub(']','').split(',').map{|r|r.to_f} if others
|
|
88
|
+
in_dbm << (in_optical=='N/A' ? 'N/A' : in_optical.to_f)
|
|
89
|
+
in_range << in_ranges if others
|
|
90
|
+
out_optical, others = words[1].split('/[')
|
|
91
|
+
out_ranges = others.gsub(']','').split(',').map{|r|r.to_f} if others
|
|
92
|
+
out_dbm << (out_optical=='N/A' ? 'N/A' : out_optical.to_f)
|
|
93
|
+
out_range << out_ranges if others
|
|
94
|
+
else # out_dbm, state
|
|
95
|
+
out_optical, others = words[0].split('/[')
|
|
96
|
+
out_ranges = others.gsub(']','').split(',').map{|r|r.to_f} if others
|
|
97
|
+
out_dbm << (out_optical=='N/A' ? 'N/A' : out_optical.to_f)
|
|
98
|
+
out_range << out_ranges if others
|
|
99
|
+
state << words[1]
|
|
100
|
+
end
|
|
101
|
+
elsif words.size==1 # in_dbm/out_dbm
|
|
102
|
+
optical, others = words[0].split('/[')
|
|
103
|
+
ranges = others.gsub(']','').split(',').map{|r|r.to_f} if others
|
|
104
|
+
in_dbm << (optical=='N/A' ? 'N/A' : optical.to_f) if in_dbm.size<=out_dbm.size
|
|
105
|
+
out_dbm << (optical=='N/A' ? 'N/A' : optical.to_f) if in_dbm.size>out_dbm.size
|
|
106
|
+
in_range << ranges if others && in_range.size<=out_range.size
|
|
107
|
+
out_range << ranges if others && in_range.size>out_range.size
|
|
108
|
+
end
|
|
109
|
+
if ( !if_name.empty? && !mod_type.empty? && !wav_len.empty? && !in_dbm.empty? && !out_dbm.empty? && !state.empty? )
|
|
110
|
+
if if_name.include?('cgei')
|
|
111
|
+
if in_dbm.size > 4 && out_dbm.size > 4
|
|
112
|
+
context << [if_name, mod_type, wav_len, in_dbm, in_range, out_dbm, out_range, state]
|
|
113
|
+
if_name, mod_type, wav_len, in_dbm, in_range, out_dbm, out_range, state = '','','',[],[],[],[],[]
|
|
114
|
+
end
|
|
115
|
+
else
|
|
116
|
+
context << [if_name, mod_type, wav_len, in_dbm, in_range, out_dbm, out_range, state]
|
|
117
|
+
if_name, mod_type, wav_len, in_dbm, in_range, out_dbm, out_range, state = '','','',[],[],[],[],[]
|
|
118
|
+
end
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
context.sort_by!{|c|c[0]}
|
|
124
|
+
context.unshift head=['interface','module_type', 'wave_length', 'in_optical','in_range','out_optical','out_range','state']
|
|
125
|
+
return context
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
def subscriber_statistic content
|
|
129
|
+
context,flag = [], false
|
|
130
|
+
head = ['domain','state','limit','num','num(v4)','num(v6)','num(dual)']
|
|
131
|
+
content.split("\n").each do|line|
|
|
132
|
+
(flag = true;next) if line.include?('#### begin subscriber ####')
|
|
133
|
+
break if line.include?('#### end subscriber ####')
|
|
134
|
+
if flag
|
|
135
|
+
words = line.strip.split(' ')
|
|
136
|
+
next if words.size != 4 || words.include?('subscriber')
|
|
137
|
+
num, sub = words[-1].split('(')
|
|
138
|
+
num4, num6, numd = sub.split(')').first.split('/')
|
|
139
|
+
context << words[0..1]+ [words[2].to_i, num.to_i, num4.to_i, num6.to_i, numd.to_i]
|
|
140
|
+
end
|
|
141
|
+
end
|
|
142
|
+
context.sort_by!{|c|c[0]}
|
|
143
|
+
context.unshift head
|
|
144
|
+
return context
|
|
145
|
+
end
|
|
146
|
+
end
|
|
147
|
+
```
|