network-utility 1.1.41 → 1.1.42

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: d91f268f69c1aa7a91c1736cc4691583a28051d97ec9852d992498157f42c66b
4
+ data.tar.gz: 3525f6054ddf2053b69c4147c10b34ed25f05c8883efbb36087528d95400b9a8
5
5
  SHA512:
6
- metadata.gz: d3f84eab160e9cf82a3d4da552e22ffd45235507bf4e745ab55c6785bad035343759cacc4cbbee0aa57f43a8d38d52c35fdb52e8e071267ad0bedeed1d81771a
7
- data.tar.gz: e007aba82c8ea5141813da5644bb16a193b3586fa5ffd9a324226563b0201b921d6f6c24ef2e82148917649ff1fa7433a077369b79b5cda2d7a4db59d88eb4f5
6
+ metadata.gz: 33d4d3b7ddca7f8d7ffc8c111b21e437101e9e3cc8deecfe6515a8f272dca272836678f077801e517da3be76fc51211eafb7be6dbde69b50f06df0320de80583
7
+ data.tar.gz: '09db809ee1f704e5c2fb6a26872864710e2e48d469296e442ba0afa443daf02c2f820e54c888649ec70a40f44248d7a0d5f2612dce34c067a8d4e2fd1bd899e8'
@@ -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
+ ```
@@ -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
+ ```
@@ -0,0 +1,141 @@
1
+
2
+ # CX600-X8A isis
3
+
4
+ ```ruby
5
+ @sign << ['CX600-X8A', '接口isis']
6
+ @sign << ['CX600-X8A', 'isis']
7
+
8
+ module CX600_X8A
9
+ module_function
10
+
11
+ def 接口isis 接口配置
12
+ isis = {}
13
+ port_name = self.端口识别(接口配置.split("\n").first.to_s).join()
14
+ lines = 接口配置.split("\n").select{|line|line.strip[0..4]=='isis '}
15
+ lines.each do|line|
16
+ isis['pid'] = line.strip.split(' ').last.to_i if line.include?('isis enable')
17
+ isis['ipv6-pid'] = line.strip.split(' ').last.to_i if line.include?('isis ipv6 enable')
18
+ isis['circuit-type'] = line.split('circuit-type').last.strip if line.include?('isis circuit-type')
19
+ isis['cost'] = line.strip.split(' ').last.to_i if line.include?('isis cost')
20
+ isis['ipv6-cost'] = line.strip.split(' ').last.to_i if line.include?('isis ipv6 cost')
21
+ if line.include?('isis ldp-sync')
22
+ isis['ldp-sync'] ||= {}
23
+ isis['ldp-sync']['state'] = 'enable'
24
+ isis['ldp-sync']['hold-max-cost-timer'] = line.strip.split(' ').last+'s' if line.include?('isis timer ldp-sync')
25
+ end
26
+ isis['hold-max-cost-timer'] = line.strip.split(' ').last+'ms' if line.include?('isis peer hold-max-cost')
27
+ end
28
+ return { port_name => isis }
29
+ end
30
+
31
+ def isis isis配置
32
+ isis = {};frr4_flag, frr6_flag = false, false
33
+ isis配置.split("\n").each do|line|
34
+ isis['pid'] = line.split(' ').last.strip if line[0..4]=='isis '
35
+ isis['level'] = line.split(' ').last.strip if line.include?('is-level')
36
+ isis['cost-style'] = line.split(' ').last.strip if line.include?('cost-style')
37
+ if line.include?('timer lsp-generation')
38
+ isis['lsp-generation-timer'] ||= {}
39
+ setter = line.split('lsp-generation').last.strip.split(' ')
40
+ setlevels = []
41
+ setlevels = ['level-1'] if setter[-1]=='level-1'
42
+ setlevels = ['level-2'] if setter[-1]=='level-2'
43
+ setlevels = ['level-1', 'level-2']
44
+ setlevels.each do|setlevel|
45
+ isis['lsp-generation-timer']['max-interval'] = setter[0]+'s'
46
+ isis['lsp-generation-timer']['init-interval'] = setter[1]+'ms' if setter[1] && !setter[1].include?('level')
47
+ isis['lsp-generation-timer']['incr-interval'] = setter[2]+'ms' if setter[2] && !setter[2].include?('level')
48
+ end
49
+ end
50
+ if line.include?('bfd all-interfaces') && line.strip[0..2]=='bfd'
51
+ isis['bfd'] ||= {}
52
+ isis['bfd']['interface'] = 'enable' if line.include?('enable')
53
+ words = line.split(' ')
54
+ isis['bfd']['min-tx-interval'] = words[words.index('min-tx-interval')+1] + 'ms' if words.index('min-tx-interval')
55
+ isis['bfd']['min-rx-interval'] = words[words.index('min-rx-interval')+1] + 'ms' if words.index('min-rx-interval')
56
+ isis['bfd']['detect-multiplier'] = words[words.index('detect-multiplier')+1].to_i if words.index('detect-multiplier')
57
+ isis['bfd']['tos-exp'] = words[words.index('tos-exp')+1].to_i if words.index('tos-exp')
58
+ isis['bfd']['frr-binding'] = 'enable' if line.include?('frr-binding')
59
+ end
60
+ if line.include?('ipv6 bfd all-interfaces')
61
+ isis['ipv6-bfd'] ||= {}
62
+ isis['ipv6-bfd']['interface'] = 'enable' if line.include?('enable')
63
+ words = line.split(' ')
64
+ isis['ipv6-bfd']['min-tx-interval'] = words[words.index('min-tx-interval')+1] + 'ms' if words.index('min-tx-interval')
65
+ isis['ipv6-bfd']['min-rx-interval'] = words[words.index('min-rx-interval')+1] + 'ms' if words.index('min-rx-interval')
66
+ isis['ipv6-bfd']['detect-multiplier'] = words[words.index('detect-multiplier')+1].to_i if words.index('detect-multiplier')
67
+ isis['ipv6-bfd']['frr-binding'] = 'enable' if line.include?('frr-binding')
68
+ end
69
+ isis['net'] = line.split(' ').last if line.include?('network-entity')
70
+ isis['is-name'] = line.split(' ').last if line.include?('is-name')
71
+ if line.include?('avoid-microloop') && line.strip[0..4]=='avoid'
72
+ isis['avoid-microloop'] ||= {}
73
+ isis['avoid-microloop']['frr-protected'] ||= {'rib-update-delay'=>'100ms'} if line.include?('frr-protected')
74
+ isis['avoid-microloop']['frr-protected']['rib-update-delay'] = line.split(' ').last+'ms' if line.include?('frr-protected') && line.include?('rib-update-delay')
75
+ isis['avoid-microloop']['te-tunnel'] ||= {'rib-update-delay'=>'1000ms'} if line.include?('te-tunnel')
76
+ isis['avoid-microloop']['te-tunnel']['rib-update-delay'] = line.split(' ').last+'ms' if line.include?('te-tunnel') && line.include?('rib-update-delay')
77
+ end
78
+ if line.include?('ipv6 avoid-microloop')
79
+ isis['ipv6-avoid-microloop'] ||= {}
80
+ isis['ipv6-avoid-microloop']['segment-routing'] ||= {'rib-update-delay'=>'5000ms'} if line.include?('segment-routing')
81
+ isis['ipv6-avoid-microloop']['segment-routing']['rib-update-delay'] = line.split(' ').last+'ms' if line.include?('segment-routing') && line.include?('rib-update-delay')
82
+ end
83
+ isis['preference'] = line.split(' ').last.to_i if line.strip[0..10]=='preference '
84
+ isis['ipv6-preference'] = line.split(' ').last.to_i if line.include?('ipv6 preference ')
85
+ if line.include?('timer spf')
86
+ setter = line.split('timer spf').last.strip.split(' ')
87
+ isis['spf-timer'] ||= {}
88
+ isis['spf-timer']['max-interval'] = setter[0]+'s'
89
+ isis['spf-timer']['init-interval'] = setter[1]+'ms' if setter[1]
90
+ isis['spf-timer']['incr-interval'] = setter[2]+'ms' if setter[2]
91
+ end
92
+ if line.include?('set-overload')
93
+ isis['set-overload'] ||= {}
94
+ isis['set-overload']['allow'] = 'interlevel' if line.include?('allow interlevel')
95
+ isis['set-overload']['allow'] = 'external' if line.include?('allow external')
96
+ isis['set-overload']['on-startup'] ||= {} if line.include?('on-startup')
97
+ words = line.strip.split(' ')
98
+ if line.include?('on-startup') && words[words.index('on-startup')+1].to_s.match(/^\d+$/)
99
+ isis['set-overload']['on-startup']['timeout'] = words[words.index('on-startup')+1]+'s'
100
+ else
101
+ # isis['set-overload']['on-startup']['timeout'] = '600s'
102
+ if line.include?('send-sa-bit') && words[words.index('send-sa-bit')+1].match(/^\d+$/)
103
+ isis['set-overload']['on-startup']['send-sa-bit'] = words[words.index('send-sa-bit')+1]+'s'
104
+ else
105
+ # isis['set-overload']['on-startup']['send-sa-bit'] = '30s'
106
+ end
107
+ # TODO: start-from-nbr | wait-for-bgp | route-delay-distribute
108
+ end
109
+ end
110
+ (isis['frr'] = {}; frr4_flag = true) if line.strip=='frr'
111
+ isis['frr']['loop-free-alternate'] = line.split(' ').last if line.include?('loop-free-alternate ') && frr4_flag
112
+ isis['frr']['ti-lfa'] = line.split(' ').last if line.include?('ti-lfa ') && frr4_flag
113
+ (frr4_flag = false) if frr4_flag && line==' #'
114
+ (isis['ipv6-frr'] = {}; frr6_flag = true) if line.include?('ipv6 frr')
115
+ isis['ipv6-frr']['loop-free-alternate'] = line.split(' ').last if line.include?('loop-free-alternate ') && frr6_flag
116
+ isis['ipv6-frr']['ti-lfa'] = line.split(' ').last if line.include?('ti-lfa ') && frr6_flag
117
+ (frr6_flag = false) if frr6_flag && line==' #'
118
+ isis['topology'] = line.split('topology ').last.strip if line.include?('ipv6 enable topology ')
119
+ isis['ipv6-advertise'] = 'link-attributes' if line.include?('ipv6 advertise link attributes')
120
+ isis['ipv6-traffic-eng'] = line.split(' ').last if line.include?('ipv6 traffic-eng')
121
+ if line.include?('ipv6 metric-delay')
122
+ isis['ipv6-metric-delay'] ||= {}
123
+ isis['ipv6-metric-delay']['advertisement'] = line.split(' ').last if line.include?('advertisement enable')
124
+ if line.include?('suppress')
125
+ words = line.split(' ')
126
+ isis['ipv6-metric-delay']['suppress'] ||= {}
127
+ isis['ipv6-metric-delay']['suppress']['timer'] = words[words.index('timer')+1]+'s' if words.index('timer')
128
+ isis['ipv6-metric-delay']['suppress']['percent-threshold'] = words[words.index('percent-threshold')+1]+'%' if words.index('percent-threshold')
129
+ isis['ipv6-metric-delay']['suppress']['absolute-threshold'] = words[words.index('absolute-threshold')+1]+'ms' if words.index('absolute-threshold')
130
+ end
131
+ end
132
+ if line.include?('segment-routing ipv6 locator')
133
+ isis['srv6-locator'] ||= {}
134
+ isis['srv6-locator']['name'] = line.split('locator').last.strip.split(' ').first
135
+ isis['srv6-locator']['auto-sid-disable'] = true if line.split('locator').last.strip.split(' ')[1]
136
+ end
137
+ end
138
+ return isis
139
+ end
140
+ end
141
+ ```