network-utility 1.1.41 → 1.1.43

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c79aaf431b6b0fbd78ead56c7d918e5ff9e9d2181e775e7445691b1d43fc8eac
4
- data.tar.gz: d03798c42ebc1169be66dc7490f4fb3f286616bc54158e68f34f9a7bc8633565
3
+ metadata.gz: efefda6c8d40e86b6cbf5721bce9069fc335e2593e7bc53245538738fac87643
4
+ data.tar.gz: f5e98f9ada324bdcb1df2bb108bb5bb2cd59408d7b5ab4cd31631c1eefc27a8b
5
5
  SHA512:
6
- metadata.gz: d3f84eab160e9cf82a3d4da552e22ffd45235507bf4e745ab55c6785bad035343759cacc4cbbee0aa57f43a8d38d52c35fdb52e8e071267ad0bedeed1d81771a
7
- data.tar.gz: e007aba82c8ea5141813da5644bb16a193b3586fa5ffd9a324226563b0201b921d6f6c24ef2e82148917649ff1fa7433a077369b79b5cda2d7a4db59d88eb4f5
6
+ metadata.gz: 5b590eb785a6bbf02cf5b7b7011f2f80e23210ff855e52ad241f2ef4a955c23a3a8eaf38998f58042a34ecd153a95cc1488a9741efc665b0dddaa9c418fe86d4
7
+ data.tar.gz: 298bf7e8f4da077a4fbb3643cbb0dafd802173d435457c3f462058cc62c87956d5f074cc370d4d194ed25baa742850fccf17ae62e939bdb00cf190f39a87c45a
@@ -0,0 +1,26 @@
1
+ # T8000-18 访问控制列表
2
+
3
+ ```ruby
4
+ @sign << ['T8000-18', 'ACL']
5
+
6
+ module T8000_18
7
+ module_function
8
+
9
+ def ACL config
10
+ table = {}
11
+ name = nil
12
+ config.split("\n").each do|line|
13
+ name = line.split('ipv4-access-list')[1].strip if line.include?('ipv4-access-list')
14
+ name = line.split('ipv6-access-list')[1].strip if line.include?('ipv6-access-list')
15
+ name = line.split('link-access-list')[1].strip if line.include?('link-access-list')
16
+ table[name] ||= {}
17
+ if line.include?('rule')
18
+ rule = line.split(' ')
19
+ table[name][rule[1].to_i] = rule[2..-1]
20
+ end
21
+ end
22
+ table.delete(nil)
23
+ return table
24
+ end
25
+ end
26
+ ```
data/document/document.rb CHANGED
@@ -24,4 +24,74 @@ class Array
24
24
  proc.call code
25
25
  end
26
26
  end
27
- end
27
+ end
28
+
29
+ module Doc
30
+ module_function
31
+ def build paths, option={}
32
+ # custom: :active, runtime: :runtime|:static, select: @sign
33
+ params = {custom: nil, runtime: :runtime, dir: nil}.merge(option)
34
+ custom = params[:custom] # if custom then {custom: :active} else do nothing
35
+ runtime = params[:runtime] # if runtime then {runtime: :runtime} else {runtime: :static}
36
+ build = ""
37
+ @sign = []
38
+ paths.each do|path|
39
+ codes = path.refine(custom)
40
+ codes.run{|code|eval(code)} if runtime==:runtime
41
+ codes.map{|code|build<<code+"\n\n"} if runtime==:static
42
+ if params[:dir] && runtime==:static
43
+ Dir.mkdir('document') unless File.exist?('document')
44
+ File.write path.gsub('.md','.rb'), codes.join("\n\n")
45
+ end
46
+ end
47
+ warning = $VERBOSE
48
+ $VERBOSE = nil
49
+ @sign.map{|ms|(eval "::#{ms[0].gsub('-','_')} = #{ms[0].gsub('-','_')}")}
50
+ $VERBOSE = warning
51
+ File.write "build.rb", build if !params[:dir] && runtime==:static
52
+ return @sign
53
+ end
54
+
55
+ def load paths
56
+ File.write "_@sign_.rb","@sign = []"
57
+ require './_@sign_'
58
+ File.delete "./_@sign_.rb"
59
+ Kernel.instance_variable_set(:@sign,[])
60
+ if paths.is_a?(Array)
61
+ paths.each{|path|require "./"+path.gsub('.md','.rb')}
62
+ else
63
+ require "./"+paths.gsub('.md','.rb')
64
+ end
65
+ return @sign
66
+ end
67
+
68
+ def reload option={
69
+ # runtime: :static, if use runtime: :runtime, wont make doc files
70
+ # config: 'document.txt', each line is a path of reference module file
71
+ # document: [], path set of original module files
72
+ # expansion: [], path set of extension module files
73
+ }
74
+ parameters = {runtime: :static, config: 'document.txt'}.merge(option)
75
+ if File.exist?(parameters[:config])
76
+ paths = File.read(parameters[:config]).split("\n")
77
+ Doc.build paths, runtime: :static, dir: :yes
78
+ Doc.load paths
79
+ end
80
+ if File.exist?(parameters[:document])
81
+ paths = parameters[:document]
82
+ Doc.build paths, runtime: :static, dir: :yes
83
+ Doc.load paths
84
+ end
85
+ if parameters[:expansion]
86
+ paths = parameters[:expansion]
87
+ Doc.build paths, custom: :active, runtime: :static, dir: :yes
88
+ Doc.load paths
89
+ end
90
+ end
91
+
92
+ def path
93
+ Dir["#{$_DOC_PATH_}/document/*.md"].map{|d|d.split('/')[-2..-1].join("/")}
94
+ end
95
+ end
96
+
97
+ $_DOC_PATH_ = Pathname.new(__FILE__).realpath.join('..', '..')
@@ -0,0 +1,74 @@
1
+
2
+ # CX600-X16A FlexE
3
+
4
+ ```ruby
5
+ @sign << ['CX600-X16A', 'flexe_client']
6
+ @sign << ['CX600-X16A', 'flexe_enable']
7
+ @sign << ['CX600-X16A', 'flexe_group']
8
+ @sign << ['CX600-X16A', 'flexe_genport']
9
+
10
+ module CX600_X16A
11
+ module_function
12
+
13
+ def flexe_client confs
14
+ table = []
15
+ instances = (confs||[]).select{|c|c.include?('flexe client-instance ')}
16
+ instances.each do|instance|
17
+ fc = {}
18
+ instance.split("\n").each do|line|
19
+ if line.include?('flexe client-instance ')
20
+ fc['name'] = line.split('flexe client-instance ').last.split(' ').first.to_s.strip
21
+ fc['group'] = line.split('flexe-group ').last.split(' ').first.to_s.strip
22
+ fc['type'] = line.split('flexe-type ').last.split(' ').first.to_s.strip
23
+ fc['port-id'] = line.split('port-id ').last.to_s.strip
24
+ end
25
+ if line.include?('flexe-clientid ')
26
+ fc['client-id'] = line.split('flexe-clientid ').last.to_s.strip
27
+ end
28
+ if line.include?('binding interface ')
29
+ fc['binding-if'] = line.split('binding interface ').last.split(' ').first.to_s.strip
30
+ ts = line.split('time-slot ').last.split(' ').first.to_s.strip
31
+ # TODO: subts = line.split('sub-time-slot ').last.to_s.strip
32
+ fc['time-slot'] = []
33
+ ts.split(',').each do|ts_part|
34
+ if ts_part.include?('-')
35
+ h,d = ts_part.split('-')
36
+ fc['time-slot'] << (h.to_i .. d.to_i)
37
+ else
38
+ fc['time-slot'] << ts_part.to_i
39
+ end
40
+ end
41
+ end
42
+ end
43
+ table << fc
44
+ end
45
+ return table
46
+ end
47
+
48
+ def flexe_enable confs
49
+ enables = (confs||[]).select{|c|c.include?('flexe enable ')}
50
+ enables.map{|enable|enable.split("\n").map{|fp|fp.split(' port ').last}}.flatten
51
+ end
52
+
53
+ def flexe_group confs
54
+ table = []
55
+ groups = (confs||[]).select{|c|c.include?('flexe group ')}
56
+ groups.each do|group|
57
+ fg = {}
58
+ group.split("\n").each do|line|
59
+ fg['name'] = line.split('flexe group').last.to_s.strip if line.include?('flexe group ')
60
+ fg['num'] = line.split('flexe-groupnum').last.to_s.strip if line.include?('flexe-groupnum ')
61
+ fg['binding-if'] = line.split('binding interface').last.to_s.strip if line.include?('binding interface ')
62
+ end
63
+ table << fg
64
+ end
65
+ return table
66
+ end
67
+
68
+ def flexe_genport flexe_client_info
69
+ slot, subslot, _port = flexe_client_info['binding-if'].match(/\d+\/\d+\/\d+/).to_s.split('/')
70
+ port = flexe_client_info['port-id']
71
+ return "FlexE#{slot}/#{subslot}/#{port}"
72
+ end
73
+ end
74
+ ```
@@ -0,0 +1,73 @@
1
+ # CX600-X8A FlexE
2
+
3
+ ```ruby
4
+ @sign << ['CX600-X8A', 'flexe_client']
5
+ @sign << ['CX600-X8A', 'flexe_enable']
6
+ @sign << ['CX600-X8A', 'flexe_group']
7
+ @sign << ['CX600-X8A', 'flexe_genport']
8
+
9
+ module CX600_X8A
10
+ module_function
11
+
12
+ def flexe_client confs
13
+ table = []
14
+ instances = (confs||[]).select{|c|c.include?('flexe client-instance ')}
15
+ instances.each do|instance|
16
+ fc = {}
17
+ instance.split("\n").each do|line|
18
+ if line.include?('flexe client-instance ')
19
+ fc['name'] = line.split('flexe client-instance ').last.split(' ').first.to_s.strip
20
+ fc['group'] = line.split('flexe-group ').last.split(' ').first.to_s.strip
21
+ fc['type'] = line.split('flexe-type ').last.split(' ').first.to_s.strip
22
+ fc['port-id'] = line.split('port-id ').last.to_s.strip
23
+ end
24
+ if line.include?('flexe-clientid ')
25
+ fc['client-id'] = line.split('flexe-clientid ').last.to_s.strip
26
+ end
27
+ if line.include?('binding interface ')
28
+ fc['binding-if'] = line.split('binding interface ').last.split(' ').first.to_s.strip
29
+ ts = line.split('time-slot ').last.split(' ').first.to_s.strip
30
+ # TODO: subts = line.split('sub-time-slot ').last.to_s.strip
31
+ fc['time-slot'] = []
32
+ ts.split(',').each do|ts_part|
33
+ if ts_part.include?('-')
34
+ h,d = ts_part.split('-')
35
+ fc['time-slot'] << (h.to_i .. d.to_i)
36
+ else
37
+ fc['time-slot'] << ts_part.to_i
38
+ end
39
+ end
40
+ end
41
+ end
42
+ table << fc
43
+ end
44
+ return table
45
+ end
46
+
47
+ def flexe_enable confs
48
+ enables = (confs||[]).select{|c|c.include?('flexe enable ')}
49
+ enables.map{|enable|enable.split("\n").map{|fp|fp.split(' port ').last}}.flatten
50
+ end
51
+
52
+ def flexe_group confs
53
+ table = []
54
+ groups = (confs||[]).select{|c|c.include?('flexe group ')}
55
+ groups.each do|group|
56
+ fg = {}
57
+ group.split("\n").each do|line|
58
+ fg['name'] = line.split('flexe group').last.to_s.strip if line.include?('flexe group ')
59
+ fg['num'] = line.split('flexe-groupnum').last.to_s.strip if line.include?('flexe-groupnum ')
60
+ fg['binding-if'] = line.split('binding interface').last.to_s.strip if line.include?('binding interface ')
61
+ end
62
+ table << fg
63
+ end
64
+ return table
65
+ end
66
+
67
+ def flexe_genport flexe_client_info
68
+ slot, subslot, _port = flexe_client_info['binding-if'].match(/\d+\/\d+\/\d+/).to_s.split('/')
69
+ port = flexe_client_info['port-id']
70
+ return "FlexE#{slot}/#{subslot}/#{port}"
71
+ end
72
+ end
73
+ ```
@@ -0,0 +1,73 @@
1
+ # NE8000E-X8 FlexE
2
+
3
+ ```ruby
4
+ @sign << ['NE8000E-X8', 'flexe_client']
5
+ @sign << ['NE8000E-X8', 'flexe_enable']
6
+ @sign << ['NE8000E-X8', 'flexe_group']
7
+ @sign << ['NE8000E-X8', 'flexe_genport']
8
+
9
+ module NE8000E_X8
10
+ module_function
11
+
12
+ def flexe_client confs
13
+ table = []
14
+ instances = (confs||[]).select{|c|c.include?('flexe client-instance ')}
15
+ instances.each do|instance|
16
+ fc = {}
17
+ instance.split("\n").each do|line|
18
+ if line.include?('flexe client-instance ')
19
+ fc['name'] = line.split('flexe client-instance ').last.split(' ').first.to_s.strip
20
+ fc['group'] = line.split('flexe-group ').last.split(' ').first.to_s.strip
21
+ fc['type'] = line.split('flexe-type ').last.split(' ').first.to_s.strip
22
+ fc['port-id'] = line.split('port-id ').last.to_s.strip
23
+ end
24
+ if line.include?('flexe-clientid ')
25
+ fc['client-id'] = line.split('flexe-clientid ').last.to_s.strip
26
+ end
27
+ if line.include?('binding interface ')
28
+ fc['binding-if'] = line.split('binding interface ').last.split(' ').first.to_s.strip
29
+ ts = line.split('time-slot ').last.split(' ').first.to_s.strip
30
+ # TODO: subts = line.split('sub-time-slot ').last.to_s.strip
31
+ fc['time-slot'] = []
32
+ ts.split(',').each do|ts_part|
33
+ if ts_part.include?('-')
34
+ h,d = ts_part.split('-')
35
+ fc['time-slot'] << (h.to_i .. d.to_i)
36
+ else
37
+ fc['time-slot'] << ts_part.to_i
38
+ end
39
+ end
40
+ end
41
+ end
42
+ table << fc
43
+ end
44
+ return table
45
+ end
46
+
47
+ def flexe_enable confs
48
+ enables = (confs||[]).select{|c|c.include?('flexe enable ')}
49
+ enables.map{|enable|enable.split("\n").map{|fp|fp.split(' port ').last}}.flatten
50
+ end
51
+
52
+ def flexe_group confs
53
+ table = []
54
+ groups = (confs||[]).select{|c|c.include?('flexe group ')}
55
+ groups.each do|group|
56
+ fg = {}
57
+ group.split("\n").each do|line|
58
+ fg['name'] = line.split('flexe group').last.to_s.strip if line.include?('flexe group ')
59
+ fg['num'] = line.split('flexe-groupnum').last.to_s.strip if line.include?('flexe-groupnum ')
60
+ fg['binding-if'] = line.split('binding interface').last.to_s.strip if line.include?('binding interface ')
61
+ end
62
+ table << fg
63
+ end
64
+ return table
65
+ end
66
+
67
+ def flexe_genport flexe_client_info
68
+ slot, subslot, _port = flexe_client_info['binding-if'].match(/\d+\/\d+\/\d+/).to_s.split('/')
69
+ port = flexe_client_info['port-id']
70
+ return "FlexE#{slot}/#{subslot}/#{port}"
71
+ end
72
+ end
73
+ ```
@@ -0,0 +1,74 @@
1
+
2
+ # NE8100-X8 FlexE
3
+
4
+ ```ruby
5
+ @sign << ['NE8100-X8', 'flexe_client']
6
+ @sign << ['NE8100-X8', 'flexe_enable']
7
+ @sign << ['NE8100-X8', 'flexe_group']
8
+ @sign << ['NE8100-X8', 'flexe_genport']
9
+
10
+ module NE8100_X8
11
+ module_function
12
+
13
+ def flexe_client confs
14
+ table = []
15
+ instances = (confs||[]).select{|c|c.include?('flexe client-instance ')}
16
+ instances.each do|instance|
17
+ fc = {}
18
+ instance.split("\n").each do|line|
19
+ if line.include?('flexe client-instance ')
20
+ fc['name'] = line.split('flexe client-instance ').last.split(' ').first.to_s.strip
21
+ fc['group'] = line.split('flexe-group ').last.split(' ').first.to_s.strip
22
+ fc['type'] = line.split('flexe-type ').last.split(' ').first.to_s.strip
23
+ fc['port-id'] = line.split('port-id ').last.to_s.strip
24
+ end
25
+ if line.include?('flexe-clientid ')
26
+ fc['client-id'] = line.split('flexe-clientid ').last.to_s.strip
27
+ end
28
+ if line.include?('binding interface ')
29
+ fc['binding-if'] = line.split('binding interface ').last.split(' ').first.to_s.strip
30
+ ts = line.split('time-slot ').last.split(' ').first.to_s.strip
31
+ # TODO: subts = line.split('sub-time-slot ').last.to_s.strip
32
+ fc['time-slot'] = []
33
+ ts.split(',').each do|ts_part|
34
+ if ts_part.include?('-')
35
+ h,d = ts_part.split('-')
36
+ fc['time-slot'] << (h.to_i .. d.to_i)
37
+ else
38
+ fc['time-slot'] << ts_part.to_i
39
+ end
40
+ end
41
+ end
42
+ end
43
+ table << fc
44
+ end
45
+ return table
46
+ end
47
+
48
+ def flexe_enable confs
49
+ enables = (confs||[]).select{|c|c.include?('flexe enable ')}
50
+ enables.map{|enable|enable.split("\n").map{|fp|fp.split(' port ').last}}.flatten
51
+ end
52
+
53
+ def flexe_group confs
54
+ table = []
55
+ groups = (confs||[]).select{|c|c.include?('flexe group ')}
56
+ groups.each do|group|
57
+ fg = {}
58
+ group.split("\n").each do|line|
59
+ fg['name'] = line.split('flexe group').last.to_s.strip if line.include?('flexe group ')
60
+ fg['num'] = line.split('flexe-groupnum').last.to_s.strip if line.include?('flexe-groupnum ')
61
+ fg['binding-if'] = line.split('binding interface').last.to_s.strip if line.include?('binding interface ')
62
+ end
63
+ table << fg
64
+ end
65
+ return table
66
+ end
67
+
68
+ def flexe_genport flexe_client_info
69
+ slot, subslot, _port = flexe_client_info['binding-if'].match(/\d+\/\d+\/\d+/).to_s.split('/')
70
+ port = flexe_client_info['port-id']
71
+ return "FlexE#{slot}/#{subslot}/#{port}"
72
+ end
73
+ end
74
+ ```
@@ -0,0 +1,140 @@
1
+ # CX600-X16A isis
2
+
3
+ ```ruby
4
+ @sign << ['CX600-X16A', '接口isis']
5
+ @sign << ['CX600-X16A', 'isis']
6
+
7
+ module CX600_X16A
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['pid'] = line.strip.split(' ').last.to_i if line.include?('isis enable')
16
+ isis['ipv6-pid'] = line.strip.split(' ').last.to_i if line.include?('isis ipv6 enable')
17
+ isis['circuit-type'] = line.split('circuit-type').last.strip if line.include?('isis circuit-type')
18
+ isis['cost'] = line.strip.split(' ').last.to_i if line.include?('isis cost')
19
+ isis['ipv6-cost'] = line.strip.split(' ').last.to_i if line.include?('isis ipv6 cost')
20
+ if line.include?('isis ldp-sync')
21
+ isis['ldp-sync'] ||= {}
22
+ isis['ldp-sync']['state'] = 'enable'
23
+ isis['ldp-sync']['hold-max-cost-timer'] = line.strip.split(' ').last+'s' if line.include?('isis timer ldp-sync')
24
+ end
25
+ isis['hold-max-cost-timer'] = line.strip.split(' ').last+'ms' if line.include?('isis peer hold-max-cost')
26
+ end
27
+ return { port_name => isis }
28
+ end
29
+
30
+ def isis isis配置
31
+ isis = {};frr4_flag, frr6_flag = false, false
32
+ isis配置.split("\n").each do|line|
33
+ isis['pid'] = line.split(' ').last.strip if line[0..4]=='isis '
34
+ isis['level'] = line.split(' ').last.strip if line.include?('is-level')
35
+ isis['cost-style'] = line.split(' ').last.strip if line.include?('cost-style')
36
+ if line.include?('timer lsp-generation')
37
+ isis['lsp-generation-timer'] ||= {}
38
+ setter = line.split('lsp-generation').last.strip.split(' ')
39
+ setlevels = []
40
+ setlevels = ['level-1'] if setter[-1]=='level-1'
41
+ setlevels = ['level-2'] if setter[-1]=='level-2'
42
+ setlevels = ['level-1', 'level-2']
43
+ setlevels.each do|setlevel|
44
+ isis['lsp-generation-timer']['max-interval'] = setter[0]+'s'
45
+ isis['lsp-generation-timer']['init-interval'] = setter[1]+'ms' if setter[1] && !setter[1].include?('level')
46
+ isis['lsp-generation-timer']['incr-interval'] = setter[2]+'ms' if setter[2] && !setter[2].include?('level')
47
+ end
48
+ end
49
+ if line.include?('bfd all-interfaces') && line.strip[0..2]=='bfd'
50
+ isis['bfd'] ||= {}
51
+ isis['bfd']['interface'] = 'enable' if line.include?('enable')
52
+ words = line.split(' ')
53
+ isis['bfd']['min-tx-interval'] = words[words.index('min-tx-interval')+1] + 'ms' if words.index('min-tx-interval')
54
+ isis['bfd']['min-rx-interval'] = words[words.index('min-rx-interval')+1] + 'ms' if words.index('min-rx-interval')
55
+ isis['bfd']['detect-multiplier'] = words[words.index('detect-multiplier')+1].to_i if words.index('detect-multiplier')
56
+ isis['bfd']['tos-exp'] = words[words.index('tos-exp')+1].to_i if words.index('tos-exp')
57
+ isis['bfd']['frr-binding'] = 'enable' if line.include?('frr-binding')
58
+ end
59
+ if line.include?('ipv6 bfd all-interfaces')
60
+ isis['ipv6-bfd'] ||= {}
61
+ isis['ipv6-bfd']['interface'] = 'enable' if line.include?('enable')
62
+ words = line.split(' ')
63
+ isis['ipv6-bfd']['min-tx-interval'] = words[words.index('min-tx-interval')+1] + 'ms' if words.index('min-tx-interval')
64
+ isis['ipv6-bfd']['min-rx-interval'] = words[words.index('min-rx-interval')+1] + 'ms' if words.index('min-rx-interval')
65
+ isis['ipv6-bfd']['detect-multiplier'] = words[words.index('detect-multiplier')+1].to_i if words.index('detect-multiplier')
66
+ isis['ipv6-bfd']['frr-binding'] = 'enable' if line.include?('frr-binding')
67
+ end
68
+ isis['net'] = line.split(' ').last if line.include?('network-entity')
69
+ isis['is-name'] = line.split(' ').last if line.include?('is-name')
70
+ if line.include?('avoid-microloop') && line.strip[0..4]=='avoid'
71
+ isis['avoid-microloop'] ||= {}
72
+ isis['avoid-microloop']['frr-protected'] ||= {'rib-update-delay'=>'100ms'} if line.include?('frr-protected')
73
+ isis['avoid-microloop']['frr-protected']['rib-update-delay'] = line.split(' ').last+'ms' if line.include?('frr-protected') && line.include?('rib-update-delay')
74
+ isis['avoid-microloop']['te-tunnel'] ||= {'rib-update-delay'=>'1000ms'} if line.include?('te-tunnel')
75
+ isis['avoid-microloop']['te-tunnel']['rib-update-delay'] = line.split(' ').last+'ms' if line.include?('te-tunnel') && line.include?('rib-update-delay')
76
+ end
77
+ if line.include?('ipv6 avoid-microloop')
78
+ isis['ipv6-avoid-microloop'] ||= {}
79
+ isis['ipv6-avoid-microloop']['segment-routing'] ||= {'rib-update-delay'=>'5000ms'} if line.include?('segment-routing')
80
+ isis['ipv6-avoid-microloop']['segment-routing']['rib-update-delay'] = line.split(' ').last+'ms' if line.include?('segment-routing') && line.include?('rib-update-delay')
81
+ end
82
+ isis['preference'] = line.split(' ').last.to_i if line.strip[0..10]=='preference '
83
+ isis['ipv6-preference'] = line.split(' ').last.to_i if line.include?('ipv6 preference ')
84
+ if line.include?('timer spf')
85
+ setter = line.split('timer spf').last.strip.split(' ')
86
+ isis['spf-timer'] ||= {}
87
+ isis['spf-timer']['max-interval'] = setter[0]+'s'
88
+ isis['spf-timer']['init-interval'] = setter[1]+'ms' if setter[1]
89
+ isis['spf-timer']['incr-interval'] = setter[2]+'ms' if setter[2]
90
+ end
91
+ if line.include?('set-overload')
92
+ isis['set-overload'] ||= {}
93
+ isis['set-overload']['allow'] = 'interlevel' if line.include?('allow interlevel')
94
+ isis['set-overload']['allow'] = 'external' if line.include?('allow external')
95
+ isis['set-overload']['on-startup'] ||= {} if line.include?('on-startup')
96
+ words = line.strip.split(' ')
97
+ if line.include?('on-startup') && words[words.index('on-startup')+1].to_s.match(/^\d+$/)
98
+ isis['set-overload']['on-startup']['timeout'] = words[words.index('on-startup')+1]+'s'
99
+ else
100
+ # isis['set-overload']['on-startup']['timeout'] = '600s'
101
+ if line.include?('send-sa-bit') && words[words.index('send-sa-bit')+1].match(/^\d+$/)
102
+ isis['set-overload']['on-startup']['send-sa-bit'] = words[words.index('send-sa-bit')+1]+'s'
103
+ else
104
+ # isis['set-overload']['on-startup']['send-sa-bit'] = '30s'
105
+ end
106
+ # TODO: start-from-nbr | wait-for-bgp | route-delay-distribute
107
+ end
108
+ end
109
+ (isis['frr'] = {}; frr4_flag = true) if line.strip=='frr'
110
+ isis['frr']['loop-free-alternate'] = line.split(' ').last if line.include?('loop-free-alternate ') && frr4_flag
111
+ isis['frr']['ti-lfa'] = line.split(' ').last if line.include?('ti-lfa ') && frr4_flag
112
+ (frr4_flag = false) if frr4_flag && line==' #'
113
+ (isis['ipv6-frr'] = {}; frr6_flag = true) if line.include?('ipv6 frr')
114
+ isis['ipv6-frr']['loop-free-alternate'] = line.split(' ').last if line.include?('loop-free-alternate ') && frr6_flag
115
+ isis['ipv6-frr']['ti-lfa'] = line.split(' ').last if line.include?('ti-lfa ') && frr6_flag
116
+ (frr6_flag = false) if frr6_flag && line==' #'
117
+ isis['topology'] = line.split('topology ').last.strip if line.include?('ipv6 enable topology ')
118
+ isis['ipv6-advertise'] = 'link-attributes' if line.include?('ipv6 advertise link attributes')
119
+ isis['ipv6-traffic-eng'] = line.split(' ').last if line.include?('ipv6 traffic-eng')
120
+ if line.include?('ipv6 metric-delay')
121
+ isis['ipv6-metric-delay'] ||= {}
122
+ isis['ipv6-metric-delay']['advertisement'] = line.split(' ').last if line.include?('advertisement enable')
123
+ if line.include?('suppress')
124
+ words = line.split(' ')
125
+ isis['ipv6-metric-delay']['suppress'] ||= {}
126
+ isis['ipv6-metric-delay']['suppress']['timer'] = words[words.index('timer')+1]+'s' if words.index('timer')
127
+ isis['ipv6-metric-delay']['suppress']['percent-threshold'] = words[words.index('percent-threshold')+1]+'%' if words.index('percent-threshold')
128
+ isis['ipv6-metric-delay']['suppress']['absolute-threshold'] = words[words.index('absolute-threshold')+1]+'ms' if words.index('absolute-threshold')
129
+ end
130
+ end
131
+ if line.include?('segment-routing ipv6 locator')
132
+ isis['srv6-locator'] ||= {}
133
+ isis['srv6-locator']['name'] = line.split('locator').last.strip.split(' ').first
134
+ isis['srv6-locator']['auto-sid-disable'] = true if line.split('locator').last.strip.split(' ')[1]
135
+ end
136
+ end
137
+ return isis
138
+ end
139
+ end
140
+ ```