network-utility 2.0.10 → 2.0.11
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-NE8000E-X8.md +139 -0
- data/document/bgp-NE8100-X8.md +139 -0
- data/document/system-NE8000E-X8.md +51 -0
- data/document/system-NE8100-X8.md +51 -0
- data/document/vpn-NE8000E-X8.md +78 -0
- data/document/vpn-NE8100-X8.md +78 -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: 0a3b0fc59f7c4192911010370b98d0c37569c128320452ca08d307726b3eda6a
|
|
4
|
+
data.tar.gz: 1f45b69a26b7ee3dcedbf548520b468205cc64bd4616d12c659abb30b0a9cc4d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d3ae532a5b64027fc9176a73b6b767c39b2f0e0e754d089f1b86944ae6c28fcbffa441af23bdd5544ea06747c44b6f910f68e6a6030f5bbc737d2eeb637b9ba8
|
|
7
|
+
data.tar.gz: b40241f95ffb5f22ea2ec37b1c9e0682ceab91f53441c6f4b888ebe74fef35ab0aeb81b8847123f62cd52314f9d21a59a6244c44eb54e6bfedbe43a8a3d2553e
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# NE8000E-X8 bgp
|
|
2
|
+
|
|
3
|
+
```ruby
|
|
4
|
+
@sign << ['NE8000E-X8', 'bgp']
|
|
5
|
+
@sign << ['NE8000E-X8', 'bgp地址族']
|
|
6
|
+
@sign << ['NE8000E-X8', '宣告网段解析']
|
|
7
|
+
|
|
8
|
+
module NE8000E_X8
|
|
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
|
+
if line.strip[0..4]=='group'
|
|
16
|
+
groupname,mode = line.split(' ')[1..2]
|
|
17
|
+
bgp['group'] ||= {}
|
|
18
|
+
bgp['group'][groupname] ||= {}
|
|
19
|
+
bgp['group'][groupname].merge!('mode' => mode)
|
|
20
|
+
elsif line.strip[0..3]=='peer'
|
|
21
|
+
afname = 'global'
|
|
22
|
+
words = line.split(' ')
|
|
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
|
+
unless afs[afname]['peer'][peername]
|
|
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
|
+
words = line.split(' ')
|
|
40
|
+
attribute = words[0]
|
|
41
|
+
value = words[1..-1].join(" ")
|
|
42
|
+
bgp[attribute] ||= []
|
|
43
|
+
if value.empty?
|
|
44
|
+
bgp[attribute] << true
|
|
45
|
+
else
|
|
46
|
+
bgp[attribute] << value
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
address_family.each do|afname, afconf|
|
|
51
|
+
afs[afname] ||= {}
|
|
52
|
+
afconf.each do|line|
|
|
53
|
+
if line.strip[0..3]=='peer'
|
|
54
|
+
words = line.split(' ')
|
|
55
|
+
peername,attribute = words[1..2]
|
|
56
|
+
value = words[3..-1].join(" ")
|
|
57
|
+
if (bgp['group']||{})[peername]
|
|
58
|
+
if value.empty?
|
|
59
|
+
bgp['group'][peername][attribute] = true
|
|
60
|
+
else
|
|
61
|
+
bgp['group'][peername][attribute] ||= []
|
|
62
|
+
bgp['group'][peername][attribute] << value
|
|
63
|
+
end
|
|
64
|
+
else
|
|
65
|
+
afs[afname]['peer'] ||= {}
|
|
66
|
+
afs[afname]['peer'][peername] ||= {}
|
|
67
|
+
if value.empty?
|
|
68
|
+
afs[afname]['peer'][peername][attribute] = true
|
|
69
|
+
else
|
|
70
|
+
afs[afname]['peer'][peername][attribute] ||= []
|
|
71
|
+
afs[afname]['peer'][peername][attribute] << value
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
elsif line.strip[0..4]=='group'
|
|
75
|
+
groupname = line.split(' ')[1]
|
|
76
|
+
bgp['group'] ||= {}
|
|
77
|
+
bgp['group'][groupname] ||= {}
|
|
78
|
+
else
|
|
79
|
+
words = line.split(' ')
|
|
80
|
+
attribute = words[0]
|
|
81
|
+
value = words[1..-1].join(" ")
|
|
82
|
+
if value.empty?
|
|
83
|
+
afs[afname][attribute] = true
|
|
84
|
+
else
|
|
85
|
+
afs[afname][attribute] ||= []
|
|
86
|
+
afs[afname][attribute] << value
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
bgp.merge!('address-family'=>afs)
|
|
92
|
+
return bgp
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
def bgp地址族 bgp配置
|
|
96
|
+
address_family = {};non_af_conf = []
|
|
97
|
+
af_begin = false; af_name = 'global'
|
|
98
|
+
bgp配置.join("\n").split("\n").each do|line|
|
|
99
|
+
if line[0..11]==' ipv4-family' || line[0..11]==' ipv6-family'
|
|
100
|
+
af_begin = true
|
|
101
|
+
af_name = line.strip.gsub(' ','-')
|
|
102
|
+
address_family[af_name] ||= []
|
|
103
|
+
end
|
|
104
|
+
if line[0..1]==' #' # 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==' #'
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
return address_family, non_af_conf
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
def 宣告网段解析 配置散列
|
|
121
|
+
ranges = []
|
|
122
|
+
配置散列['bgp'].each do|segment|
|
|
123
|
+
bgps = segment.match_paragraph("\n ipv4-family unicast", "\n #")
|
|
124
|
+
bgps.each do|bgp|
|
|
125
|
+
bgp.split("\n").each do|line|
|
|
126
|
+
if line.include?('network ') && line.strip.split(' ').size > 2
|
|
127
|
+
words = line.split(' ')
|
|
128
|
+
address, netmask = line.split(' ')[1].include?(':') ? IP.v6("#{words[1]}/#{words[2]}") : IP.v4("#{words[1]}/#{words[2]}")
|
|
129
|
+
network = address.network_with netmask
|
|
130
|
+
route_policy = words.index('route-policy') ? words[words.index('route-policy')+1] : ''
|
|
131
|
+
ranges << [ 'bgp', network.to_s, netmask.to_s, route_policy ]
|
|
132
|
+
end
|
|
133
|
+
end
|
|
134
|
+
end
|
|
135
|
+
end
|
|
136
|
+
return ranges
|
|
137
|
+
end
|
|
138
|
+
end
|
|
139
|
+
```
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# NE8100-X8 bgp
|
|
2
|
+
|
|
3
|
+
```ruby
|
|
4
|
+
@sign << ['NE8100-X8', 'bgp']
|
|
5
|
+
@sign << ['NE8100-X8', 'bgp地址族']
|
|
6
|
+
@sign << ['NE8100-X8', '宣告网段解析']
|
|
7
|
+
|
|
8
|
+
module NE8100_X8
|
|
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
|
+
if line.strip[0..4]=='group'
|
|
16
|
+
groupname,mode = line.split(' ')[1..2]
|
|
17
|
+
bgp['group'] ||= {}
|
|
18
|
+
bgp['group'][groupname] ||= {}
|
|
19
|
+
bgp['group'][groupname].merge!('mode' => mode)
|
|
20
|
+
elsif line.strip[0..3]=='peer'
|
|
21
|
+
afname = 'global'
|
|
22
|
+
words = line.split(' ')
|
|
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
|
+
unless afs[afname]['peer'][peername]
|
|
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
|
+
words = line.split(' ')
|
|
40
|
+
attribute = words[0]
|
|
41
|
+
value = words[1..-1].join(" ")
|
|
42
|
+
bgp[attribute] ||= []
|
|
43
|
+
if value.empty?
|
|
44
|
+
bgp[attribute] << true
|
|
45
|
+
else
|
|
46
|
+
bgp[attribute] << value
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
address_family.each do|afname, afconf|
|
|
51
|
+
afs[afname] ||= {}
|
|
52
|
+
afconf.each do|line|
|
|
53
|
+
if line.strip[0..3]=='peer'
|
|
54
|
+
words = line.split(' ')
|
|
55
|
+
peername,attribute = words[1..2]
|
|
56
|
+
value = words[3..-1].join(" ")
|
|
57
|
+
if (bgp['group']||{})[peername]
|
|
58
|
+
if value.empty?
|
|
59
|
+
bgp['group'][peername][attribute] = true
|
|
60
|
+
else
|
|
61
|
+
bgp['group'][peername][attribute] ||= []
|
|
62
|
+
bgp['group'][peername][attribute] << value
|
|
63
|
+
end
|
|
64
|
+
else
|
|
65
|
+
afs[afname]['peer'] ||= {}
|
|
66
|
+
afs[afname]['peer'][peername] ||= {}
|
|
67
|
+
if value.empty?
|
|
68
|
+
afs[afname]['peer'][peername][attribute] = true
|
|
69
|
+
else
|
|
70
|
+
afs[afname]['peer'][peername][attribute] ||= []
|
|
71
|
+
afs[afname]['peer'][peername][attribute] << value
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
elsif line.strip[0..4]=='group'
|
|
75
|
+
groupname = line.split(' ')[1]
|
|
76
|
+
bgp['group'] ||= {}
|
|
77
|
+
bgp['group'][groupname] ||= {}
|
|
78
|
+
else
|
|
79
|
+
words = line.split(' ')
|
|
80
|
+
attribute = words[0]
|
|
81
|
+
value = words[1..-1].join(" ")
|
|
82
|
+
if value.empty?
|
|
83
|
+
afs[afname][attribute] = true
|
|
84
|
+
else
|
|
85
|
+
afs[afname][attribute] ||= []
|
|
86
|
+
afs[afname][attribute] << value
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
bgp.merge!('address-family'=>afs)
|
|
92
|
+
return bgp
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
def bgp地址族 bgp配置
|
|
96
|
+
address_family = {};non_af_conf = []
|
|
97
|
+
af_begin = false; af_name = 'global'
|
|
98
|
+
bgp配置.join("\n").split("\n").each do|line|
|
|
99
|
+
if line[0..11]==' ipv4-family' || line[0..11]==' ipv6-family'
|
|
100
|
+
af_begin = true
|
|
101
|
+
af_name = line.strip.gsub(' ','-')
|
|
102
|
+
address_family[af_name] ||= []
|
|
103
|
+
end
|
|
104
|
+
if line[0..1]==' #' # 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==' #'
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
return address_family, non_af_conf
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
def 宣告网段解析 配置散列
|
|
121
|
+
ranges = []
|
|
122
|
+
配置散列['bgp'].each do|segment|
|
|
123
|
+
bgps = segment.match_paragraph("\n ipv4-family unicast", "\n #")
|
|
124
|
+
bgps.each do|bgp|
|
|
125
|
+
bgp.split("\n").each do|line|
|
|
126
|
+
if line.include?('network ') && line.strip.split(' ').size > 2
|
|
127
|
+
words = line.split(' ')
|
|
128
|
+
address, netmask = line.split(' ')[1].include?(':') ? IP.v6("#{words[1]}/#{words[2]}") : IP.v4("#{words[1]}/#{words[2]}")
|
|
129
|
+
network = address.network_with netmask
|
|
130
|
+
route_policy = words.index('route-policy') ? words[words.index('route-policy')+1] : ''
|
|
131
|
+
ranges << [ 'bgp', network.to_s, netmask.to_s, route_policy ]
|
|
132
|
+
end
|
|
133
|
+
end
|
|
134
|
+
end
|
|
135
|
+
end
|
|
136
|
+
return ranges
|
|
137
|
+
end
|
|
138
|
+
end
|
|
139
|
+
```
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
|
|
2
|
+
# NE8000E-X8 系统信息
|
|
3
|
+
|
|
4
|
+
```ruby
|
|
5
|
+
@sign << ['NE8000E-X8', '系统版本']
|
|
6
|
+
@sign << ['NE8000E-X8', '版本']
|
|
7
|
+
@sign << ['NE8000E-X8', '补丁']
|
|
8
|
+
@sign << ['NE8000E-X8', '板卡']
|
|
9
|
+
|
|
10
|
+
module NE8000E_X8
|
|
11
|
+
module_function
|
|
12
|
+
|
|
13
|
+
def 系统版本 文本
|
|
14
|
+
info = {}
|
|
15
|
+
info['version'] = 版本 文本
|
|
16
|
+
info['patch'] = 补丁 文本
|
|
17
|
+
info['board'] = 板卡 文本
|
|
18
|
+
return info
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def 版本 文本
|
|
22
|
+
vrp = 文本.split("\n").find{|l|l.include?("VRP")}
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def 补丁 文本
|
|
26
|
+
patch = 文本.split("\n").find{|l|l.include?("Patch version")}.to_s.split(":")[-1]
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def 板卡 文本
|
|
30
|
+
head = ['Slot','Type','Online','Register','Status','Role','LsId','Primary'] + ['Pic','Status','Type','Port_count','Init_result','Logic_down']
|
|
31
|
+
raw1 = 文本.split("NE5000E's Device status:")[-1].split("\n<")[0].split("\n-------------------------------------------------------------------------------")[2].strip
|
|
32
|
+
tab1 = raw1.split("\n").map{|l|l.split(" ")}
|
|
33
|
+
raw2 = 文本.split("Pic-status information :")[-1].split("\n<")[0].split("\n-------------------------------------------------------------------------------")[2].strip
|
|
34
|
+
tab2 = raw2.split("\n").map{|l|l.split(" ")}[1..-1]
|
|
35
|
+
tab = [head]
|
|
36
|
+
tab1.each do|rec|
|
|
37
|
+
ext = tab2.select{|r|r[0].split("/")[0]==rec[0]}
|
|
38
|
+
if ext.size==0
|
|
39
|
+
tmp = rec + ['','','','','','']
|
|
40
|
+
tab << tmp
|
|
41
|
+
else
|
|
42
|
+
ext.each do|r|
|
|
43
|
+
tmp = rec + r[0..-1]
|
|
44
|
+
tab << tmp
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
return tab
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
```
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
|
|
2
|
+
# NE8100-X8 系统信息
|
|
3
|
+
|
|
4
|
+
```ruby
|
|
5
|
+
@sign << ['NE8100-X8', '系统版本']
|
|
6
|
+
@sign << ['NE8100-X8', '版本']
|
|
7
|
+
@sign << ['NE8100-X8', '补丁']
|
|
8
|
+
@sign << ['NE8100-X8', '板卡']
|
|
9
|
+
|
|
10
|
+
module NE8100_X8
|
|
11
|
+
module_function
|
|
12
|
+
|
|
13
|
+
def 系统版本 文本
|
|
14
|
+
info = {}
|
|
15
|
+
info['version'] = 版本 文本
|
|
16
|
+
info['patch'] = 补丁 文本
|
|
17
|
+
info['board'] = 板卡 文本
|
|
18
|
+
return info
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def 版本 文本
|
|
22
|
+
vrp = 文本.split("\n").find{|l|l.include?("VRP")}
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def 补丁 文本
|
|
26
|
+
patch = 文本.split("\n").find{|l|l.include?("Patch version")}.to_s.split(":")[-1]
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def 板卡 文本
|
|
30
|
+
head = ['Slot','Type','Online','Register','Status','Role','LsId','Primary'] + ['Pic','Status','Type','Port_count','Init_result','Logic_down']
|
|
31
|
+
raw1 = 文本.split("NE5000E's Device status:")[-1].split("\n<")[0].split("\n-------------------------------------------------------------------------------")[2].strip
|
|
32
|
+
tab1 = raw1.split("\n").map{|l|l.split(" ")}
|
|
33
|
+
raw2 = 文本.split("Pic-status information :")[-1].split("\n<")[0].split("\n-------------------------------------------------------------------------------")[2].strip
|
|
34
|
+
tab2 = raw2.split("\n").map{|l|l.split(" ")}[1..-1]
|
|
35
|
+
tab = [head]
|
|
36
|
+
tab1.each do|rec|
|
|
37
|
+
ext = tab2.select{|r|r[0].split("/")[0]==rec[0]}
|
|
38
|
+
if ext.size==0
|
|
39
|
+
tmp = rec + ['','','','','','']
|
|
40
|
+
tab << tmp
|
|
41
|
+
else
|
|
42
|
+
ext.each do|r|
|
|
43
|
+
tmp = rec + r[0..-1]
|
|
44
|
+
tab << tmp
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
return tab
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
```
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# NE8000E-X8 VPN
|
|
2
|
+
|
|
3
|
+
```ruby
|
|
4
|
+
@sign << ['NE8000E-X8', 'vpn_instance']
|
|
5
|
+
@sign << ['NE8000E-X8', 'evpn_instance']
|
|
6
|
+
@sign << ['NE8000E-X8', 'bridge_domain']
|
|
7
|
+
@sign << ['NE8000E-X8', 'if_bridge_domain']
|
|
8
|
+
|
|
9
|
+
module NE8000E_X8
|
|
10
|
+
module_function
|
|
11
|
+
|
|
12
|
+
def vpn_instance conf
|
|
13
|
+
doc = {}
|
|
14
|
+
vpn_family = 'ipv4-family'
|
|
15
|
+
conf.split("\n").each do|line|
|
|
16
|
+
doc['vpn-name'] = line.split('vpn-instance ').last.strip if line.include?('ip') && line.include?('vpn-instance')
|
|
17
|
+
vpn_family = 'ipv4-family' if line.include?('ipv4-family')
|
|
18
|
+
vpn_family = 'ipv6-family' if line.include?('ipv6-family')
|
|
19
|
+
doc[vpn_family] ||= {}
|
|
20
|
+
doc[vpn_family]['route-distinguisher'] = line.split('route-distinguisher ').last.strip if line.include?('route-distinguisher')
|
|
21
|
+
if line.include?('vpn-target')
|
|
22
|
+
family = line.include?('evpn') ? 'evpn' : vpn_family.split('-').first
|
|
23
|
+
direction = 'export' if line.include?('export')
|
|
24
|
+
direction = 'import' if line.include?('import')
|
|
25
|
+
words = line.split('vpn-target ').last.split(' ')
|
|
26
|
+
target = words.select{|w|!w.include?('community') && !w.include?('evpn') && !w.strip.empty?}.map{|w|w.strip}
|
|
27
|
+
doc[vpn_family][family] ||= {}
|
|
28
|
+
doc[vpn_family][family][direction] ||= []
|
|
29
|
+
doc[vpn_family][family][direction] += target
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
return doc
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def evpn_instance conf
|
|
36
|
+
doc = {}
|
|
37
|
+
conf.split("\n").each do|line|
|
|
38
|
+
doc['vpn-name'] = line.split('vpn-instance ')[-1].split(' ').first.strip if line.include?('evpn') && line.include?('vpn-instance')
|
|
39
|
+
doc['mode'] = 'bd-mode' if line.include?('bd-mode') && line.include?('vpn-instance')
|
|
40
|
+
doc['route-distinguisher'] = line.split('route-distinguisher ').last.strip if line.include?('route-distinguisher')
|
|
41
|
+
if line.include?('segment-routing')
|
|
42
|
+
doc['segment-routing'] ||= {}
|
|
43
|
+
family = line.include?('ipv6') ? 'ipv6-family' : 'ipv4-family'
|
|
44
|
+
doc['segment-routing'][family] ||= {}
|
|
45
|
+
doc['segment-routing'][family]['mode'] = 'best-effort' if line.include?('best-effort')
|
|
46
|
+
doc['segment-routing'][family]['locator'] = line.split('locator ').last.strip if line.include?('locator')
|
|
47
|
+
end
|
|
48
|
+
if line.include?('vpn-target')
|
|
49
|
+
direction = 'export' if line.include?('export')
|
|
50
|
+
direction = 'import' if line.include?('import')
|
|
51
|
+
words = line.split('vpn-target ').last.split(' ')
|
|
52
|
+
target = words.select{|w|!w.include?('community') && !w.include?('evpn') && !w.strip.empty?}.map{|w|w.strip}
|
|
53
|
+
doc['vpn-target'] ||= {}
|
|
54
|
+
doc['vpn-target'][direction] ||= []
|
|
55
|
+
doc['vpn-target'][direction] += target
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
return doc
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def bridge_domain bdconf
|
|
62
|
+
bd = {}
|
|
63
|
+
bdconf.split("\n").each do|line|
|
|
64
|
+
bd['bridge-domain'] = line.split(' ').last.strip if line.include?('bridge-domain')
|
|
65
|
+
bd['statistic'] = 'enable' if line.include?('statistic enable')
|
|
66
|
+
bd['evpn-instance'] = line.split("vpn-instance").last.strip if line.include?('vpn-instance')
|
|
67
|
+
end
|
|
68
|
+
return bd
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def if_bridge_domain ifconf
|
|
72
|
+
ifconf.split("\n").each do|line|
|
|
73
|
+
return line.split(' ').last.strip if line.include?('bridge-domain')
|
|
74
|
+
end
|
|
75
|
+
return nil
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
```
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# NE8100-X8 VPN
|
|
2
|
+
|
|
3
|
+
```ruby
|
|
4
|
+
@sign << ['NE8100-X8', 'vpn_instance']
|
|
5
|
+
@sign << ['NE8100-X8', 'evpn_instance']
|
|
6
|
+
@sign << ['NE8100-X8', 'bridge_domain']
|
|
7
|
+
@sign << ['NE8100-X8', 'if_bridge_domain']
|
|
8
|
+
|
|
9
|
+
module NE8100_X8
|
|
10
|
+
module_function
|
|
11
|
+
|
|
12
|
+
def vpn_instance conf
|
|
13
|
+
doc = {}
|
|
14
|
+
vpn_family = 'ipv4-family'
|
|
15
|
+
conf.split("\n").each do|line|
|
|
16
|
+
doc['vpn-name'] = line.split('vpn-instance ').last.strip if line.include?('ip') && line.include?('vpn-instance')
|
|
17
|
+
vpn_family = 'ipv4-family' if line.include?('ipv4-family')
|
|
18
|
+
vpn_family = 'ipv6-family' if line.include?('ipv6-family')
|
|
19
|
+
doc[vpn_family] ||= {}
|
|
20
|
+
doc[vpn_family]['route-distinguisher'] = line.split('route-distinguisher ').last.strip if line.include?('route-distinguisher')
|
|
21
|
+
if line.include?('vpn-target')
|
|
22
|
+
family = line.include?('evpn') ? 'evpn' : vpn_family.split('-').first
|
|
23
|
+
direction = 'export' if line.include?('export')
|
|
24
|
+
direction = 'import' if line.include?('import')
|
|
25
|
+
words = line.split('vpn-target ').last.split(' ')
|
|
26
|
+
target = words.select{|w|!w.include?('community') && !w.include?('evpn') && !w.strip.empty?}.map{|w|w.strip}
|
|
27
|
+
doc[vpn_family][family] ||= {}
|
|
28
|
+
doc[vpn_family][family][direction] ||= []
|
|
29
|
+
doc[vpn_family][family][direction] += target
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
return doc
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def evpn_instance conf
|
|
36
|
+
doc = {}
|
|
37
|
+
conf.split("\n").each do|line|
|
|
38
|
+
doc['vpn-name'] = line.split('vpn-instance ')[-1].split(' ').first.strip if line.include?('evpn') && line.include?('vpn-instance')
|
|
39
|
+
doc['mode'] = 'bd-mode' if line.include?('bd-mode') && line.include?('vpn-instance')
|
|
40
|
+
doc['route-distinguisher'] = line.split('route-distinguisher ').last.strip if line.include?('route-distinguisher')
|
|
41
|
+
if line.include?('segment-routing')
|
|
42
|
+
doc['segment-routing'] ||= {}
|
|
43
|
+
family = line.include?('ipv6') ? 'ipv6-family' : 'ipv4-family'
|
|
44
|
+
doc['segment-routing'][family] ||= {}
|
|
45
|
+
doc['segment-routing'][family]['mode'] = 'best-effort' if line.include?('best-effort')
|
|
46
|
+
doc['segment-routing'][family]['locator'] = line.split('locator ').last.strip if line.include?('locator')
|
|
47
|
+
end
|
|
48
|
+
if line.include?('vpn-target')
|
|
49
|
+
direction = 'export' if line.include?('export')
|
|
50
|
+
direction = 'import' if line.include?('import')
|
|
51
|
+
words = line.split('vpn-target ').last.split(' ')
|
|
52
|
+
target = words.select{|w|!w.include?('community') && !w.include?('evpn') && !w.strip.empty?}.map{|w|w.strip}
|
|
53
|
+
doc['vpn-target'] ||= {}
|
|
54
|
+
doc['vpn-target'][direction] ||= []
|
|
55
|
+
doc['vpn-target'][direction] += target
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
return doc
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def bridge_domain bdconf
|
|
62
|
+
bd = {}
|
|
63
|
+
bdconf.split("\n").each do|line|
|
|
64
|
+
bd['bridge-domain'] = line.split(' ').last.strip if line.include?('bridge-domain')
|
|
65
|
+
bd['statistic'] = 'enable' if line.include?('statistic enable')
|
|
66
|
+
bd['evpn-instance'] = line.split("vpn-instance").last.strip if line.include?('vpn-instance')
|
|
67
|
+
end
|
|
68
|
+
return bd
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def if_bridge_domain ifconf
|
|
72
|
+
ifconf.split("\n").each do|line|
|
|
73
|
+
return line.split(' ').last.strip if line.include?('bridge-domain')
|
|
74
|
+
end
|
|
75
|
+
return nil
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
```
|
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.11
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Matt
|
|
@@ -94,7 +94,9 @@ files:
|
|
|
94
94
|
- document/bgp-NE5000E-20.md
|
|
95
95
|
- document/bgp-NE5000E-X16.md
|
|
96
96
|
- document/bgp-NE5000E-X16A.md
|
|
97
|
+
- document/bgp-NE8000E-X8.md
|
|
97
98
|
- document/bgp-NE80E.md
|
|
99
|
+
- document/bgp-NE8100-X8.md
|
|
98
100
|
- document/bgp-T8000-18.md
|
|
99
101
|
- document/bgp-ZXCTN9000-18EA.md
|
|
100
102
|
- document/bgp-ZXCTN9000-8EA.md
|
|
@@ -277,10 +279,14 @@ files:
|
|
|
277
279
|
- document/system-NE5000E-20.md
|
|
278
280
|
- document/system-NE5000E-X16.md
|
|
279
281
|
- document/system-NE5000E-X16A.md
|
|
282
|
+
- document/system-NE8000E-X8.md
|
|
280
283
|
- document/system-NE80E.md
|
|
284
|
+
- document/system-NE8100-X8.md
|
|
281
285
|
- document/telnet.md
|
|
282
286
|
- document/vpn-CX600-X16A.md
|
|
283
287
|
- document/vpn-CX600-X8A.md
|
|
288
|
+
- document/vpn-NE8000E-X8.md
|
|
289
|
+
- document/vpn-NE8100-X8.md
|
|
284
290
|
- document/vpn-ZXCTN9000-18EA.md
|
|
285
291
|
- document/vpn-ZXCTN9000-8EA.md
|
|
286
292
|
- network.rb
|