network-utility 2.0.7 → 2.0.8
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-ZXCTN9000-18EA.md +77 -0
- data/document/acl-ZXCTN9000-8EA.md +77 -0
- data/document/bgp-ZXCTN9000-18EA.md +135 -0
- data/document/bgp-ZXCTN9000-8EA.md +135 -0
- data/document/isis-ZXCTN9000-18EA.md +99 -0
- data/document/isis-ZXCTN9000-8EA.md +99 -0
- data/network.rb +1 -1
- metadata +7 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c8b6e7268a3f3ebe7f9de7da912280f8682865d0634c2e0c3edd0d2b4b218893
|
|
4
|
+
data.tar.gz: 8b03fe4bfd78f5a4911abedea9cefb1abd64b3281685d155ad2a30f91246a4fc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6fb10afaaacf6d75c57dc3935508ed6bedd503f9e52b41226cbd87f439700620f1f668bdecaa2c000e4f88172d440ddaaab154a0641d65f267758769a774297f
|
|
7
|
+
data.tar.gz: 822d1d679bcc092fa2ffcd949d4276f84b4ae3766ee036b69ff28df52dad8a2a9d4cb335c8454ca2336e604eb9b09d362afa05e6dfcc22b38083e655f1a398a3
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# ZXCTN9000-18EA 访问控制列表
|
|
2
|
+
|
|
3
|
+
```ruby
|
|
4
|
+
@sign << ['ZXCTN9000-18EA', 'ACL']
|
|
5
|
+
@sign << ['ZXCTN9000-18EA', 'ACL6']
|
|
6
|
+
@sign << ['ZXCTN9000-18EA', 'LinkACL']
|
|
7
|
+
|
|
8
|
+
module ZXCTN9000_18EA
|
|
9
|
+
module_function
|
|
10
|
+
|
|
11
|
+
def ACL config, mode=:config # or :text
|
|
12
|
+
table = {}
|
|
13
|
+
name = nil
|
|
14
|
+
config.split("\n").each do|line|
|
|
15
|
+
name = line.split('ipv4-access-list')[1].strip if line.include?('ipv4-access-list')
|
|
16
|
+
table[name] ||= {}
|
|
17
|
+
if mode==:config
|
|
18
|
+
if line.include?('rule')
|
|
19
|
+
rule = line.split(' ')
|
|
20
|
+
table[name][rule[1].to_i] = rule[2..-1]
|
|
21
|
+
end
|
|
22
|
+
elsif mode==:text
|
|
23
|
+
if line.include?('permit') || line.include?('deny')
|
|
24
|
+
rule = line.split(' ')
|
|
25
|
+
table[name][rule[0].to_i] = rule[1..-1]
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
table.delete(nil)
|
|
30
|
+
return table
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def ACL6 config, mode=:config # or :text
|
|
34
|
+
table = {}
|
|
35
|
+
name = nil
|
|
36
|
+
config.split("\n").each do|line|
|
|
37
|
+
name = line.split('ipv6-access-list')[1].strip if line.include?('ipv6-access-list')
|
|
38
|
+
table[name] ||= {}
|
|
39
|
+
if mode==:config
|
|
40
|
+
if line.include?('rule')
|
|
41
|
+
rule = line.split(' ')
|
|
42
|
+
table[name][rule[1].to_i] = rule[2..-1]
|
|
43
|
+
end
|
|
44
|
+
elsif mode==:text
|
|
45
|
+
if line.include?('permit') || line.include?('deny')
|
|
46
|
+
rule = line.split(' ')
|
|
47
|
+
table[name][rule[0].to_i] = rule[1..-1]
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
table.delete(nil)
|
|
52
|
+
return table
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def LinkACL config, mode=:config # or :text
|
|
56
|
+
table = {}
|
|
57
|
+
name = nil
|
|
58
|
+
config.split("\n").each do|line|
|
|
59
|
+
name = line.split('link-access-list')[1].strip if line.include?('link-access-list')
|
|
60
|
+
table[name] ||= {}
|
|
61
|
+
if mode==:config
|
|
62
|
+
if line.include?('rule')
|
|
63
|
+
rule = line.split(' ')
|
|
64
|
+
table[name][rule[1].to_i] = rule[2..-1]
|
|
65
|
+
end
|
|
66
|
+
elsif mode==:text
|
|
67
|
+
if line.include?('permit') || line.include?('deny')
|
|
68
|
+
rule = line.split(' ')
|
|
69
|
+
table[name][rule[0].to_i] = rule[1..-1]
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
table.delete(nil)
|
|
74
|
+
return table
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
```
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# ZXCTN9000-8EA 访问控制列表
|
|
2
|
+
|
|
3
|
+
```ruby
|
|
4
|
+
@sign << ['ZXCTN9000-8EA', 'ACL']
|
|
5
|
+
@sign << ['ZXCTN9000-8EA', 'ACL6']
|
|
6
|
+
@sign << ['ZXCTN9000-8EA', 'LinkACL']
|
|
7
|
+
|
|
8
|
+
module ZXCTN9000_8EA
|
|
9
|
+
module_function
|
|
10
|
+
|
|
11
|
+
def ACL config, mode=:config # or :text
|
|
12
|
+
table = {}
|
|
13
|
+
name = nil
|
|
14
|
+
config.split("\n").each do|line|
|
|
15
|
+
name = line.split('ipv4-access-list')[1].strip if line.include?('ipv4-access-list')
|
|
16
|
+
table[name] ||= {}
|
|
17
|
+
if mode==:config
|
|
18
|
+
if line.include?('rule')
|
|
19
|
+
rule = line.split(' ')
|
|
20
|
+
table[name][rule[1].to_i] = rule[2..-1]
|
|
21
|
+
end
|
|
22
|
+
elsif mode==:text
|
|
23
|
+
if line.include?('permit') || line.include?('deny')
|
|
24
|
+
rule = line.split(' ')
|
|
25
|
+
table[name][rule[0].to_i] = rule[1..-1]
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
table.delete(nil)
|
|
30
|
+
return table
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def ACL6 config, mode=:config # or :text
|
|
34
|
+
table = {}
|
|
35
|
+
name = nil
|
|
36
|
+
config.split("\n").each do|line|
|
|
37
|
+
name = line.split('ipv6-access-list')[1].strip if line.include?('ipv6-access-list')
|
|
38
|
+
table[name] ||= {}
|
|
39
|
+
if mode==:config
|
|
40
|
+
if line.include?('rule')
|
|
41
|
+
rule = line.split(' ')
|
|
42
|
+
table[name][rule[1].to_i] = rule[2..-1]
|
|
43
|
+
end
|
|
44
|
+
elsif mode==:text
|
|
45
|
+
if line.include?('permit') || line.include?('deny')
|
|
46
|
+
rule = line.split(' ')
|
|
47
|
+
table[name][rule[0].to_i] = rule[1..-1]
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
table.delete(nil)
|
|
52
|
+
return table
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def LinkACL config, mode=:config # or :text
|
|
56
|
+
table = {}
|
|
57
|
+
name = nil
|
|
58
|
+
config.split("\n").each do|line|
|
|
59
|
+
name = line.split('link-access-list')[1].strip if line.include?('link-access-list')
|
|
60
|
+
table[name] ||= {}
|
|
61
|
+
if mode==:config
|
|
62
|
+
if line.include?('rule')
|
|
63
|
+
rule = line.split(' ')
|
|
64
|
+
table[name][rule[1].to_i] = rule[2..-1]
|
|
65
|
+
end
|
|
66
|
+
elsif mode==:text
|
|
67
|
+
if line.include?('permit') || line.include?('deny')
|
|
68
|
+
rule = line.split(' ')
|
|
69
|
+
table[name][rule[0].to_i] = rule[1..-1]
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
table.delete(nil)
|
|
74
|
+
return table
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
```
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
# ZXCTN9000-18EA bgp
|
|
2
|
+
|
|
3
|
+
```ruby
|
|
4
|
+
@sign << ['ZXCTN9000-18EA', 'bgp']
|
|
5
|
+
@sign << ['ZXCTN9000-18EA', 'bgp地址族']
|
|
6
|
+
@sign << ['ZXCTN9000-18EA', '宣告网段解析']
|
|
7
|
+
|
|
8
|
+
module ZXCTN9000_18EA
|
|
9
|
+
module_function
|
|
10
|
+
|
|
11
|
+
def bgp bgp配置
|
|
12
|
+
address_family, non_af_conf = self.bgp地址族 bgp配置
|
|
13
|
+
bgp, afs = {}, {}
|
|
14
|
+
non_af_conf.each do|line|
|
|
15
|
+
line = line.strip[2..-1] if line.strip[0..1]=='++' # default
|
|
16
|
+
words = line.strip.split(' ')
|
|
17
|
+
if words.include?('peer-group') && words.size==3
|
|
18
|
+
groupname = words[1]
|
|
19
|
+
bgp['group'] ||= {}
|
|
20
|
+
bgp['group'][groupname] ||= {}
|
|
21
|
+
elsif words[0]=='neighbor'
|
|
22
|
+
afname = 'global'
|
|
23
|
+
peername, attribute = words[1..2]
|
|
24
|
+
value = words[3..-1].join(" ")
|
|
25
|
+
afs[afname] ||= {}
|
|
26
|
+
afs[afname]['peer'] ||= {}
|
|
27
|
+
afs[afname]['peer'][peername] ||= {}
|
|
28
|
+
if value.empty?
|
|
29
|
+
afs[afname]['peer'][peername][attribute] = true
|
|
30
|
+
else
|
|
31
|
+
if !afs[afname]['peer'][peername] || afs[afname]['peer'][peername].is_a?(Hash)
|
|
32
|
+
afs[afname]['peer'][peername][attribute] ||= []
|
|
33
|
+
afs[afname]['peer'][peername][attribute] << value
|
|
34
|
+
else
|
|
35
|
+
afs[afname]['peer'][peername][attribute] = value
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
else
|
|
39
|
+
attribute = words[0]
|
|
40
|
+
value = words[1..-1].join(" ")
|
|
41
|
+
if value.empty?
|
|
42
|
+
bgp[attribute] = true
|
|
43
|
+
else
|
|
44
|
+
bgp[attribute] ||= []
|
|
45
|
+
bgp[attribute] << value
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
address_family.each do|afname, afconf|
|
|
50
|
+
afs[afname] ||= {}
|
|
51
|
+
afconf.each do|line|
|
|
52
|
+
words = line.strip.split(' ')
|
|
53
|
+
if words[0]=='neighbor'
|
|
54
|
+
peername,attribute = words[1..2]
|
|
55
|
+
value = words[3..-1].join(" ")
|
|
56
|
+
if (bgp['group']||{})[peername]
|
|
57
|
+
if value.empty?
|
|
58
|
+
bgp['group'][peername][attribute] = true
|
|
59
|
+
else
|
|
60
|
+
bgp['group'][peername][attribute] ||= []
|
|
61
|
+
bgp['group'][peername][attribute] << value
|
|
62
|
+
end
|
|
63
|
+
else
|
|
64
|
+
afs[afname]['peer'] ||= {}
|
|
65
|
+
afs[afname]['peer'][peername] ||= {}
|
|
66
|
+
if value.empty?
|
|
67
|
+
afs[afname]['peer'][peername][attribute] = true
|
|
68
|
+
else
|
|
69
|
+
afs[afname]['peer'][peername][attribute] ||= []
|
|
70
|
+
afs[afname]['peer'][peername][attribute] << value
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
elsif words.include?('peer-group') && words.size==3
|
|
74
|
+
groupname = line.split(' ')[1]
|
|
75
|
+
bgp['group'] ||= {}
|
|
76
|
+
bgp['group'][groupname] ||= {}
|
|
77
|
+
else
|
|
78
|
+
words = line.split(' ')
|
|
79
|
+
attribute = words[0]
|
|
80
|
+
value = words[1..-1].join(" ")
|
|
81
|
+
if value.empty?
|
|
82
|
+
afs[afname][attribute] = true
|
|
83
|
+
else
|
|
84
|
+
afs[afname][attribute] ||= []
|
|
85
|
+
afs[afname][attribute] << value
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
bgp.merge!('address-family'=>afs)
|
|
91
|
+
return bgp
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def bgp地址族 bgp配置
|
|
95
|
+
address_family = {};non_af_conf = []
|
|
96
|
+
af_begin = false; af_name = 'global'
|
|
97
|
+
bgp配置.join("\n").split("\n").each do|line|
|
|
98
|
+
line = line.strip[2..-1] if line.strip[0..1]=='++' # default
|
|
99
|
+
if line[0..15]==' address-family'
|
|
100
|
+
af_begin = true
|
|
101
|
+
af_name = line.split(' ')[1..-1].join('-')
|
|
102
|
+
address_family[af_name] ||= []
|
|
103
|
+
end
|
|
104
|
+
if line[0..2]==' $' # af_end
|
|
105
|
+
af_begin = false
|
|
106
|
+
af_name = 'global'
|
|
107
|
+
elsif line[0]=='$' # bgp_end or no-finisher
|
|
108
|
+
af_begin = false
|
|
109
|
+
af_name = 'global'
|
|
110
|
+
end
|
|
111
|
+
if af_begin
|
|
112
|
+
address_family[af_name] << line
|
|
113
|
+
else
|
|
114
|
+
non_af_conf << line unless line.strip=='$'
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
return address_family, non_af_conf
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
def 宣告网段解析 配置散列
|
|
121
|
+
ranges = []
|
|
122
|
+
segment = 配置散列['bgp']
|
|
123
|
+
segment.split("\n").each do|line|
|
|
124
|
+
if line.include?('network ') && line.strip.split(' ').size > 2
|
|
125
|
+
words = line.split(' ')
|
|
126
|
+
address, netmask = line.split(' ')[1].include?(':') ? IP.v6("#{words[1]}/#{words[2]}") : IP.v4("#{words[1]}/#{words[2]}")
|
|
127
|
+
network = address.network_with netmask
|
|
128
|
+
route_map = words.index('route-map') ? words[words.index('route-map')+1] : ''
|
|
129
|
+
ranges << [ 'bgp', network.to_s, netmask.to_s, route_map ]
|
|
130
|
+
end
|
|
131
|
+
end
|
|
132
|
+
return ranges
|
|
133
|
+
end
|
|
134
|
+
end
|
|
135
|
+
```
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
# ZXCTN9000-8EA bgp
|
|
2
|
+
|
|
3
|
+
```ruby
|
|
4
|
+
@sign << ['ZXCTN9000-8EA', 'bgp']
|
|
5
|
+
@sign << ['ZXCTN9000-8EA', 'bgp地址族']
|
|
6
|
+
@sign << ['ZXCTN9000-8EA', '宣告网段解析']
|
|
7
|
+
|
|
8
|
+
module ZXCTN9000_8EA
|
|
9
|
+
module_function
|
|
10
|
+
|
|
11
|
+
def bgp bgp配置
|
|
12
|
+
address_family, non_af_conf = self.bgp地址族 bgp配置
|
|
13
|
+
bgp, afs = {}, {}
|
|
14
|
+
non_af_conf.each do|line|
|
|
15
|
+
line = line.strip[2..-1] if line.strip[0..1]=='++' # default
|
|
16
|
+
words = line.strip.split(' ')
|
|
17
|
+
if words.include?('peer-group') && words.size==3
|
|
18
|
+
groupname = words[1]
|
|
19
|
+
bgp['group'] ||= {}
|
|
20
|
+
bgp['group'][groupname] ||= {}
|
|
21
|
+
elsif words[0]=='neighbor'
|
|
22
|
+
afname = 'global'
|
|
23
|
+
peername, attribute = words[1..2]
|
|
24
|
+
value = words[3..-1].join(" ")
|
|
25
|
+
afs[afname] ||= {}
|
|
26
|
+
afs[afname]['peer'] ||= {}
|
|
27
|
+
afs[afname]['peer'][peername] ||= {}
|
|
28
|
+
if value.empty?
|
|
29
|
+
afs[afname]['peer'][peername][attribute] = true
|
|
30
|
+
else
|
|
31
|
+
if !afs[afname]['peer'][peername] || afs[afname]['peer'][peername].is_a?(Hash)
|
|
32
|
+
afs[afname]['peer'][peername][attribute] ||= []
|
|
33
|
+
afs[afname]['peer'][peername][attribute] << value
|
|
34
|
+
else
|
|
35
|
+
afs[afname]['peer'][peername][attribute] = value
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
else
|
|
39
|
+
attribute = words[0]
|
|
40
|
+
value = words[1..-1].join(" ")
|
|
41
|
+
if value.empty?
|
|
42
|
+
bgp[attribute] = true
|
|
43
|
+
else
|
|
44
|
+
bgp[attribute] ||= []
|
|
45
|
+
bgp[attribute] << value
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
address_family.each do|afname, afconf|
|
|
50
|
+
afs[afname] ||= {}
|
|
51
|
+
afconf.each do|line|
|
|
52
|
+
words = line.strip.split(' ')
|
|
53
|
+
if words[0]=='neighbor'
|
|
54
|
+
peername,attribute = words[1..2]
|
|
55
|
+
value = words[3..-1].join(" ")
|
|
56
|
+
if (bgp['group']||{})[peername]
|
|
57
|
+
if value.empty?
|
|
58
|
+
bgp['group'][peername][attribute] = true
|
|
59
|
+
else
|
|
60
|
+
bgp['group'][peername][attribute] ||= []
|
|
61
|
+
bgp['group'][peername][attribute] << value
|
|
62
|
+
end
|
|
63
|
+
else
|
|
64
|
+
afs[afname]['peer'] ||= {}
|
|
65
|
+
afs[afname]['peer'][peername] ||= {}
|
|
66
|
+
if value.empty?
|
|
67
|
+
afs[afname]['peer'][peername][attribute] = true
|
|
68
|
+
else
|
|
69
|
+
afs[afname]['peer'][peername][attribute] ||= []
|
|
70
|
+
afs[afname]['peer'][peername][attribute] << value
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
elsif words.include?('peer-group') && words.size==3
|
|
74
|
+
groupname = line.split(' ')[1]
|
|
75
|
+
bgp['group'] ||= {}
|
|
76
|
+
bgp['group'][groupname] ||= {}
|
|
77
|
+
else
|
|
78
|
+
words = line.split(' ')
|
|
79
|
+
attribute = words[0]
|
|
80
|
+
value = words[1..-1].join(" ")
|
|
81
|
+
if value.empty?
|
|
82
|
+
afs[afname][attribute] = true
|
|
83
|
+
else
|
|
84
|
+
afs[afname][attribute] ||= []
|
|
85
|
+
afs[afname][attribute] << value
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
bgp.merge!('address-family'=>afs)
|
|
91
|
+
return bgp
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def bgp地址族 bgp配置
|
|
95
|
+
address_family = {};non_af_conf = []
|
|
96
|
+
af_begin = false; af_name = 'global'
|
|
97
|
+
bgp配置.join("\n").split("\n").each do|line|
|
|
98
|
+
line = line.strip[2..-1] if line.strip[0..1]=='++' # default
|
|
99
|
+
if line[0..15]==' address-family'
|
|
100
|
+
af_begin = true
|
|
101
|
+
af_name = line.split(' ')[1..-1].join('-')
|
|
102
|
+
address_family[af_name] ||= []
|
|
103
|
+
end
|
|
104
|
+
if line[0..2]==' $' # af_end
|
|
105
|
+
af_begin = false
|
|
106
|
+
af_name = 'global'
|
|
107
|
+
elsif line[0]=='$' # bgp_end or no-finisher
|
|
108
|
+
af_begin = false
|
|
109
|
+
af_name = 'global'
|
|
110
|
+
end
|
|
111
|
+
if af_begin
|
|
112
|
+
address_family[af_name] << line
|
|
113
|
+
else
|
|
114
|
+
non_af_conf << line unless line.strip=='$'
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
return address_family, non_af_conf
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
def 宣告网段解析 配置散列
|
|
121
|
+
ranges = []
|
|
122
|
+
segment = 配置散列['bgp']
|
|
123
|
+
segment.split("\n").each do|line|
|
|
124
|
+
if line.include?('network ') && line.strip.split(' ').size > 2
|
|
125
|
+
words = line.split(' ')
|
|
126
|
+
address, netmask = line.split(' ')[1].include?(':') ? IP.v6("#{words[1]}/#{words[2]}") : IP.v4("#{words[1]}/#{words[2]}")
|
|
127
|
+
network = address.network_with netmask
|
|
128
|
+
route_map = words.index('route-map') ? words[words.index('route-map')+1] : ''
|
|
129
|
+
ranges << [ 'bgp', network.to_s, netmask.to_s, route_map ]
|
|
130
|
+
end
|
|
131
|
+
end
|
|
132
|
+
return ranges
|
|
133
|
+
end
|
|
134
|
+
end
|
|
135
|
+
```
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# ZXCTN9000-18EA isis
|
|
2
|
+
|
|
3
|
+
```ruby
|
|
4
|
+
@sign << ['ZXCTN9000-18EA', '接口isis']
|
|
5
|
+
@sign << ['ZXCTN9000-18EA', 'isis接口']
|
|
6
|
+
@sign << ['ZXCTN9000-18EA', 'isis']
|
|
7
|
+
|
|
8
|
+
module ZXCTN9000_18EA
|
|
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
|
+
```
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# ZXCTN9000-8EA isis
|
|
2
|
+
|
|
3
|
+
```ruby
|
|
4
|
+
@sign << ['ZXCTN9000-8EA', '接口isis']
|
|
5
|
+
@sign << ['ZXCTN9000-8EA', 'isis接口']
|
|
6
|
+
@sign << ['ZXCTN9000-8EA', 'isis']
|
|
7
|
+
|
|
8
|
+
module ZXCTN9000_8EA
|
|
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
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: 2.0.
|
|
4
|
+
version: 2.0.8
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Matt
|
|
@@ -70,6 +70,8 @@ files:
|
|
|
70
70
|
- document/acl-NE5000E-X16A.md
|
|
71
71
|
- document/acl-NE80E.md
|
|
72
72
|
- document/acl-T8000-18.md
|
|
73
|
+
- document/acl-ZXCTN9000-18EA.md
|
|
74
|
+
- document/acl-ZXCTN9000-8EA.md
|
|
73
75
|
- document/bgp-CR16010H-F.md
|
|
74
76
|
- document/bgp-CR16018-F.md
|
|
75
77
|
- document/bgp-CR19000-20.md
|
|
@@ -90,6 +92,8 @@ files:
|
|
|
90
92
|
- document/bgp-NE5000E-X16A.md
|
|
91
93
|
- document/bgp-NE80E.md
|
|
92
94
|
- document/bgp-T8000-18.md
|
|
95
|
+
- document/bgp-ZXCTN9000-18EA.md
|
|
96
|
+
- document/bgp-ZXCTN9000-8EA.md
|
|
93
97
|
- document/config.md
|
|
94
98
|
- document/document.rb
|
|
95
99
|
- document/flexe-CX600-X16A.md
|
|
@@ -146,6 +150,8 @@ files:
|
|
|
146
150
|
- document/isis-NE8100-X8.md
|
|
147
151
|
- document/isis-Nokia7750.md
|
|
148
152
|
- document/isis-T8000-18.md
|
|
153
|
+
- document/isis-ZXCTN9000-18EA.md
|
|
154
|
+
- document/isis-ZXCTN9000-8EA.md
|
|
149
155
|
- document/lic-M6000-16E.md
|
|
150
156
|
- document/lic-M6000-18S.md
|
|
151
157
|
- document/lic-M6000-8.md
|