network-utility 2.0.7 → 2.0.9

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.
@@ -0,0 +1,139 @@
1
+ # CX600-X16A bgp
2
+
3
+ ```ruby
4
+ @sign << ['CX600-X16A', 'bgp']
5
+ @sign << ['CX600-X16A', 'bgp地址族']
6
+ @sign << ['CX600-X16A', '宣告网段解析']
7
+
8
+ module CX600_X16A
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
+ if value.empty?
43
+ bgp[attribute] = true
44
+ else
45
+ bgp[attribute] ||= []
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
+ # CX600-X8A bgp
2
+
3
+ ```ruby
4
+ @sign << ['CX600-X8A', 'bgp']
5
+ @sign << ['CX600-X8A', 'bgp地址族']
6
+ @sign << ['CX600-X8A', '宣告网段解析']
7
+
8
+ module CX600_X8A
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
+ if value.empty?
43
+ bgp[attribute] = true
44
+ else
45
+ bgp[attribute] ||= []
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,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
+ ```