network-utility 2.0.9 → 2.0.10
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-CX600-X16A.md +2 -2
- data/document/bgp-CX600-X8A.md +2 -2
- data/document/bgp-ME60-16.md +2 -2
- data/document/bgp-ME60-X16.md +2 -2
- data/document/bgp-NE40E-X16.md +2 -2
- data/document/bgp-NE40E-X16A.md +2 -2
- data/document/bgp-NE40E-X8.md +2 -2
- data/document/bgp-NE40E.md +111 -0
- data/document/bgp-NE5000E-20.md +2 -2
- data/document/bgp-NE5000E-X16.md +2 -2
- data/document/bgp-NE5000E-X16A.md +2 -2
- data/document/bgp-NE80E.md +111 -0
- data/network.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 929c274aa699c68f118072411a17e530ded66edb4e67db3c2571f552ce648bdf
|
|
4
|
+
data.tar.gz: 0a40495971f768bb4069f5b03a7900b49fb6f98599eec6d998e60cd4548cc4a6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e695e5cc3d7cc53b40cdb20a0867c86aeed12bd7b7cd9f1832e8693fc8aa26492fcc2eeacc80cbe10d6cfb7cf8150e695122472b943141b8ced813643d219f4d
|
|
7
|
+
data.tar.gz: 589671add2f94e6f9389fdd213f75696fc35f92e4db334e1da7a4bbb285617ea47df04b5bd294bb42724cc5fc857af93c0d47fc48b37bfdc160714132a874114
|
data/document/bgp-CX600-X16A.md
CHANGED
|
@@ -39,10 +39,10 @@ module CX600_X16A
|
|
|
39
39
|
words = line.split(' ')
|
|
40
40
|
attribute = words[0]
|
|
41
41
|
value = words[1..-1].join(" ")
|
|
42
|
+
bgp[attribute] ||= []
|
|
42
43
|
if value.empty?
|
|
43
|
-
bgp[attribute]
|
|
44
|
+
bgp[attribute] << true
|
|
44
45
|
else
|
|
45
|
-
bgp[attribute] ||= []
|
|
46
46
|
bgp[attribute] << value
|
|
47
47
|
end
|
|
48
48
|
end
|
data/document/bgp-CX600-X8A.md
CHANGED
|
@@ -39,10 +39,10 @@ module CX600_X8A
|
|
|
39
39
|
words = line.split(' ')
|
|
40
40
|
attribute = words[0]
|
|
41
41
|
value = words[1..-1].join(" ")
|
|
42
|
+
bgp[attribute] ||= []
|
|
42
43
|
if value.empty?
|
|
43
|
-
bgp[attribute]
|
|
44
|
+
bgp[attribute] << true
|
|
44
45
|
else
|
|
45
|
-
bgp[attribute] ||= []
|
|
46
46
|
bgp[attribute] << value
|
|
47
47
|
end
|
|
48
48
|
end
|
data/document/bgp-ME60-16.md
CHANGED
|
@@ -39,10 +39,10 @@ module ME60_16
|
|
|
39
39
|
words = line.split(' ')
|
|
40
40
|
attribute = words[0]
|
|
41
41
|
value = words[1..-1].join(" ")
|
|
42
|
+
bgp[attribute] ||= []
|
|
42
43
|
if value.empty?
|
|
43
|
-
bgp[attribute]
|
|
44
|
+
bgp[attribute] << true
|
|
44
45
|
else
|
|
45
|
-
bgp[attribute] ||= []
|
|
46
46
|
bgp[attribute] << value
|
|
47
47
|
end
|
|
48
48
|
end
|
data/document/bgp-ME60-X16.md
CHANGED
|
@@ -39,10 +39,10 @@ module ME60_X16
|
|
|
39
39
|
words = line.split(' ')
|
|
40
40
|
attribute = words[0]
|
|
41
41
|
value = words[1..-1].join(" ")
|
|
42
|
+
bgp[attribute] ||= []
|
|
42
43
|
if value.empty?
|
|
43
|
-
bgp[attribute]
|
|
44
|
+
bgp[attribute] << true
|
|
44
45
|
else
|
|
45
|
-
bgp[attribute] ||= []
|
|
46
46
|
bgp[attribute] << value
|
|
47
47
|
end
|
|
48
48
|
end
|
data/document/bgp-NE40E-X16.md
CHANGED
|
@@ -39,10 +39,10 @@ module NE40E_X16
|
|
|
39
39
|
words = line.split(' ')
|
|
40
40
|
attribute = words[0]
|
|
41
41
|
value = words[1..-1].join(" ")
|
|
42
|
+
bgp[attribute] ||= []
|
|
42
43
|
if value.empty?
|
|
43
|
-
bgp[attribute]
|
|
44
|
+
bgp[attribute] << true
|
|
44
45
|
else
|
|
45
|
-
bgp[attribute] ||= []
|
|
46
46
|
bgp[attribute] << value
|
|
47
47
|
end
|
|
48
48
|
end
|
data/document/bgp-NE40E-X16A.md
CHANGED
|
@@ -39,10 +39,10 @@ module NE40E_X16A
|
|
|
39
39
|
words = line.split(' ')
|
|
40
40
|
attribute = words[0]
|
|
41
41
|
value = words[1..-1].join(" ")
|
|
42
|
+
bgp[attribute] ||= []
|
|
42
43
|
if value.empty?
|
|
43
|
-
bgp[attribute]
|
|
44
|
+
bgp[attribute] << true
|
|
44
45
|
else
|
|
45
|
-
bgp[attribute] ||= []
|
|
46
46
|
bgp[attribute] << value
|
|
47
47
|
end
|
|
48
48
|
end
|
data/document/bgp-NE40E-X8.md
CHANGED
|
@@ -39,10 +39,10 @@ module NE40E_X8
|
|
|
39
39
|
words = line.split(' ')
|
|
40
40
|
attribute = words[0]
|
|
41
41
|
value = words[1..-1].join(" ")
|
|
42
|
+
bgp[attribute] ||= []
|
|
42
43
|
if value.empty?
|
|
43
|
-
bgp[attribute]
|
|
44
|
+
bgp[attribute] << true
|
|
44
45
|
else
|
|
45
|
-
bgp[attribute] ||= []
|
|
46
46
|
bgp[attribute] << value
|
|
47
47
|
end
|
|
48
48
|
end
|
data/document/bgp-NE40E.md
CHANGED
|
@@ -2,11 +2,122 @@
|
|
|
2
2
|
# NE40E BGP
|
|
3
3
|
|
|
4
4
|
```ruby
|
|
5
|
+
@sign << ['NE40E', 'bgp']
|
|
6
|
+
@sign << ['NE40E', 'bgp地址族']
|
|
5
7
|
@sign << ['NE40E', '宣告网段解析']
|
|
6
8
|
|
|
7
9
|
module NE40E
|
|
8
10
|
module_function
|
|
9
11
|
|
|
12
|
+
def bgp bgp配置
|
|
13
|
+
address_family, non_af_conf = self.bgp地址族 bgp配置
|
|
14
|
+
bgp, afs = {}, {}
|
|
15
|
+
non_af_conf.each do|line|
|
|
16
|
+
if line.strip[0..4]=='group'
|
|
17
|
+
groupname,mode = line.split(' ')[1..2]
|
|
18
|
+
bgp['group'] ||= {}
|
|
19
|
+
bgp['group'][groupname] ||= {}
|
|
20
|
+
bgp['group'][groupname].merge!('mode' => mode)
|
|
21
|
+
elsif line.strip[0..3]=='peer'
|
|
22
|
+
afname = 'global'
|
|
23
|
+
words = line.split(' ')
|
|
24
|
+
peername,attribute = words[1..2]
|
|
25
|
+
value = words[3..-1].join(" ")
|
|
26
|
+
afs[afname] ||= {}
|
|
27
|
+
afs[afname]['peer'] ||= {}
|
|
28
|
+
afs[afname]['peer'][peername] ||= {}
|
|
29
|
+
if value.empty?
|
|
30
|
+
afs[afname]['peer'][peername][attribute] = true
|
|
31
|
+
else
|
|
32
|
+
unless afs[afname]['peer'][peername]
|
|
33
|
+
afs[afname]['peer'][peername][attribute] ||= []
|
|
34
|
+
afs[afname]['peer'][peername][attribute] << value
|
|
35
|
+
else
|
|
36
|
+
afs[afname]['peer'][peername][attribute] = value
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
else
|
|
40
|
+
words = line.split(' ')
|
|
41
|
+
attribute = words[0]
|
|
42
|
+
value = words[1..-1].join(" ")
|
|
43
|
+
bgp[attribute] ||= []
|
|
44
|
+
if value.empty?
|
|
45
|
+
bgp[attribute] << true
|
|
46
|
+
else
|
|
47
|
+
bgp[attribute] << value
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
address_family.each do|afname, afconf|
|
|
52
|
+
afs[afname] ||= {}
|
|
53
|
+
afconf.each do|line|
|
|
54
|
+
if line.strip[0..3]=='peer'
|
|
55
|
+
words = line.split(' ')
|
|
56
|
+
peername,attribute = words[1..2]
|
|
57
|
+
value = words[3..-1].join(" ")
|
|
58
|
+
if (bgp['group']||{})[peername]
|
|
59
|
+
if value.empty?
|
|
60
|
+
bgp['group'][peername][attribute] = true
|
|
61
|
+
else
|
|
62
|
+
bgp['group'][peername][attribute] ||= []
|
|
63
|
+
bgp['group'][peername][attribute] << value
|
|
64
|
+
end
|
|
65
|
+
else
|
|
66
|
+
afs[afname]['peer'] ||= {}
|
|
67
|
+
afs[afname]['peer'][peername] ||= {}
|
|
68
|
+
if value.empty?
|
|
69
|
+
afs[afname]['peer'][peername][attribute] = true
|
|
70
|
+
else
|
|
71
|
+
afs[afname]['peer'][peername][attribute] ||= []
|
|
72
|
+
afs[afname]['peer'][peername][attribute] << value
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
elsif line.strip[0..4]=='group'
|
|
76
|
+
groupname = line.split(' ')[1]
|
|
77
|
+
bgp['group'] ||= {}
|
|
78
|
+
bgp['group'][groupname] ||= {}
|
|
79
|
+
else
|
|
80
|
+
words = line.split(' ')
|
|
81
|
+
attribute = words[0]
|
|
82
|
+
value = words[1..-1].join(" ")
|
|
83
|
+
if value.empty?
|
|
84
|
+
afs[afname][attribute] = true
|
|
85
|
+
else
|
|
86
|
+
afs[afname][attribute] ||= []
|
|
87
|
+
afs[afname][attribute] << value
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
bgp.merge!('address-family'=>afs)
|
|
93
|
+
return bgp
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
def bgp地址族 bgp配置
|
|
97
|
+
address_family = {};non_af_conf = []
|
|
98
|
+
af_begin = false; af_name = 'global'
|
|
99
|
+
bgp配置.join("\n").split("\n").each do|line|
|
|
100
|
+
if line[0..11]==' ipv4-family' || line[0..11]==' ipv6-family'
|
|
101
|
+
af_begin = true
|
|
102
|
+
af_name = line.strip.gsub(' ','-')
|
|
103
|
+
address_family[af_name] ||= []
|
|
104
|
+
end
|
|
105
|
+
if line[0..1]==' #' # af_end
|
|
106
|
+
af_begin = false
|
|
107
|
+
af_name = 'global'
|
|
108
|
+
elsif line[0]=='#' # bgp_end or no-finisher
|
|
109
|
+
af_begin = false
|
|
110
|
+
af_name = 'global'
|
|
111
|
+
end
|
|
112
|
+
if af_begin
|
|
113
|
+
address_family[af_name] << line
|
|
114
|
+
else
|
|
115
|
+
non_af_conf << line unless line==' #'
|
|
116
|
+
end
|
|
117
|
+
end
|
|
118
|
+
return address_family, non_af_conf
|
|
119
|
+
end
|
|
120
|
+
|
|
10
121
|
def 宣告网段解析 配置散列
|
|
11
122
|
ranges = []
|
|
12
123
|
配置散列['bgp'].each do|segment|
|
data/document/bgp-NE5000E-20.md
CHANGED
|
@@ -39,10 +39,10 @@ module NE5000E_20
|
|
|
39
39
|
words = line.split(' ')
|
|
40
40
|
attribute = words[0]
|
|
41
41
|
value = words[1..-1].join(" ")
|
|
42
|
+
bgp[attribute] ||= []
|
|
42
43
|
if value.empty?
|
|
43
|
-
bgp[attribute]
|
|
44
|
+
bgp[attribute] << true
|
|
44
45
|
else
|
|
45
|
-
bgp[attribute] ||= []
|
|
46
46
|
bgp[attribute] << value
|
|
47
47
|
end
|
|
48
48
|
end
|
data/document/bgp-NE5000E-X16.md
CHANGED
|
@@ -39,10 +39,10 @@ module NE5000E_X16
|
|
|
39
39
|
words = line.split(' ')
|
|
40
40
|
attribute = words[0]
|
|
41
41
|
value = words[1..-1].join(" ")
|
|
42
|
+
bgp[attribute] ||= []
|
|
42
43
|
if value.empty?
|
|
43
|
-
bgp[attribute]
|
|
44
|
+
bgp[attribute] << true
|
|
44
45
|
else
|
|
45
|
-
bgp[attribute] ||= []
|
|
46
46
|
bgp[attribute] << value
|
|
47
47
|
end
|
|
48
48
|
end
|
|
@@ -39,10 +39,10 @@ module NE5000E_X16A
|
|
|
39
39
|
words = line.split(' ')
|
|
40
40
|
attribute = words[0]
|
|
41
41
|
value = words[1..-1].join(" ")
|
|
42
|
+
bgp[attribute] ||= []
|
|
42
43
|
if value.empty?
|
|
43
|
-
bgp[attribute]
|
|
44
|
+
bgp[attribute] << true
|
|
44
45
|
else
|
|
45
|
-
bgp[attribute] ||= []
|
|
46
46
|
bgp[attribute] << value
|
|
47
47
|
end
|
|
48
48
|
end
|
data/document/bgp-NE80E.md
CHANGED
|
@@ -2,11 +2,122 @@
|
|
|
2
2
|
# NE80E BGP
|
|
3
3
|
|
|
4
4
|
```ruby
|
|
5
|
+
@sign << ['NE80E', 'bgp']
|
|
6
|
+
@sign << ['NE80E', 'bgp地址族']
|
|
5
7
|
@sign << ['NE80E', '宣告网段解析']
|
|
6
8
|
|
|
7
9
|
module NE80E
|
|
8
10
|
module_function
|
|
9
11
|
|
|
12
|
+
def bgp bgp配置
|
|
13
|
+
address_family, non_af_conf = self.bgp地址族 bgp配置
|
|
14
|
+
bgp, afs = {}, {}
|
|
15
|
+
non_af_conf.each do|line|
|
|
16
|
+
if line.strip[0..4]=='group'
|
|
17
|
+
groupname,mode = line.split(' ')[1..2]
|
|
18
|
+
bgp['group'] ||= {}
|
|
19
|
+
bgp['group'][groupname] ||= {}
|
|
20
|
+
bgp['group'][groupname].merge!('mode' => mode)
|
|
21
|
+
elsif line.strip[0..3]=='peer'
|
|
22
|
+
afname = 'global'
|
|
23
|
+
words = line.split(' ')
|
|
24
|
+
peername,attribute = words[1..2]
|
|
25
|
+
value = words[3..-1].join(" ")
|
|
26
|
+
afs[afname] ||= {}
|
|
27
|
+
afs[afname]['peer'] ||= {}
|
|
28
|
+
afs[afname]['peer'][peername] ||= {}
|
|
29
|
+
if value.empty?
|
|
30
|
+
afs[afname]['peer'][peername][attribute] = true
|
|
31
|
+
else
|
|
32
|
+
unless afs[afname]['peer'][peername]
|
|
33
|
+
afs[afname]['peer'][peername][attribute] ||= []
|
|
34
|
+
afs[afname]['peer'][peername][attribute] << value
|
|
35
|
+
else
|
|
36
|
+
afs[afname]['peer'][peername][attribute] = value
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
else
|
|
40
|
+
words = line.split(' ')
|
|
41
|
+
attribute = words[0]
|
|
42
|
+
value = words[1..-1].join(" ")
|
|
43
|
+
bgp[attribute] ||= []
|
|
44
|
+
if value.empty?
|
|
45
|
+
bgp[attribute] << true
|
|
46
|
+
else
|
|
47
|
+
bgp[attribute] << value
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
address_family.each do|afname, afconf|
|
|
52
|
+
afs[afname] ||= {}
|
|
53
|
+
afconf.each do|line|
|
|
54
|
+
if line.strip[0..3]=='peer'
|
|
55
|
+
words = line.split(' ')
|
|
56
|
+
peername,attribute = words[1..2]
|
|
57
|
+
value = words[3..-1].join(" ")
|
|
58
|
+
if (bgp['group']||{})[peername]
|
|
59
|
+
if value.empty?
|
|
60
|
+
bgp['group'][peername][attribute] = true
|
|
61
|
+
else
|
|
62
|
+
bgp['group'][peername][attribute] ||= []
|
|
63
|
+
bgp['group'][peername][attribute] << value
|
|
64
|
+
end
|
|
65
|
+
else
|
|
66
|
+
afs[afname]['peer'] ||= {}
|
|
67
|
+
afs[afname]['peer'][peername] ||= {}
|
|
68
|
+
if value.empty?
|
|
69
|
+
afs[afname]['peer'][peername][attribute] = true
|
|
70
|
+
else
|
|
71
|
+
afs[afname]['peer'][peername][attribute] ||= []
|
|
72
|
+
afs[afname]['peer'][peername][attribute] << value
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
elsif line.strip[0..4]=='group'
|
|
76
|
+
groupname = line.split(' ')[1]
|
|
77
|
+
bgp['group'] ||= {}
|
|
78
|
+
bgp['group'][groupname] ||= {}
|
|
79
|
+
else
|
|
80
|
+
words = line.split(' ')
|
|
81
|
+
attribute = words[0]
|
|
82
|
+
value = words[1..-1].join(" ")
|
|
83
|
+
if value.empty?
|
|
84
|
+
afs[afname][attribute] = true
|
|
85
|
+
else
|
|
86
|
+
afs[afname][attribute] ||= []
|
|
87
|
+
afs[afname][attribute] << value
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
bgp.merge!('address-family'=>afs)
|
|
93
|
+
return bgp
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
def bgp地址族 bgp配置
|
|
97
|
+
address_family = {};non_af_conf = []
|
|
98
|
+
af_begin = false; af_name = 'global'
|
|
99
|
+
bgp配置.join("\n").split("\n").each do|line|
|
|
100
|
+
if line[0..11]==' ipv4-family' || line[0..11]==' ipv6-family'
|
|
101
|
+
af_begin = true
|
|
102
|
+
af_name = line.strip.gsub(' ','-')
|
|
103
|
+
address_family[af_name] ||= []
|
|
104
|
+
end
|
|
105
|
+
if line[0..1]==' #' # af_end
|
|
106
|
+
af_begin = false
|
|
107
|
+
af_name = 'global'
|
|
108
|
+
elsif line[0]=='#' # bgp_end or no-finisher
|
|
109
|
+
af_begin = false
|
|
110
|
+
af_name = 'global'
|
|
111
|
+
end
|
|
112
|
+
if af_begin
|
|
113
|
+
address_family[af_name] << line
|
|
114
|
+
else
|
|
115
|
+
non_af_conf << line unless line==' #'
|
|
116
|
+
end
|
|
117
|
+
end
|
|
118
|
+
return address_family, non_af_conf
|
|
119
|
+
end
|
|
120
|
+
|
|
10
121
|
def 宣告网段解析 配置散列
|
|
11
122
|
ranges = []
|
|
12
123
|
配置散列['bgp'].each do|segment|
|
data/network.rb
CHANGED