network-utility 1.1.54 → 1.1.61
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/bgp-CR16010H-F.md +112 -1
- data/document/bgp-CR16018-F.md +112 -2
- data/document/bgp-CR19000-20.md +112 -2
- data/document/bgp-CRS-16.md +178 -2
- data/document/bgp-M6000-16E.md +112 -2
- data/document/bgp-M6000-18S.md +112 -2
- data/document/bgp-M6000-8.md +112 -2
- data/document/bgp-M6000-8E.md +112 -2
- data/document/bgp-ME60-16.md +112 -2
- data/document/bgp-ME60-X16.md +112 -2
- data/document/bgp-NE40E-X16.md +112 -2
- data/document/bgp-NE40E-X16A.md +112 -2
- data/document/bgp-NE40E-X8.md +112 -2
- data/document/bgp-NE5000E-20.md +112 -2
- data/document/bgp-NE5000E-X16.md +112 -2
- data/document/bgp-NE5000E-X16A.md +112 -2
- data/document/bgp-T8000-18.md +112 -1
- data/document/config.md +31 -27
- data/document/if-ALCATEL7750.md +24 -0
- data/document/if-CRS-16.md +28 -0
- data/document/if-NE40E-X16.md +11 -11
- data/document/if-Nokia7750.md +24 -0
- data/document/isis-ALCATEL7750.md +73 -0
- data/document/isis-CR16010H-F.md +66 -0
- data/document/isis-CR16018-F.md +66 -0
- data/document/isis-CR19000-20.md +66 -0
- data/document/isis-CRS-16.md +110 -0
- data/document/isis-CX600-X16A.md +1 -0
- data/document/isis-CX600-X8A.md +1 -0
- data/document/isis-M6000-16E.md +99 -0
- data/document/isis-M6000-18S.md +99 -0
- data/document/isis-M6000-8E.md +99 -0
- data/document/isis-NE40E-X16.md +141 -0
- data/document/isis-NE40E-X16A.md +1 -0
- data/document/isis-NE5000E-20.md +1 -0
- data/document/isis-NE5000E-X16.md +1 -0
- data/document/isis-NE5000E-X16A.md +1 -0
- data/document/isis-NE8000E-X8.md +1 -0
- data/document/isis-NE8100-X8.md +1 -0
- data/document/isis-Nokia7750.md +75 -0
- data/document/isis-T8000-18.md +99 -0
- data/network.rb +2 -1
- data/utility/asnum.rb +62 -0
- metadata +13 -1
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
# NE40E-X16 接口
|
|
2
|
+
|
|
3
|
+
```ruby
|
|
4
|
+
@sign << ['NE40E-X16', '接口isis']
|
|
5
|
+
@sign << ['NE40E-X16', 'isis']
|
|
6
|
+
|
|
7
|
+
module NE40E_X16
|
|
8
|
+
module_function
|
|
9
|
+
|
|
10
|
+
def 接口isis 接口配置
|
|
11
|
+
isis = {}
|
|
12
|
+
port_name = self.端口识别(接口配置.split("\n").first.to_s).join()
|
|
13
|
+
lines = 接口配置.split("\n").select{|line|line.strip[0..4]=='isis '}
|
|
14
|
+
lines.each do|line|
|
|
15
|
+
isis['authentication-mode'] = line.strip.split('mode ').last if line.include?('authentication-mode')
|
|
16
|
+
isis['pid'] = line.strip.split(' ').last.to_i if line.include?('isis enable')
|
|
17
|
+
isis['ipv6-pid'] = line.strip.split(' ').last.to_i if line.include?('isis ipv6 enable')
|
|
18
|
+
isis['circuit-type'] = line.split('circuit-type').last.strip if line.include?('isis circuit-type')
|
|
19
|
+
isis['cost'] = line.strip.split(' ').last.to_i if line.include?('isis cost')
|
|
20
|
+
isis['ipv6-cost'] = line.strip.split(' ').last.to_i if line.include?('isis ipv6 cost')
|
|
21
|
+
if line.include?('isis ldp-sync')
|
|
22
|
+
isis['ldp-sync'] ||= {}
|
|
23
|
+
isis['ldp-sync']['state'] = 'enable'
|
|
24
|
+
isis['ldp-sync']['hold-max-cost-timer'] = line.strip.split(' ').last+'s' if line.include?('isis timer ldp-sync')
|
|
25
|
+
end
|
|
26
|
+
isis['hold-max-cost-timer'] = line.strip.split(' ').last+'ms' if line.include?('isis peer hold-max-cost')
|
|
27
|
+
end
|
|
28
|
+
return { port_name => isis }
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def isis isis配置
|
|
32
|
+
isis = {};frr4_flag, frr6_flag = false, false
|
|
33
|
+
isis配置.split("\n").each do|line|
|
|
34
|
+
isis['pid'] = line.split(' ').last.strip if line[0..4]=='isis '
|
|
35
|
+
isis['level'] = line.split(' ').last.strip if line.include?('is-level')
|
|
36
|
+
isis['cost-style'] = line.split(' ').last.strip if line.include?('cost-style')
|
|
37
|
+
if line.include?('timer lsp-generation')
|
|
38
|
+
isis['lsp-generation-timer'] ||= {}
|
|
39
|
+
setter = line.split('lsp-generation').last.strip.split(' ')
|
|
40
|
+
setlevels = []
|
|
41
|
+
setlevels = ['level-1'] if setter[-1]=='level-1'
|
|
42
|
+
setlevels = ['level-2'] if setter[-1]=='level-2'
|
|
43
|
+
setlevels = ['level-1', 'level-2']
|
|
44
|
+
setlevels.each do|setlevel|
|
|
45
|
+
isis['lsp-generation-timer']['max-interval'] = setter[0]+'s'
|
|
46
|
+
isis['lsp-generation-timer']['init-interval'] = setter[1]+'ms' if setter[1] && !setter[1].include?('level')
|
|
47
|
+
isis['lsp-generation-timer']['incr-interval'] = setter[2]+'ms' if setter[2] && !setter[2].include?('level')
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
if line.include?('bfd all-interfaces') && line.strip[0..2]=='bfd'
|
|
51
|
+
isis['bfd'] ||= {}
|
|
52
|
+
isis['bfd']['interface'] = 'enable' if line.include?('enable')
|
|
53
|
+
words = line.split(' ')
|
|
54
|
+
isis['bfd']['min-tx-interval'] = words[words.index('min-tx-interval')+1] + 'ms' if words.index('min-tx-interval')
|
|
55
|
+
isis['bfd']['min-rx-interval'] = words[words.index('min-rx-interval')+1] + 'ms' if words.index('min-rx-interval')
|
|
56
|
+
isis['bfd']['detect-multiplier'] = words[words.index('detect-multiplier')+1].to_i if words.index('detect-multiplier')
|
|
57
|
+
isis['bfd']['tos-exp'] = words[words.index('tos-exp')+1].to_i if words.index('tos-exp')
|
|
58
|
+
isis['bfd']['frr-binding'] = 'enable' if line.include?('frr-binding')
|
|
59
|
+
end
|
|
60
|
+
if line.include?('ipv6 bfd all-interfaces')
|
|
61
|
+
isis['ipv6-bfd'] ||= {}
|
|
62
|
+
isis['ipv6-bfd']['interface'] = 'enable' if line.include?('enable')
|
|
63
|
+
words = line.split(' ')
|
|
64
|
+
isis['ipv6-bfd']['min-tx-interval'] = words[words.index('min-tx-interval')+1] + 'ms' if words.index('min-tx-interval')
|
|
65
|
+
isis['ipv6-bfd']['min-rx-interval'] = words[words.index('min-rx-interval')+1] + 'ms' if words.index('min-rx-interval')
|
|
66
|
+
isis['ipv6-bfd']['detect-multiplier'] = words[words.index('detect-multiplier')+1].to_i if words.index('detect-multiplier')
|
|
67
|
+
isis['ipv6-bfd']['frr-binding'] = 'enable' if line.include?('frr-binding')
|
|
68
|
+
end
|
|
69
|
+
isis['net'] = line.split(' ').last if line.include?('network-entity')
|
|
70
|
+
isis['is-name'] = line.split(' ').last if line.include?('is-name')
|
|
71
|
+
if line.include?('avoid-microloop') && line.strip[0..4]=='avoid'
|
|
72
|
+
isis['avoid-microloop'] ||= {}
|
|
73
|
+
isis['avoid-microloop']['frr-protected'] ||= {'rib-update-delay'=>'100ms'} if line.include?('frr-protected')
|
|
74
|
+
isis['avoid-microloop']['frr-protected']['rib-update-delay'] = line.split(' ').last+'ms' if line.include?('frr-protected') && line.include?('rib-update-delay')
|
|
75
|
+
isis['avoid-microloop']['te-tunnel'] ||= {'rib-update-delay'=>'1000ms'} if line.include?('te-tunnel')
|
|
76
|
+
isis['avoid-microloop']['te-tunnel']['rib-update-delay'] = line.split(' ').last+'ms' if line.include?('te-tunnel') && line.include?('rib-update-delay')
|
|
77
|
+
end
|
|
78
|
+
if line.include?('ipv6 avoid-microloop')
|
|
79
|
+
isis['ipv6-avoid-microloop'] ||= {}
|
|
80
|
+
isis['ipv6-avoid-microloop']['segment-routing'] ||= {'rib-update-delay'=>'5000ms'} if line.include?('segment-routing')
|
|
81
|
+
isis['ipv6-avoid-microloop']['segment-routing']['rib-update-delay'] = line.split(' ').last+'ms' if line.include?('segment-routing') && line.include?('rib-update-delay')
|
|
82
|
+
end
|
|
83
|
+
isis['preference'] = line.split(' ').last.to_i if line.strip[0..10]=='preference '
|
|
84
|
+
isis['ipv6-preference'] = line.split(' ').last.to_i if line.include?('ipv6 preference ')
|
|
85
|
+
if line.include?('timer spf')
|
|
86
|
+
setter = line.split('timer spf').last.strip.split(' ')
|
|
87
|
+
isis['spf-timer'] ||= {}
|
|
88
|
+
isis['spf-timer']['max-interval'] = setter[0]+'s'
|
|
89
|
+
isis['spf-timer']['init-interval'] = setter[1]+'ms' if setter[1]
|
|
90
|
+
isis['spf-timer']['incr-interval'] = setter[2]+'ms' if setter[2]
|
|
91
|
+
end
|
|
92
|
+
if line.include?('set-overload')
|
|
93
|
+
isis['set-overload'] ||= {}
|
|
94
|
+
isis['set-overload']['allow'] = 'interlevel' if line.include?('allow interlevel')
|
|
95
|
+
isis['set-overload']['allow'] = 'external' if line.include?('allow external')
|
|
96
|
+
isis['set-overload']['on-startup'] ||= {} if line.include?('on-startup')
|
|
97
|
+
words = line.strip.split(' ')
|
|
98
|
+
if line.include?('on-startup') && words[words.index('on-startup')+1].to_s.match(/^\d+$/)
|
|
99
|
+
isis['set-overload']['on-startup']['timeout'] = words[words.index('on-startup')+1]+'s'
|
|
100
|
+
else
|
|
101
|
+
# isis['set-overload']['on-startup']['timeout'] = '600s'
|
|
102
|
+
if line.include?('send-sa-bit') && words[words.index('send-sa-bit')+1].match(/^\d+$/)
|
|
103
|
+
isis['set-overload']['on-startup']['send-sa-bit'] = words[words.index('send-sa-bit')+1]+'s'
|
|
104
|
+
else
|
|
105
|
+
# isis['set-overload']['on-startup']['send-sa-bit'] = '30s'
|
|
106
|
+
end
|
|
107
|
+
# TODO: start-from-nbr | wait-for-bgp | route-delay-distribute
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
(isis['frr'] = {}; frr4_flag = true) if line.strip=='frr'
|
|
111
|
+
isis['frr']['loop-free-alternate'] = line.split(' ').last if line.include?('loop-free-alternate ') && frr4_flag
|
|
112
|
+
isis['frr']['ti-lfa'] = line.split(' ').last if line.include?('ti-lfa ') && frr4_flag
|
|
113
|
+
(frr4_flag = false) if frr4_flag && line==' #'
|
|
114
|
+
(isis['ipv6-frr'] = {}; frr6_flag = true) if line.include?('ipv6 frr')
|
|
115
|
+
isis['ipv6-frr']['loop-free-alternate'] = line.split(' ').last if line.include?('loop-free-alternate ') && frr6_flag
|
|
116
|
+
isis['ipv6-frr']['ti-lfa'] = line.split(' ').last if line.include?('ti-lfa ') && frr6_flag
|
|
117
|
+
(frr6_flag = false) if frr6_flag && line==' #'
|
|
118
|
+
isis['topology'] = line.split('topology ').last.strip if line.include?('ipv6 enable topology ')
|
|
119
|
+
isis['ipv6-advertise'] = 'link-attributes' if line.include?('ipv6 advertise link attributes')
|
|
120
|
+
isis['ipv6-traffic-eng'] = line.split(' ').last if line.include?('ipv6 traffic-eng')
|
|
121
|
+
if line.include?('ipv6 metric-delay')
|
|
122
|
+
isis['ipv6-metric-delay'] ||= {}
|
|
123
|
+
isis['ipv6-metric-delay']['advertisement'] = line.split(' ').last if line.include?('advertisement enable')
|
|
124
|
+
if line.include?('suppress')
|
|
125
|
+
words = line.split(' ')
|
|
126
|
+
isis['ipv6-metric-delay']['suppress'] ||= {}
|
|
127
|
+
isis['ipv6-metric-delay']['suppress']['timer'] = words[words.index('timer')+1]+'s' if words.index('timer')
|
|
128
|
+
isis['ipv6-metric-delay']['suppress']['percent-threshold'] = words[words.index('percent-threshold')+1]+'%' if words.index('percent-threshold')
|
|
129
|
+
isis['ipv6-metric-delay']['suppress']['absolute-threshold'] = words[words.index('absolute-threshold')+1]+'ms' if words.index('absolute-threshold')
|
|
130
|
+
end
|
|
131
|
+
end
|
|
132
|
+
if line.include?('segment-routing ipv6 locator')
|
|
133
|
+
isis['srv6-locator'] ||= {}
|
|
134
|
+
isis['srv6-locator']['name'] = line.split('locator').last.strip.split(' ').first
|
|
135
|
+
isis['srv6-locator']['auto-sid-disable'] = true if line.split('locator').last.strip.split(' ')[1]
|
|
136
|
+
end
|
|
137
|
+
end
|
|
138
|
+
return isis
|
|
139
|
+
end
|
|
140
|
+
end
|
|
141
|
+
```
|
data/document/isis-NE40E-X16A.md
CHANGED
|
@@ -13,6 +13,7 @@ module NE40E_X16A
|
|
|
13
13
|
port_name = self.端口识别(接口配置.split("\n").first.to_s).join()
|
|
14
14
|
lines = 接口配置.split("\n").select{|line|line.strip[0..4]=='isis '}
|
|
15
15
|
lines.each do|line|
|
|
16
|
+
isis['authentication-mode'] = line.strip.split('mode ').last if line.include?('authentication-mode')
|
|
16
17
|
isis['pid'] = line.strip.split(' ').last.to_i if line.include?('isis enable')
|
|
17
18
|
isis['ipv6-pid'] = line.strip.split(' ').last.to_i if line.include?('isis ipv6 enable')
|
|
18
19
|
isis['circuit-type'] = line.split('circuit-type').last.strip if line.include?('isis circuit-type')
|
data/document/isis-NE5000E-20.md
CHANGED
|
@@ -13,6 +13,7 @@ module NE5000E_20
|
|
|
13
13
|
port_name = self.端口识别(接口配置.split("\n").first.to_s).join()
|
|
14
14
|
lines = 接口配置.split("\n").select{|line|line.strip[0..4]=='isis '}
|
|
15
15
|
lines.each do|line|
|
|
16
|
+
isis['authentication-mode'] = line.strip.split('mode ').last if line.include?('authentication-mode')
|
|
16
17
|
isis['pid'] = line.strip.split(' ').last.to_i if line.include?('isis enable')
|
|
17
18
|
isis['ipv6-pid'] = line.strip.split(' ').last.to_i if line.include?('isis ipv6 enable')
|
|
18
19
|
isis['circuit-type'] = line.split('circuit-type').last.strip if line.include?('isis circuit-type')
|
|
@@ -13,6 +13,7 @@ module NE5000E_X16
|
|
|
13
13
|
port_name = self.端口识别(接口配置.split("\n").first.to_s).join()
|
|
14
14
|
lines = 接口配置.split("\n").select{|line|line.strip[0..4]=='isis '}
|
|
15
15
|
lines.each do|line|
|
|
16
|
+
isis['authentication-mode'] = line.strip.split('mode ').last if line.include?('authentication-mode')
|
|
16
17
|
isis['pid'] = line.strip.split(' ').last.to_i if line.include?('isis enable')
|
|
17
18
|
isis['ipv6-pid'] = line.strip.split(' ').last.to_i if line.include?('isis ipv6 enable')
|
|
18
19
|
isis['circuit-type'] = line.split('circuit-type').last.strip if line.include?('isis circuit-type')
|
|
@@ -13,6 +13,7 @@ module NE5000E_X16A
|
|
|
13
13
|
port_name = self.端口识别(接口配置.split("\n").first.to_s).join()
|
|
14
14
|
lines = 接口配置.split("\n").select{|line|line.strip[0..4]=='isis '}
|
|
15
15
|
lines.each do|line|
|
|
16
|
+
isis['authentication-mode'] = line.strip.split('mode ').last if line.include?('authentication-mode')
|
|
16
17
|
isis['pid'] = line.strip.split(' ').last.to_i if line.include?('isis enable')
|
|
17
18
|
isis['ipv6-pid'] = line.strip.split(' ').last.to_i if line.include?('isis ipv6 enable')
|
|
18
19
|
isis['circuit-type'] = line.split('circuit-type').last.strip if line.include?('isis circuit-type')
|
data/document/isis-NE8000E-X8.md
CHANGED
|
@@ -12,6 +12,7 @@ module NE8000E_X8
|
|
|
12
12
|
port_name = self.端口识别(接口配置.split("\n").first.to_s).join()
|
|
13
13
|
lines = 接口配置.split("\n").select{|line|line.strip[0..4]=='isis '}
|
|
14
14
|
lines.each do|line|
|
|
15
|
+
isis['authentication-mode'] = line.strip.split('mode ').last if line.include?('authentication-mode')
|
|
15
16
|
isis['pid'] = line.strip.split(' ').last.to_i if line.include?('isis enable')
|
|
16
17
|
isis['ipv6-pid'] = line.strip.split(' ').last.to_i if line.include?('isis ipv6 enable')
|
|
17
18
|
isis['circuit-type'] = line.split('circuit-type').last.strip if line.include?('isis circuit-type')
|
data/document/isis-NE8100-X8.md
CHANGED
|
@@ -12,6 +12,7 @@ module NE8100_X8
|
|
|
12
12
|
port_name = self.端口识别(接口配置.split("\n").first.to_s).join()
|
|
13
13
|
lines = 接口配置.split("\n").select{|line|line.strip[0..4]=='isis '}
|
|
14
14
|
lines.each do|line|
|
|
15
|
+
isis['authentication-mode'] = line.strip.split('mode ').last if line.include?('authentication-mode')
|
|
15
16
|
isis['pid'] = line.strip.split(' ').last.to_i if line.include?('isis enable')
|
|
16
17
|
isis['ipv6-pid'] = line.strip.split(' ').last.to_i if line.include?('isis ipv6 enable')
|
|
17
18
|
isis['circuit-type'] = line.split('circuit-type').last.strip if line.include?('isis circuit-type')
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Nokia7750 isis
|
|
2
|
+
|
|
3
|
+
```ruby
|
|
4
|
+
@sign << ['Nokia7750', '接口isis']
|
|
5
|
+
@sign << ['Nokia7750', 'isis']
|
|
6
|
+
|
|
7
|
+
module Nokia7750
|
|
8
|
+
module_function
|
|
9
|
+
|
|
10
|
+
def 接口isis 正文
|
|
11
|
+
isis = {}
|
|
12
|
+
isis_conf = 正文['ISIS Configuration'].join("\n").match_paragraph(" isis 0","\n exit")
|
|
13
|
+
interfaces = isis_conf.join.match_paragraph(" interface ","\n exit")
|
|
14
|
+
interfaces.each do|interface|
|
|
15
|
+
if_name = interface.split("\n")[0].gsub('"','')
|
|
16
|
+
interface.split("\n").each_with_index do|line,index|
|
|
17
|
+
if_name = line.strip if index==0
|
|
18
|
+
isis[if_name] ||= {}
|
|
19
|
+
isis[if_name]['level'] = line.split(' ').last if line.include?('level-capability')
|
|
20
|
+
isis[if_name]['interface-type'] = line.split(' ').last if line.include?('interface-type')
|
|
21
|
+
isis[if_name]['status'] = 'no shutdown' if line.strip=='no shutdown'
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
lv_num = nil
|
|
25
|
+
level = interface.match_paragraph(" level ","\n exit")
|
|
26
|
+
level.join.split("\n").each_with_index do|line,index|
|
|
27
|
+
lv_num = "level#{line.strip}" if index==0
|
|
28
|
+
isis[if_name][lv_num] ||= {}
|
|
29
|
+
isis[if_name][lv_num]['metric'] = line.split(' ').last.to_i if line.include?('metric')
|
|
30
|
+
isis[if_name][lv_num]['passive'] = 'enable' if line.include?('passive')
|
|
31
|
+
isis[if_name][lv_num]['ipv6-unicast-metric'] = line.split(' ').last.to_i if line.include?('ipv6-unicast-metric')
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
return isis
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def isis 正文
|
|
38
|
+
isis = {}
|
|
39
|
+
isis_conf = 正文['ISIS Configuration'].join("\n").match_paragraph(" isis 0","\n exit")
|
|
40
|
+
isis_conf.join.split("\n").each do|line|
|
|
41
|
+
isis['level'] = line.split(' ').last if line.include?('level-capability')
|
|
42
|
+
isis['area-id'] = line.split(' ').last if line.include?('area-id')
|
|
43
|
+
isis['ignore-lsp-errors'] = 'enable' if line.include?('ignore-lsp-errors')
|
|
44
|
+
if line.include?('lsp')
|
|
45
|
+
isis['lsp'] ||= {}
|
|
46
|
+
isis['lsp']['lifetime'] = line.split(' ').last if line.include?('lsp-lifetime')
|
|
47
|
+
isis['lsp']['refresh-interval'] = line.split('refresh-interval ')[1].split(' ')[0] if line.include?('lsp-refresh-interval')
|
|
48
|
+
isis['lsp']['half-lifetime'] = line.split('half-lifetime ')[1].strip if line.include?('half-lifetime')
|
|
49
|
+
end
|
|
50
|
+
isis['overload-on-boot-timeout'] = line.split(' ').last.to_i if line.include?('overload-on-boot timeout')
|
|
51
|
+
isis['ipv6-routing'] = line.split(' ').last if line.include?('ipv6-routing')
|
|
52
|
+
isis['enable'] = true if line.strip=='no shutdown'
|
|
53
|
+
end
|
|
54
|
+
multi_topology = isis_conf.join.match_paragraph(" multi-topology","\n exit")
|
|
55
|
+
multi_topology.join.split("\n").each do|line|
|
|
56
|
+
if line.include?('ipv6-unicast')
|
|
57
|
+
isis['multi-topology'] ||= {}
|
|
58
|
+
isis['multi-topology']['ipv6-unicast'] = 'enable'
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
lv_num = nil
|
|
62
|
+
level = isis_conf.join.match_paragraph(" level ","\n exit")
|
|
63
|
+
level.join.split("\n").each_with_index do|line,index|
|
|
64
|
+
if index==0
|
|
65
|
+
lv_num = "level#{line.strip}"
|
|
66
|
+
isis[lv_num] ||= {}
|
|
67
|
+
end
|
|
68
|
+
isis[lv_num]['external-preference'] = line.split(' ').last if line.include?('external-preference')
|
|
69
|
+
isis[lv_num]['preference'] = line.split(' ').last if line.include?('preference') && !line.include?('external')
|
|
70
|
+
isis[lv_num]['wide-metrics-only'] = 'enable' if line.include?('wide-metrics-only')
|
|
71
|
+
end
|
|
72
|
+
return isis
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
```
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# T8000-18 isis
|
|
2
|
+
|
|
3
|
+
```ruby
|
|
4
|
+
@sign << ['T8000-18', '接口isis']
|
|
5
|
+
@sign << ['T8000-18', 'isis接口']
|
|
6
|
+
@sign << ['T8000-18', 'isis']
|
|
7
|
+
|
|
8
|
+
module T8000_18
|
|
9
|
+
module_function
|
|
10
|
+
|
|
11
|
+
def 接口isis 接口配置 # from isis module
|
|
12
|
+
isis = {}
|
|
13
|
+
port_name = self.端口识别(接口配置.split("\n").first.to_s).join()
|
|
14
|
+
接口配置.split("\n").each do|line|
|
|
15
|
+
isis['isis'] = 'enable' if line.include?('ip router isis')
|
|
16
|
+
isis['isis-ipv6'] = 'enable' if line.include?('ipv6 router isis')
|
|
17
|
+
if line.include?('metric') && line.include?('level') && !line.include?('ipv6')
|
|
18
|
+
isis['metric'] = {
|
|
19
|
+
'value' => line.split('metric ').last.split(' ').first,
|
|
20
|
+
'type' => line.split(' ').find{|w|w.include?('level')}
|
|
21
|
+
}
|
|
22
|
+
elsif line.include?('metric') && line.include?('level') && line.include?('ipv6')
|
|
23
|
+
isis['metric-ipv6'] = {
|
|
24
|
+
'value' => line.split('metric ').last.split(' ').first,
|
|
25
|
+
'type' => line.split(' ').find{|w|w.include?('level')}
|
|
26
|
+
}
|
|
27
|
+
end
|
|
28
|
+
isis['circuit-type'] = line.split('circuit-type').last.strip if line.include?('circuit-type')
|
|
29
|
+
isis['network'] = line.split('network').last.strip if line.include?('network')
|
|
30
|
+
if line.include?('authentication')
|
|
31
|
+
isis['authentication'] ||= {}
|
|
32
|
+
if line.include?('authentication-type')
|
|
33
|
+
isis['authentication']['type'] = line.split('authentication-type').last.strip
|
|
34
|
+
elsif line.include?('authentication encrypted')
|
|
35
|
+
isis['authentication']['password'] = line.split('authentication').last.strip
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
return { port_name => isis }
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def isis接口 isis配置
|
|
43
|
+
isis配置.match_paragraph("\n interface ", "\n $")
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def isis isis配置
|
|
47
|
+
isis = {};aflag,iflag = false, false;af_name = nil
|
|
48
|
+
isis配置.split("\n").each do|line|
|
|
49
|
+
if line.include?('address-family ')
|
|
50
|
+
aflag = true
|
|
51
|
+
isis['address-family'] ||= {}
|
|
52
|
+
af_name = line.split(' ').last
|
|
53
|
+
isis['address-family'][af_name] ||= {}
|
|
54
|
+
elsif line.include?('interface ')
|
|
55
|
+
bflag = true
|
|
56
|
+
end
|
|
57
|
+
(aflag = false;af_name=nil) if aflag && line.strip=='$'
|
|
58
|
+
iflag = false if iflag && line.strip=='$'
|
|
59
|
+
if aflag
|
|
60
|
+
isis['address-family'][af_name]['distance'] = line.split('distance').last.strip if line.include?('distance')
|
|
61
|
+
isis['address-family'][af_name]['maximum-paths'] = line.split('maximum-paths').last.strip if line.include?('maximum-paths')
|
|
62
|
+
isis['address-family'][af_name]['multi-topology'] = line.split('multi-topology').last.strip if line.include?('multi-topology')
|
|
63
|
+
if line.include?('metric')
|
|
64
|
+
isis['address-family'][af_name]['metric'] = {
|
|
65
|
+
'value' => line.split("metric").last.split(' ').first.strip,
|
|
66
|
+
'type' => line.split(' ').find{|s|s.include?('level')}.to_s.strip
|
|
67
|
+
}
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
if !aflag && !iflag
|
|
71
|
+
isis['pid'] = line.split(' ').last.strip if line.include?('router isis ')
|
|
72
|
+
isis['area'] = line.split(' ').last.strip if line.include?('area ')
|
|
73
|
+
isis['system-id'] = line.split(' ').last.strip if line.include?('system-id ')
|
|
74
|
+
isis['is-type'] = line.split(' ').last.strip if line.include?('is-type ')
|
|
75
|
+
isis['distance'] = line.split(' ').last.strip if line.include?('distance ')
|
|
76
|
+
isis['lsp-refresh-time'] = line.split(' ').last.strip if line.include?('lsp-refresh-time')
|
|
77
|
+
isis['max-lsp-lifetime'] = line.split(' ').last.strip if line.include?('max-lsp-lifetime')
|
|
78
|
+
isis['maximum-paths'] = line.split(' ').last.strip if line.include?('maximum-paths')
|
|
79
|
+
if line.include?('metric')
|
|
80
|
+
isis['metric'] ||= {}
|
|
81
|
+
if line.include?('metric-style ')
|
|
82
|
+
isis['metric']['style'] = line.split(' ').last.strip
|
|
83
|
+
else
|
|
84
|
+
isis['metric'].merge!(
|
|
85
|
+
'value' => line.split("metric").last.split(' ').first.strip,
|
|
86
|
+
'type' => line.split(' ').find{|s|s.include?('level')}.to_s.strip
|
|
87
|
+
)
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
if line.include?('redistribute')
|
|
91
|
+
isis['redistribute'] ||= []
|
|
92
|
+
isis['redistribute'] << line.split(' ')[1..-1].join(' ')
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
return isis
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
```
|
data/network.rb
CHANGED
data/utility/asnum.rb
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
#coding:utf-8
|
|
2
|
+
|
|
3
|
+
=begin # MD
|
|
4
|
+
<< 16位AS号(2字节,传统)>>
|
|
5
|
+
|
|
6
|
+
| 类型 | 范围 | 说明 |
|
|
7
|
+
| --------- | ----------------- | --------------------------- |
|
|
8
|
+
| **公有AS号** | **1 – 64511** | 全球互联网可路由,需向RIR(区域互联网注册机构)申请 |
|
|
9
|
+
| **私有AS号** | **64512 – 65534** | 仅用于内部网络,不可通告到公网 |
|
|
10
|
+
| **保留** | 65535 | 保留用于文档和特殊用途 |
|
|
11
|
+
|
|
12
|
+
特殊保留:AS 0(保留)、AS 23456(AS_TRANS,用于16位与32位互通过渡)
|
|
13
|
+
|
|
14
|
+
<< 32位AS号(4字节,RFC 4893/6793)>>
|
|
15
|
+
|
|
16
|
+
| 类型 | 范围 | 说明 |
|
|
17
|
+
| --------- | --------------------------------- | ------------- |
|
|
18
|
+
| **公有AS号** | **65536 – 4,199,999,999** | 全球可路由(约42亿个) |
|
|
19
|
+
| **私有AS号** | **4,200,000,000 – 4,294,967,294** | 内部使用(约9500万个) |
|
|
20
|
+
| **保留** | 4,294,967,295 | 保留(相当于32位全1) |
|
|
21
|
+
=end
|
|
22
|
+
|
|
23
|
+
class String
|
|
24
|
+
def is_public_as?
|
|
25
|
+
if !self.match(/^\d+\.{0,1}\d+$/)
|
|
26
|
+
return "Invalid AS number #{self}"
|
|
27
|
+
elsif self.include?('.')
|
|
28
|
+
left,right = self.split('.')
|
|
29
|
+
num = eval("0b"+[left.to_i,right.to_i].map{|n|"%016b" % n}.join(''))
|
|
30
|
+
return true if num.between?(65536,4199999999)
|
|
31
|
+
else
|
|
32
|
+
return true if self.to_i.between?(1,64511)
|
|
33
|
+
end
|
|
34
|
+
return false
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def is_private_as?
|
|
38
|
+
if !self.match(/^\d+\.{0,1}\d+$/)
|
|
39
|
+
return "Invalid AS number #{self}"
|
|
40
|
+
elsif self.include?('.')
|
|
41
|
+
left,right = self.split('.')
|
|
42
|
+
num = eval("0b"+[left.to_i,right.to_i].map{|n|"%016b" % n}.join(''))
|
|
43
|
+
return true if num.between?(4_200_000_000, 4_294_967_294)
|
|
44
|
+
else
|
|
45
|
+
return true if self.to_i.between?(64512,65534)
|
|
46
|
+
end
|
|
47
|
+
return false
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def is_reserved_as?
|
|
51
|
+
if !self.match(/^\d+\.{0,1}\d+$/)
|
|
52
|
+
return "Invalid AS number #{self}"
|
|
53
|
+
elsif self.include?('.')
|
|
54
|
+
left,right = self.split('.')
|
|
55
|
+
num = eval("0b"+[left.to_i,right.to_i].map{|n|"%016b" % n}.join(''))
|
|
56
|
+
return true if num==4_294_967_295
|
|
57
|
+
else
|
|
58
|
+
return true if [0,23456].include?(self.to_i)
|
|
59
|
+
end
|
|
60
|
+
return false
|
|
61
|
+
end
|
|
62
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: network-utility
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.1.
|
|
4
|
+
version: 1.1.61
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Matt
|
|
@@ -121,14 +121,25 @@ files:
|
|
|
121
121
|
- document/if-VNE9000.md
|
|
122
122
|
- document/if-ZXCTN9000-18EA.md
|
|
123
123
|
- document/if-ZXCTN9000-8EA.md
|
|
124
|
+
- document/isis-ALCATEL7750.md
|
|
125
|
+
- document/isis-CR16010H-F.md
|
|
126
|
+
- document/isis-CR16018-F.md
|
|
127
|
+
- document/isis-CR19000-20.md
|
|
128
|
+
- document/isis-CRS-16.md
|
|
124
129
|
- document/isis-CX600-X16A.md
|
|
125
130
|
- document/isis-CX600-X8A.md
|
|
131
|
+
- document/isis-M6000-16E.md
|
|
132
|
+
- document/isis-M6000-18S.md
|
|
133
|
+
- document/isis-M6000-8E.md
|
|
134
|
+
- document/isis-NE40E-X16.md
|
|
126
135
|
- document/isis-NE40E-X16A.md
|
|
127
136
|
- document/isis-NE5000E-20.md
|
|
128
137
|
- document/isis-NE5000E-X16.md
|
|
129
138
|
- document/isis-NE5000E-X16A.md
|
|
130
139
|
- document/isis-NE8000E-X8.md
|
|
131
140
|
- document/isis-NE8100-X8.md
|
|
141
|
+
- document/isis-Nokia7750.md
|
|
142
|
+
- document/isis-T8000-18.md
|
|
132
143
|
- document/lic-M6000-16E.md
|
|
133
144
|
- document/lic-M6000-18S.md
|
|
134
145
|
- document/lic-M6000-8.md
|
|
@@ -258,6 +269,7 @@ files:
|
|
|
258
269
|
- document/vpn-ZXCTN9000-8EA.md
|
|
259
270
|
- network.rb
|
|
260
271
|
- support/snmp.rb
|
|
272
|
+
- utility/asnum.rb
|
|
261
273
|
- utility/ipv4_address.rb
|
|
262
274
|
- utility/ipv6_address.rb
|
|
263
275
|
- utility/mac_address.rb
|